示例#1
0
  private Composite createPermissionsGroup(Composite parent, IExtendedFileInfo fileInfo) {
    fPermissionsGroup = new PermissionsGroup(parent);
    fPermissionsGroup.setText(Messages.FileInfoPropertyPage_Permissions);
    fPermissionsGroup.setPermissions(fileInfo.getPermissions());

    return (Composite) fPermissionsGroup.getControl();
  }
示例#2
0
  private Composite createOwnerGroup(Composite parent, IExtendedFileInfo fileInfo) {
    Group container = new Group(parent, SWT.NONE);
    container.setText(Messages.FileInfoPropertyPage_OwnerAndGroup);
    container.setLayout(GridLayoutFactory.swtDefaults().numColumns(2).margins(0, 0).create());

    Label label = new Label(container, SWT.NONE);
    label.setText(StringUtil.makeFormLabel(Messages.FileInfoPropertyPage_Owner));
    Text text = new Text(container, SWT.READ_ONLY);
    text.setText(fileInfo.getOwner());
    text.setLayoutData(
        GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).create());

    label = new Label(container, SWT.NONE);
    label.setText(StringUtil.makeFormLabel(Messages.FileInfoPropertyPage_Group));
    text = new Text(container, SWT.READ_ONLY);
    text.setText(fileInfo.getGroup());
    text.setLayoutData(
        GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).create());

    return container;
  }
示例#3
0
  public boolean performOk() {
    if (fFileInfo != null && (fFileInfo instanceof IExtendedFileInfo)) {
      long permissions = fPermissionsGroup.getPermissions();
      IExtendedFileInfo extendedInfo = (IExtendedFileInfo) fFileInfo;
      if (permissions != extendedInfo.getPermissions()) {
        // the permissions have been modified
        extendedInfo.setPermissions(permissions);

        IFileStore fileStore = Utils.getFileStore(getElement());
        if (fileStore != null) {
          try {
            fileStore.putInfo(
                fFileInfo, IExtendedFileInfo.SET_PERMISSIONS, new NullProgressMonitor());
          } catch (CoreException e) {
            UIUtils.showErrorMessage(Messages.FileInfoPropertyPage_ErrorStoreInfo, e);
          }
        }
      }
    }

    return super.performOk();
  }