コード例 #1
0
 private void enableProjectTypeControls(boolean enabled) {
   left_label.setEnabled(enabled);
   right_label.setEnabled(enabled);
   tree.setEnabled(enabled);
   right.setEnabled(enabled);
   enabledCompositeChildren(right, enabled);
   show_sup.setEnabled(enabled);
 }
コード例 #2
0
  private void createWorkspaceValueEditor(Group grpDocumentationSettings) {
    btnWorkspace = new Button(grpDocumentationSettings, SWT.RADIO);
    btnWorkspace.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    btnWorkspace.addSelectionListener(
        new SelectionAdapter() {

          /**
           * {@inheritDoc}
           *
           * @see
           *     org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
           */
          @Override
          public void widgetSelected(SelectionEvent e) {
            valueText.setEnabled(false);
            treeViewer.getControl().setEnabled(true);
          }
        });
    btnWorkspace.setText(
        DocBridgeUI.getInstance()
            .getString("DocumentationLinkDialog_WorkspaceEditor_title")); // $NON-NLS-1$

    treeViewer = new TreeViewer(grpDocumentationSettings, SWT.BORDER);
    Tree tree = treeViewer.getTree();
    tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
    tree.setEnabled(false);

    treeViewer.setContentProvider(new WorkbenchContentProvider());
    treeViewer.setLabelProvider(new WorkbenchLabelProvider());
    treeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot());
    treeViewer.addSelectionChangedListener(
        new ISelectionChangedListener() {

          public void selectionChanged(SelectionChangedEvent event) {
            if (event.getSelection() instanceof StructuredSelection) {
              Object selection = ((StructuredSelection) event.getSelection()).getFirstElement();
              if (selection instanceof IFile) {
                value =
                    DocumentationLink.WORKSPACE_PREFIX
                        + ((IFile) selection).getFullPath().toString();
              } else {
                value = null;
              }
              updateButtons();
            }
          }
        });
  }
コード例 #3
0
 /*
  * (non-Javadoc)
  *
  * @see
  * org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets
  * .Composite)
  */
 @Override
 protected Control createDialogArea(Composite parent) {
   Composite composite = (Composite) super.createDialogArea(parent);
   Label messageLabel = createMessageArea(composite);
   CheckboxTreeViewer treeViewer = createTreeViewer(composite);
   Control buttonComposite = createSelectionButtons(composite);
   GridData data = new GridData(GridData.FILL_BOTH);
   data.widthHint = convertWidthInCharsToPixels(fWidth);
   data.heightHint = convertHeightInCharsToPixels(fHeight);
   Tree treeWidget = treeViewer.getTree();
   treeWidget.setLayoutData(data);
   treeWidget.setFont(parent.getFont());
   if (fIsEmpty) {
     messageLabel.setEnabled(false);
     treeWidget.setEnabled(false);
     buttonComposite.setEnabled(false);
   }
   return composite;
 }