Java 类org.eclipse.ui.forms.IFormColors 实例源码

项目:eclox    文件:Part.java   
/**
 * Adds the given editor instance to the part, with the given label.
 *
 * The editor life-cycle will get managed by the part.
 *
 * @param   text    a string containing a label text
 * @param   editor  an editor instance
 * @param   indent  an extra margin that will be added to the left side of the editor's cell
 */
protected void addEditor(String text, IEditor editor, int indent) {
    // Creates the controls
    Label label = toolkit.createLabel(content, text);
    Composite container = toolkit.createComposite(content);
    GridData labelData = new GridData(SWT.FILL, SWT.CENTER, false, false);
    GridData containerData = new GridData(SWT.FILL, SWT.FILL, true, false);

    labelData.verticalIndent = spacer;
    labelData.horizontalIndent = indent;
    labelData.grabExcessVerticalSpace = editor.grabVerticalSpace();
    containerData.verticalIndent = spacer;
    containerData.grabExcessVerticalSpace = editor.grabVerticalSpace();
    label.setLayoutData(labelData);
    label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
    container.setLayoutData(containerData);
    editor.createContent(container, toolkit);
    spacer = 0;

    // Registers the editor
    editors.add(editor);
}
项目:git-appraise-eclipse    文件:AppraiseDiffViewerPart.java   
/**
 * Creates an individual diff viewer in the given composite.
 */
private void createDiffViewer(final FormToolkit toolkit, Composite composite,
    final TaskAttribute diffTaskAttribute) {

  int style = ExpandableComposite.TREE_NODE | ExpandableComposite.LEFT_TEXT_CLIENT_ALIGNMENT
      | ExpandableComposite.COMPACT;
  ExpandableComposite diffComposite = toolkit.createExpandableComposite(composite, style);
  diffComposite.clientVerticalSpacing = 0;
  diffComposite.setLayout(new GridLayout());
  diffComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  diffComposite.setTitleBarForeground(toolkit.getColors().getColor(IFormColors.TITLE));
  diffComposite.setText(calculateDiffChangeHeader(diffTaskAttribute));

  final Composite diffViewerComposite = toolkit.createComposite(diffComposite);
  diffComposite.setClient(diffViewerComposite);
  diffViewerComposite.setLayout(
      new FillWidthLayout(EditorUtil.getLayoutAdvisor(getTaskEditorPage()), 15, 0, 0, 3));

  diffComposite.addExpansionListener(new ExpansionAdapter() {
    @Override
    public void expansionStateChanged(ExpansionEvent event) {
      expandCollapseDiff(toolkit, diffViewerComposite, diffTaskAttribute, event.getState());
    }
  });
  GridDataFactory.fillDefaults().grab(true, false).applyTo(diffComposite);
}
项目:PDFReporter-Studio    文件:TabbedPropertySearch.java   
/**
 * @param e
 */
protected void drawTitleBackground(PaintEvent e) {
    if (factory.getColors() == null) return;
    Rectangle bounds = getClientArea();
    Color bg = factory.getColors().getColor(IFormColors.H_GRADIENT_END);
    Color gbg = factory.getColors().getColor(IFormColors.H_GRADIENT_START);
    GC gc = e.gc;
    gc.setForeground(bg);
    gc.setBackground(gbg);
    gc.fillGradientRectangle(bounds.x, bounds.y, bounds.width,
            bounds.height, true);
    // background bottom separator
    gc.setForeground(factory.getColors().getColor(
            IFormColors.H_BOTTOM_KEYLINE1));
    gc.drawLine(bounds.x, bounds.height - 2, bounds.x + bounds.width - 1,
            bounds.height - 2);
    gc.setForeground(factory.getColors().getColor(
            IFormColors.H_BOTTOM_KEYLINE2));
    gc.drawLine(bounds.x, bounds.height - 1, bounds.x + bounds.width - 1,
            bounds.height - 1);
}
项目:PDFReporter-Studio    文件:TabbedPropertyTitle.java   
/**
 * @param e
 */
protected void drawTitleBackground(PaintEvent e) {
    if (factory.getColors() == null) return;
    Rectangle bounds = getClientArea();
    label.setBackground(new Color[] {
            factory.getColors().getColor(IFormColors.H_GRADIENT_END),
            factory.getColors().getColor(IFormColors.H_GRADIENT_START) },
            new int[] { 100 }, true);
    Color bg = factory.getColors().getColor(IFormColors.H_GRADIENT_END);
    Color gbg = factory.getColors().getColor(IFormColors.H_GRADIENT_START);
    GC gc = e.gc;
    gc.setForeground(bg);
    gc.setBackground(gbg);
    gc.fillGradientRectangle(bounds.x, bounds.y, bounds.width,
            bounds.height, true);
    // background bottom separator
    gc.setForeground(factory.getColors().getColor(
            IFormColors.H_BOTTOM_KEYLINE1));
    gc.drawLine(bounds.x, bounds.height - 2, bounds.x + bounds.width - 1,
            bounds.height - 2);
    gc.setForeground(factory.getColors().getColor(
            IFormColors.H_BOTTOM_KEYLINE2));
    gc.drawLine(bounds.x, bounds.height - 1, bounds.x + bounds.width - 1,
            bounds.height - 1);
}
项目:EASyProducer    文件:AbstractEASyEditorPage.java   
/**
 * Sole constructor for this class.
 * @param plp The {@link ProductLineProject} edited in this editor page.
 * @param title The title for this editor page.
 * @param parent The parent, holding this editor page.
 */
public AbstractEASyEditorPage(ProductLineProject plp, String title, Composite parent) {
    super(parent, SWT.BORDER);
    this.plp = plp;
    setLayout(new FillLayout());
    pageListeners = new ArrayList<IEASyPageListener>();
    toolkit = new FormToolkit(getDisplay()); // display is assumed to be valid!
    contentPane = toolkit.createScrolledForm(this);
    GridLayout layout = new GridLayout();
    contentPane.getBody().setLayout(layout);

    //Set Title contentPane.setText(text) will cause that scrollbars won't work correctly.
    FormText titleText = toolkit.createFormText(contentPane.getBody(), false);
    String htmlTitle = "<form><p><span color=\"header\" font=\"header\">" + title + ": " + plp.getProjectName()
        + "</span></p></form>";
    titleText.setWhitespaceNormalized(true);
    titleText.setFont("header", JFaceResources.getHeaderFont());
    titleText.setColor("header", toolkit.getColors().getColor(IFormColors.TITLE));
    titleText.setText(htmlTitle, true, false);
}
项目:mondo-integration    文件:FormComboBoxField.java   
public FormComboBoxField(FormToolkit toolkit, Composite sectionClient, String labelText, String[] options) {
    label = toolkit.createLabel(sectionClient, labelText, SWT.WRAP);
    label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));

    final TableWrapData layoutData = new TableWrapData();
    layoutData.valign = TableWrapData.MIDDLE;
    label.setLayoutData(layoutData);

    combobox = new Combo(sectionClient, SWT.READ_ONLY);
    combobox.setItems(options);
    combobox.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
}
项目:mondo-integration    文件:FormCheckBoxField.java   
public FormCheckBoxField(FormToolkit toolkit, Composite sectionClient, String labelText, boolean defaultValue) {
    label = toolkit.createLabel(sectionClient, labelText, SWT.WRAP);
    label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));

    final TableWrapData layoutData = new TableWrapData();
    layoutData.valign = TableWrapData.MIDDLE;
    label.setLayoutData(layoutData);

    checkbox = toolkit.createButton(sectionClient, "", SWT.CHECK);
    checkbox.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
    checkbox.setSelection(defaultValue);
}
项目:mondo-integration    文件:FormTextField.java   
public FormTextField(FormToolkit toolkit, Composite sectionClient, String labelText, String defaultValue, int textStyle) {
    label = toolkit.createFormText(sectionClient, true);
    label.setText("<form><p>" + labelText + "</p></form>", true, false);
    label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));

    final TableWrapData layoutData = new TableWrapData();
    layoutData.valign = TableWrapData.MIDDLE;
    label.setLayoutData(layoutData);

    text = toolkit.createText(sectionClient, defaultValue, textStyle|SWT.WRAP);
    text.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
}
项目:git-appraise-eclipse    文件:AppraiseDiffViewerPart.java   
@Override
public void createControl(Composite parent, final FormToolkit toolkit) {
  final List<TaskAttribute> diffTaskAttributes = getDiffTaskAttributes();

  if (diffTaskAttributes == null || diffTaskAttributes.isEmpty()) {
    return;
  }
  int style = ExpandableComposite.TWISTIE | ExpandableComposite.SHORT_TITLE_BAR;
  final Section groupSection = toolkit.createSection(parent, style);
  groupSection.setText("Changes (" + diffTaskAttributes.size() + ')');
  groupSection.clientVerticalSpacing = 0;
  groupSection.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));

  if (groupSection.isExpanded()) {
    addDiffViewersToSection(toolkit, diffTaskAttributes, groupSection);
  } else {
    groupSection.addExpansionListener(new ExpansionAdapter() {
      @Override
      public void expansionStateChanged(ExpansionEvent e) {
        if (groupSection.getClient() == null) {
          try {
            getTaskEditorPage().setReflow(false);
            addDiffViewersToSection(toolkit, diffTaskAttributes, groupSection);
          } finally {
            getTaskEditorPage().setReflow(true);
          }
          getTaskEditorPage().reflow();
        }
      }
    });
  }
}
项目:mondo-hawk    文件:FormComboBoxField.java   
public FormComboBoxField(FormToolkit toolkit, Composite sectionClient, String labelText, String[] options) {
    label = toolkit.createLabel(sectionClient, labelText, SWT.WRAP);
    label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));

    final TableWrapData layoutData = new TableWrapData();
    layoutData.valign = TableWrapData.MIDDLE;
    label.setLayoutData(layoutData);

    combobox = new Combo(sectionClient, SWT.READ_ONLY);
    combobox.setItems(options);
    combobox.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
}
项目:mondo-hawk    文件:FormCheckBoxField.java   
public FormCheckBoxField(FormToolkit toolkit, Composite sectionClient, String labelText, boolean defaultValue) {
    label = toolkit.createLabel(sectionClient, labelText, SWT.WRAP);
    label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));

    final TableWrapData layoutData = new TableWrapData();
    layoutData.valign = TableWrapData.MIDDLE;
    label.setLayoutData(layoutData);

    checkbox = toolkit.createButton(sectionClient, "", SWT.CHECK);
    checkbox.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
    checkbox.setSelection(defaultValue);
}
项目:mondo-hawk    文件:FormTextField.java   
public FormTextField(FormToolkit toolkit, Composite sectionClient, String labelText, String defaultValue, int textStyle) {
    label = toolkit.createFormText(sectionClient, true);
    label.setText("<form><p>" + labelText + "</p></form>", true, false);
    label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));

    final TableWrapData layoutData = new TableWrapData();
    layoutData.valign = TableWrapData.MIDDLE;
    label.setLayoutData(layoutData);

    text = toolkit.createText(sectionClient, defaultValue, textStyle|SWT.WRAP);
    text.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
}
项目:mondo-collab-framework    文件:FormComboBoxField.java   
public FormComboBoxField(FormToolkit toolkit, Composite sectionClient, String labelText, String[] options) {
    label = toolkit.createLabel(sectionClient, labelText, SWT.WRAP);
    label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));

    final TableWrapData layoutData = new TableWrapData();
    layoutData.valign = TableWrapData.MIDDLE;
    label.setLayoutData(layoutData);

    combobox = new Combo(sectionClient, SWT.READ_ONLY);
    combobox.setItems(options);
    combobox.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
}
项目:mondo-collab-framework    文件:FormCheckBoxField.java   
public FormCheckBoxField(FormToolkit toolkit, Composite sectionClient, String labelText, boolean defaultValue) {
    label = toolkit.createLabel(sectionClient, labelText, SWT.WRAP);
    label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));

    final TableWrapData layoutData = new TableWrapData();
    layoutData.valign = TableWrapData.MIDDLE;
    label.setLayoutData(layoutData);

    checkbox = toolkit.createButton(sectionClient, "", SWT.CHECK);
    checkbox.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
    checkbox.setSelection(defaultValue);
}
项目:mondo-collab-framework    文件:FormTextField.java   
public FormTextField(FormToolkit toolkit, Composite sectionClient, String labelText, String defaultValue, int textStyle) {
    label = toolkit.createFormText(sectionClient, true);
    label.setText("<form><p>" + labelText + "</p></form>", true, false);
    label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));

    final TableWrapData layoutData = new TableWrapData();
    layoutData.valign = TableWrapData.MIDDLE;
    label.setLayoutData(layoutData);

    text = toolkit.createText(sectionClient, defaultValue, textStyle|SWT.WRAP);
    text.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
}
项目:cft    文件:ApplicationDetailsPart.java   
private Label createLabel(Composite parent, String value, int verticalAlign) {
    Label label = toolkit.createLabel(parent, value);
    GridDataFactory.fillDefaults().align(SWT.FILL, verticalAlign).applyTo(label);
    label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
    return label;
}
项目:dockerfoundry    文件:ApplicationDetailsPart.java   
private Label createLabel(Composite parent, String value, int verticalAlign) {
    Label label = toolkit.createLabel(parent, value);
    GridDataFactory.fillDefaults().align(SWT.FILL, verticalAlign).applyTo(label);
    label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
    return label;
}
项目:SecureBPMN    文件:FormToolTip.java   
protected Composite createToolTipContentArea(Event event, Composite parent) {

        FormToolkit toolkit = new FormToolkit(parent.getDisplay());
        FormColors colors = toolkit.getColors();
        Color top = colors.getColor(IFormColors.H_GRADIENT_END);
        Color bot = colors.getColor(IFormColors.H_GRADIENT_START);

        // create the base form
        Form form = toolkit.createForm(parent);
        form.setText(title);
        form.setTextBackground(new Color[] { top, bot }, new int[] { 100 }, true);
        FormLayout layout = new FormLayout();
        layout.marginTop = 10;
        layout.marginBottom = 10;
        layout.marginLeft = 10;
        layout.marginRight = 10;
        form.getBody().setLayout(layout);

        // Scrolled text
        ScrolledFormText scrolledFormText = new ScrolledFormText(form.getBody(), true);
        FormText text = toolkit.createFormText(scrolledFormText, true);

        scrolledFormText.setAlwaysShowScrollBars(false);

        StringBuilder builder = new StringBuilder();
        for (final String currentText : texts) {
            builder.append("<p>").append(currentText).append("</p>");
        }

        text.setText(String.format("<form>%s</form>", builder.toString()), true, false);

        FormData data = new FormData();
        data.left = new FormAttachment(0, 0);
        data.right = new FormAttachment(100);
        scrolledFormText.setLayoutData(data);

        scrolledFormText.setFormText(text);
        scrolledFormText.setBackground(ColorConstants.white);

        return parent;
    }
项目:PDFReporter-Studio    文件:TabbedPropertyTitle.java   
/**
 * Constructor for TabbedPropertyTitle.
 * 
 * @param parent
 *            the parent composite.
 * @param factory
 *            the widget factory for the tabbed property sheet
 */
public TabbedPropertyTitle(Composite parent,
        TabbedPropertySheetWidgetFactory factory) {
    super(parent, SWT.NO_FOCUS);
    this.factory = factory;

    this.addPaintListener(new PaintListener() {

        public void paintControl(PaintEvent e) {
            if (image == null && (text == null || text.equals(BLANK))) {
                label.setVisible(false);
            } else {
                label.setVisible(true);
                drawTitleBackground(e);
            }
        }
    });

    factory.getColors().initializeSectionToolBarColors();
    setBackground(factory.getColors().getBackground());
    setForeground(factory.getColors().getForeground());

    FormLayout layout = new FormLayout();
    layout.marginWidth = 1;
    layout.marginHeight = 0;
    setLayout(layout);

    Font font;
    if (! JFaceResources.getFontRegistry().hasValueFor(TITLE_FONT)) {
        FontData[] fontData = JFaceResources.getFontRegistry().getBold(
                JFaceResources.DEFAULT_FONT).getFontData();
        /* title font is 2pt larger than that used in the tabs. */  
        fontData[0].setHeight(fontData[0].getHeight() + 2);
        JFaceResources.getFontRegistry().put(TITLE_FONT, fontData);
    }
    font = JFaceResources.getFont(TITLE_FONT);

    label = factory.createCLabel(this, BLANK);
    label.setBackground(new Color[] {
            factory.getColors().getColor(IFormColors.H_GRADIENT_END),
            factory.getColors().getColor(IFormColors.H_GRADIENT_START) },
            new int[] { 100 }, true);
    label.setFont(font);
    label.setForeground(factory.getColors().getColor(IFormColors.TITLE));
    FormData data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.top = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.bottom = new FormAttachment(100, 0);
    label.setLayoutData(data);

    /*
     * setImage(PlatformUI.getWorkbench().getSharedImages().getImage(
     * ISharedImages.IMG_OBJ_ELEMENT));
     */
}
项目:ChangeScribe    文件:DescribeVersionsDialog.java   
private Composite createMessageAndPersonArea(Composite container) {

        messageAndPersonArea = toolkit.createComposite(container);
        GridDataFactory.fillDefaults().grab(true, true)
                .applyTo(messageAndPersonArea);
        GridLayoutFactory.swtDefaults().margins(0, 0).spacing(0, 0)
                .applyTo(messageAndPersonArea);

        Section messageSection = toolkit.createSection(messageAndPersonArea, 
                ExpandableComposite.TITLE_BAR | ExpandableComposite.CLIENT_INDENT);
        messageSection.setText(Messages.FilesChangedListDialog_CommitMessage);
        Composite messageArea = toolkit.createComposite(messageSection);
        GridLayoutFactory.fillDefaults().spacing(0, 0).extendedMargins(2, 2, 2, 2).applyTo(messageArea);
        toolkit.paintBordersFor(messageArea);
        GridDataFactory.fillDefaults().grab(true, true).applyTo(messageSection);
        GridLayoutFactory.swtDefaults().applyTo(messageSection);

        Composite headerArea = new Composite(messageSection, SWT.NONE);
        GridLayoutFactory.fillDefaults().spacing(0, 0).numColumns(2).applyTo(headerArea);

        ToolBar messageToolbar = new ToolBar(headerArea, SWT.FLAT | SWT.HORIZONTAL);
        GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).grab(true, false).applyTo(messageToolbar);
        addMessageDropDown(headerArea);

        messageSection.setTextClient(headerArea);

        Composite personArea = toolkit.createComposite(messageAndPersonArea);
        toolkit.paintBordersFor(personArea);
        GridLayoutFactory.swtDefaults().numColumns(2).applyTo(personArea);
        GridDataFactory.fillDefaults().grab(true, false).applyTo(personArea);

        toolkit.createLabel(personArea, Messages.DescribeVersionsDialog_OlderCommitId).setForeground(toolkit.getColors().getColor(IFormColors.TB_TOGGLE));
        setOlderVersionText(toolkit.createText(personArea, null));
        getOlderVersionText().setText(commitPreviousID);
        getOlderVersionText().setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
        getOlderVersionText().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());

        toolkit.createLabel(personArea, Messages.DescribeVersionsDialog_NewerCommitId).setForeground(toolkit.getColors().getColor(IFormColors.TB_TOGGLE));
        setNewerVersionText(toolkit.createText(personArea, null));
        getNewerVersionText().setText(commitCurrentID);
        getNewerVersionText().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());

        Point size = createJavaSourceCodeViewer(container, messageSection,
                messageArea);

        createSignatureCanvas(size);

        return messageAndPersonArea;
    }
项目:ChangeScribe    文件:GenerateMessagePage.java   
private Composite createMessageAndPersonArea(Composite container) {
    messageAndPersonArea = toolkit.createComposite(container);
    GridDataFactory.fillDefaults().grab(true, true)
            .applyTo(messageAndPersonArea);
    GridLayoutFactory.swtDefaults().margins(0, 0).spacing(0, 0)
            .applyTo(messageAndPersonArea);

    Section messageSection = toolkit.createSection(messageAndPersonArea, 
            ExpandableComposite.TITLE_BAR | ExpandableComposite.CLIENT_INDENT);
    messageSection.setText(Messages.FilesChangedListDialog_CommitMessage);
    Composite messageArea = toolkit.createComposite(messageSection);
    GridLayoutFactory.fillDefaults().spacing(0, 0).extendedMargins(2, 2, 2, 2).applyTo(messageArea);
    toolkit.paintBordersFor(messageArea);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(messageSection);
    GridLayoutFactory.swtDefaults().applyTo(messageSection);

    Composite headerArea = new Composite(messageSection, SWT.NONE);
    GridLayoutFactory.fillDefaults().spacing(0, 0).numColumns(2).applyTo(headerArea);

    ToolBar messageToolbar = new ToolBar(headerArea, SWT.FLAT | SWT.HORIZONTAL);
    GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).grab(true, false).applyTo(messageToolbar);
    addMessageDropDown(headerArea);

    messageSection.setTextClient(headerArea);

    Composite personArea = toolkit.createComposite(messageAndPersonArea);
    toolkit.paintBordersFor(personArea);
    GridLayoutFactory.swtDefaults().numColumns(2).applyTo(personArea);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(personArea);

    toolkit.createLabel(personArea, Messages.DescribeVersionsDialog_OlderCommitId).setForeground(toolkit.getColors().getColor(IFormColors.TB_TOGGLE));
    setOlderVersionText(toolkit.createText(personArea, null));
    getOlderVersionText().setText(commitPreviousID);
    getOlderVersionText().setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
    getOlderVersionText().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());

    toolkit.createLabel(personArea, Messages.DescribeVersionsDialog_NewerCommitId).setForeground(toolkit.getColors().getColor(IFormColors.TB_TOGGLE));
    setNewerVersionText(toolkit.createText(personArea, null));
    getNewerVersionText().setText(commitCurrentID);
    getNewerVersionText().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());

    Point size = createJavaSourceCodeViewer(container, messageSection,
            messageArea);

    createSignatureCanvas(size);

    return messageAndPersonArea;
}