org.eclipse.jface.preference.PreferenceStore Java Examples

The following examples show how to use org.eclipse.jface.preference.PreferenceStore. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TexSourceViewerConfiguration.java    From texlipse with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getReconciler(org.eclipse.jface.text.source.ISourceViewer)
 */
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
    if (fPreferenceStore == null || !fPreferenceStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED))
        return null;
    if (!TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(TexlipseProperties.ECLIPSE_BUILDIN_SPELLCHECKER))
        return null;
    //Set TeXlipse spelling Engine as default
    PreferenceStore store = new PreferenceStore();
    store.setValue(SpellingService.PREFERENCE_SPELLING_ENGINE, 
            "org.eclipse.texlipse.LaTeXSpellEngine");
    store.setValue(SpellingService.PREFERENCE_SPELLING_ENABLED, 
    true);
    SpellingService spellingService = new SpellingService(store);
    if (spellingService.getActiveSpellingEngineDescriptor(store) == null)
        return null;
    IReconcilingStrategy strategy= new TeXSpellingReconcileStrategy(sourceViewer, spellingService);
    
    MonoReconciler reconciler= new MonoReconciler(strategy, true);
    reconciler.setDelay(500);
    reconciler.setProgressMonitor(new NullProgressMonitor());
    return reconciler;
}
 
Example #2
Source File: PyCodeScannerTest.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
private PyCodeScanner createCodeScanner() {
    PreferenceStore store = new PreferenceStore();
    store.putValue(PyDevEditorPreferences.KEYWORD_COLOR, StringConverter.asString(new RGB(1, 0, 0)));
    store.putValue(PyDevEditorPreferences.SELF_COLOR, StringConverter.asString(new RGB(2, 0, 0)));
    store.putValue(PyDevEditorPreferences.CODE_COLOR, StringConverter.asString(new RGB(3, 0, 0)));
    store.putValue(PyDevEditorPreferences.DECORATOR_COLOR, StringConverter.asString(new RGB(4, 0, 0)));
    store.putValue(PyDevEditorPreferences.NUMBER_COLOR, StringConverter.asString(new RGB(5, 0, 0)));
    store.putValue(PyDevEditorPreferences.FUNC_NAME_COLOR, StringConverter.asString(new RGB(6, 0, 0)));
    store.putValue(PyDevEditorPreferences.CLASS_NAME_COLOR, StringConverter.asString(new RGB(7, 0, 0)));
    store.putValue(PyDevEditorPreferences.OPERATORS_COLOR, StringConverter.asString(new RGB(8, 0, 0)));
    store.putValue(PyDevEditorPreferences.PARENS_COLOR, StringConverter.asString(new RGB(9, 0, 0)));

    this.colorCache = new ColorAndStyleCache(store);
    PyCodeScanner scanner = new PyCodeScanner(colorCache);
    return scanner;
}
 
Example #3
Source File: StyledTextForShowingCodeFactory.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * @return a styled text that can be used to show code with the colors based on the color cache received.
 */
public StyledText createStyledTextForCodePresentation(Composite parent) {
    styledText = new StyledText(parent, SWT.BORDER | SWT.READ_ONLY);
    this.backgroundColorCache = new ColorAndStyleCache(new PreferenceStore());
    this.colorCache = new ColorAndStyleCache(null);

    try {
        styledText.setFont(new Font(parent.getDisplay(), FontUtils.getFontData(IFontUsage.STYLED, true)));
    } catch (Throwable e) {
        //ignore
    }
    updateBackgroundColor();

    PyDevUiPrefs.getChainedPrefStore().addPropertyChangeListener(this);

    return styledText;
}
 
Example #4
Source File: RoutesKarafBundleRepositorySettingPage.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@Override
public void save() throws IOException {
    if (getPreferenceStore() instanceof PreferenceStore) {
        ((PreferenceStore) getPreferenceStore()).save();
    }
    super.save();
}
 
Example #5
Source File: ServicesKarafPomRepositorySettingPage.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@Override
public void save() throws IOException {
    if (getPreferenceStore() instanceof PreferenceStore) {
        ((PreferenceStore) getPreferenceStore()).save();
    }
    super.save();
}
 
Example #6
Source File: ServicesKarafParentRepositorySettingPage.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@Override
public void load() throws IOException {
    if (getPreferenceStore() instanceof PreferenceStore) {
        ((PreferenceStore) getPreferenceStore()).load();
    }
    super.load();
}
 
Example #7
Source File: ServicesKarafParentRepositorySettingPage.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@Override
public void save() throws IOException {
    if (getPreferenceStore() instanceof PreferenceStore) {
        ((PreferenceStore) getPreferenceStore()).save();
    }
    super.save();
}
 
Example #8
Source File: ServicesKarafBundleRepositorySettingPage.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@Override
public void load() throws IOException {
    if (getPreferenceStore() instanceof PreferenceStore) {
        ((PreferenceStore) getPreferenceStore()).load();
    }
    super.load();
}
 
Example #9
Source File: ServicesKarafBundleRepositorySettingPage.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@Override
public void save() throws IOException {
    if (getPreferenceStore() instanceof PreferenceStore) {
        ((PreferenceStore) getPreferenceStore()).save();
    }
    super.save();
}
 
Example #10
Source File: RoutesKarafParentRepositorySettingPage.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@Override
public void load() throws IOException {
    if (getPreferenceStore() instanceof PreferenceStore) {
        ((PreferenceStore) getPreferenceStore()).load();
    }
    super.load();
}
 
Example #11
Source File: RoutesKarafParentRepositorySettingPage.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@Override
public void save() throws IOException {
    if (getPreferenceStore() instanceof PreferenceStore) {
        ((PreferenceStore) getPreferenceStore()).save();
    }
    super.save();
}
 
Example #12
Source File: RoutesKarafBundleRepositorySettingPage.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@Override
public void load() throws IOException {
    if (getPreferenceStore() instanceof PreferenceStore) {
        ((PreferenceStore) getPreferenceStore()).load();
    }
    super.load();
}
 
Example #13
Source File: ServicesKarafFeatureRepositorySettingPage.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@Override
public void save() throws IOException {
    if (getPreferenceStore() instanceof PreferenceStore) {
        ((PreferenceStore) getPreferenceStore()).save();
    }
    super.save();
}
 
Example #14
Source File: RoutesKarafPomRepositorySettingPage.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@Override
public void load() throws IOException {
    if (getPreferenceStore() instanceof PreferenceStore) {
        ((PreferenceStore) getPreferenceStore()).load();
    }
    super.load();
}
 
Example #15
Source File: RoutesKarafPomRepositorySettingPage.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@Override
public void save() throws IOException {
    if (getPreferenceStore() instanceof PreferenceStore) {
        ((PreferenceStore) getPreferenceStore()).save();
    }
    super.save();
}
 
Example #16
Source File: RoutesKarafFeatureRepositorySettingPage.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@Override
public void load() throws IOException {
    if (getPreferenceStore() instanceof PreferenceStore) {
        ((PreferenceStore) getPreferenceStore()).load();
    }
    super.load();
}
 
Example #17
Source File: RoutesKarafFeatureRepositorySettingPage.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@Override
public void save() throws IOException {
    if (getPreferenceStore() instanceof PreferenceStore) {
        ((PreferenceStore) getPreferenceStore()).save();
    }
    super.save();
}
 
Example #18
Source File: ServicesKarafPomRepositorySettingPage.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@Override
public void load() throws IOException {
    if (getPreferenceStore() instanceof PreferenceStore) {
        ((PreferenceStore) getPreferenceStore()).load();
    }
    super.load();
}
 
Example #19
Source File: ServicesKarafFeatureRepositorySettingPage.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@Override
public void load() throws IOException {
    if (getPreferenceStore() instanceof PreferenceStore) {
        ((PreferenceStore) getPreferenceStore()).load();
    }
    super.load();
}
 
Example #20
Source File: JavaPreview.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public JavaPreview(Map<String, String> workingValues, Composite parent) {
		JavaTextTools tools= JavaPlugin.getDefault().getJavaTextTools();
		fPreviewDocument= new Document();
		fWorkingValues= workingValues;
		tools.setupJavaDocumentPartitioner( fPreviewDocument, IJavaPartitions.JAVA_PARTITIONING);

		PreferenceStore prioritizedSettings= new PreferenceStore();
		HashMap<String, String> complianceOptions= new HashMap<String, String>();
		JavaModelUtil.setComplianceOptions(complianceOptions, JavaModelUtil.VERSION_LATEST);
		for (Entry<String, String> complianceOption : complianceOptions.entrySet()) {
			prioritizedSettings.setValue(complianceOption.getKey(), complianceOption.getValue());
		}

		IPreferenceStore[] chain= { prioritizedSettings, JavaPlugin.getDefault().getCombinedPreferenceStore() };
		fPreferenceStore= new ChainedPreferenceStore(chain);
		fSourceViewer= new JavaSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER, fPreferenceStore);
		fSourceViewer.setEditable(false);
		Cursor arrowCursor= fSourceViewer.getTextWidget().getDisplay().getSystemCursor(SWT.CURSOR_ARROW);
		fSourceViewer.getTextWidget().setCursor(arrowCursor);

		// Don't set caret to 'null' as this causes https://bugs.eclipse.org/293263
//		fSourceViewer.getTextWidget().setCaret(null);

		fViewerConfiguration= new SimpleJavaSourceViewerConfiguration(tools.getColorManager(), fPreferenceStore, null, IJavaPartitions.JAVA_PARTITIONING, true);
		fSourceViewer.configure(fViewerConfiguration);
		fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT));

		fMarginPainter= new MarginPainter(fSourceViewer);
		final RGB rgb= PreferenceConverter.getColor(fPreferenceStore, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR);
		fMarginPainter.setMarginRulerColor(tools.getColorManager().getColor(rgb));
		fSourceViewer.addPainter(fMarginPainter);

		new JavaSourcePreviewerUpdater();
		fSourceViewer.setDocument(fPreviewDocument);
	}
 
Example #21
Source File: Preferences.java    From Rel with Apache License 2.0 5 votes vote down vote up
public static void setPreference(String name, Rectangle rect) {
	PreferenceStore prefs = getPreferences();
	prefs.setValue(name + "_x", rect.x);
	prefs.setValue(name + "_y", rect.y);
	prefs.setValue(name + "_width", rect.width);
	prefs.setValue(name + "_height", rect.height);
	save();
}
 
Example #22
Source File: Preferences.java    From Rel with Apache License 2.0 5 votes vote down vote up
public static Rectangle getPreferenceRectangle(String name) {
	PreferenceStore prefs = getPreferences();
	int x = prefs.getInt(name + "_x");
	int y = prefs.getInt(name + "_y");
	int width = prefs.getInt(name + "_width");
	int height = prefs.getInt(name + "_height");
	return new Rectangle(x, y, width, height);
}
 
Example #23
Source File: OverlayPreferenceStore.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public OverlayPreferenceStore( IPreferences preference,
		OverlayKey[] overlayKeys )
{
	fParent = preference;
	fOverlayKeys = overlayKeys;
	fStore = new PreferenceStore( );
}
 
Example #24
Source File: PydevEditorPrefs.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
public PydevEditorPrefs() {
    setDescription("PyDev editor appearance settings");
    setPreferenceStore(PydevPlugin.getDefault().getPreferenceStore());

    fOverlayStore = createOverlayStore();
    localStore = new PreferenceStore();
}
 
Example #25
Source File: CloseJUnitStatusActionTest.java    From eclipse-extras with Eclipse Public License 1.0 5 votes vote down vote up
@Before
public void setUp() {
  evaluationService = mock( IEvaluationService.class );
  workbench = mock( IWorkbench.class );
  when( workbench.getService( IEvaluationService.class ) ).thenReturn( evaluationService );
  preferences = new WorkspaceScopePreferences( new PreferenceStore() );
  action = new CloseJUnitStatusAction( workbench, preferences );
}
 
Example #26
Source File: ContributionAnnotationManagerTest.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
@Before
public void setUp() {
  store = new PreferenceStore();
  store.setValue(EclipsePreferenceConstants.SHOW_CONTRIBUTION_ANNOTATIONS, true);
  createListenerMocks();

  manager = new ContributionAnnotationManager(sessionMock, store);
  model = new AnnotationModel();
}
 
Example #27
Source File: ProcBuilder.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
private Element createShape(final String id, final EObject container, final Point location, final Dimension size, final IElementType type,
        final boolean isCollapsed) throws ProcBuilderException {

    diagramPart.refresh();
    final IGraphicalEditPart parentEditPart = GMFTools.findEditPart(diagramPart, container);
    final IGraphicalEditPart compartment = retrieveCompartmentEditPartFor(parentEditPart);
    if (compartment instanceof LaneLaneCompartmentEditPart) {
        int laneHeightOffset = 0;

        final PoolPoolCompartmentEditPart poolCompartment = (PoolPoolCompartmentEditPart) compartment.getParent().getParent();
        final int currentLaneIndex = ((Container) currentContainer.eContainer()).getElements().indexOf(currentContainer);
        if (currentLaneIndex > 0) {
            for (final Object object : poolCompartment.getChildren()) {
                if (object instanceof LaneEditPart) {
                    final EObject semanticElement = ((LaneEditPart) object).resolveSemanticElement();
                    final int laneIndex = ((Container) currentContainer.eContainer()).getElements().indexOf(semanticElement);
                    if (laneIndex < currentLaneIndex) {
                        laneHeightOffset = laneHeightOffset + ((LaneEditPart) object).getFigure().getSize().height;
                    }
                }
            }
        }
        if (laneHeightOffset != 0 && laneHeightOffset + 80 > location.y) {
            location.y = location.y + laneHeightOffset + 20;
        }
    }

    final PreferencesHint hint = diagramPart.getDiagramPreferencesHint();
    final PreferenceStore store = (PreferenceStore) hint.getPreferenceStore();
    store.setValue("isCollapsed", isCollapsed);

    final ViewAndElementDescriptor viewDescriptor = new ViewAndElementDescriptor(new CreateElementRequestAdapter(new CreateElementRequest(type)),
            Node.class,
            ((IHintedType) type).getSemanticHint(), hint);
    final CreateViewAndElementRequest createRequest = createCreationRequest(location, size, viewDescriptor);

    if (container == null || !(container instanceof Element)) {
        throw new ProcBuilderException("Impossible to find the parent EditPart");
    }

    diagramPart.getDiagramEditDomain().getDiagramCommandStack().execute(compartment.getCommand(createRequest));
    compartment.refresh();

    final Node newNode = (Node) viewDescriptor.getAdapter(Node.class);
    if (newNode == null) {
        throw new ProcBuilderException("New element not created");
    }
    currentView = newNode;
    final Element createdElement = (Element) newNode.getElement();
    final ShapeNodeEditPart nodeEditPart = (ShapeNodeEditPart) GMFTools.findEditPart(diagramPart, createdElement);

    if (nodeEditPart == null) {
        throw new ProcBuilderException("New edit part not created");
    }

    editParts.put(id, nodeEditPart);

    return createdElement;
}
 
Example #28
Source File: OverlayPreferenceStore.java    From editorconfig-eclipse with Apache License 2.0 4 votes vote down vote up
public OverlayPreferenceStore(IPreferenceStore parent, OverlayKey[] overlayKeys) {
	fParent= parent;
	fOverlayKeys= overlayKeys;
	fStore= new PreferenceStore();
}
 
Example #29
Source File: OverlayPreferenceStore.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
public OverlayPreferenceStore(IPreferenceStore parent, OverlayKey[] overlayKeys) {
    fParent = parent;
    fOverlayKeys = overlayKeys;
    fStore = new PreferenceStore();
}
 
Example #30
Source File: AbstractDetailsPart.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public AbstractDetailsPart(IPreferenceStore masterPreferenceStore) {
	super(GRID);
	this.masterPreferenceStore = masterPreferenceStore;
	internalStore = new PreferenceStore();
}