Search in sources :

Example 91 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project xtext-xtend by eclipse.

the class AbstractXtendContentAssistBugTest method tearDown.

@Override
public void tearDown() throws Exception {
    if (demandCreateProject != null)
        deleteProject(demandCreateProject);
    IPreferenceStore preferenceStore = preferenceStoreAccess.getWritablePreferenceStore(null);
    preferenceStore.setToDefault(XbaseBuilderPreferenceAccess.PREF_USE_COMPILER_SOURCE);
    preferenceStore.setToDefault(XbaseBuilderPreferenceAccess.PREF_JAVA_VERSION);
    super.tearDown();
}
Also used : IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 92 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project xtext-xtend by eclipse.

the class XtendPreferenceStoreAccess method getContextPreferenceStore.

@SuppressWarnings("all")
@Override
public IPreferenceStore getContextPreferenceStore(Object context) {
    IProject project = getProject(context);
    if (project == null)
        return getPreferenceStore();
    IPreferenceStore store = super.getContextPreferenceStore(context);
    ProjectScope projectScope = new ProjectScope(project);
    FixedScopedPreferenceStore jdtStore = new FixedScopedPreferenceStore(projectScope, JavaCore.PLUGIN_ID);
    jdtStore.setSearchContexts(new IScopeContext[] { projectScope, new InstanceScope(), new ConfigurationScope() });
    return new ChainedPreferenceStore(new IPreferenceStore[] { store, jdtStore, PreferenceConstants.getPreferenceStore() });
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) InstanceScope(org.eclipse.core.runtime.preferences.InstanceScope) ChainedPreferenceStore(org.eclipse.ui.texteditor.ChainedPreferenceStore) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) FixedScopedPreferenceStore(org.eclipse.xtext.ui.editor.preferences.FixedScopedPreferenceStore) IProject(org.eclipse.core.resources.IProject) ConfigurationScope(org.eclipse.core.runtime.preferences.ConfigurationScope)

Example 93 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project xtext-xtend by eclipse.

the class DerivedSourceView method inititalizeColors.

@Override
protected void inititalizeColors() {
    IPreferenceStore store = preferenceStoreAccess.getPreferenceStore();
    getColorRegistry().addListener(this);
    StyledText textWidget = getSourceViewer().getTextWidget();
    textWidget.setForeground(getColorFromStore(store, AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT, SWT.COLOR_WIDGET_FOREGROUND, AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND));
    textWidget.setBackground(getColorFromStore(store, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, SWT.COLOR_INFO_BACKGROUND, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND));
    lineNumberRulerColumn.setForeground(getColorFromStore(store, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR, SWT.COLOR_WIDGET_FOREGROUND, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR));
    lineNumberRulerColumn.setBackground(getColorFromStore(store, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, SWT.COLOR_WIDGET_BACKGROUND, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND));
    lineNumberRulerColumn.setFont(getFont(getViewerFontName()));
}
Also used : StyledText(org.eclipse.swt.custom.StyledText) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 94 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project xtext-xtend by eclipse.

the class DerivedSourceView method createSourceViewer.

@Override
protected SourceViewer createSourceViewer(Composite parent) {
    IPreferenceStore store = JavaPlugin.getDefault().getCombinedPreferenceStore();
    IOverviewRuler overviewRuler = new OverviewRuler(defaultMarkerAnnotationAccess, OVERVIEW_RULER_WIDTH, getSharedTextColors());
    AnnotationRulerColumn annotationRulerColumn = new AnnotationRulerColumn(VERTICAL_RULER_WIDTH, defaultMarkerAnnotationAccess);
    @SuppressWarnings("unchecked") List<AnnotationPreference> annotationPreferences = markerAnnotationPreferences.getAnnotationPreferences();
    for (AnnotationPreference annotationPreference : annotationPreferences) {
        String key = annotationPreference.getVerticalRulerPreferenceKey();
        boolean showAnnotation = true;
        if (key != null && store.contains(key)) {
            showAnnotation = store.getBoolean(key);
        }
        if (showAnnotation) {
            annotationRulerColumn.addAnnotationType(annotationPreference.getAnnotationType());
        }
    }
    annotationRulerColumn.addAnnotationType(Annotation.TYPE_UNKNOWN);
    lineNumberRulerColumn = new LineNumberRulerColumn();
    CompositeRuler compositeRuler = new CompositeRuler();
    compositeRuler.addDecorator(0, annotationRulerColumn);
    compositeRuler.addDecorator(1, lineNumberRulerColumn);
    javaSourceViewer = new JavaSourceViewer(parent, compositeRuler, overviewRuler, true, SWT.V_SCROLL | SWT.H_SCROLL, store);
    javaSourceViewerConfiguration = new SimpleJavaSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), store, null, IJavaPartitions.JAVA_PARTITIONING, true) {

        @Override
        public IInformationControlCreator getInformationControlCreator(ISourceViewer sourceViewer) {
            return new IInformationControlCreator() {

                @Override
                public IInformationControl createInformationControl(final Shell parent) {
                    return new DefaultInformationControl(parent, true);
                }
            };
        }

        @Override
        public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
            return new DefaultAnnotationHover();
        }
    };
    javaSourceViewer.configure(javaSourceViewerConfiguration);
    javaSourceViewer.setEditable(false);
    javaSourceViewer.showAnnotations(true);
    sourceViewerDecorationSupport = new SourceViewerDecorationSupport(javaSourceViewer, overviewRuler, defaultMarkerAnnotationAccess, getSharedTextColors());
    for (AnnotationPreference annotationPreference : annotationPreferences) {
        sourceViewerDecorationSupport.setAnnotationPreference(annotationPreference);
    }
    sourceViewerDecorationSupport.install(preferenceStoreAccess.getPreferenceStore());
    return javaSourceViewer;
}
Also used : LineNumberRulerColumn(org.eclipse.jface.text.source.LineNumberRulerColumn) SimpleJavaSourceViewerConfiguration(org.eclipse.jdt.internal.ui.text.SimpleJavaSourceViewerConfiguration) DefaultInformationControl(org.eclipse.jface.text.DefaultInformationControl) CompositeRuler(org.eclipse.jface.text.source.CompositeRuler) SourceViewerDecorationSupport(org.eclipse.ui.texteditor.SourceViewerDecorationSupport) IAnnotationHover(org.eclipse.jface.text.source.IAnnotationHover) IOverviewRuler(org.eclipse.jface.text.source.IOverviewRuler) IInformationControlCreator(org.eclipse.jface.text.IInformationControlCreator) AnnotationRulerColumn(org.eclipse.jface.text.source.AnnotationRulerColumn) Shell(org.eclipse.swt.widgets.Shell) IInformationControl(org.eclipse.jface.text.IInformationControl) JavaSourceViewer(org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer) OverviewRuler(org.eclipse.jface.text.source.OverviewRuler) IOverviewRuler(org.eclipse.jface.text.source.IOverviewRuler) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) AnnotationPreference(org.eclipse.ui.texteditor.AnnotationPreference) ISourceViewer(org.eclipse.jface.text.source.ISourceViewer) DefaultAnnotationHover(org.eclipse.jface.text.source.DefaultAnnotationHover)

Example 95 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project xtext-xtend by eclipse.

the class XtendSourceViewerConfiguration method getPresentationReconciler.

@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
    XtextPresentationReconciler reconciler = (XtextPresentationReconciler) super.getPresentationReconciler(sourceViewer);
    IPreferenceStore store = JavaPlugin.getDefault().getCombinedPreferenceStore();
    IColorManager colorManager = JavaPlugin.getDefault().getJavaTextTools().getColorManager();
    JavaDocScanner javaDocScanner = new JavaDocScanner(colorManager, store, null);
    DefaultDamagerRepairer dr = new DefaultDamagerRepairer(javaDocScanner);
    reconciler.setRepairer(dr, TokenTypeToPartitionMapper.JAVA_DOC_PARTITION);
    reconciler.setDamager(dr, TokenTypeToPartitionMapper.JAVA_DOC_PARTITION);
    return reconciler;
}
Also used : JavaDocScanner(org.eclipse.jdt.internal.ui.text.javadoc.JavaDocScanner) IColorManager(org.eclipse.jdt.ui.text.IColorManager) DefaultDamagerRepairer(org.eclipse.jface.text.rules.DefaultDamagerRepairer) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) XtextPresentationReconciler(org.eclipse.xtext.ui.editor.XtextPresentationReconciler)

Aggregations

IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)311 ArrayList (java.util.ArrayList)35 Test (org.junit.Test)23 Hashtable (java.util.Hashtable)19 File (java.io.File)18 Before (org.junit.Before)17 List (java.util.List)14 IPath (org.eclipse.core.runtime.IPath)14 InvocationTargetException (java.lang.reflect.InvocationTargetException)13 IOException (java.io.IOException)12 MessageDialogWithToggle (org.eclipse.jface.dialogs.MessageDialogWithToggle)12 IElementParameter (org.talend.core.model.process.IElementParameter)12 CoreException (org.eclipse.core.runtime.CoreException)11 Path (org.eclipse.core.runtime.Path)11 Font (org.eclipse.swt.graphics.Font)11 Point (org.eclipse.swt.graphics.Point)11 Composite (org.eclipse.swt.widgets.Composite)11 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)10 IStatus (org.eclipse.core.runtime.IStatus)10 StyledText (org.eclipse.swt.custom.StyledText)10