Example usage for org.eclipse.jface.preference PreferenceStore PreferenceStore

List of usage examples for org.eclipse.jface.preference PreferenceStore PreferenceStore

Introduction

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

Prototype

public PreferenceStore() 

Source Link

Document

Creates an empty preference store.

Usage

From source file:org.eclipse.jdt.text.tests.JavaPartitionerTest.java

License:Open Source License

protected void setUp() {

    fTextTools = new JavaTextTools(new PreferenceStore());

    fDocument = new Document();
    IDocumentPartitioner partitioner = fTextTools.createDocumentPartitioner();
    partitioner.connect(fDocument);//  ww  w . ja  v a2 s  .  c  o m
    fDocument.setDocumentPartitioner(partitioner);
    fDocument.set("xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx");

    fDocumentPartitioningChanged = false;
    fDocument.addDocumentPartitioningListener(new IDocumentPartitioningListener() {
        public void documentPartitioningChanged(IDocument document) {
            fDocumentPartitioningChanged = true;
        }
    });
}

From source file:org.eclipse.jdt.text.tests.PropertiesFilePartitionerTest.java

License:Open Source License

protected void setUp() {

    fTextTools = new JavaTextTools(new PreferenceStore());

    fDocument = new Document();
    PropertiesFileDocumentSetupParticipant.setupDocument(fDocument);
    fDocument.set("###Comment\nkey=value\nkey value\nkey:value");
    //             01234567890 1234567890 1234567890 123456789

    fDocumentPartitioningChanged = false;
    fDocument.addDocumentPartitioningListener(new IDocumentPartitioningListener() {
        public void documentPartitioningChanged(IDocument document) {
            fDocumentPartitioningChanged = true;
        }//from   w  w  w.j  a  v a  2  s . c  om
    });
}

From source file:org.eclipse.jpt.jpadiagrameditor.ui.tests.internal.preferences.JPAEditorPreferenceInitializerTest.java

License:Open Source License

@Test
public void testInitializeDefaultPreferences() {
    IPreferenceStore store = new PreferenceStore();
    AbstractPreferenceInitializer fixture = new JPAEditorPreferenceInitializer(store);
    fixture.initializeDefaultPreferences();
    String pack = store.getDefaultString(JPAEditorPreferenceInitializer.PROPERTY_ENTITY_PACKAGE);
    assertEquals(JPAEditorPreferenceInitializer.PROPERTY_VAL_ENTITY_PACKAGE, pack);
}

From source file:org.eclipse.m2m.atl.adt.ui.preferences.AtlPreferenceStore.java

License:Open Source License

/**
 * Creates a new instance of ATL preference fPreferenceeStore.
 * //from ww w .j  a  v  a 2s  .  co  m
 * @param parent
 *            the parent fPreferenceeStore let's this one restore to the current value the preferences
 * @param keys
 *            this array is a list of keys for initialization
 */
public AtlPreferenceStore(IPreferenceStore parent, Key[] keys) {
    this.parent = parent;
    this.keys = keys;
    this.store = new PreferenceStore();
}

From source file:org.eclipse.mat.dtfj.InitDTFJ.java

License:Open Source License

public Object getPreferenceStore() {
    // Copied from AbstractUIPlugin, so that InitDTFJ doesn't have a hard dependency
    // on org.eclipse.ui
    // Create the preference store lazily.
    if (preferenceStore == null) {
        try {//from   ww  w .  ja  v  a2  s.  c  o m
            preferenceStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, getBundle().getSymbolicName());

        } catch (LinkageError e) {
            preferenceStore = new PreferenceStore();
        }
    }
    return preferenceStore;
}

From source file:org.eclipse.mat.hprof.HprofPlugin.java

License:Open Source License

/**
 * Lazily load and return the preference store.
 * @return Current preference store.// w ww. j a  v a2s .com
 */

public Object getPreferenceStore() {
    // Avoid hard dependency on org.eclipse.ui
    // Create the preference store lazily.
    if (preferenceStore == null) {
        try {
            preferenceStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, getBundle().getSymbolicName());
        } catch (LinkageError e) {
            preferenceStore = new PreferenceStore();
        }
    }
    return preferenceStore;
}

From source file:org.eclipse.scanning.device.ui.Activator.java

License:Open Source License

public static IPreferenceStore getStore() {
    if (plugin != null)
        return plugin.getPreferenceStore();
    if (store == null)
        store = new PreferenceStore();
    return store;
}

From source file:org.eclipse.sirius.diagram.ui.tools.internal.print.SiriusDiagramPrintPreviewHelper.java

License:Open Source License

/**
 * Initialize the preferences for a diagram edit part, specifically
 * including page breaks and margins./*from   w w  w .  java 2 s .  c o m*/
 * 
 * Typically, the diagram edit part is created using createDiagramEditPart()
 * and the diagram edit part is passed in as the first parameter of this
 * method.
 * 
 * @param diagramEditPart
 *            the DiagramEditPart to pass in
 * @param preferencesHint
 *            the preferences hint to use for intiializing the preferences
 * 
 * @return true if the preferences could be loaded, false if they weren't
 *         loaded and defaults had to be used instead
 */
public static boolean initializePreferences(DiagramEditPart diagramEditPart, PreferencesHint preferencesHint) {
    assert diagramEditPart.getViewer() instanceof DiagramGraphicalViewer;

    DiagramGraphicalViewer viewer = (DiagramGraphicalViewer) diagramEditPart.getViewer();

    boolean loadedPreferences = true;

    IPreferenceStore fPreferences = SiriusDiagramPrintPreviewHelper
            .getPreferenceStoreForDiagram(diagramEditPart);

    if (fPreferences == null) {
        loadedPreferences = false;
        // leave at default x and y
        PreferenceStore defaults = new PreferenceStore();
        DiagramEditor.addDefaultPreferences(defaults, preferencesHint);

        fPreferences = SiriusDiagramPrintPreviewHelper.getWorkspacePreferenceStore(preferencesHint);
    } else if (!fPreferences.getBoolean(WorkspaceViewerProperties.PREF_USE_DIAGRAM_SETTINGS)) {
        // if we aren't supposed to use the diagram settings, switch to the
        // workspace settings

        // we have to use the page break x and y settings from the diagram
        int x = fPreferences.getInt(WorkspaceViewerProperties.PAGEBREAK_X),
                y = fPreferences.getInt(WorkspaceViewerProperties.PAGEBREAK_Y);

        // minor performance optimization, use the existing
        // preferences from the workspace instead of making a new one
        fPreferences = SiriusDiagramPrintPreviewHelper.getWorkspacePreferenceStore(preferencesHint);
        fPreferences.setValue(WorkspaceViewerProperties.PAGEBREAK_X, x);
        fPreferences.setValue(WorkspaceViewerProperties.PAGEBREAK_Y, y);
    }

    viewer.hookWorkspacePreferenceStore(fPreferences);

    diagramEditPart.refreshPageBreaks();

    return loadedPreferences;
}

From source file:org.eclipse.swtbot.eclipse.ui.preferences.PreferenceInitializerTest.java

License:Open Source License

@Before
public void setUp() throws Exception {
    swtbotPreferenceStore = new PreferenceStore();
    jdtPreferenceStore = new PreferenceStore();
    initializer = new PreferenceInitializer(swtbotPreferenceStore, jdtPreferenceStore);
}

From source file:org.eclipse.tcf.internal.cdt.ui.breakpoints.TCFBreakpointThreadFilterPage.java

License:Open Source License

protected TCFBreakpointScopeExtension getFilterExtension() {
    if (fFilterExtension != null)
        return fFilterExtension;

    fFilterExtension = new TCFBreakpointScopeExtension();
    BreakpointScopeCategory category = getScopeCategory();
    if (category != null) {
        fFilterExtension.initialize(new PreferenceStore());
        fFilterExtension.setPropertiesFilter(category.getFilter());
        fFilterExtension.setRawContextIds(category.getContextIds());
    } else {/*ww w .j av a2  s .co m*/
        fFilterExtension.initialize(getPreferenceStore());
    }
    return fFilterExtension;
}