private void createFileContentsGroup(Composite parent) {
    Group theGroup =
        WidgetFactory.createGroup(
            parent, getString("fileContentsGroup"), SWT.NONE, 1, 4); // $NON-NLS-1$
    GridData groupGD = new GridData(GridData.FILL_BOTH);
    groupGD.heightHint = GROUP_HEIGHT_190;
    groupGD.widthHint = 400;
    theGroup.setLayoutData(groupGD);

    this.fileContentsViewer = new ListViewer(theGroup, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    GridData data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 4;
    this.fileContentsViewer.getControl().setFont(JFaceResources.getTextFont());
    this.fileContentsViewer.getControl().setLayoutData(data);

    if (this.dataFileInfo != null) {
      for (String row : this.dataFileInfo.getCachedFirstLines()) {
        if (row != null) {
          this.fileContentsViewer.add(row);
        }
      }
    }

    // Add a Context Menu
    final MenuManager columnMenuManager = new MenuManager();
    this.fileContentsViewer.getControl().setMenu(columnMenuManager.createContextMenu(parent));
  }
  @Test
  public void testFont() {
    ConsoleInformationControlCreator creator = new ConsoleInformationControlCreator(FIXED);
    creator.createInformationControl(parentShell);

    assertThat(getStyledText().getFont()).isSameAs(JFaceResources.getTextFont());
  }
 @Override
 public Font getToolTipFont(final Object element) {
   if (element instanceof RemoteR) {
     return JFaceResources.getTextFont();
   }
   return null;
 }
Ejemplo n.º 4
0
  /*
   * (non-Javadoc)
   * @see org.eclipse.jface.viewers.IFontProvider#getFont(java.lang.Object)
   */
  public Font getFont(Object element) {
    Font font = JFaceResources.getFont(IThemeManager.VIEW_FONT_NAME);

    if (font == null) {
      font = JFaceResources.getTextFont();
    }

    return font;
  }
Ejemplo n.º 5
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(),);
    }
Ejemplo n.º 6
0
/** @author Roberto E. Escobar */
public class ODMConstants {

  public static final int TOTAL_STEPS = Integer.MAX_VALUE;
  public static final int SHORT_TASK_STEPS = TOTAL_STEPS / 50;
  public static final int VERY_LONG_TASK = TOTAL_STEPS / 2;
  public static final int TASK_STEPS = (TOTAL_STEPS - SHORT_TASK_STEPS * 3 - VERY_LONG_TASK) / 2;

  public static final Font HEADER_FONT = JFaceResources.getTextFont();

  public static String getDataTypeText(DataType dataType) {
    return dataType.getName();
  }
}
Ejemplo n.º 7
0
 public ConversionReportView(Composite parent, final TopLevelEditor editor) {
   FormToolkit toolkit = new FormToolkit(parent.getDisplay());
   message = toolkit.createFormText(parent, true);
   message.setFont("code", JFaceResources.getTextFont());
   message.setColor("light", parent.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
   message.addHyperlinkListener(
       new HyperlinkAdapter() {
         @Override
         public void linkActivated(HyperlinkEvent e) {
           if (e.getHref().toString().equals(ConversionReport.HREF_CONFIRM)) {
             editor.confirmConversionReport();
           }
         }
       });
 }
Ejemplo n.º 8
0
  public static void initFormText(FormText formText) {

    formText.setWhitespaceNormalized(false);

    Font formTextFont = formText.getFont();
    FontData formTextFontData = formTextFont.getFontData()[0];

    FontData h1FontData =
        new FontData(formTextFontData.getName(), formTextFontData.getHeight() + 5, SWT.BOLD);
    final Font h1Font = new Font(formTextFont.getDevice(), h1FontData);
    formText.setFont(FONT_H1_KEY, h1Font);

    FontData h3FontData =
        new FontData(formTextFontData.getName(), formTextFontData.getHeight() + 3, SWT.BOLD);
    final Font h3Font = new Font(formTextFont.getDevice(), h3FontData);
    formText.setFont(FONT_H3_KEY, h3Font);

    Font codeFont = JFaceResources.getTextFont();
    formText.setFont(FONT_CODE_KEY, codeFont);

    formText.addDisposeListener(
        new DisposeListener() {

          @Override
          public void widgetDisposed(DisposeEvent e) {
            h1Font.dispose();
            h3Font.dispose();
          }
        });

    // Set fontKeySet = JFaceResources.getFontRegistry().getKeySet();
    // if (fontKeySet != null) {
    // for (Object fontKey : fontKeySet) {
    // System.out.println(fontKey);
    // }
    // }

  }
Ejemplo n.º 9
0
 @Override
 public void createPartControl(Composite parent) {
   text = new Text(parent, SWT.NONE | SWT.H_SCROLL | SWT.V_SCROLL);
   text.setEditable(false);
   text.setFont(JFaceResources.getTextFont());
 }
  @Override
  public void createControl(Composite parent) {
    GridData gd;

    Composite composite = new Composite(parent, SWT.NULL);
    setControl(composite);

    composite.setLayout(new GridLayout(1, false));

    new Label(composite, SWT.NONE).setText("Select Template:");

    tree = new Tree(composite, SWT.BORDER | SWT.FULL_SELECTION);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.heightHint = 100;
    tree.setLayoutData(gd);

    viewer = new TreeViewer(tree);
    contentProvider = new RepoTemplateContentProvider(false);
    viewer.setContentProvider(contentProvider);
    viewer.setLabelProvider(new RepoTemplateLabelProvider(loadedImages));
    viewer.addFilter(latestFilter);
    setTemplates(Collections.singletonList(emptyTemplate));

    btnLatestOnly = new Button(composite, SWT.CHECK);
    btnLatestOnly.setText("Show latest versions only");
    btnLatestOnly.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));
    btnLatestOnly.setSelection(true);

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

    Composite cmpDescription = new Composite(composite, SWT.BORDER);
    cmpDescription.setBackground(tree.getBackground());

    txtDescription = new ScrolledFormText(cmpDescription, SWT.V_SCROLL | SWT.H_SCROLL, false);
    FormText formText = new FormText(txtDescription, SWT.NO_FOCUS);
    txtDescription.setFormText(formText);
    txtDescription.setBackground(tree.getBackground());
    formText.setBackground(tree.getBackground());
    formText.setForeground(tree.getForeground());
    formText.setFont("fixed", JFaceResources.getTextFont());
    formText.setFont("italic", JFaceResources.getFontRegistry().getItalic(""));

    GridData gd_cmpDescription = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd_cmpDescription.heightHint = 100;
    cmpDescription.setLayoutData(gd_cmpDescription);

    GridLayout layout_cmpDescription = new GridLayout(1, false);
    cmpDescription.setLayout(layout_cmpDescription);

    GridData gd_txtDescription = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gd_txtDescription.heightHint = 100;
    txtDescription.setLayoutData(gd_txtDescription);

    Hyperlink linkRetina = new Hyperlink(composite, SWT.NONE);
    linkRetina.setText("Why is this text blurred?");
    linkRetina.setUnderlined(true);
    linkRetina.setForeground(JFaceColors.getHyperlinkText(getShell().getDisplay()));
    linkRetina.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));

    viewer.addSelectionChangedListener(
        new ISelectionChangedListener() {
          @Override
          public void selectionChanged(SelectionChangedEvent event) {
            Object element = ((IStructuredSelection) viewer.getSelection()).getFirstElement();
            setTemplate(element instanceof Template ? (Template) element : null);
            getContainer().updateButtons();
          }
        });
    viewer.addOpenListener(
        new IOpenListener() {
          @Override
          public void open(OpenEvent event) {
            Object element = ((IStructuredSelection) viewer.getSelection()).getFirstElement();
            setTemplate(element instanceof Template ? (Template) element : null);
            getContainer().updateButtons();
            IWizardPage nextPage = getNextPage();
            if (nextPage != null) getContainer().showPage(nextPage);
          }
        });
    btnLatestOnly.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            boolean latestOnly = btnLatestOnly.getSelection();
            if (latestOnly) viewer.addFilter(latestFilter);
            else viewer.removeFilter(latestFilter);
          }
        });
    linkRetina.addHyperlinkListener(
        new HyperlinkAdapter() {
          @Override
          public void linkActivated(HyperlinkEvent ev) {
            try {
              IWorkbenchBrowserSupport browser = PlatformUI.getWorkbench().getBrowserSupport();
              browser
                  .getExternalBrowser()
                  .openURL(
                      new URL(
                          "https://github.com/bndtools/bndtools/wiki/Blurry-Form-Text-on-High-Resolution-Displays"));
            } catch (Exception e) {
              log.log(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Browser open error", e));
            }
          }
        });
  }
Ejemplo n.º 11
0
  @Override
  protected void createBundleContent(Composite parent) {

    mform = new ManagedForm(parent);
    setManagedForm(mform);
    sform = mform.getForm();
    FormToolkit toolkit = mform.getToolkit();
    sform.setText("Server Console");
    sform.setImage(ServerUICore.getLabelProvider().getImage(getServer()));
    sform.setExpandHorizontal(true);
    sform.setExpandVertical(true);
    toolkit.decorateFormHeading(sform.getForm());

    Composite body = sform.getBody();
    GridLayout layout = new GridLayout(1, false);
    layout.marginLeft = 6;
    layout.marginTop = 6;
    layout.marginRight = 6;
    body.setLayout(layout);

    Section manifestSection =
        toolkit.createSection(sform.getBody(), ExpandableComposite.TITLE_BAR | Section.DESCRIPTION);
    manifestSection.setText("Commands");
    manifestSection.setDescription("Execute commands on server.");
    layout = new GridLayout();
    manifestSection.setLayout(layout);
    manifestSection.setLayoutData(new GridData(GridData.FILL_BOTH));

    Composite manifestComposite = toolkit.createComposite(manifestSection);
    layout = new GridLayout();
    layout.marginLeft = 6;
    layout.marginTop = 6;
    layout.numColumns = 3;
    manifestComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    manifestComposite.setLayout(layout);
    manifestSection.setClient(manifestComposite);

    Label commandLabel = toolkit.createLabel(manifestComposite, "Command:");
    commandLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
    GridDataFactory.fillDefaults().grab(true, false).span(3, 1).applyTo(commandLabel);
    commandText = toolkit.createText(manifestComposite, "", SWT.CANCEL | SWT.SEARCH);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(commandText);

    commandText.addKeyListener(
        new KeyAdapter() {
          @Override
          public void keyPressed(KeyEvent e) {
            if (e.character == SWT.CR || e.character == SWT.LF) {
              history.add(commandText.getText());
              String cmdLine = commandText.getText();
              executeCommand(cmdLine);
            } else if (e.keyCode == SWT.ARROW_UP) {
              String command = history.back();
              commandText.setText(command);
              commandText.setSelection(command.length());
              e.doit = false;
            } else if (e.keyCode == SWT.ARROW_DOWN) {
              String command = history.forward();
              commandText.setText(command);
              commandText.setSelection(command.length());
              e.doit = false;
            }
          }
        });

    Button commandButton = toolkit.createButton(manifestComposite, "Execute", SWT.PUSH);
    commandButton.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            history.add(commandText.getText());
            String cmdLine = commandText.getText();
            executeCommand(cmdLine);
          }
        });
    Button clearButton = toolkit.createButton(manifestComposite, "Clear", SWT.PUSH);
    clearButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            manifestText.setText("");
          }
        });

    manifestText =
        new StyledText(manifestComposite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    manifestText.setWordWrap(false);
    manifestText.setFont(JFaceResources.getTextFont());
    GridData data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 3;
    manifestText.setLayoutData(data);

    Label helpLabel =
        toolkit.createLabel(manifestComposite, "Type 'help' to get a list of supported commands.");
    GridDataFactory.fillDefaults().grab(true, false).span(3, 1).applyTo(helpLabel);

    toolBarManager = sform.getToolBarManager();

    backAction =
        new Action("Back") {
          @Override
          public void run() {
            commandText.setText(history.back());
            String cmdLine = commandText.getText();
            executeCommand(cmdLine);
          }
        };
    backAction.setImageDescriptor(
        ImageResource.getImageDescriptor(
            org.eclipse.ui.internal.browser.ImageResource.IMG_ELCL_NAV_BACKWARD));
    backAction.setHoverImageDescriptor(
        ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_NAV_BACKWARD));
    backAction.setDisabledImageDescriptor(
        ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_NAV_BACKWARD));
    backAction.setEnabled(false);
    toolBarManager.add(backAction);

    forwardAction =
        new Action("Forward") {
          @Override
          public void run() {
            commandText.setText(history.forward());
            String cmdLine = commandText.getText();
            executeCommand(cmdLine);
          }
        };
    forwardAction.setImageDescriptor(
        ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_NAV_FORWARD));
    forwardAction.setHoverImageDescriptor(
        ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_NAV_FORWARD));
    forwardAction.setDisabledImageDescriptor(
        ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_NAV_FORWARD));
    forwardAction.setEnabled(false);
    toolBarManager.add(forwardAction);

    refreshAction =
        new Action(
            "Refresh from server",
            ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_NAV_REFRESH)) {

          @Override
          public void run() {
            String cmdLine = history.current();
            if (cmdLine != null) {
              executeCommand(cmdLine);
            }
          }
        };
    toolBarManager.add(refreshAction);
    sform.updateToolBar();
  }