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

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

Introduction

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

Prototype

String CONTENT_ASSIST_BACKGROUND_COLOR

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

Click Source Link

Document

Identifier for the color used for the background of content assist popup dialogs.

Usage

From source file:com.aptana.editor.common.contentassist.CompletionProposalPopup.java

License:Open Source License

/**
 * Returns the background color to use.//  w ww  .  ja va2 s .c  o m
 * 
 * @param control
 *            the control to get the display from
 * @return the background color
 * @since 3.2
 */
private Color getBackgroundColor(Control control) {
    Color c = fContentAssistant.getProposalSelectorBackground();
    if (c == null)
        c = JFaceResources.getColorRegistry().get(JFacePreferences.CONTENT_ASSIST_BACKGROUND_COLOR);
    return c;
}

From source file:com.aptana.ide.editors.unified.contentassist.CompletionProposalPopup.java

License:Open Source License

/**
 * Returns the background color to use./*from   w ww  . j av a 2s .co  m*/
 *
 * @param control the control to get the display from
 * @return the background color
 * @since 3.2
 */
private Color getBackgroundColor(Control control) {
    Color c = fContentAssistant.getProposalSelectorBackground();
    if (c == null) {
        c = JFaceResources.getColorRegistry().get(JFacePreferences.CONTENT_ASSIST_BACKGROUND_COLOR);
    }
    return c;
}

From source file:com.cisco.yangide.editor.editors.YangSourceViewerConfiguration.java

License:Open Source License

@Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {

    ContentAssistant assistant = new ContentAssistant();
    IContentAssistProcessor processor = new YangSimpleCompletionProcessor();
    assistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);

    assistant.setDocumentPartitioning(YangDocumentSetupParticipant.YANG_PARTITIONING);

    assistant.enableAutoActivation(false);
    assistant.setAutoActivationDelay(200);
    assistant.setProposalPopupOrientation(ContentAssistant.PROPOSAL_REMOVE);
    assistant.setContextInformationPopupOrientation(ContentAssistant.CONTEXT_INFO_ABOVE);
    assistant.setInformationControlCreator(getInformationControlCreator());

    Color background = JFaceResources.getColorRegistry().get(JFacePreferences.CONTENT_ASSIST_BACKGROUND_COLOR);
    assistant.setContextInformationPopupBackground(background);
    assistant.setContextSelectorBackground(background);

    Color foreground = JFaceResources.getColorRegistry().get(JFacePreferences.CONTENT_ASSIST_FOREGROUND_COLOR);
    assistant.setContextInformationPopupForeground(foreground);
    assistant.setContextSelectorForeground(foreground);

    assistant.setStatusLineVisible(true);

    assistant.enableAutoInsert(true);//from   w  w w .  j  a  v  a  2 s.  com

    return assistant;
}

From source file:cz.vutbr.fit.xhriba01.bc.jdt.ui.PreferenceConstants.java

License:Open Source License

/**
 * Initializes deprecated color constants.
 * /*from  w  w  w.  j  av  a2s.c o m*/
 * @param store the preference store
 * @since 3.6
 */
private static void initializeDeprecatedColorConstants(IPreferenceStore store) {
    RGB bgRGB = null;
    RGB fgRGB = null;

    // Don't fail in headless mode
    //if (PlatformUI.isWorkbenchRunning()) {
    bgRGB = JFaceResources.getColorRegistry().getRGB(JFacePreferences.CONTENT_ASSIST_BACKGROUND_COLOR);
    fgRGB = JFaceResources.getColorRegistry().getRGB(JFacePreferences.CONTENT_ASSIST_FOREGROUND_COLOR);
    //}

    // Workaround for https://bugs.eclipse.org/306736
    if (bgRGB == null)
        bgRGB = new RGB(255, 255, 255);
    if (fgRGB == null)
        fgRGB = new RGB(0, 0, 0);

    setRGBValue(store, PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND, bgRGB);
    setRGBValue(store, PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND, fgRGB);

}

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

License:Open Source License

@Override
public List<ICompletionProposal> computeCompletionProposals(ContentAssistInvocationContext arg0,
        IProgressMonitor arg1) {/* ww  w . j av a 2 s  . c om*/

    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:org.csstudio.autocomplete.ui.content.ContentProposalPopup.java

License:Open Source License

protected Color getBackground() {
    return JFaceResources.getColorRegistry().get(JFacePreferences.CONTENT_ASSIST_BACKGROUND_COLOR);
}

From source file:org.eclipse.ant.internal.ui.editor.AntEditorSourceViewerConfiguration.java

License:Open Source License

@Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
    fContentAssistant = new ContentAssistant();
    AntEditorCompletionProcessor processor = new AntEditorCompletionProcessor(fEditor.getAntModel());
    fContentAssistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
    fContentAssistant.setContentAssistProcessor(processor, AntEditorPartitionScanner.XML_TAG);
    fContentAssistant.setDocumentPartitioning(AntDocumentSetupParticipant.ANT_PARTITIONING);

    String triggers = fPreferenceStore
            .getString(AntEditorPreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS);
    if (triggers != null) {
        processor.setCompletionProposalAutoActivationCharacters(triggers.toCharArray());
    }/*from   w w  w .  ja  v a2 s  .c o  m*/

    fContentAssistant
            .enableAutoInsert(fPreferenceStore.getBoolean(AntEditorPreferenceConstants.CODEASSIST_AUTOINSERT));
    fContentAssistant.enableAutoActivation(
            fPreferenceStore.getBoolean(AntEditorPreferenceConstants.CODEASSIST_AUTOACTIVATION));
    fContentAssistant.setAutoActivationDelay(
            fPreferenceStore.getInt(AntEditorPreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY));
    fContentAssistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
    fContentAssistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
    fContentAssistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));

    Color background = JFaceResources.getColorRegistry().get(JFacePreferences.CONTENT_ASSIST_BACKGROUND_COLOR);
    fContentAssistant.setContextInformationPopupBackground(background);
    fContentAssistant.setContextSelectorBackground(background);

    Color foreground = JFaceResources.getColorRegistry().get(JFacePreferences.CONTENT_ASSIST_FOREGROUND_COLOR);
    fContentAssistant.setContextInformationPopupForeground(foreground);
    fContentAssistant.setContextSelectorForeground(foreground);

    IInformationControlCreator creator = getInformationControlCreator(sourceViewer);
    fContentAssistant.setInformationControlCreator(creator);

    fContentAssistant.setRepeatedInvocationMode(true);
    fContentAssistant.setStatusLineVisible(true);
    fContentAssistant.setShowEmptyList(true);
    fContentAssistant.addCompletionListener(processor);
    return fContentAssistant;
}

From source file:org.eclipse.vex.ui.internal.swt.ContentAssist.java

License:Open Source License

@Override
protected Color getBackground() {
    return JFaceResources.getColorRegistry().get(JFacePreferences.CONTENT_ASSIST_BACKGROUND_COLOR);
}

From source file:org.eclipse.wst.xml.vex.ui.internal.swt.ContentAssist.java

License:Open Source License

@Override
protected Color getBackground() {
    String colorId = JFacePreferences.CONTENT_ASSIST_BACKGROUND_COLOR;
    return JFaceResources.getColorRegistry().get(colorId);
}

From source file:org.ganoro.phing.ui.editors.AntEditorSourceViewerConfiguration.java

License:Open Source License

public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
    fContentAssistant = new ContentAssistant();
    AntEditorCompletionProcessor processor = new AntEditorCompletionProcessor(fEditor.getAntModel());
    fContentAssistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
    fContentAssistant.setContentAssistProcessor(processor, AntEditorPartitionScanner.XML_TAG);
    fContentAssistant.setDocumentPartitioning(AntDocumentSetupParticipant.ANT_PARTITIONING);

    String triggers = fPreferenceStore
            .getString(AntEditorPreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS);
    if (triggers != null) {
        processor.setCompletionProposalAutoActivationCharacters(triggers.toCharArray());
    }/*from ww w  .ja  v  a 2 s. com*/

    fContentAssistant
            .enableAutoInsert(fPreferenceStore.getBoolean(AntEditorPreferenceConstants.CODEASSIST_AUTOINSERT));
    fContentAssistant.enableAutoActivation(
            fPreferenceStore.getBoolean(AntEditorPreferenceConstants.CODEASSIST_AUTOACTIVATION));
    fContentAssistant.setAutoActivationDelay(
            fPreferenceStore.getInt(AntEditorPreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY));
    fContentAssistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
    fContentAssistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
    fContentAssistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));

    Color background = JFaceResources.getColorRegistry().get(JFacePreferences.CONTENT_ASSIST_BACKGROUND_COLOR);
    fContentAssistant.setContextInformationPopupBackground(background);
    fContentAssistant.setContextSelectorBackground(background);

    Color foreground = JFaceResources.getColorRegistry().get(JFacePreferences.CONTENT_ASSIST_FOREGROUND_COLOR);
    fContentAssistant.setContextInformationPopupForeground(foreground);
    fContentAssistant.setContextSelectorForeground(foreground);

    IInformationControlCreator creator = getInformationControlCreator(sourceViewer);
    fContentAssistant.setInformationControlCreator(creator);

    fContentAssistant.setRepeatedInvocationMode(true);
    fContentAssistant.setStatusLineVisible(true);
    fContentAssistant.setShowEmptyList(true);
    fContentAssistant.addCompletionListener(processor);
    return fContentAssistant;
}