@Override
    protected void createDestinationGroup(Composite parent) {
      UIPlugin plugin = UIPlugin.getInstance();
      Group destinationGroup = new Group(parent, SWT.NONE);
      GridLayout layout = new GridLayout();
      destinationGroup.setLayout(layout);
      destinationGroup.setLayoutData(
          new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
      destinationGroup.setText(plugin.getString("_UI_Forge_Credentials_label"));
      destinationGroup.setFont(parent.getFont());

      Font font = destinationGroup.getFont();

      Label loginLabel = new Label(destinationGroup, SWT.NONE);
      loginLabel.setText(plugin.getString("_UI_Login_label"));
      loginLabel.setFont(font);

      loginField = new Text(destinationGroup, SWT.BORDER | SWT.READ_ONLY);
      GridData data = new GridData(GridData.FILL_HORIZONTAL);
      data.widthHint = SIZING_TEXT_FIELD_WIDTH;
      loginField.setLayoutData(data);
      loginField.setFont(font);

      Label passwordLabel = new Label(destinationGroup, SWT.NONE);
      passwordLabel.setText(plugin.getString("_UI_Password_label"));
      passwordLabel.setFont(font);

      passwordField = new Text(destinationGroup, SWT.BORDER | SWT.PASSWORD);
      data = new GridData(GridData.FILL_HORIZONTAL);
      data.widthHint = SIZING_TEXT_FIELD_WIDTH;
      passwordField.setLayoutData(data);
      passwordField.setFont(font);
      passwordField.addListener(SWT.Modify, this);
    }
Beispiel #2
0
 @Test
 public void testGetLineHeight() {
   Text text = new Text(shell, SWT.MULTI);
   // default theme font is 11px
   assertEquals(16, text.getLineHeight());
   text.setFont(Graphics.getFont("Helvetica", 12, SWT.NORMAL));
   assertEquals(14, text.getLineHeight());
   text.setFont(null);
   assertEquals(16, text.getLineHeight());
 }
Beispiel #3
0
  /**
   * ************************************************************************* Create the dialog
   * area contents.
   *
   * @param parent The base composite of the dialog
   * @return The resulting contents
   *     ************************************************************************
   */
  protected Control createDialogArea(Composite parent) {
    // Main composite of the dialog area -----------------------------------
    Composite top = new Composite(parent, SWT.NONE);
    top.setLayoutData(new GridData(GridData.FILL_BOTH));
    top.setLayout(new GridLayout(1, true));

    IConfigurationManager cfg =
        (IConfigurationManager) ServiceManager.get(IConfigurationManager.class);

    Font codeFont = cfg.getFont(FontKey.MASTERC);
    Color bcolor = cfg.getGuiColor(GuiColorKey.CONSOLE_BG);
    Color wcolor = cfg.getGuiColor(GuiColorKey.CONSOLE_FG);

    // Create the console display
    m_display = new Text(top, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    m_display.setFont(codeFont);
    m_display.setBackground(bcolor);
    m_display.setForeground(wcolor);
    GridData ddata = new GridData(GridData.FILL_BOTH);
    ddata.minimumHeight = 200;
    m_display.setLayoutData(ddata);
    m_display.setText("");
    m_display.setEditable(false);

    // Create the input field
    m_prompt = new PromptField(top, "");
    m_prompt.getContents().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    m_prompt.getContents().addKeyListener(this);

    m_prompt.getContents().setFocus();

    return parent;
  }
  private void createExperimentNameGroup(Composite parent) {
    Font font = parent.getFont();
    Composite folderGroup = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    folderGroup.setLayout(layout);
    folderGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // New experiment label
    Label experimentLabel = new Label(folderGroup, SWT.NONE);
    experimentLabel.setFont(font);
    experimentLabel.setText(Messages.NewExperimentDialog_ExperimentName);

    // New experiment name entry field
    fExperimentName = new Text(folderGroup, SWT.BORDER);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    fExperimentName.setLayoutData(data);
    fExperimentName.setFont(font);
    fExperimentName.addListener(
        SWT.Modify,
        new Listener() {
          @Override
          public void handleEvent(Event event) {
            validateNewExperimentName();
          }
        });
  }
 /**
  * Set the font to display with
  *
  * @param fontData
  */
 public void setFont(FontData[] fontData) {
   if (font != null) {
     font.dispose();
   }
   font = new Font(text.getDisplay(), fontData);
   text.setFont(font);
 }
Beispiel #6
0
  public void applyFont(FontType type, FontData data) {
    Font newFont = new Font(SwtUtils.DISPLAY, data);
    Font oldFont = null;

    switch (type) {
      case GLOBAL:
        {
          oldFont = iniAppearance.getFontGlobal();

          for (Control control : controls) {
            if (control.isDisposed()) continue;

            control.setFont(newFont);
          }

          for (Label label : labels) {
            if (label.isDisposed()) continue;

            label.setFont(newFont);
          }

          for (Button button : buttons) {
            if (button.isDisposed()) continue;

            button.setFont(newFont);
          }

          iniAppearance.setFontGlobal(newFont);
          break;
        }
      case LOG:
        {
          oldFont = iniAppearance.getFontLog();

          for (StyledText control : logControls) {
            if (control.isDisposed()) continue;

            control.setFont(newFont);
          }

          iniAppearance.setFontLog(newFont);
          break;
        }
      case CHAT:
        {
          oldFont = iniAppearance.getFontChat();

          for (Text control : chatControls) {
            if (control.isDisposed()) continue;

            control.setFont(newFont);
          }

          iniAppearance.setFontChat(newFont);
          break;
        }
    }

    if (oldFont != null) oldFont.dispose();
  }
Beispiel #7
0
  public void initChatControl(Text chat) {
    chat.setFont(iniAppearance.getFontChat());
    chat.setBackground(iniAppearance.getColorBackground());
    chat.setForeground(iniAppearance.getColorForeground());

    chatControls.add(chat);
  }
  /**
   * Returns this field editor's text control.
   *
   * <p>The control is created if it does not yet exist
   *
   * @param parent the parent
   * @return the text control
   */
  public Text getTextControl(Composite parent) {
    if (textField == null) {
      textField = new Text(parent, SWT.SINGLE | SWT.BORDER);

      textField.setEchoChar('*');

      textField.setFont(parent.getFont());
      switch (validateStrategy) {
        case VALIDATE_ON_KEY_STROKE:
          textField.addKeyListener(
              new KeyAdapter() {

                /** {@inheritDoc} */
                @Override
                public void keyReleased(KeyEvent e) {
                  valueChanged();
                }
              });

          break;
        case VALIDATE_ON_FOCUS_LOST:
          textField.addKeyListener(
              new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                  clearErrorMessage();
                }
              });
          textField.addFocusListener(
              new FocusAdapter() {
                @Override
                public void focusGained(FocusEvent e) {
                  refreshValidState();
                }

                @Override
                public void focusLost(FocusEvent e) {
                  valueChanged();
                  clearErrorMessage();
                }
              });
          break;
        default:
          Assert.isTrue(false, "Unknown validate strategy"); // $NON-NLS-1$
      }
      textField.addDisposeListener(
          new DisposeListener() {
            @Override
            public void widgetDisposed(DisposeEvent event) {
              textField = null;
            }
          });
      if (textLimit > 0) { // Only set limits above 0 - see SWT spec
        textField.setTextLimit(textLimit);
      }
    } else {
      checkParent(textField, parent);
    }
    return textField;
  }
Beispiel #9
0
  /**
   * Creates the input score text.
   *
   * @param main the main
   * @param player the player
   */
  private void createInputScoreText(Composite main, IPlayer player) {
    Text inputScoreText = this.toolkit.createText(main, "", SWT.CENTER | SWT.BORDER);
    inputScoreText.setFont(OpenDartsFormsToolkit.getFont(OpenDartsFormsToolkit.FONT_SCORE_INPUT));
    inputScoreText.setEnabled(false);
    this.playerScoreInput.put(player, inputScoreText);

    // Tooltip
    ShortcutsTooltip tooltip = new ShortcutsTooltip(inputScoreText);
    tooltip.setPopupDelay(200);

    // layout
    int indent = FieldDecorationRegistry.getDefault().getMaximumDecorationWidth() + 2;
    GridDataFactory.fillDefaults()
        .grab(true, false)
        .indent(indent, SWT.DEFAULT)
        .hint(SWT.DEFAULT, 100)
        .applyTo(inputScoreText);

    // decoration
    ControlDecoration dec = new ControlDecoration(inputScoreText, SWT.TOP | SWT.LEFT);

    // listener
    TextInputListener listener =
        new TextInputListener(this.getSite().getShell(), inputScoreText, this.game, player, dec);
    inputScoreText.addKeyListener(listener);

    inputScoreText.addTraverseListener(new CancelTraverseListener());
  }
  /**
   * Create this dialog's drop-down list component.
   *
   * @param parent the parent composite
   */
  protected void createDropDownText(Composite parent) {
    // create the list
    text = new Text(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    text.setFont(parent.getFont());

    // print the stacktrace in the text field
    try {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      PrintStream ps = new PrintStream(baos);
      detail.printStackTrace(ps);
      ps.flush();
      baos.flush();
      text.setText(baos.toString());
    } catch (IOException e) {
    }

    GridData data =
        new GridData(
            GridData.HORIZONTAL_ALIGN_FILL
                | GridData.GRAB_HORIZONTAL
                | GridData.VERTICAL_ALIGN_FILL
                | GridData.GRAB_VERTICAL);
    data.heightHint = text.getLineHeight() * TEXT_LINE_COUNT;
    data.horizontalSpan = 2;
    text.setLayoutData(data);
  }
  /**
   * Creates the project name specification controls.
   *
   * @param parent the parent composite
   */
  private final void createProjectNameGroup(Composite parent) {

    Font dialogFont = parent.getFont();

    // project specification group
    Composite projectGroup = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    projectGroup.setFont(dialogFont);
    projectGroup.setLayout(layout);
    projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // new project label
    Label projectLabel = new Label(projectGroup, SWT.NONE);
    projectLabel.setText(DataTransferMessages.WizardExternalProjectImportPage_nameLabel);
    projectLabel.setFont(dialogFont);

    // new project name entry field
    projectNameField = new Text(projectGroup, SWT.BORDER | SWT.READ_ONLY);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = SIZING_TEXT_FIELD_WIDTH;
    projectNameField.setLayoutData(data);
    projectNameField.setFont(dialogFont);
    projectNameField.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
  }
Beispiel #12
0
  /** reset the algorithm. Executed when pressed the plus or minus button */
  public void reset() {
    view.enableMenu(false);
    showDialog = false;
    execute = false;

    equationGroup.setEnabled(true);
    for (Equation equation : equations.getEquationSet()) {
      equation.setEquationEnable(true);
    }

    step1Text.setFont(FontService.getSmallBoldFont());
    step2Text.setFont(FontService.getSmallFont());
    step3Text.setFont(FontService.getSmallFont());
    step4Text.setFont(FontService.getSmallFont());
    resultText.setFont(FontService.getSmallFont());
    resultValueText.setFont(FontService.getSmallFont());
    resultMoreText.setFont(FontService.getSmallFont());
    resultXText.setFont(FontService.getSmallFont());

    step1Group.setEnabled(true);
    step2Group.setEnabled(false);
    step3Group.setEnabled(false);
    step4Group.setEnabled(false);
    resultGroup.setEnabled(false);

    step1Text.setEnabled(true);
    step2Text.setEnabled(false);
    step3Text.setEnabled(false);
    step4Text.setEnabled(false);

    step1nextButton.setEnabled(true);
    step2nextButton.setEnabled(false);
    step3nextButton.setEnabled(false);
    step4nextButton.setEnabled(false);

    resultText.setEnabled(false);
    resultMoreText.setEnabled(false);
    resultValueText.setEnabled(false);
    resultXText.setEnabled(false);
    resultValueText.setText(""); // $NON-NLS-1$

    nextButton.setEnabled(false);
    previousButton.setEnabled(false);

    /*
     * dispose the inverse and verify group for the next turn of calculating
     */
    for (Control elem : inverseGroup.getChildren()) {
      elem.dispose();
    }
    inverseGroup.pack();

    for (Control elem : verifyGroup.getChildren()) {
      elem.dispose();
    }
    verifyGroup.pack();
  }
 /**
  * Creates a new text widget
  *
  * @param parent the parent composite to add this text widget to
  * @param hspan the horizontal span to take up on the parent composite
  * @return the new text widget
  */
 private static Text createSingleText(Composite parent, int hspan) {
   Text t = new Text(parent, SWT.SINGLE | SWT.BORDER);
   t.setFont(parent.getFont());
   GridData gd = new GridData(GridData.FILL_HORIZONTAL);
   gd.horizontalSpan = hspan;
   t.setLayoutData(gd);
   return t;
 }
 /**
  * Creates a new text widget
  *
  * @param parent the parent composite to add this text widget to
  * @param style the style bits for the text widget
  * @param hspan the horizontal span to take up on the parent composite
  * @return the new text widget
  * @since 3.3
  */
 public static Text createText(Composite parent, int style, int hspan) {
   Text t = new Text(parent, style);
   t.setFont(parent.getFont());
   GridData gd = new GridData(GridData.FILL_HORIZONTAL);
   gd.horizontalSpan = hspan;
   t.setLayoutData(gd);
   return t;
 }
Beispiel #15
0
 public void setFont(Font font) {
   super.setFont(font);
   this.font = font;
   text.setFont(font);
   if (icon != null) icon.setFont(font);
   list.setFont(font);
   internalLayout(true);
 }
  /**
   * Returns this field editor's text control.
   *
   * <p>The control is created if it does not yet exist
   *
   * @param parent the parent
   * @return the text control
   */
  public Text getTextControl(Composite parent) {
    if (textField == null) {
      //            System.out.println("creating...");
      textField = new Text(parent, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
      textField.setFont(parent.getFont());
      switch (validateStrategy) {
        case VALIDATE_ON_KEY_STROKE:
          textField.addKeyListener(
              new KeyAdapter() {

                /*
                 * (non-Javadoc)
                 *
                 * @see org.eclipse.swt.events.KeyAdapter#keyReleased(org.eclipse.swt.events.KeyEvent)
                 */
                public void keyReleased(KeyEvent e) {
                  valueChanged();
                }
              });

          break;
        case VALIDATE_ON_FOCUS_LOST:
          textField.addKeyListener(
              new KeyAdapter() {
                public void keyPressed(KeyEvent e) {
                  clearErrorMessage();
                }
              });
          textField.addFocusListener(
              new FocusAdapter() {
                public void focusGained(FocusEvent e) {
                  refreshValidState();
                }

                public void focusLost(FocusEvent e) {
                  valueChanged();
                  clearErrorMessage();
                }
              });
          break;
        default:
          Assert.isTrue(false, "Unknown validate strategy"); // $NON-NLS-1$
      }
      textField.addDisposeListener(
          new DisposeListener() {
            public void widgetDisposed(DisposeEvent event) {
              textField = null;
            }
          });
      if (textLimit > 0) { // Only set limits above 0 - see SWT spec
        textField.setTextLimit(textLimit);
      }
    } else {
      checkParent(textField, parent);
    }
    return textField;
  }
  private void createDestinationGroup(Composite parent) {
    GridData gd;
    Font font = parent.getFont();
    // destination specification group
    Composite destinationSelectionGroup = new Composite(parent, SWT.NONE);
    destinationSelectionGroup.setLayout(new GridLayout(2, false));
    destinationSelectionGroup.setLayoutData(
        new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
    destinationSelectionGroup.setFont(font);

    Label destinationLabel = new Label(destinationSelectionGroup, SWT.NONE);
    destinationLabel.setText(Messages.TeamProjectIndexExportWizardPage_destinationLabel);
    destinationLabel.setFont(font);
    destinationLabel.setLayoutData(gd = new GridData());
    gd.horizontalSpan = 2;

    // destination name entry field
    fDestinationField = new Text(destinationSelectionGroup, SWT.BORDER);
    fDestinationField.addListener(SWT.Modify, this);
    fDestinationField.addListener(SWT.Selection, this);
    fDestinationField.setFont(font);
    fDestinationField.setLayoutData(gd = new GridData());
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = GridData.FILL;
    gd.widthHint = SIZING_TEXT_FIELD_WIDTH;

    Button button =
        createButton(
            destinationSelectionGroup,
            IDialogConstants.CLIENT_ID,
            Messages.TeamProjectIndexExportWizardPage_variableButton,
            false);
    SelectionAdapter listener =
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            onInsertVariable();
          }
        };
    button.addSelectionListener(listener);

    // resource snapshot destination group
    Composite resourceSnapshotDestinationGroup = new Composite(parent, SWT.NONE);
    resourceSnapshotDestinationGroup.setLayout(new GridLayout(1, false));
    resourceSnapshotDestinationGroup.setLayoutData(
        new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
    resourceSnapshotDestinationGroup.setFont(font);

    fResourceSnapshotButton = new Button(resourceSnapshotDestinationGroup, SWT.CHECK);
    fResourceSnapshotButton.setText(
        Messages.TeamProjectIndexExportWizardPage_resourceSnapshotButton);
    fResourceSnapshotButton.setFont(font);
    fResourceSnapshotButton.setLayoutData(gd = new GridData());
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = GridData.FILL;
  }
  private void createProjectInfo(Composite parent) {
    Composite workArea = new Composite(parent, SWT.NONE);
    workArea.setLayout(new GridLayout(2, false));
    workArea.setLayoutData(new GridData(GridData.FILL_BOTH));

    // Project name
    Label nameLabel = new Label(workArea, SWT.NONE);
    nameLabel.setText(TernUIMessages.ImportTernRepositoryWizardPage_name_label);
    nameText = new Text(workArea, SWT.SINGLE | SWT.BORDER);
    nameText.setFont(parent.getFont());
    nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // File system path
    Label locationLabel = new Label(workArea, SWT.NONE);
    locationLabel.setText(TernUIMessages.ImportTernRepositoryWizardPage_location_label);
    locationText = new Text(workArea, SWT.WRAP | SWT.READ_ONLY);
    locationText.setFont(parent.getFont());
    locationText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  }
Beispiel #19
0
 /** Creates text area for displaying application environment info */
 private void createTextEnvironment() {
   textEnvironment = new Text(shell, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.BORDER);
   textEnvironment.setFont(SharedStyle.FONT_FIXED);
   textEnvironment.setText(Version.getEnvironmentReport());
   textEnvironment.setEditable(false);
   final FormData layout = SharedStyle.relativeTo(labelEnvironment, null, buttonClose, null);
   layout.width = 500;
   layout.height = 150;
   textEnvironment.setLayoutData(layout);
 }
Beispiel #20
0
    @Override
    public void createControl(final Composite parent) {
      final Composite composite = new Composite(parent, SWT.NONE);
      composite.setLayout(LayoutUtil.applyDialogDefaults(new GridLayout(), 2));
      setControl(composite);

      final int count = getRefactoring().getAllOccurrencesCount();

      {
        final Label label = new Label(composite, SWT.NONE);
        label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
        label.setText(Messages.ExtractTemp_Wizard_header);
        label.setFont(JFaceResources.getBannerFont());
      }

      LayoutUtil.addSmallFiller(composite, false);

      {
        final Label label = new Label(composite, SWT.NONE);
        label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
        label.setText(Messages.ExtractTemp_Wizard_VariableName_label);

        fVariableNameControl = new Text(composite, SWT.BORDER);
        fVariableNameControl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
        fVariableNameControl.setFont(JFaceResources.getTextFont());
      }

      LayoutUtil.addSmallFiller(composite, false);

      {
        if (count > 0) {
          final Label label = new Label(composite, SWT.WRAP);
          label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
          if (count == 1) {
            label.setText("No other occurrences of the selected expression found.");
          } else {
            label.setText(
                NLS.bind("{0} other occurrences of the selected expression found.", count - 1));
          }
        }

        fReplaceAllControl = new Button(composite, SWT.CHECK);
        fReplaceAllControl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
        fReplaceAllControl.setText(Messages.ExtractTemp_Wizard_ReplaceAll_label);
        if (count <= 1) {
          fReplaceAllControl.setEnabled(false);
        }
      }

      LayoutUtil.addSmallFiller(composite, false);
      Dialog.applyDialogFont(composite);

      initBindings();
      //			PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),);
    }
 /**
  * Creates a new text widget
  *
  * @param parent the parent composite to add this text widget to
  * @param style the style bits for the text widget
  * @param hspan the horizontal span to take up on the parent composite
  * @param width the desired width of the text widget
  * @param height the desired height of the text widget
  * @param fill the fill style for the widget
  * @return the new text widget
  * @since 3.3
  */
 public static Text createText(
     Composite parent, int style, int hspan, int width, int height, int fill) {
   Text t = new Text(parent, style);
   t.setFont(parent.getFont());
   GridData gd = new GridData(fill);
   gd.horizontalSpan = hspan;
   gd.widthHint = width;
   gd.heightHint = height;
   t.setLayoutData(gd);
   return t;
 }
  /** Creates the widgets that display the target order */
  private void createTaskList(Composite parent) {
    Font font = parent.getFont();

    Label label = new Label(parent, SWT.NONE);
    label.setText("Task execution order:");
    label.setFont(font);

    Composite orderComposite = new Composite(parent, SWT.NONE);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    orderComposite.setLayoutData(gd);
    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    orderComposite.setLayout(layout);
    orderComposite.setFont(font);

    taskOrderText =
        new Text(orderComposite, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL | SWT.READ_ONLY);
    taskOrderText.setFont(font);
    gd = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
    gd.heightHint = 40;
    gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    taskOrderText.setLayoutData(gd);

    Composite buttonColumn = new Composite(orderComposite, SWT.NONE);
    layout = new GridLayout(1, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    buttonColumn.setLayout(layout);
    buttonColumn.setFont(font);

    orderButton = createPushButton(buttonColumn, "Order...", null);
    gd = (GridData) orderButton.getLayoutData();
    gd.verticalAlignment = GridData.BEGINNING;
    orderButton.setFont(font);
    orderButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            handleOrderPressed();
          }
        });
    clearButton = createPushButton(buttonColumn, "Clear", null);
    gd = (GridData) orderButton.getLayoutData();
    gd.verticalAlignment = GridData.BEGINNING;
    clearButton.setFont(font);
    clearButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            handleClearPressed();
          }
        });
    updateOrderedTargets();
  }
  private void createTextFields(Composite parent) {
    Font font = parent.getFont();
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    composite.setFont(font);
    composite.setLayout(layout);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.widthHint = 250;
    composite.setLayoutData(gd);

    Label addr_label = new Label(composite, SWT.WRAP);
    addr_label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
    addr_label.setFont(font);
    addr_label.setText("Address:");

    addr_text = new Text(composite, SWT.SINGLE | SWT.BORDER);
    addr_text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    addr_text.setFont(font);
    addr_text.setEditable(enable_editing);

    Label size_label = new Label(composite, SWT.WRAP);
    size_label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
    size_label.setFont(font);
    size_label.setText("Size:");

    size_text = new Text(composite, SWT.SINGLE | SWT.BORDER);
    size_text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    size_text.setFont(font);
    size_text.setEditable(enable_editing);

    Label offset_label = new Label(composite, SWT.WRAP);
    offset_label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
    offset_label.setFont(font);
    offset_label.setText("File offset:");

    offset_text = new Text(composite, SWT.SINGLE | SWT.BORDER);
    offset_text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    offset_text.setFont(font);
    offset_text.setEditable(enable_editing);
  }
Beispiel #24
0
  /**
   * Creates the player score sheet composite.
   *
   * @param parent the parent
   * @param iPlayer the i player
   * @return the composite
   */
  private Composite createPlayerScoreLeftComposite(Composite parent, IPlayer player) {
    Composite main = this.toolkit.createComposite(parent);
    GridLayoutFactory.fillDefaults().applyTo(main);

    Text txtScore =
        this.toolkit.createText(
            main, this.getPlayerCurrentScore(player), SWT.READ_ONLY | SWT.CENTER | SWT.BORDER);
    txtScore.setFont(OpenDartsFormsToolkit.getFont(OpenDartsFormsToolkit.FONT_SCORE_LEFT));
    GridDataFactory.fillDefaults().grab(true, true).applyTo(txtScore);
    this.playerScoreLeft.put(player, txtScore);

    return main;
  }
  public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(
        new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
    Group projectGroup = new Group(composite, SWT.NONE);
    projectGroup.setText("Ecore model to bind"); // $NON-NLS-1$
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    projectGroup.setLayout(layout);
    projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // new project name entry field
    pathField = new Text(projectGroup, SWT.BORDER);
    if (ecoreFilePath != null) {
      pathField.setText(ecoreFilePath.toString());
    }
    GridData data = new GridData(GridData.FILL_HORIZONTAL);

    final int width = 250;
    data.widthHint = width;
    pathField.setLayoutData(data);
    pathField.setFont(parent.getFont());
    pathField.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            boolean validatePage = validatePage();
            setPageComplete(validatePage);
          }
        });
    Button modelButton = new Button(projectGroup, SWT.PUSH);
    modelButton.setText("Search"); // $NON-NLS-1$
    modelButton.addSelectionListener(
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent e) {
            /*
             * Empty by default
             */
          }

          public void widgetSelected(SelectionEvent e) {
            handleBrowseModelTargetButton();
          }
        });
    this.validatePage();

    this.setControl(composite);
  }
  public static Text createLabelTextPair(Composite parent, String labelText) {
    Font font = parent.getFont();

    Label label = new Label(parent, SWT.NONE);
    label.setText(labelText);
    label.setFont(font);

    Text text = new Text(parent, SWT.BORDER | SWT.SINGLE);
    text.setText("");
    text.setFont(font);

    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    text.setLayoutData(gd);

    return text;
  }
Beispiel #27
0
 private void setText() {
   text.setBackground(UI.WHITE);
   text.setFont(UI.MONO);
   text.setEditable(false);
   text.addListener(
       SWT.Modify,
       new Listener() {
         @Override
         public void handleEvent(Event event) {
           String textInput = text.getText();
           if (textInput.contains("(") && textInput.contains(")")) {
             text.setForeground(UI.RED);
           }
         }
       });
 }
Beispiel #28
0
  @Override
  protected Label createMessageArea(Composite composite) {
    Label label = super.createMessageArea(composite);

    // ok, after the label, we have to create the edit so that the user can filter the results
    text = new Text(composite, SWT.BORDER);
    text.setFont(composite.getFont());
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = convertWidthInCharsToPixels(fWidth);
    text.setLayoutData(data);

    Listener listener =
        new Listener() {
          public void handleEvent(Event e) {
            if (updateInThread) {
              if (updateJob != null) {
                updateJob.cancel(); // cancel it if it was already in progress
              }
              updateJob = new UpdateJob();
              updateJob.start();
            } else {
              doFilterUpdate(new NullProgressMonitor());
            }
          }
        };
    text.addListener(SWT.Modify, listener);

    text.addKeyListener(
        new KeyListener() {
          public void keyPressed(KeyEvent e) {
            if (e.keyCode == SWT.ARROW_DOWN) {
              Tree tree = getTreeViewer().getTree();
              tree.setFocus();
              updateSelectionIfNothingSelected(tree);
            }
          }

          public void keyReleased(KeyEvent e) {}
        });

    return label;
  }
Beispiel #29
0
  /**
   * Creates or returns the created text control.
   *
   * @param parent The parent composite or <code>null</code> when the widget has already been
   *     created.
   */
  public Text getTextControl(Composite parent) {
    if (fTextControl == null) {
      assertCompositeNotNull(parent);
      fModifyListener =
          new ModifyListener() {
            public void modifyText(ModifyEvent e) {
              doModifyText(e);
            }
          };

      fTextControl =
          new Text(parent, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL);
      // moved up due to 1GEUNW2
      fTextControl.setText(fText);
      fTextControl.setFont(parent.getFont());
      fTextControl.addModifyListener(fModifyListener);

      fTextControl.setEnabled(isEnabled());
    }
    return fTextControl;
  }
  private void createFileNameFields(Composite parent) {
    Font font = parent.getFont();
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(3, false);
    composite.setFont(font);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Label file_label = new Label(composite, SWT.WRAP);
    file_label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
    file_label.setFont(font);
    file_label.setText("File name:");

    file_text = new Text(composite, SWT.SINGLE | SWT.BORDER);
    file_text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    file_text.setFont(font);
    file_text.setEditable(enable_editing);

    file_text.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            updateButtons();
          }
        });

    Button button = new Button(composite, SWT.PUSH);
    button.setFont(font);
    button.setText("...");
    button.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
    button.setEnabled(enable_editing);
    button.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            FileDialog file_dialog = new FileDialog(getShell(), SWT.NONE);
            file_dialog.setFileName(file_text.getText());
            String path = file_dialog.open();
            if (path != null) file_text.setText(path);
          }
        });
  }