protected void createServerSelectionControl(Composite parent) {
    Group group = new Group(parent, SWT.NONE);
    group.setText(PHPServerUIMessages.getString("ServerTab.server")); // $NON-NLS-1$
    GridLayout ly = new GridLayout(1, false);
    ly.marginHeight = 0;
    ly.marginWidth = 0;
    group.setLayout(ly);
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Composite phpServerComp = new Composite(group, SWT.NONE);
    phpServerComp.setLayout(new GridLayout(4, false));
    phpServerComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    phpServerComp.setFont(parent.getFont());

    Label label = new Label(phpServerComp, SWT.WRAP);
    GridData data = new GridData(GridData.BEGINNING);
    data.widthHint = 100;
    label.setLayoutData(data);
    label.setFont(parent.getFont());
    label.setText(PHPServerUIMessages.getString("ServerLaunchConfigurationTab.0")); // $NON-NLS-1$

    serverCombo = new Combo(phpServerComp, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
    serverCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    serverCombo.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            handleServerSelection();
          }
        });

    createNewServer =
        createPushButton(
            phpServerComp, PHPServerUIMessages.getString("ServerTab.new"), null); // $NON-NLS-1$
    createNewServer.addSelectionListener(fListener);

    configureServers =
        createPushButton(
            phpServerComp,
            PHPServerUIMessages.getString("ServerTab.configure"),
            null); //$NON-NLS-1$
    configureServers.addSelectionListener(fListener);

    servers = new ArrayList<Server>();
    populateServerList(servers);

    // initialize the servers list
    if (!servers.isEmpty()) {
      for (int i = 0; i < servers.size(); i++) {
        Server svr = servers.get(i);
        serverCombo.add(svr.getName());
      }
    }

    // select first item in list
    if (serverCombo.getItemCount() > 0) {
      serverCombo.select(0);
    }

    serverCombo.forceFocus();
  }
 private void createUICategoryCombo(Composite parent) {
   int style = SWT.READ_ONLY | SWT.BORDER;
   fCategoryCombo = new Combo(parent, style);
   GridData data = new GridData(GridData.FILL_HORIZONTAL);
   fCategoryCombo.setLayoutData(data);
   fCategoryCombo.add(CSWizardMessages.RegisterCSWizardPage_none);
   fCategoryCombo.setText(CSWizardMessages.RegisterCSWizardPage_none);
 }
示例#3
0
  public static Combo createLabelCombo(Composite parent, String label, int style) {
    Label labelControl = createControlLabel(parent, label);
    // labelControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    final Combo combo = new Combo(parent, style);
    combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    return combo;
  }
示例#4
0
  /**
   * Must be called after createProjectDropDownMenu, since we need to figure out the selected
   * project.
   *
   * @author stolz
   */
  protected void createProductDropDownMenu(TabListener myListener, Composite comp) {
    Group group = createGroup(comp, "ABS Product", 1, 1, GridData.FILL_HORIZONTAL);

    productDropDown = new Combo(group, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
    GridData gridData = new GridData();
    gridData.widthHint = 200;
    productDropDown.setLayoutData(gridData);

    productDropDown.addListener(SWT.Selection, myListener);
  }
示例#5
0
  /* (non-Javadoc)
   * @see org.eclipse.ui.dialogs.WizardNewFileCreationPage#createAdvancedControls(org.eclipse.swt.widgets.Composite)
   */
  protected void createAdvancedControls(Composite parent) {
    fGroup = new Group(parent, SWT.NONE);
    fGroup.setText(PDEUIMessages.ProductFileWizadPage_groupTitle);
    fGroup.setLayout(new GridLayout(2, false));
    fGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    fBasicButton = new Button(fGroup, SWT.RADIO);
    GridData gd = new GridData();
    gd.horizontalSpan = 2;
    fBasicButton.setLayoutData(gd);
    fBasicButton.setText(PDEUIMessages.ProductFileWizadPage_basic);

    fProductButton = new Button(fGroup, SWT.RADIO);
    fProductButton.setText(PDEUIMessages.ProductFileWizadPage_existingProduct);
    fProductButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            fProductCombo.setEnabled(fProductButton.getSelection());
          }
        });

    fProductCombo = new Combo(fGroup, SWT.SINGLE | SWT.READ_ONLY);
    fProductCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fProductCombo.setItems(TargetPlatform.getProducts());

    fLaunchConfigButton = new Button(fGroup, SWT.RADIO);
    fLaunchConfigButton.setText(PDEUIMessages.ProductFileWizadPage_existingLaunchConfig);
    fLaunchConfigButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            fLaunchConfigCombo.setEnabled(fLaunchConfigButton.getSelection());
          }
        });

    fLaunchConfigCombo = new Combo(fGroup, SWT.SINGLE | SWT.READ_ONLY);
    fLaunchConfigCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fLaunchConfigCombo.setItems(getLaunchConfigurations());

    initializeState();
  }
  private void relayoutControls() {
    boolean twoRowToolbar = Math.abs(feederRegistry.current().getSize().y - buttonHeight * 2) <= 10;

    feederSelectionCombo.setLayoutData(
        LayoutHelper.formData(
            SWT.DEFAULT, buttonHeight, new FormAttachment(0), null, new FormAttachment(0), null));
    if (twoRowToolbar) {
      startStopButton.setLayoutData(
          LayoutHelper.formData(
              feederSelectionCombo.getSize().x,
              Platform.MAC_OS ? SWT.DEFAULT : buttonHeight,
              new FormAttachment(0),
              null,
              new FormAttachment(feederSelectionCombo, 0),
              null));
      prefsButton.setLayoutData(
          LayoutHelper.formData(
              new FormAttachment(feederSelectionCombo),
              null,
              new FormAttachment(feederSelectionCombo, 0, SWT.CENTER),
              null));
      fetchersButton.setLayoutData(
          LayoutHelper.formData(
              new FormAttachment(startStopButton),
              null,
              new FormAttachment(startStopButton, 0, SWT.CENTER),
              null));
    } else {
      startStopButton.setLayoutData(
          LayoutHelper.formData(
              feederSelectionCombo.getSize().x,
              Platform.MAC_OS ? SWT.DEFAULT : buttonHeight,
              new FormAttachment(feederSelectionCombo),
              null,
              new FormAttachment(-1),
              null));
      prefsButton.setLayoutData(
          LayoutHelper.formData(
              new FormAttachment(startStopButton),
              null,
              new FormAttachment(feederSelectionCombo, 0, SWT.CENTER),
              null));
      fetchersButton.setLayoutData(
          LayoutHelper.formData(
              new FormAttachment(prefsButton),
              null,
              new FormAttachment(startStopButton, 0, SWT.CENTER),
              null));
    }
  }
 public void createFileFilterPanel(Shell dialog) {
   Composite filterPanel = new Composite(dialog, SWT.NONE);
   GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
   filterPanel.setLayoutData(gridData);
   filterPanel.setLayout(new GridLayout(3, false));
   // create filter label
   Label filterLabel = new Label(filterPanel, SWT.NONE);
   filterLabel.setText(Messages.getString("VfsFileChooserDialog.filter")); // $NON-NLS-1$
   gridData = new GridData(SWT.FILL, SWT.CENTER, false, false);
   filterLabel.setLayoutData(gridData);
   // create file filter combo
   fileFilterCombo = new Combo(filterPanel, SWT.READ_ONLY);
   gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
   fileFilterCombo.setLayoutData(gridData);
   fileFilterCombo.setItems(fileFilterNames);
   fileFilterCombo.addSelectionListener(this);
   fileFilterCombo.select(0);
 }
示例#8
0
  protected void createProjectDropDownMenu(TabListener myListener, Composite comp) {
    Group group = createGroup(comp, "ABS Project", 1, 1, GridData.FILL_HORIZONTAL);

    projectDropDown = new Combo(group, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
    GridData gridData = new GridData();
    gridData.widthHint = 200;
    projectDropDown.setLayoutData(gridData);

    projectDropDown.addListener(SWT.Selection, myListener);
    /* Refresh products everytime the project is changed */
    projectDropDown.addListener(
        SWT.Selection,
        new Listener() {
          @Override
          public void handleEvent(Event event) {
            fillProductDropDownMenue(null);
            updateErrors();
          }
        });
  }
  @Override
  protected Control createDialogArea(Composite parent) {
    getShell().setText("Choose content editor");

    Composite group = (Composite) super.createDialogArea(parent);
    GridData gd = new GridData(GridData.FILL_BOTH);
    group.setLayoutData(gd);

    Label infoLabel = new Label(group, SWT.NONE);
    infoLabel.setText("Content was modified in mutliple editors. Choose correct one:");
    gd = new GridData(GridData.FILL_HORIZONTAL);
    infoLabel.setLayoutData(gd);

    final Combo combo = new Combo(group, SWT.READ_ONLY | SWT.DROP_DOWN);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    combo.setLayoutData(gd);
    combo.add("");
    for (ContentEditorPart part : dirtyParts) {
      combo.add(part.getContentTypeTitle());
    }
    combo.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            if (combo.getSelectionIndex() >= 1) {
              selectedPart = dirtyParts.get(combo.getSelectionIndex() - 1);
            } else {
              selectedPart = null;
            }
            getButton(IDialogConstants.OK_ID).setEnabled(selectedPart != null);
          }
        });
    /*
            final Table table = new Table(group, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
            table.setLinesVisible (true);
            table.setHeaderVisible(true);
            gd = new GridData(GridData.FILL_BOTH);
            gd.heightHint = 150;
            gd.widthHint = 200;
            table.setLayoutData(gd);

            TableColumn tableColumn = new TableColumn(table, SWT.NONE);
            tableColumn.setText("Editor");
            for (ContentEditorPart part : dirtyParts) {
                TableItem item = new TableItem(table, SWT.NONE);
                item.setText(part.getContentTypeTitle());
                Image image = part.getContentTypeImage();
                if (image != null) {
                    item.setImage(image);
                }
                item.setData(part);
            }
            tableColumn.pack();
            table.pack();

            table.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(SelectionEvent e)
                {
                    TableItem item = (TableItem) e.item;
                    selectedPart = (ContentEditorPart) item.getData();
                    getButton(IDialogConstants.OK_ID).setEnabled(true);
                }
            });
    */

    return group;
  }
示例#10
0
  /**
   * Init with listener
   *
   * @param azureus_core
   * @param parent
   * @param linkURL
   * @param referrer
   * @param listener
   */
  public OpenUrlWindow(
      final Shell parent,
      String linkURL,
      boolean default_magnet,
      final String referrer,
      final TorrentDownloaderCallBackInterface listener) {

    final Shell shell =
        ShellFactory.createShell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE);
    shell.setText(MessageText.getString("openUrl.title"));
    Utils.setShellIcon(shell);

    GridData gridData;
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    shell.setLayout(layout);

    // URL field

    Label label = new Label(shell, SWT.NULL);
    label.setText(MessageText.getString("openUrl.url"));
    gridData = new GridData();
    label.setLayoutData(gridData);

    final Text url = new Text(shell, SWT.BORDER);

    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.widthHint = 400;
    gridData.horizontalSpan = 2;
    url.setLayoutData(gridData);
    if (linkURL == null) Utils.setTextLinkFromClipboard(shell, url, true, default_magnet);
    else url.setText(linkURL);
    url.setSelection(url.getText().length());

    // help field
    Label help_label = new Label(shell, SWT.NULL);
    help_label.setText(MessageText.getString("openUrl.url.info"));
    gridData = new GridData();
    gridData.horizontalSpan = 3;
    help_label.setLayoutData(gridData);

    Label space = new Label(shell, SWT.NULL);
    gridData = new GridData();
    gridData.horizontalSpan = 3;
    space.setLayoutData(gridData);

    // referrer field

    Label referrer_label = new Label(shell, SWT.NULL);
    referrer_label.setText(MessageText.getString("openUrl.referrer"));
    gridData = new GridData();
    referrer_label.setLayoutData(gridData);

    final Combo referrer_combo = new Combo(shell, SWT.BORDER);

    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.widthHint = 150;
    gridData.grabExcessHorizontalSpace = true;
    referrer_combo.setLayoutData(gridData);

    final StringList referrers =
        COConfigurationManager.getStringListParameter("url_open_referrers");
    StringIterator iter = referrers.iterator();
    while (iter.hasNext()) {
      referrer_combo.add(iter.next());
    }

    if (referrer != null && referrer.length() > 0) {

      referrer_combo.setText(referrer);

    } else if (last_referrer != null) {

      referrer_combo.setText(last_referrer);
    }

    Label referrer_info = new Label(shell, SWT.NULL);
    referrer_info.setText(MessageText.getString("openUrl.referrer.info"));

    // line

    Label labelSeparator = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
    gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END);
    gridData.horizontalSpan = 3;
    labelSeparator.setLayoutData(gridData);

    // buttons

    Composite panel = new Composite(shell, SWT.NULL);
    layout = new GridLayout();
    layout.numColumns = 3;
    panel.setLayout(layout);
    gridData =
        new GridData(
            GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_END);
    gridData.horizontalSpan = 3;
    gridData.grabExcessHorizontalSpace = true;
    panel.setLayoutData(gridData);

    new Label(panel, SWT.NULL);

    Button ok = new Button(panel, SWT.PUSH);
    gridData =
        new GridData(
            GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_END);
    gridData.widthHint = 70;
    gridData.grabExcessHorizontalSpace = true;
    ok.setLayoutData(gridData);
    ok.setText(MessageText.getString("Button.ok"));
    ok.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event e) {
            last_referrer = referrer_combo.getText().trim();

            if (!referrers.contains(last_referrer)) {
              referrers.add(last_referrer);
              COConfigurationManager.setParameter("url_open_referrers", referrers);
              COConfigurationManager.save();
            }

            COConfigurationManager.setParameter(CONFIG_REFERRER_DEFAULT, last_referrer);
            COConfigurationManager.save();

            String url_str = url.getText();

            url_str = UrlUtils.parseTextForURL(url_str, true);

            if (url_str == null) {
              url_str = UrlUtils.parseTextForMagnets(url.getText());
            }

            if (url_str == null) {

              url_str = url.getText();
            }

            new FileDownloadWindow(parent, url_str, last_referrer, null, null, listener);
            shell.dispose();
          }
        });

    shell.setDefaultButton(ok);

    Button cancel = new Button(panel, SWT.PUSH);
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
    gridData.grabExcessHorizontalSpace = false;
    gridData.widthHint = 70;
    cancel.setLayoutData(gridData);
    cancel.setText(MessageText.getString("Button.cancel"));
    cancel.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event e) {
            shell.dispose();
          }
        });

    shell.addListener(
        SWT.Traverse,
        new Listener() {

          public void handleEvent(Event e) {

            if (e.character == SWT.ESC) {
              shell.dispose();
            }
          }
        });

    Point p = shell.computeSize(SWT.DEFAULT, SWT.DEFAULT);

    if (p.x > 800) {

      p.x = 800;
    }

    shell.setSize(p);

    Utils.createURLDropTarget(shell, url);

    Utils.centreWindow(shell);

    shell.open();
  }
  public void createToolbarPanel(Shell dialog) {
    Composite chooserToolbarPanel = new Composite(dialog, SWT.NONE);
    chooserToolbarPanel.setLayout(new GridLayout(6, false));
    GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    chooserToolbarPanel.setLayoutData(gridData);

    // changeRootButton = new Button(chooserToolbarPanel, SWT.PUSH);
    // changeRootButton.setToolTipText(Messages.getString("VfsFileChooserDialog.changeVFSRoot"));
    // //$NON-NLS-1$
    // changeRootButton.setImage(new Image(chooserToolbarPanel.getDisplay(),
    // getClass().getResourceAsStream("/icons/network.gif"))); //$NON-NLS-1$
    // gridData = new GridData(SWT.CENTER, SWT.CENTER, false, false);
    // changeRootButton.setLayoutData(gridData);
    // changeRootButton.addSelectionListener(this);

    Label parentFoldersLabel = new Label(chooserToolbarPanel, SWT.NONE);
    if (fileDialogMode != VFS_DIALOG_SAVEAS) {
      parentFoldersLabel.setText(
          Messages.getString("VfsFileChooserDialog.openFromFolder")); // $NON-NLS-1$
    } else {
      parentFoldersLabel.setText(
          Messages.getString("VfsFileChooserDialog.saveInFolder")); // $NON-NLS-1$
    }
    gridData = new GridData(SWT.FILL, SWT.CENTER, false, false);
    parentFoldersLabel.setLayoutData(gridData);
    openFileCombo = new Combo(chooserToolbarPanel, SWT.BORDER);
    gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    openFileCombo.setLayoutData(gridData);
    openFileCombo.addSelectionListener(this);
    openFileCombo.addKeyListener(
        new KeyListener() {

          public void keyPressed(KeyEvent event) {
            // UP :
            //
            if ((event.keyCode == SWT.ARROW_UP)
                && ((event.stateMask & SWT.CONTROL) == 0)
                && ((event.stateMask & SWT.ALT) == 0)) {
              resolveVfsBrowser();
              vfsBrowser.selectPreviousItem();
            }

            // DOWN:
            //
            if ((event.keyCode == SWT.ARROW_DOWN)
                && ((event.stateMask & SWT.CONTROL) == 0)
                && ((event.stateMask & SWT.ALT) == 0)) {
              resolveVfsBrowser();
              vfsBrowser.selectNextItem();
            }
          }

          public void keyReleased(KeyEvent event) {
            if (event.keyCode == SWT.CR || event.keyCode == SWT.KEYPAD_CR) {
              try {
                // resolve the selected folder (without displaying access/secret keys in plain text)
                //            FileObject newRoot =
                // rootFile.getFileSystem().getFileSystemManager().resolveFile(folderURL.getFolderURL(openFileCombo.getText()));
                //            FileObject newRoot =
                // rootFile.getFileSystem().getFileSystemManager().resolveFile(getSelectedFile().getName().getURI());
                FileObject newRoot = currentPanel.resolveFile(openFileCombo.getText());

                vfsBrowser.resetVfsRoot(newRoot);
              } catch (FileSystemException e) {
                MessageBox errorDialog =
                    new MessageBox(vfsBrowser.getDisplay().getActiveShell(), SWT.OK);
                errorDialog.setText(
                    Messages.getString("VfsFileChooserDialog.error")); // $NON-NLS-1$
                errorDialog.setMessage(e.getMessage());
                errorDialog.open();
              }
            }
          }
        });
    folderUpButton = new Button(chooserToolbarPanel, SWT.PUSH);
    folderUpButton.setToolTipText(
        Messages.getString("VfsFileChooserDialog.upOneLevel")); // $NON-NLS-1$
    folderUpButton.setImage(getFolderUpImage(chooserToolbarPanel.getDisplay()));
    gridData = new GridData(SWT.CENTER, SWT.CENTER, false, false);
    folderUpButton.setLayoutData(gridData);
    folderUpButton.addSelectionListener(this);
    deleteFileButton = new Button(chooserToolbarPanel, SWT.PUSH);
    deleteFileButton.setToolTipText(
        Messages.getString("VfsFileChooserDialog.deleteFile")); // $NON-NLS-1$
    deleteFileButton.setImage(getDeleteImage(chooserToolbarPanel.getDisplay()));
    gridData = new GridData(SWT.CENTER, SWT.CENTER, false, false);
    deleteFileButton.setLayoutData(gridData);
    deleteFileButton.addSelectionListener(this);
    newFolderButton = new Button(chooserToolbarPanel, SWT.PUSH);
    newFolderButton.setToolTipText(
        Messages.getString("VfsFileChooserDialog.createNewFolder")); // $NON-NLS-1$
    newFolderButton.setImage(getNewFolderImage(chooserToolbarPanel.getDisplay()));
    gridData = new GridData(SWT.CENTER, SWT.CENTER, false, false);
    newFolderButton.setLayoutData(gridData);
    newFolderButton.addSelectionListener(this);
  }
示例#12
0
  /**
   * Constructor to create an editor to update/create an ontology entry
   *
   * @param display - points back to the display
   * @param oureditOntEntry - the entry being edited
   * @param ontParent - the edited item's parent in the hierarchy
   * @param newItem - true if this is a new item
   */
  public EditOntEntry(
      Display display, OntEntry oureditOntEntry, OntEntry ontParent, boolean newItem) {
    super();
    shell = new Shell(display, SWT.DIALOG_TRIM | SWT.PRIMARY_MODAL);
    shell.setText("OntEntry Information");
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 3;
    gridLayout.marginHeight = 5;
    gridLayout.makeColumnsEqualWidth = true;
    shell.setLayout(gridLayout);

    ourOntEntry = oureditOntEntry;
    ourParent = ontParent;

    if (newItem) {
      ourOntEntry.setName("");
      ourOntEntry.setImportance(Importance.MODERATE);
    }

    new Label(shell, SWT.NONE).setText("Name:");

    nameField = new Text(shell, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL);
    nameField.setText(ourOntEntry.getName());
    GridData gridData =
        new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
    DisplayUtilities.setTextDimensions(nameField, gridData, 75);
    gridData.horizontalSpan = 2;
    nameField.setLayoutData(gridData);

    new Label(shell, SWT.NONE).setText("Description:");

    descArea = new Text(shell, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
    descArea.setText(ourOntEntry.getDescription());
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    DisplayUtilities.setTextDimensions(descArea, gridData, 75, 5);
    gridData.horizontalSpan = 2;
    gridData.heightHint = descArea.getLineHeight() * 3;
    descArea.setLayoutData(gridData);

    new Label(shell, SWT.NONE).setText("Importance:");
    importanceBox = new Combo(shell, SWT.DROP_DOWN | SWT.READ_ONLY);
    Enumeration impEnum = Importance.elements();
    int l = 0;
    Importance itype;
    while (impEnum.hasMoreElements()) {
      itype = (Importance) impEnum.nextElement();
      importanceBox.add(itype.toString());
      if (itype.toString().compareTo(ourOntEntry.getImportance().toString()) == 0) {
        importanceBox.select(l);
      }
      l++;
    }
    // Error checking: if no such selection is valid, set it to select index 0
    if (importanceBox.getSelectionIndex() == -1) {
      importanceBox.select(0);
    }
    importanceBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));

    new Label(shell, SWT.NONE).setText(" ");
    new Label(shell, SWT.NONE).setText(" ");

    addButton = new Button(shell, SWT.PUSH);
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
    addButton.setLayoutData(gridData);
    if (newItem) {
      addButton.setText("Add");
      addButton.addSelectionListener(
          new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
              canceled = false;
              if (!nameField.getText().trim().equals("")) {
                ConsistencyChecker checker =
                    new ConsistencyChecker(ourOntEntry.getID(), nameField.getText(), "OntEntries");

                if (ourOntEntry.getName() == nameField.getText() || checker.check()) {
                  ourParent.addChild(ourOntEntry);
                  ourOntEntry.setLevel(ourParent.getLevel() + 1);
                  ourOntEntry.setName(nameField.getText());
                  ourOntEntry.setDescription(descArea.getText());
                  ourOntEntry.setImportance(
                      Importance.fromString(
                          importanceBox.getItem(importanceBox.getSelectionIndex())));

                  // comment before this made no sense...
                  ourOntEntry.setID(ourOntEntry.toDatabase(ourParent.getID()));
                  System.out.println("Name of added item = " + ourOntEntry.getName());

                  shell.close();
                  shell.dispose();
                }
              } else {
                MessageBox mbox = new MessageBox(shell, SWT.ICON_ERROR);
                mbox.setMessage("Need to provide the OntEntry name");
                mbox.open();
              }
            }
          });

    } else {
      addButton.setText("Save");
      addButton.addSelectionListener(
          new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
              canceled = false;

              ConsistencyChecker checker =
                  new ConsistencyChecker(ourOntEntry.getID(), nameField.getText(), "OntEntries");

              if (ourOntEntry.getName() == nameField.getText() || checker.check()) {
                ourOntEntry.setName(nameField.getText());
                ourOntEntry.setDescription(descArea.getText());
                ourOntEntry.setImportance(
                    Importance.fromString(
                        importanceBox.getItem(importanceBox.getSelectionIndex())));
                // since this is a save, not an add, the type and parent are ignored
                ourOntEntry.setID(ourOntEntry.toDatabase(0));

                //			RationaleDB db = RationaleDB.getHandle();
                //			db.addOntEntry(ourOntEntry);

                shell.close();
                shell.dispose();
              }
            }
          });
    }

    cancelButton = new Button(shell, SWT.PUSH);
    cancelButton.setText("Cancel");
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
    cancelButton.setLayoutData(gridData);
    cancelButton.addSelectionListener(
        new SelectionAdapter() {

          public void widgetSelected(SelectionEvent event) {
            canceled = true;
            shell.close();
            shell.dispose();
          }
        });

    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
  }
示例#13
0
  /** @see OpenGLTab#createControls(Composite) */
  void createControls(Composite composite) {
    Group movementGroup = new Group(composite, SWT.NONE);
    movementGroup.setText("Translation");
    movementGroup.setLayout(new GridLayout(2, false));

    new Label(movementGroup, SWT.NONE).setText("X:");
    final Slider xMove = new Slider(movementGroup, SWT.NONE);
    xMove.setIncrement(1);
    xMove.setMaximum(12);
    xMove.setMinimum(0);
    xMove.setThumb(2);
    xMove.setPageIncrement(2);
    xMove.setSelection(5);
    xMove.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event e) {
            xPos = xMove.getSelection() - 5;
          }
        });

    new Label(movementGroup, SWT.NONE).setText("Y:");
    final Slider yMove = new Slider(movementGroup, SWT.NONE);
    yMove.setIncrement(1);
    yMove.setMaximum(12);
    yMove.setMinimum(0);
    yMove.setThumb(2);
    yMove.setPageIncrement(2);
    yMove.setSelection(5);
    yMove.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event e) {
            yPos = yMove.getSelection() - 5;
          }
        });

    new Label(movementGroup, SWT.NONE).setText("Z:");
    final Slider zMove = new Slider(movementGroup, SWT.NONE);
    zMove.setIncrement(1);
    zMove.setMaximum(24);
    zMove.setMinimum(0);
    zMove.setThumb(4);
    zMove.setPageIncrement(2);
    zMove.setSelection(10);
    zMove.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event e) {
            zPos = zMove.getSelection() - 25;
          }
        });

    Composite fogTypesGroup = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    fogTypesGroup.setLayout(layout);
    fogTypesGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));

    new Label(fogTypesGroup, SWT.NONE).setText("Fog Types:");
    final Combo fogTypeCombo = new Combo(fogTypesGroup, SWT.READ_ONLY);
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    data.grabExcessHorizontalSpace = true;
    fogTypeCombo.setLayoutData(data);
    fogTypeCombo.setItems(FOG_NAMES);
    fogTypeCombo.select(0);

    new Label(composite, SWT.NONE).setText("Fog Density:");
    final Slider fogDensitySlider = new Slider(composite, SWT.NONE);
    fogDensitySlider.setIncrement(1);
    fogDensitySlider.setMaximum(32);
    fogDensitySlider.setMinimum(0);
    fogDensitySlider.setThumb(2);
    fogDensitySlider.setPageIncrement(5);
    fogDensitySlider.setSelection(0);
    fogDensitySlider.setEnabled(false);
    fogDensitySlider.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event e) {
            float fogDensity = ((float) fogDensitySlider.getSelection()) / 100;
            GL.glFogf(GL.GL_FOG_DENSITY, fogDensity);
          }
        });
    fogTypeCombo.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event e) {
            int currentSelection = fogTypeCombo.getSelectionIndex();
            // fog type GL.GL_LINEAR does not utilize fogDensity, but the other fog types do
            fogDensitySlider.setEnabled(currentSelection != 0);
            GL.glFogf(GL.GL_FOG_MODE, FOG_TYPES[currentSelection]);
          }
        });
  }
  /**
   * Creates the buttons in this group inside a new composite
   *
   * @param parent parent composite
   * @param toolkit toolkit to give form style or <code>null</code> for dialog style
   */
  private void createButtons(Composite parent, FormToolkit toolkit) {
    if (toolkit != null) {
      Composite buttonComp = toolkit.createComposite(parent);
      GridLayout layout = new GridLayout();
      layout.marginWidth = layout.marginHeight = 0;
      buttonComp.setLayout(layout);
      buttonComp.setLayoutData(new GridData(GridData.FILL_VERTICAL));

      fSelectButton = toolkit.createButton(buttonComp, Messages.IncludedBundlesTree_0, SWT.PUSH);
      fSelectButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
      fDeselectButton = toolkit.createButton(buttonComp, Messages.IncludedBundlesTree_1, SWT.PUSH);
      fDeselectButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

      Label emptySpace = new Label(buttonComp, SWT.NONE);
      GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
      gd.widthHint = gd.heightHint = 5;
      emptySpace.setLayoutData(gd);

      fSelectAllButton = toolkit.createButton(buttonComp, Messages.IncludedBundlesTree_2, SWT.PUSH);
      fSelectAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
      fDeselectAllButton =
          toolkit.createButton(buttonComp, Messages.IncludedBundlesTree_3, SWT.PUSH);
      fDeselectAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

      emptySpace = new Label(buttonComp, SWT.NONE);
      gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
      gd.widthHint = gd.heightHint = 5;
      emptySpace.setLayoutData(gd);

      fSelectRequiredButton =
          toolkit.createButton(buttonComp, Messages.TargetContentsGroup_4, SWT.PUSH);
      fSelectRequiredButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

      Composite filterComp = toolkit.createComposite(buttonComp);
      layout = new GridLayout();
      layout.marginWidth = layout.marginHeight = 0;
      filterComp.setLayout(layout);
      filterComp.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, true, true));

      fModeLabel = toolkit.createLabel(filterComp, Messages.TargetContentsGroup_ManageUsing);

      fPluginModeButton =
          toolkit.createButton(filterComp, Messages.TargetContentsGroup_PluginMode, SWT.RADIO);
      fPluginModeButton.setSelection(true);
      fFeaureModeButton =
          toolkit.createButton(filterComp, Messages.TargetContentsGroup_FeatureMode, SWT.RADIO);
      fFeaureModeButton.setSelection(true);

      emptySpace = new Label(filterComp, SWT.NONE);
      gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
      gd.widthHint = gd.heightHint = 5;
      emptySpace.setLayoutData(gd);

      fShowLabel = toolkit.createLabel(filterComp, Messages.BundleContainerTable_9);

      fShowPluginsButton =
          toolkit.createButton(filterComp, Messages.BundleContainerTable_14, SWT.CHECK);
      fShowPluginsButton.setSelection(true);
      fShowSourceButton =
          toolkit.createButton(filterComp, Messages.BundleContainerTable_15, SWT.CHECK);
      fShowSourceButton.setSelection(true);

      emptySpace = new Label(filterComp, SWT.NONE);
      gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
      gd.widthHint = gd.heightHint = 5;
      emptySpace.setLayoutData(gd);

      fGroupLabel = toolkit.createLabel(filterComp, Messages.TargetContentsGroup_0);

      fGroupComboPart = new ComboPart();
      fGroupComboPart.createControl(filterComp, toolkit, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
      gd = new GridData(GridData.FILL_HORIZONTAL);
      gd.horizontalIndent = 10;
      fGroupComboPart.getControl().setLayoutData(gd);
      fGroupComboPart.setItems(
          new String[] {
            Messages.TargetContentsGroup_1,
            Messages.TargetContentsGroup_2,
            Messages.TargetContentsGroup_3
          });
      fGroupComboPart.setVisibleItemCount(30);
      fGroupComboPart.addSelectionListener(
          new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
              handleGroupChange();
            }
          });
      fGroupComboPart.select(0);

    } else {
      Composite buttonComp = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_VERTICAL, 0, 0);
      fSelectButton = SWTFactory.createPushButton(buttonComp, Messages.IncludedBundlesTree_0, null);
      fDeselectButton =
          SWTFactory.createPushButton(buttonComp, Messages.IncludedBundlesTree_1, null);

      Label emptySpace = new Label(buttonComp, SWT.NONE);
      GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
      gd.widthHint = gd.heightHint = 5;
      emptySpace.setLayoutData(gd);

      fSelectAllButton =
          SWTFactory.createPushButton(buttonComp, Messages.IncludedBundlesTree_2, null);
      fDeselectAllButton =
          SWTFactory.createPushButton(buttonComp, Messages.IncludedBundlesTree_3, null);

      emptySpace = new Label(buttonComp, SWT.NONE);
      gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
      gd.widthHint = gd.heightHint = 5;
      emptySpace.setLayoutData(gd);

      fSelectRequiredButton =
          SWTFactory.createPushButton(buttonComp, Messages.TargetContentsGroup_4, null);

      Composite filterComp = SWTFactory.createComposite(buttonComp, 1, 1, SWT.NONE, 0, 0);
      filterComp.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, true, true));

      fModeLabel = SWTFactory.createLabel(filterComp, Messages.TargetContentsGroup_ManageUsing, 1);

      fPluginModeButton =
          SWTFactory.createRadioButton(filterComp, Messages.TargetContentsGroup_PluginMode);
      fFeaureModeButton =
          SWTFactory.createRadioButton(filterComp, Messages.TargetContentsGroup_FeatureMode);

      emptySpace = new Label(filterComp, SWT.NONE);
      gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
      gd.widthHint = gd.heightHint = 5;
      emptySpace.setLayoutData(gd);

      fShowLabel = SWTFactory.createLabel(filterComp, Messages.BundleContainerTable_9, 1);

      fShowPluginsButton =
          SWTFactory.createCheckButton(filterComp, Messages.BundleContainerTable_14, null, true, 1);
      fShowSourceButton =
          SWTFactory.createCheckButton(filterComp, Messages.BundleContainerTable_15, null, true, 1);

      emptySpace = new Label(filterComp, SWT.NONE);
      gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
      gd.widthHint = gd.heightHint = 5;
      emptySpace.setLayoutData(gd);

      fGroupLabel = SWTFactory.createLabel(filterComp, Messages.TargetContentsGroup_0, 1);
      fGroupCombo =
          SWTFactory.createCombo(
              filterComp,
              SWT.READ_ONLY,
              1,
              new String[] {
                Messages.TargetContentsGroup_1,
                Messages.TargetContentsGroup_2,
                Messages.TargetContentsGroup_3
              });
      gd = new GridData(GridData.FILL_HORIZONTAL);
      gd.horizontalIndent = 10;
      fGroupCombo.setLayoutData(gd);
      fGroupCombo.addSelectionListener(
          new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
              handleGroupChange();
            }
          });
      fGroupCombo.select(0);
    }

    fSelectButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            if (!fTree.getSelection().isEmpty()) {
              Object[] selected = ((IStructuredSelection) fTree.getSelection()).toArray();
              for (int i = 0; i < selected.length; i++) {
                fTree.setChecked(selected[i], true);
              }
              saveIncludedBundleState();
              contentChanged();
              updateButtons();
              fTree.update(
                  fTargetDefinition.getBundleContainers(),
                  new String[] {IBasicPropertyConstants.P_TEXT});
            }
          }
        });

    fDeselectButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            if (!fTree.getSelection().isEmpty()) {
              Object[] selected = ((IStructuredSelection) fTree.getSelection()).toArray();
              for (int i = 0; i < selected.length; i++) {
                fTree.setChecked(selected[i], false);
              }
              saveIncludedBundleState();
              contentChanged();
              updateButtons();
              fTree.update(
                  fTargetDefinition.getBundleContainers(),
                  new String[] {IBasicPropertyConstants.P_TEXT});
            }
          }
        });

    fSelectAllButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            fTree.setAllChecked(true);
            saveIncludedBundleState();
            contentChanged();
            updateButtons();
            fTree.update(
                fTargetDefinition.getBundleContainers(),
                new String[] {IBasicPropertyConstants.P_TEXT});
          }
        });

    fDeselectAllButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            fTree.setAllChecked(false);
            saveIncludedBundleState();
            contentChanged();
            updateButtons();
            fTree.update(
                fTargetDefinition.getBundleContainers(),
                new String[] {IBasicPropertyConstants.P_TEXT});
          }
        });

    fSelectRequiredButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            Object[] allChecked = fTree.getCheckedLeafElements();
            Object[] required = null;
            if (fFeaureModeButton.getSelection()) {
              required = getRequiredFeatures(fTargetDefinition.getAllFeatures(), allChecked);
            } else {
              required = getRequiredPlugins(fAllBundles, allChecked);
            }
            for (int i = 0; i < required.length; i++) {
              fTree.setChecked(required[i], true);
            }
            saveIncludedBundleState();
            contentChanged();
            updateButtons();
            fTree.update(
                fTargetDefinition.getBundleContainers(),
                new String[] {IBasicPropertyConstants.P_TEXT});
          }
        });

    fPluginModeButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            // Moving from feature based filtering to plug-in based, need to update storage
            ((TargetDefinition) fTargetDefinition).setUIMode(TargetDefinition.MODE_PLUGIN);
            contentChanged();
            fTargetDefinition.setIncluded(null);

            fGroupLabel.setEnabled(true);
            if (fGroupCombo != null) {
              fGroupCombo.setEnabled(true);
            } else {
              fGroupComboPart.getControl().setEnabled(true);
            }

            fTree.getControl().setRedraw(false);
            fTree.refresh(false);
            fTree.expandAll();
            updateCheckState();
            updateButtons();
            fTree.getControl().setRedraw(true);
          }
        });
    fPluginModeButton.setSelection(true);
    GridData gd = new GridData();
    gd.horizontalIndent = 10;
    fPluginModeButton.setLayoutData(gd);

    fFeaureModeButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            // Moving from plug-in based filtering to feature based, need to update storage
            ((TargetDefinition) fTargetDefinition).setUIMode(TargetDefinition.MODE_FEATURE);
            contentChanged();
            fTargetDefinition.setIncluded(null);

            fGroupLabel.setEnabled(false);
            if (fGroupCombo != null) {
              fGroupCombo.setEnabled(false);
            } else {
              fGroupComboPart.getControl().setEnabled(false);
            }

            fTree.getControl().setRedraw(false);
            fTree.refresh(false);
            fTree.expandAll();
            updateCheckState();
            updateButtons();
            fTree.getControl().setRedraw(true);
          }
        });
    fFeaureModeButton.setSelection(false);
    gd = new GridData();
    gd.horizontalIndent = 10;
    fFeaureModeButton.setLayoutData(gd);

    fShowPluginsButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            if (!fShowPluginsButton.getSelection()) {
              fTree.addFilter(fPluginFilter);
            } else {
              fTree.removeFilter(fPluginFilter);
              fTree.expandAll();
              updateCheckState();
            }
            updateButtons();
          }
        });
    fShowPluginsButton.setSelection(true);
    gd = new GridData();
    gd.horizontalIndent = 10;
    fShowPluginsButton.setLayoutData(gd);

    fShowSourceButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            if (!fShowSourceButton.getSelection()) {
              fTree.addFilter(fSourceFilter);
            } else {
              fTree.removeFilter(fSourceFilter);
              fTree.expandAll();
              updateCheckState();
            }
            updateButtons();
          }
        });
    fShowSourceButton.setSelection(true);
    gd = new GridData();
    gd.horizontalIndent = 10;
    fShowSourceButton.setLayoutData(gd);
  }
  public void createCustomUIPanel(final Shell dialog) {
    customUIPanel = new Composite(dialog, SWT.NONE);
    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
    customUIPanel.setLayoutData(gridData);
    customUIPanel.setLayout(new GridLayout(1, false));

    comboPanel = new Composite(customUIPanel, SWT.NONE);
    comboPanel.setLayoutData(gridData);
    comboPanel.setLayout(new GridLayout(2, false));
    comboPanel.setData("donotremove");

    Label lookInLabel = new Label(comboPanel, SWT.NONE);
    lookInLabel.setText(Messages.getString("VfsFileChooserDialog.LookIn"));
    gridData = new GridData(SWT.LEFT, SWT.CENTER, false, false);
    lookInLabel.setLayoutData(gridData);

    customUIPicker = new Combo(comboPanel, SWT.READ_ONLY);
    gridData = new GridData(SWT.LEFT, SWT.CENTER, true, false);
    customUIPicker.setLayoutData(gridData);

    if (!showLocation) {
      comboPanel.setParent(fakeShell);
    }

    if (!showCustomUI) {
      customUIPanel.setParent(fakeShell);
    }

    customUIPicker.addSelectionListener(
        new SelectionListener() {

          public void widgetSelected(SelectionEvent event) {
            selectCustomUI();
          }

          public void widgetDefaultSelected(SelectionEvent event) {
            selectCustomUI();
          }
        });
    customUIPicker.addKeyListener(
        new KeyListener() {

          public void keyReleased(KeyEvent arg0) {
            selectCustomUI();
          }

          public void keyPressed(KeyEvent arg0) {
            selectCustomUI();
          }
        });

    boolean createdLocal = false;
    for (CustomVfsUiPanel panel : customUIPanels) {
      if (panel.getVfsScheme().equals("file")) {
        createdLocal = true;
      }
    }

    if (!createdLocal) {
      CustomVfsUiPanel localPanel =
          new CustomVfsUiPanel("file", "Local", this, SWT.None) {
            public void activate() {
              try {
                File startFile = new File(System.getProperty("user.home"));
                if (startFile == null || !startFile.exists()) {
                  startFile = File.listRoots()[0];
                }
                FileObject dot = fsm.resolveFile(startFile.toURI().toURL().toExternalForm());
                rootFile = dot.getFileSystem().getRoot();
                selectedFile = rootFile;
                setInitialFile(selectedFile);
                openFileCombo.setText(selectedFile.getName().getURI());
                resolveVfsBrowser();
              } catch (Throwable t) {
              }
            }
          };
      addVFSUIPanel(localPanel);
    }
  }
示例#16
0
  /** This method initializes scanningTab */
  private void createScanningTab() {
    RowLayout rowLayout = createRowLayout();
    scanningTab = new Composite(tabFolder, SWT.NONE);
    scanningTab.setLayout(rowLayout);

    GridLayout groupLayout = new GridLayout();
    groupLayout.numColumns = 2;
    Group threadsGroup = new Group(scanningTab, SWT.NONE);
    threadsGroup.setText(Labels.getLabel("preferences.threads"));
    threadsGroup.setLayout(groupLayout);

    GridData gridData = new GridData(80, SWT.DEFAULT);

    Label label;

    label = new Label(threadsGroup, SWT.NONE);
    label.setText(Labels.getLabel("preferences.threads.delay"));
    threadDelayText = new Text(threadsGroup, SWT.BORDER);
    threadDelayText.setLayoutData(gridData);

    label = new Label(threadsGroup, SWT.NONE);
    label.setText(Labels.getLabel("preferences.threads.maxThreads"));
    maxThreadsText = new Text(threadsGroup, SWT.BORDER);
    maxThreadsText.setLayoutData(gridData);
    //		new Label(threadsGroup, SWT.NONE);
    //		Button checkButton = new Button(threadsGroup, SWT.NONE);
    //		checkButton.setText(Labels.getLabel("button.check"));
    //		checkButton.setLayoutData(gridData);
    //		checkButton.addListener(SWT.Selection, new CheckButtonListener());

    Group pingingGroup = new Group(scanningTab, SWT.NONE);
    pingingGroup.setLayout(groupLayout);
    pingingGroup.setText(Labels.getLabel("preferences.pinging"));

    label = new Label(pingingGroup, SWT.NONE);
    label.setText(Labels.getLabel("preferences.pinging.type"));
    pingersCombo = new Combo(pingingGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
    pingersCombo.setLayoutData(gridData);
    String[] pingerNames = pingerRegistry.getRegisteredNames();
    for (int i = 0; i < pingerNames.length; i++) {
      pingersCombo.add(Labels.getLabel(pingerNames[i]));
      // this is used by savePreferences()
      pingersCombo.setData(Integer.toString(i), pingerNames[i]);
    }
    pingersCombo.select(0);

    label = new Label(pingingGroup, SWT.NONE);
    label.setText(Labels.getLabel("preferences.pinging.count"));
    pingingCountText = new Text(pingingGroup, SWT.BORDER);
    pingingCountText.setLayoutData(gridData);

    label = new Label(pingingGroup, SWT.NONE);
    label.setText(Labels.getLabel("preferences.pinging.timeout"));
    pingingTimeoutText = new Text(pingingGroup, SWT.BORDER);
    pingingTimeoutText.setLayoutData(gridData);

    GridData gridDataWithSpan = new GridData();
    gridDataWithSpan.horizontalSpan = 2;
    deadHostsCheckbox = new Button(pingingGroup, SWT.CHECK);
    deadHostsCheckbox.setText(Labels.getLabel("preferences.pinging.deadHosts"));
    deadHostsCheckbox.setLayoutData(gridDataWithSpan);

    Group skippingGroup = new Group(scanningTab, SWT.NONE);
    skippingGroup.setLayout(groupLayout);
    skippingGroup.setText(Labels.getLabel("preferences.skipping"));

    skipBroadcastsCheckbox = new Button(skippingGroup, SWT.CHECK);
    skipBroadcastsCheckbox.setText(Labels.getLabel("preferences.skipping.broadcast"));
    GridData gridDataWithSpan2 = new GridData();
    gridDataWithSpan2.horizontalSpan = 2;
    skipBroadcastsCheckbox.setLayoutData(gridDataWithSpan2);
  }
示例#17
0
文件: FindTool.java 项目: URMC/i2b2
  public Control getFindTabControl(TabFolder tabFolder) {
    // Find Composite
    Composite compositeFind = new Composite(tabFolder, SWT.NULL);
    GridLayout gridLayout = new GridLayout(2, false);
    compositeFind.setLayout(gridLayout);
    /*		GridData fromTreeGridData = new GridData (GridData.FILL_BOTH);
    		fromTreeGridData.grabExcessHorizontalSpace = true;
    		fromTreeGridData.grabExcessVerticalSpace = true;
    	//	fromTreeGridData.widthHint = 300;
    		compositeFind.setLayoutData(fromTreeGridData);
    */

    //	First Set up the match combo box
    final Combo matchCombo = new Combo(compositeFind, SWT.READ_ONLY);

    matchCombo.add("Starting with");
    matchCombo.add("Ending with");
    matchCombo.add("Containing");
    matchCombo.add("Exact");

    // set default category
    matchCombo.setText("Containing");
    match = "Containing";

    matchCombo.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            // Item in list has been selected
            match = matchCombo.getItem(matchCombo.getSelectionIndex());
          }

          public void widgetDefaultSelected(SelectionEvent e) {
            // this is not an option (text cant be entered)
          }
        });

    // Then set up the Find text combo box
    final Combo findCombo = new Combo(compositeFind, SWT.DROP_DOWN);
    GridData findComboData = new GridData(GridData.FILL_HORIZONTAL);
    findComboData.widthHint = 200;
    findComboData.horizontalSpan = 1;
    findCombo.setLayoutData(findComboData);
    findCombo.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            // Text Item has been entered
            // Does not require 'return' to be entered
            findText = findCombo.getText();
          }
        });

    findCombo.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {}

          public void widgetDefaultSelected(SelectionEvent e) {
            findText = findCombo.getText();
            if (findCombo.indexOf(findText) < 0) {
              findCombo.add(findText);
            }
            if (findButton.getText().equals("Find")) {
              slm.setMessage("Performing search");
              slm.update(true);
              browser.flush();
              ModifierComposite.getInstance().disableComposite();
              System.setProperty("statusMessage", "Calling WebService");

              TreeNode placeholder = new TreeNode(1, "placeholder", "working...", "C-UNDEF");
              browser.rootNode.addChild(placeholder);
              browser.refresh();

              browser.getFindData(categoryKey, categories, findText, match).start();
              findButton.setText("Cancel");

            } else {
              System.setProperty("statusMessage", "Canceling WebService call");
              browser.refresh();
              browser.stopRunning = true;
              findButton.setText("Find");
            }
          }
        });

    // Next include 'Find' Button
    findButton = new Button(compositeFind, SWT.PUSH);
    findButton.setText("Find");
    GridData findButtonData = new GridData();
    if (OS.startsWith("mac")) findButtonData.widthHint = 80;
    else findButtonData.widthHint = 60;
    findButton.setLayoutData(findButtonData);
    findButton.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseDown(MouseEvent e) {
            // Add item to findCombo drop down list if not already there
            if (findText == null) {
              return;
            }
            if (findCombo.indexOf(findText) < 0) {
              findCombo.add(findText);
            }
            if (findButton.getText().equals("Find")) {
              ModifierComposite.getInstance().disableComposite();
              browser.flush();
              System.setProperty("statusMessage", "Calling WebService");
              TreeNode placeholder = new TreeNode(1, "placeholder", "working...", "C-UNDEF");
              browser.rootNode.addChild(placeholder);
              browser.refresh();

              browser.getFindData(categoryKey, categories, findText, match).start();
              findButton.setText("Cancel");
            } else {
              System.setProperty("statusMessage", "Canceling WebService call");
              browser.refresh();
              browser.stopRunning = true;
              findButton.setText("Find");
            }
          }
        });
    // Next set up the category combo box
    final Combo categoryCombo = new Combo(compositeFind, SWT.READ_ONLY);
    setCategories(categoryCombo);

    categoryCombo.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            // Item in list has been selected
            if (categoryCombo.getSelectionIndex() == 0) categoryKey = "any";
            else {
              ConceptType concept =
                  (ConceptType) categories.get(categoryCombo.getSelectionIndex() - 1);
              categoryKey = StringUtil.getTableCd(concept.getKey());
            }
          }

          public void widgetDefaultSelected(SelectionEvent e) {
            // this is not an option (text cant be entered)
          }
        });
    ModifierComposite.setInstance(compositeFind);
    browser = new NodeBrowser(compositeFind, 1, findButton, slm);

    return compositeFind;
  }