Example usage for org.eclipse.jface.preference JFacePreferences DECORATIONS_COLOR

List of usage examples for org.eclipse.jface.preference JFacePreferences DECORATIONS_COLOR

Introduction

In this page you can find the example usage for org.eclipse.jface.preference JFacePreferences DECORATIONS_COLOR.

Prototype

String DECORATIONS_COLOR

To view the source code for org.eclipse.jface.preference JFacePreferences DECORATIONS_COLOR.

Click Source Link

Document

Identifier for the color used to show label decorations For example in 'Foo.txt [1.16]', the decoration is '[1.16]'.

Usage

From source file:com.google.dart.tools.search.internal.ui.text.DecoratingFileSearchLabelProvider.java

License:Open Source License

public void propertyChange(PropertyChangeEvent event) {
    String property = event.getProperty();
    if (property.equals(JFacePreferences.QUALIFIER_COLOR) || property.equals(JFacePreferences.COUNTER_COLOR)
            || property.equals(JFacePreferences.DECORATIONS_COLOR) || property.equals(HIGHLIGHT_BG_COLOR_NAME)
            || property.equals(IWorkbenchPreferenceConstants.USE_COLORED_LABELS)) {
        Display.getDefault().asyncExec(new Runnable() {
            public void run() {
                refresh();/*from www.  ja va 2  s  .  c  o m*/
            }
        });
    }
}

From source file:com.google.dart.tools.ui.internal.viewsupport.ColoredViewersManager.java

License:Open Source License

@Override
public void propertyChange(PropertyChangeEvent event) {
    String property = event.getProperty();
    if (property.equals(QUALIFIER_COLOR_NAME) || property.equals(COUNTER_COLOR_NAME)
            || property.equals(DECORATIONS_COLOR_NAME)
            || property.equals(AppearancePreferencePage.PREF_COLORED_LABELS)
            || property.equals(JFacePreferences.QUALIFIER_COLOR)
            || property.equals(JFacePreferences.COUNTER_COLOR)
            || property.equals(JFacePreferences.DECORATIONS_COLOR) || property.equals(HIGHLIGHT_BG_COLOR_NAME)
            || property.equals(HIGHLIGHT_WRITE_BG_COLOR_NAME) || property.equals(INHERITED_COLOR_NAME)
            || property.equals(IWorkbenchPreferenceConstants.USE_COLORED_LABELS)) {
        Display.getDefault().asyncExec(new Runnable() {
            @Override/* ww  w  .ja  v a2 s. co m*/
            public void run() {
                refreshAllViewers();
            }
        });
    }
}

From source file:com.mentor.nucleus.bp.ui.search.providers.DecoratingModelSearchLabelProvider.java

License:Open Source License

@Override
public void propertyChange(PropertyChangeEvent event) {
    String property = event.getProperty();
    if (property.equals(JFacePreferences.QUALIFIER_COLOR) || property.equals(JFacePreferences.COUNTER_COLOR)
            || property.equals(JFacePreferences.DECORATIONS_COLOR) || property.equals(HIGHLIGHT_BG_COLOR_NAME)
            || property.equals(IWorkbenchPreferenceConstants.USE_COLORED_LABELS)) {
        Display.getDefault().asyncExec(new Runnable() {
            public void run() {
                refresh();/*from  w w w  . jav  a  2  s.  c o m*/
            }
        });
    }
}

From source file:com.python.pydev.ui.hierarchy.HierarchyLabelProvider.java

License:Open Source License

public StyledString getStyledText(Object element) {
    if (element instanceof DataAndImageTreeNode) {
        @SuppressWarnings("rawtypes")
        DataAndImageTreeNode treeNode = (DataAndImageTreeNode) element;
        Object data = treeNode.data;
        if (data instanceof HierarchyNodeModel) {
            HierarchyNodeModel model = (HierarchyNodeModel) data;
            String spaces = "     ";
            StyledString styledString = new StyledString(model.name + spaces);
            if (model.moduleName != null && model.moduleName.trim().length() > 0) {
                Styler styler = StyledString.createColorRegistryStyler(JFacePreferences.DECORATIONS_COLOR,
                        null);/*w  ww  .  jav  a  2 s  .c  o m*/
                styledString.append("(" + model.moduleName + ")", styler);
            }
            return styledString;
        }
        return new StyledString(data.toString());
    }
    return new StyledString(element == null ? "" : element.toString());
}

From source file:com.python.pydev.ui.hierarchy.TreeNodeContentProvider.java

License:Open Source License

public StyledString getStyledText(Object element) {
    if (element instanceof TreeNode) {
        @SuppressWarnings("rawtypes")
        TreeNode treeNode = (TreeNode) element;
        Object data = treeNode.data;
        if (data instanceof HierarchyNodeModel) {
            HierarchyNodeModel model = (HierarchyNodeModel) data;
            String spaces = "     ";
            StyledString styledString = new StyledString(model.name + spaces);
            if (model.moduleName != null && model.moduleName.trim().length() > 0) {
                Styler styler = StyledString.createColorRegistryStyler(JFacePreferences.DECORATIONS_COLOR,
                        null);//from  w w  w  . ja v  a2  s .co m
                styledString.append("(" + model.moduleName + ")", styler);
            }
            return styledString;
        }
        return new StyledString(data.toString());
    }
    return new StyledString(element == null ? "" : element.toString());
}

From source file:com.technophobia.substeps.junit.ui.component.ColoredViewersManager.java

License:Open Source License

@Override
public void propertyChange(final PropertyChangeEvent event) {
    final String property = event.getProperty();
    if (property.equals(JFacePreferences.QUALIFIER_COLOR) || property.equals(JFacePreferences.COUNTER_COLOR)
            || property.equals(JFacePreferences.DECORATIONS_COLOR) || property.equals(HIGHLIGHT_BG_COLOR_NAME)
            || property.equals(HIGHLIGHT_WRITE_BG_COLOR_NAME) || property.equals(INHERITED_COLOR_NAME)
            || property.equals(IWorkbenchPreferenceConstants.USE_COLORED_LABELS)) {
        Display.getDefault().asyncExec(new Runnable() {
            @Override/* ww  w .j ava2s.co m*/
            public void run() {
                updateAllViewers();
            }
        });
    }
}

From source file:de.ovgu.featureide.ui.editors.Completion.java

License:Open Source License

@Override
public List<ICompletionProposal> computeCompletionProposals(ContentAssistInvocationContext arg0,
        IProgressMonitor arg1) {/*w  ww . ja  v a  2s .  co m*/

    final IFile file = ((IFileEditorInput) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
            .getActiveEditor().getEditorInput()).getFile();
    final IFeatureProject featureProject = CorePlugin.getFeatureProject(file);
    final ArrayList<ICompletionProposal> list = new ArrayList<ICompletionProposal>();

    if (featureProject == null)
        return list;

    String featureName = featureProject.getFeatureName(file);
    JavaContentAssistInvocationContext context = (JavaContentAssistInvocationContext) arg0;

    String prefix = new String(context.getCoreContext().getToken());

    //      projectStructure = MPLPlugin.getDefault().extendedModules_getStruct(featureProject, featureName);
    //      if (projectStructure == null) {
    //         return list;
    //      }
    //      List<CompletionProposal> l = MPLPlugin.getDefault().extendedModules(projectStructure);
    List<CompletionProposal> l = MPLPlugin.getDefault().extendedModules_getCompl(featureProject, featureName);

    for (CompletionProposal curProp : l) {
        curProp.setReplaceRange(context.getInvocationOffset() - context.getCoreContext().getToken().length,
                context.getInvocationOffset());

        if (curProp.getKind() == CompletionProposal.TYPE_REF) {
            LazyJavaCompletionProposal prsss = new LazyJavaCompletionProposal(curProp, context);

            prsss.setStyledDisplayString(new StyledString(new String(curProp.getCompletion())));
            prsss.setReplacementString(new String(curProp.getCompletion()));
            if (prefix.length() >= 0 && new String(curProp.getCompletion()).startsWith(prefix)) {
                list.add(prsss);
            }
        } else if (curProp.getKind() == CompletionProposal.METHOD_REF) {
            LazyJavaCompletionProposal meth = new LazyJavaCompletionProposal(curProp, context);

            String displayString = new String(curProp.getCompletion());
            displayString = displayString.concat("(");
            int paramNr = Signature.getParameterCount(curProp.getSignature());
            for (int i = 0; i < paramNr; i++) {
                displayString = displayString
                        .concat(Signature.getParameterTypes(curProp.getSignature()) + " arg" + i);
                if (i + 1 < paramNr) {
                    displayString = displayString.concat(", ");
                }
            }
            displayString = displayString.concat(") : ");
            // displayString = displayString.concat(new
            // String(Signature.getReturnType(curProp.getSignature())));

            StyledString methString = new StyledString(displayString);
            Styler styler = StyledString.createColorRegistryStyler(JFacePreferences.DECORATIONS_COLOR,
                    JFacePreferences.CONTENT_ASSIST_BACKGROUND_COLOR);
            // TextStyle style = new
            // TextStyle(JFaceResources.getDefaultFont(),JFaceResources.getResources().createColor(new
            // RGB(10, 10,
            // 10)),JFaceResources.getResources().createColor(new
            // RGB(0,0,0)));
            // styler.applyStyles(style);
            StyledString infoString = new StyledString(
                    new String(" - " + new String(curProp.getName()) + " " + featureName), styler);
            methString.append(infoString);
            meth.setStyledDisplayString(methString);

            meth.setReplacementString(new String(curProp.getCompletion()));

            if (prefix.length() >= 0 && new String(curProp.getCompletion()).startsWith(prefix)) {
                list.add(meth);
            }
        } else if (curProp.getKind() == CompletionProposal.FIELD_REF) {
            LazyJavaCompletionProposal field = new LazyJavaCompletionProposal(curProp, context);
            StyledString fieldString = new StyledString(new String(curProp.getCompletion()));
            Styler styler = StyledString.createColorRegistryStyler(JFacePreferences.DECORATIONS_COLOR,
                    JFacePreferences.CONTENT_ASSIST_BACKGROUND_COLOR);
            StyledString infoString = new StyledString(
                    new String(" - " + new String(curProp.getName()) + " " + featureName), styler);
            fieldString.append(infoString);
            field.setStyledDisplayString(fieldString);

            field.setReplacementString(new String(curProp.getCompletion()));
            if (prefix.length() > 0 && new String(curProp.getCompletion()).startsWith(prefix)) {
                list.add(field);
            }
        }
    }
    return list;
}

From source file:de.walware.statet.r.internal.ui.intable.PresentationConfig.java

License:Open Source License

public PresentationConfig(final Display display) {
    final FontRegistry jFaceFontRegistry = JFaceResources.getFontRegistry();
    final ColorRegistry jFaceColorRegistry = JFaceResources.getColorRegistry();

    fHeaderGridColor = display.getSystemColor(SWT.COLOR_DARK_GRAY);
    fHeaderBackgroundColor = display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
    fHeaderForegroundColor = display.getSystemColor(SWT.COLOR_WIDGET_FOREGROUND);

    fBodyGridColor = display.getSystemColor(SWT.COLOR_GRAY);
    fBodyBackgroundColor = display.getSystemColor(SWT.COLOR_LIST_BACKGROUND);
    fBodyEvenRowBackgroundColor = fBodyBackgroundColor;
    fBodyOddRowBackgroundColor = new Color(display,
            ColorUtil.blend(display.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW).getRGB(),
                    fBodyEvenRowBackgroundColor.getRGB(), 20));

    fBodyForegroundColor = display.getSystemColor(SWT.COLOR_LIST_FOREGROUND);

    fHeaderSelectionBackgroundColor = new Color(display, ColorUtil.blend(
            display.getSystemColor(SWT.COLOR_LIST_SELECTION).getRGB(), fHeaderBackgroundColor.getRGB(), 25));
    fHeaderSelectionForegroundColor = fHeaderForegroundColor;

    fHeaderPlaceholderColor = new Color(display,
            ColorUtil.blend(fBodyGridColor.getRGB(), fHeaderBackgroundColor.getRGB(), 25));

    fHeaderFullSelectionBackgroundColor = new Color(display,
            ColorUtil.blend(display.getSystemColor(SWT.COLOR_LIST_SELECTION).getRGB(),
                    display.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW).getRGB(), 25));
    fHeaderFullSelectionForegroundColor = display.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW);

    fBodySelectionBackgroundColor = display.getSystemColor(SWT.COLOR_LIST_SELECTION);
    fBodySelectionForegroundColor = display.getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT);

    fBodyFreezeSeparatorColor = jFaceColorRegistry.get(JFacePreferences.DECORATIONS_COLOR);

    fHeaderLayerPainter = new GridLineCellLayerPainter(fHeaderGridColor);
    fHeaderLabelLayerPainter = new CornerGridLineCellLayerPainter(fHeaderGridColor);

    fBodyAnchorBorderStyle = new BorderStyle(2, fBodyForegroundColor, LineStyle.SOLID, -1);

    fBaseFont = jFaceFontRegistry.get(JFaceResources.DIALOG_FONT);
    fInfoFont = jFaceFontRegistry.getItalic(JFaceResources.DIALOG_FONT);

    {/*from ww w.  j av  a2  s.c  o  m*/
        final GC gc = new GC(display);
        gc.setFont(fBaseFont);
        final FontMetrics fontMetrics = gc.getFontMetrics();
        final int textHeight = fontMetrics.getHeight();
        final int charWidth = (gc.textExtent("1234567890.-120").x + 5) / 15;
        gc.dispose();
        final int textSpace = 3;

        fBaseSizeConfig = new LayoutSizeConfig(textSpace, textHeight, charWidth);
    }

    fBaseCellPainter = new LineBorderDecorator(new RTextPainter(fBaseSizeConfig.getDefaultSpace()));

    fHeaderCellPainter = new RTextPainter(fBaseSizeConfig.getDefaultSpace());
    fHeaderSortedCellPainter = new SortableHeaderTextPainter(
            new RTextPainter(fBaseSizeConfig.getDefaultSpace()), true, true);
    fHeaderCornerCellPainter = new DiagCellPainter(fHeaderGridColor);
}

From source file:eu.esdihumboldt.hale.ui.common.graph.figures.EntityFigure.java

License:Open Source License

/**
 * Create a entity figure.//from   w w w  .j av  a 2 s .  co  m
 * 
 * @param painter the shape
 * @param contextText the context text, may be <code>null</code>
 * @param cardinalityText the cardinality text, may be <code>null</code>
 * @param customFont a custom font to use, may be <code>null</code>
 */
public EntityFigure(ShapePainter painter, final String contextText, final String cardinalityText,
        final Font customFont) {
    super(painter, customFont);

    setAntialias(SWT.ON);

    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 1;
    if (cardinalityText != null)
        gridLayout.numColumns++;
    if (contextText != null)
        gridLayout.numColumns++;
    gridLayout.marginHeight = 3;
    gridLayout.marginWidth = 3;
    gridLayout.makeColumnsEqualWidth = true;
    setLayoutManager(gridLayout);

    // the label for the label provider text and image
    Label label = new EndSubTextLabel();
    GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, true);
    add(label, gridData);

    // the additional label for the cardinality text
    if (cardinalityText != null) {
        Label cardLabel = new Label();
        ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
        // XXX uses the same color as in schema explorer label provider -
        // centralize this?
        cardLabel.setForegroundColor(colorRegistry.get(JFacePreferences.COUNTER_COLOR));
        if (customFont != null) {
            cardLabel.setFont(customFont);
        }
        cardLabel.setText(cardinalityText);
        GridData cardGridData = new GridData(GridData.END, GridData.CENTER, false, true);
        add(cardLabel, cardGridData);
    }

    // the additional label for the context text
    if (contextText != null) {
        Label contextLabel = new Label();
        ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
        // XXX uses the same color as in schema explorer label provider -
        // centralize this?
        contextLabel.setForegroundColor(colorRegistry.get(JFacePreferences.DECORATIONS_COLOR));
        if (customFont != null) {
            contextLabel.setFont(customFont);
        }
        contextLabel.setText(contextText);
        contextLabel.setToolTip(new Label(contextText));
        GridData contextGridData = new GridData(GridData.END, GridData.CENTER, true, true);
        add(contextLabel, contextGridData);
    }

    setTextLabel(label);
    setIconLabel(label);
}

From source file:ext.org.eclipse.jdt.internal.ui.viewsupport.ColoredViewersManager.java

License:Open Source License

public void propertyChange(PropertyChangeEvent event) {
    String property = event.getProperty();
    if (property.equals(JFacePreferences.QUALIFIER_COLOR) || property.equals(JFacePreferences.COUNTER_COLOR)
            || property.equals(JFacePreferences.DECORATIONS_COLOR) || property.equals(HIGHLIGHT_BG_COLOR_NAME)
            || property.equals(HIGHLIGHT_WRITE_BG_COLOR_NAME) || property.equals(INHERITED_COLOR_NAME)
            || property.equals(IWorkbenchPreferenceConstants.USE_COLORED_LABELS)) {
        Display.getDefault().asyncExec(new Runnable() {
            public void run() {
                updateAllViewers();//from   w w  w. j  av a 2 s. co  m
            }
        });
    }
}