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.kalypso.ui.repository.factory.FileRepositoryConfigDialog.java

License:Open Source License

/**
 * Constructor. If plugin is specified, it uses the values provided by its DialogSettings as default values for this
 * dialog./*from   ww w  . j a v  a  2  s .c o  m*/
 * 
 * @param parentShell
 * @param location
 * @param identifier
 * @param filters
 * @param plugin
 *          [optional] if not null, default values are used
 */
public FileRepositoryConfigDialog(final Shell parentShell, String location, String identifier, String filters,
        final AbstractUIPlugin plugin) {
    super(parentShell);

    m_plugin = plugin;

    if (plugin != null) {
        String s = plugin.getDialogSettings().get(BASEDIR);
        location = s == null ? location : s;

        s = plugin.getDialogSettings().get(IDENTIFIER);
        identifier = s == null ? identifier : s;

        s = plugin.getDialogSettings().get(FILTER);
        filters = s == null ? filters : s;
    }

    m_store = new PreferenceStore();
    m_store.setDefault(BASEDIR, location);
    m_store.setDefault(IDENTIFIER, identifier);
    m_store.setDefault(FILTER, filters);
}

From source file:org.multicore_association.shim.edit.model.preferences.ShimPreferencesStore.java

License:MIT License

/**
 * default constructor/*from   w  w  w  .j av a  2s  .  c  o  m*/
 */
private ShimPreferencesStore() {
    store = new PreferenceStore();
    try {
        if (prefFile.exists()) {
            store.load(new FileInputStream(prefFile));
        }
    } catch (Exception e) {
    }

    // -------------------------------------------------
    // Shim_WizardPage_ComponentParameter
    store.setDefault(ShimPreferencesKey.CP_SYSTEM_NAME, "System");
    store.setDefault(ShimPreferencesKey.CP_NUMBER_MASTER, 4);
    store.setDefault(ShimPreferencesKey.CP_NUMBER_SLAVE, 3);
    store.setDefault(ShimPreferencesKey.CP_NUMBER_COMPONENT, 2);
    store.setDefault(ShimPreferencesKey.CP_CLOCK, 100000000f);

    // Master tab
    store.setDefault(ShimPreferencesKey.CP_MASTER_NAME, "Core");
    store.setDefault(ShimPreferencesKey.CP_MASTER_TYPE, MasterType.PU.ordinal());
    store.setDefault(ShimPreferencesKey.CP_MASTER_ENDIAN, EndianType.LITTLE.ordinal());
    store.setDefault(ShimPreferencesKey.CP_MASTER_ARCH, "Generic");
    store.setDefault(ShimPreferencesKey.CP_MASTER_ARCH_OPT, "");
    store.setDefault(ShimPreferencesKey.CP_MASTER_NUMBER_CHANNEL, 16);
    store.setDefault(ShimPreferencesKey.CP_MASTER_NUMBER_THREAD, 1);
    store.setDefault(ShimPreferencesKey.CP_MASTER_CHECK_CLOCKFREQUENCY, true);
    store.setDefault(ShimPreferencesKey.CP_MASTER_CLOCK, 100000000f);

    // Slave tab
    store.setDefault(ShimPreferencesKey.CP_SLAVE_NAME, "Memory");
    store.setDefault(ShimPreferencesKey.CP_SLAVE_SIZE, 128);
    store.setDefault(ShimPreferencesKey.CP_SLAVE_SIZE_UNIT, SizeUnitType.KI_B.ordinal());
    store.setDefault(ShimPreferencesKey.CP_SLAVE_RWTYPE, RWType.RW.ordinal());

    // Slave tab
    store.setDefault(ShimPreferencesKey.CP_COMPONENTSET_NAME, "Cluster");

    // -------------------------------------------------
    // Shim_WizardPage_AddressSpaceParameter
    store.setDefault(ShimPreferencesKey.AS_NUMBER_SUBSPACE, 3);
    store.setDefault(ShimPreferencesKey.AS_SIZE_SUBSPACE, 128);
    store.setDefault(ShimPreferencesKey.AS_NAME, "AS");
    store.setDefault(ShimPreferencesKey.AS_SUBSPACE_NAME, "SS");
    store.setDefault(ShimPreferencesKey.AS_CHECK_DONT_CONNECT, false);

    // -------------------------------------------------
    // Shim_WizardPage_AddressSpace
    store.setDefault(ShimPreferencesKey.AS_START, 0);
    store.setDefault(ShimPreferencesKey.AS_END, 0);
    store.setDefault(ShimPreferencesKey.AS_ENDIAN, EndianType.LITTLE.ordinal());

    // -------------------------------------------------
    // Shim_WizardPage_CommunicationSet
    store.setDefault(ShimPreferencesKey.CS_CHECK_INTERRUPT, true);
    store.setDefault(ShimPreferencesKey.CS_CHECK_EVENT, true);
    store.setDefault(ShimPreferencesKey.CS_CHECK_FIFO, true);
    store.setDefault(ShimPreferencesKey.CS_FIFO_DATA_SIZE, 64);
    store.setDefault(ShimPreferencesKey.CS_FIFO_DATA_SIZE_UNIT, SizeUnitType.KI_B.ordinal());
    store.setDefault(ShimPreferencesKey.CS_FIFO_QUEUE_SIZE, 32);
    store.setDefault(ShimPreferencesKey.CS_CHECK_SMC, true);
    store.setDefault(ShimPreferencesKey.CS_SMC_DATA_SIZE, 128);
    store.setDefault(ShimPreferencesKey.CS_SMC_DATA_SIZE_UNIT, SizeUnitType.KI_B.ordinal());
    store.setDefault(ShimPreferencesKey.CS_SMC_OPERATION, OperationType.TAS.ordinal());
    store.setDefault(ShimPreferencesKey.CS_CHECK_SRC, true);
    store.setDefault(ShimPreferencesKey.CS_SRC_DATA_SIZE, 32);
    store.setDefault(ShimPreferencesKey.CS_SRC_DATA_SIZE_UNIT, SizeUnitType.KI_B.ordinal());
    store.setDefault(ShimPreferencesKey.CS_SRC_NUMBER_REGISTER, 32);
    store.setDefault(ShimPreferencesKey.CS_DONT_CONNECT, false);

    // -------------------------------------------------
    // Shim_WizardPage_Cache
    store.setDefault(ShimPreferencesKey.CD_CACHE_TYPE, CacheTypeSelect.UNIFIED.ordinal());
    store.setDefault(ShimPreferencesKey.CD_UNIFIED_CACHE_COHERENCY, CacheCoherencyType.SOFT.ordinal());
    store.setDefault(ShimPreferencesKey.CD_UNIFIED_CACHE_SIZE, 64);
    store.setDefault(ShimPreferencesKey.CD_UNIFIED_CACHE_SIZE_UNIT, SizeUnitType.KI_B.ordinal());
    store.setDefault(ShimPreferencesKey.CD_UNIFIED_NUMBER_WAY, 16);
    store.setDefault(ShimPreferencesKey.CD_UNIFIED_LINE_SIZE, 128);
    store.setDefault(ShimPreferencesKey.CD_UNIFIED_LOCK_DOWN_TYPE, LockDownType.LINE.ordinal());
    store.setDefault(ShimPreferencesKey.CD_DATA_CACHE_COHERENCY, CacheCoherencyType.SOFT.ordinal());
    store.setDefault(ShimPreferencesKey.CD_DATA_CACHE_SIZE, 64);
    store.setDefault(ShimPreferencesKey.CD_DATA_CACHE_SIZE_UNIT, SizeUnitType.KI_B.ordinal());
    store.setDefault(ShimPreferencesKey.CD_DATA_NUMBER_WAY, 16);
    store.setDefault(ShimPreferencesKey.CD_DATA_LINE_SIZE, 128);
    store.setDefault(ShimPreferencesKey.CD_DATA_LOCK_DOWN_TYPE, LockDownType.LINE.ordinal());
    store.setDefault(ShimPreferencesKey.CD_INSTRUCTION_CACHE_COHERENCY, CacheCoherencyType.SOFT.ordinal());
    store.setDefault(ShimPreferencesKey.CD_INSTRUCTION_CACHE_SIZE, 64);
    store.setDefault(ShimPreferencesKey.CD_INSTRUCTION_CACHE_SIZE_UNIT, SizeUnitType.KI_B.ordinal());
    store.setDefault(ShimPreferencesKey.CD_INSTRUCTION_NUMBER_WAY, 16);
    store.setDefault(ShimPreferencesKey.CD_INSTRUCTION_LINE_SIZE, 128);
    store.setDefault(ShimPreferencesKey.CD_INSTRUCTION_LOCK_DOWN_TYPE, LockDownType.LINE.ordinal());

    // -------------------------------------------------
    // Shim_WizardPage_AccessType
    store.setDefault(ShimPreferencesKey.AT_NAME, "AT");
    store.setDefault(ShimPreferencesKey.AT_CHECK_R, true);
    store.setDefault(ShimPreferencesKey.AT_CHECK_W, true);
    store.setDefault(ShimPreferencesKey.AT_CHECK_RW, false);
    store.setDefault(ShimPreferencesKey.AT_CHECK_RWX, false);
    store.setDefault(ShimPreferencesKey.AT_CHECK_RX, false);
    store.setDefault(ShimPreferencesKey.AT_CHECK_X, false);
    store.setDefault(ShimPreferencesKey.AT_ACCESS_BYTE_SIZE, "4,8");
    store.setDefault(ShimPreferencesKey.AT_NUMBER_BURST, 8);

    // -------------------------------------------------
    // Shim_WizardPage_Performance
    store.setDefault(ShimPreferencesKey.P_LATENCY_BEST, 10.0);
    store.setDefault(ShimPreferencesKey.P_LATENCY_TYPICAL, 10.0);
    store.setDefault(ShimPreferencesKey.P_LATENCY_WORST, 10.0);
    store.setDefault(ShimPreferencesKey.P_PITCH_BEST, 10.0);
    store.setDefault(ShimPreferencesKey.P_PITCH_TYPICAL, 10.0);
    store.setDefault(ShimPreferencesKey.P_PITCH_WORST, 10.0);

    // -------------------------------------------------
    // save preferences which you input in the wizard.
    store.setDefault(ShimPreferencesKey.WIZ_CHECK_ALWAYS, false);
    store.setDefault(ShimPreferencesKey.WIZ_CHECK_ON_REQUEST, true);
    store.setDefault(ShimPreferencesKey.WIZ_CHECK_NEVER, false);
}

From source file:org.polymap.service.ui.OwsPropertiesPage.java

License:Open Source License

protected void createFieldEditors() {
    IPreferenceStore store = new PreferenceStore() {
        public boolean needsSaving() {
            return false;
        }//from   w  ww  .ja  v  a 2 s  . c  o  m
    };
    setPreferenceStore(store);
    store.setDefault("WMS", providedService.isEnabled());
    store.setDefault("WFS", false);
    store.setDefault(IProvidedService.PROP_PATHSPEC, providedService.getPathSpec());
    store.setDefault(IProvidedService.PROP_SRS, StringUtils.join(providedService.getSRS(), ", "));

    Composite pathParent = getFieldEditorParent();
    Composite uriParent = getFieldEditorParent();

    // URI
    final StringFieldEditor uriField = new StringFieldEditor("URI", "URI*", uriParent);
    addField(uriField);
    uriField.setStringValue(ServicesPlugin.createServiceUrl(providedService.getPathSpec()));
    uriField.getTextControl(uriParent).setToolTipText("The complete URI of this service.");
    uriField.setEnabled(false, uriParent);

    // service path
    StringFieldEditor pathField = new StringFieldEditor(IProvidedService.PROP_PATHSPEC, "Service Name/Pfad",
            pathParent) {

        protected boolean doCheckState() {
            String value = getStringValue();
            uriField.setStringValue(ServicesPlugin.createServiceUrl(value));

            String validName = ServicesPlugin.validPathSpec(value);
            if (!value.equals(validName)) {
                setErrorMessage("Der Name darf nur Buchstaben, Zahlen oder '-', '_', '.' enthalten.");
                return false;
            }
            return true;
        }
    };
    addField(pathField);

    // WMS
    BooleanFieldEditor wmsField = new BooleanFieldEditor("WMS", "WMS aktivieren", getFieldEditorParent());
    addField(wmsField);

    // WFS
    BooleanFieldEditor wfsField = new BooleanFieldEditor("WFS", "WFS aktivieren", getFieldEditorParent());
    //        wfsField.setEnabled( false, getFieldEditorParent() );

    // SRS
    //        Composite parent = getFieldEditorParent();
    //        StringFieldEditor srsField = new StringFieldEditor(
    //                IProvidedService.PROP_SRS, "Koordinatensysteme*", parent );
    //        srsField.getLabelControl( parent )
    //                .setToolTipText( "Komma-separierte Liste mit EPSG-Codes: EPSG:31468, EPSG:4326, ..." );
    //        addField( srsField );

    // load default values
    performDefaults();
}

From source file:org.python.pydev.editor.codecompletion.revisited.CodeCompletionTestsBase.java

License:Open Source License

public PreferenceStore getPreferences() {
    if (this.preferences == null) {
        this.preferences = new PreferenceStore();
    }/*from   w  w  w . j a  v  a2 s .  c om*/
    return this.preferences;
}

From source file:org.python.pydev.editor.codefolding.CodeFoldingSetterTest.java

License:Open Source License

@Override
public void setUp() throws Exception {
    super.setUp();
    DEBUG = false;//from   w ww .j a  va2s. c  o m
    preferences = new PreferenceStore();//PydevPlugin.getDefault().getPluginPreferences();
    CodeFoldingSetter.setPreferences(preferences);
    setAllOptions(false);
}

From source file:org.python.pydev.editor.preferences.PydevEditorPrefs.java

License:Open Source License

public PydevEditorPrefs() {
    setDescription(// w w  w.  j a  v a 2  s. c o m
            "PyDev editor appearance settings:\n\nNote: PyDev ignores the 'Insert spaces for tabs' in the general settings.");
    setPreferenceStore(PydevPlugin.getDefault().getPreferenceStore());

    fOverlayStore = createOverlayStore();
    localStore = new PreferenceStore();
}

From source file:org.python.pydev.editor.PyCodeScannerTest.java

License:Open Source License

private PyCodeScanner createCodeScanner() {
    PreferenceStore store = new PreferenceStore();
    store.putValue(PydevEditorPrefs.KEYWORD_COLOR, StringConverter.asString(new RGB(1, 0, 0)));
    store.putValue(PydevEditorPrefs.SELF_COLOR, StringConverter.asString(new RGB(2, 0, 0)));
    store.putValue(PydevEditorPrefs.CODE_COLOR, StringConverter.asString(new RGB(3, 0, 0)));
    store.putValue(PydevEditorPrefs.DECORATOR_COLOR, StringConverter.asString(new RGB(4, 0, 0)));
    store.putValue(PydevEditorPrefs.NUMBER_COLOR, StringConverter.asString(new RGB(5, 0, 0)));
    store.putValue(PydevEditorPrefs.FUNC_NAME_COLOR, StringConverter.asString(new RGB(6, 0, 0)));
    store.putValue(PydevEditorPrefs.CLASS_NAME_COLOR, StringConverter.asString(new RGB(7, 0, 0)));
    store.putValue(PydevEditorPrefs.OPERATORS_COLOR, StringConverter.asString(new RGB(8, 0, 0)));
    store.putValue(PydevEditorPrefs.PARENS_COLOR, StringConverter.asString(new RGB(9, 0, 0)));

    this.colorCache = new ColorAndStyleCache(store);
    PyCodeScanner scanner = new PyCodeScanner(colorCache);
    return scanner;
}

From source file:org.python.pydev.editor.StyledTextForShowingCodeFactory.java

License:Open Source License

/**
 * @return a styled text that can be used to show code with the colors based on the color cache received.
 *///from  w w  w .j a  v  a 2 s  . c  o  m
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();

    PydevPrefs.getChainedPrefStore().addPropertyChangeListener(this);

    return styledText;
}

From source file:org.python.pydev.parser.PyParser.java

License:Open Source License

/**
 * Should only be called for testing. Does not register as a thread.
 *//*from   w  ww  .ja  v a 2 s  .com*/
public PyParser(IGrammarVersionProvider grammarVersionProvider) {
    super(PyParserManager.getPyParserManager(new PreferenceStore()));
    if (grammarVersionProvider == null) {
        grammarVersionProvider = new IGrammarVersionProvider() {
            public int getGrammarVersion() {
                return IPythonNature.LATEST_GRAMMAR_VERSION;
            }
        };
    }
    this.grammarVersionProvider = grammarVersionProvider;
}

From source file:org.python.pydev.parser.PyParserEditorIntegrationTest.java

License:Open Source License

public void testIntegration() throws Exception {
    PreferenceStore preferences = new PreferenceStore();
    PyParserManager pyParserManager = PyParserManager.getPyParserManager(preferences);

    Document doc = new Document();
    PyEditStub pyEdit = new PyEditStub(doc, new PydevFileEditorInputStub());
    pyParserManager.attachParserTo(pyEdit);
    checkParserChanged(pyEdit, 1);/*from w w  w  .j a  v  a  2 s.c  o  m*/

    doc.replace(0, 0, "\r\ntest");
    checkParserChanged(pyEdit, 2);

    pyParserManager.attachParserTo(pyEdit);
    checkParserChanged(pyEdit, 3);

    doc.replace(0, 0, "\r\ntest"); //after this change, only 1 reparse should be asked, as the editor and doc is the same
    checkParserChanged(pyEdit, 4);

    pyParserManager.notifyEditorDisposed(pyEdit);
    doc.replace(0, 0, "\r\ntest"); //after this change, only 1 reparse should be asked, as the editor and doc is the same
    waitABit();
    assertEquals(4, pyEdit.parserChanged);

    assertEquals(0, pyParserManager.getParsers().size());
}