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

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

Introduction

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

Prototype

@Override
    public String getString(String name) 

Source Link

Usage

From source file:org.eclipse.titan.designer.properties.pages.PlatformSpecificLibrariesOptionsPage.java

License:Open Source License

@Override
public boolean evaluatePropertyStore(final IProject project, final PreferenceStore tempStorage) {
    String actualValue = ResourceUtils.getPersistentProperty(project, ProjectBuildPropertyData.QUALIFIER,
            platform + PlatformSpecificLibrariesOptionsData.SPECIFIC_LIBRARIES_PROPERTY);
    String copyValue = tempStorage
            .getString(platform + PlatformSpecificLibrariesOptionsData.SPECIFIC_LIBRARIES_PROPERTY);
    return (actualValue != null && !actualValue.equals(copyValue))
            || (actualValue == null && copyValue == null);

}

From source file:org.eclipse.titan.designer.properties.pages.PreprocessorIncludedOptionsPage.java

License:Open Source License

@Override
public boolean evaluatePropertyStore(final IProject project, final PreferenceStore tempStorage) {
    String property = preprocessor ? PreprocessorIncludedOptionsData.TTCN3_PREPROCESSOR_INCLUDES_PROPERTY
            : PreprocessorIncludedOptionsData.PREPROCESSOR_INCLUDES_PROPERTY;
    String actualValue = null;//from ww w.  ja v  a 2 s. c o m
    String copyValue = null;
    try {
        actualValue = project
                .getPersistentProperty(new QualifiedName(ProjectBuildPropertyData.QUALIFIER, property));
    } catch (CoreException ce) {
        ErrorReporter.logExceptionStackTrace(ce);
    }
    copyValue = tempStorage.getString(property);
    return ((actualValue != null && !actualValue.equals(copyValue))
            || (actualValue == null && copyValue == null));

}

From source file:org.eclipse.titan.designer.properties.pages.PreprocessorSymbolsOptionsPage.java

License:Open Source License

@Override
public boolean evaluatePropertyStore(final IProject project, final PreferenceStore tempStorage) {
    String definesProperty = ttcn3symbols ? PreprocessorSymbolsOptionsData.TTCN3_PREPROCESSOR_DEFINES_PROPERTY
            : PreprocessorSymbolsOptionsData.PREPROCESSOR_DEFINES_PROPERTY;
    String undefinesProperty = ttcn3symbols
            ? PreprocessorSymbolsOptionsData.TTCN3_PREPROCESSOR_UNDEFINES_PROPERTY
            : PreprocessorSymbolsOptionsData.PREPROCESSOR_UNDEFINES_PROPERTY;
    boolean result = false;
    String actualValue = null;/*from w  w w. java 2 s  . c  om*/
    String copyValue = null;
    try {
        actualValue = project
                .getPersistentProperty(new QualifiedName(ProjectBuildPropertyData.QUALIFIER, definesProperty));
        copyValue = tempStorage.getString(definesProperty);
        result |= ((actualValue != null && !actualValue.equals(copyValue))
                || (actualValue == null && copyValue == null));

        actualValue = project.getPersistentProperty(
                new QualifiedName(ProjectBuildPropertyData.QUALIFIER, undefinesProperty));
        copyValue = tempStorage.getString(undefinesProperty);
        result |= ((actualValue != null && !actualValue.equals(copyValue))
                || (actualValue == null && copyValue == null));
    } catch (CoreException ce) {
        ErrorReporter.logExceptionStackTrace(ce);
    }

    if (result && ttcn3symbols && Platform.getPreferencesService().getBoolean(
            ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.USEONTHEFLYPARSING, true, null)) {
        GlobalParser.getProjectSourceParser(project).clearSemanticInformation();
        GlobalParser.getProjectSourceParser(project).analyzeAll();
    }

    return result;
}

From source file:org.eclipse.titan.designer.properties.pages.TITANFlagsOptionsPage.java

License:Open Source License

@Override
public boolean evaluatePropertyStore(final IProject project, final PreferenceStore tempStorage) {
    String actualValue = null;//  ww w.ja  v  a 2s  . c om
    String copyValue = null;
    boolean result = false;
    for (int i = 0; i < TITANFlagsOptionsData.PROPERTIES.length; i++) {
        try {
            actualValue = project.getPersistentProperty(
                    new QualifiedName(ProjectBuildPropertyData.QUALIFIER, TITANFlagsOptionsData.PROPERTIES[i]));
            copyValue = tempStorage.getString(TITANFlagsOptionsData.PROPERTIES[i]);
            result |= ((actualValue != null && !actualValue.equals(copyValue))
                    || (actualValue == null && copyValue == null));
            if (result) {
                return true;
            }
        } catch (CoreException e) {
            ErrorReporter.logExceptionStackTrace(e);
            result = true;
        }
    }

    return result;
}

From source file:org.eclipse.titan.designer.properties.pages.TTCN3PreprocessorOptionsPage.java

License:Open Source License

@Override
public boolean evaluatePropertyStore(final IProject project, final PreferenceStore tempStorage) {
    String actualValue = null;/* ww  w.j a  va2  s.  c  o  m*/
    String copyValue = null;
    try {
        actualValue = project.getPersistentProperty(new QualifiedName(ProjectBuildPropertyData.QUALIFIER,
                TTCN3PreprocessorOptionsData.TTCN3_PREPROCESSOR_PROPERTY));
    } catch (CoreException ce) {
        ErrorReporter.logExceptionStackTrace(ce);
    }
    copyValue = tempStorage.getString(TTCN3PreprocessorOptionsData.TTCN3_PREPROCESSOR_PROPERTY);
    return ((actualValue != null && !actualValue.equals(copyValue))
            || (actualValue == null && copyValue == null));

}

From source file:org.eclipsetrader.ui.internal.application.Activator.java

License:Open Source License

private void migrateSettings() throws Exception {
    IPath workspacePath = Platform.getLocation().append(".metadata").append(".plugins")
            .append("org.eclipse.core.runtime").append(".settings");

    File preferencesFile = workspacePath.append("org.eclipsetrader.ui.prefs").toFile();
    PreferenceStore preferences = new PreferenceStore(preferencesFile.toString());
    if (preferencesFile.exists()) {
        preferences.load();//from  w ww .  j  a v a 2s  . c  o  m
    }

    File legacyPreferencesFile = workspacePath.append("org.eclipsetrader.ui.charts.prefs").toFile();
    if (legacyPreferencesFile.exists()) {
        PreferenceStore legacyPreferences = new PreferenceStore(legacyPreferencesFile.toString());
        legacyPreferences.load();
        for (String name : legacyPreferences.preferenceNames()) {
            preferences.putValue(name, legacyPreferences.getString(name));
        }
        legacyPreferencesFile.delete();
    }

    legacyPreferencesFile = workspacePath.append("org.eclipsetrader.ui.trading.prefs").toFile();
    if (legacyPreferencesFile.exists()) {
        PreferenceStore legacyPreferences = new PreferenceStore(legacyPreferencesFile.toString());
        legacyPreferences.load();
        for (String name : legacyPreferences.preferenceNames()) {
            preferences.putValue(name, legacyPreferences.getString(name));
        }
        legacyPreferencesFile.delete();
    }

    legacyPreferencesFile = workspacePath.append("org.eclipsetrader.ui.ats.prefs").toFile();
    if (legacyPreferencesFile.exists()) {
        PreferenceStore legacyPreferences = new PreferenceStore(legacyPreferencesFile.toString());
        legacyPreferences.load();
        for (String name : legacyPreferences.preferenceNames()) {
            preferences.putValue(name, legacyPreferences.getString(name));
        }
        legacyPreferencesFile.delete();
    }

    if (!preferencesFile.exists()) {
        preferencesFile.getParentFile().mkdirs();
    }
    preferences.save();
}

From source file:org.eclipsetrader.ui.internal.charts.DataImportJobTest.java

License:Open Source License

public void testGetDefaultStartDate() throws Exception {
    PreferenceStore preferences = new PreferenceStore();
    preferences.setValue(UIActivator.PREFS_INITIAL_BACKFILL_METHOD, 0);
    preferences.setValue(UIActivator.PREFS_INITIAL_BACKFILL_START_DATE, "20010512");

    Date expectedDate = new SimpleDateFormat("yyyyMMdd")
            .parse(preferences.getString(UIActivator.PREFS_INITIAL_BACKFILL_START_DATE));

    DataImportJob job = new DataImportJob(new Security("Test", null), 0, null, null, null);
    job.preferences = preferences;/*from w ww  .  java  2  s  .c  o m*/

    assertEquals(expectedDate, job.getDefaultStartDate());
}

From source file:org.eclipsetrader.ui.internal.charts.DefaultsPageTest.java

License:Open Source License

public void testSelectStartDateFromPreferences() throws Exception {
    PreferenceStore preferences = new PreferenceStore();
    preferences.setValue(UIActivator.PREFS_INITIAL_BACKFILL_START_DATE, "20090620");

    Date expectedDate = new SimpleDateFormat("yyyyMMdd")
            .parse(preferences.getString(UIActivator.PREFS_INITIAL_BACKFILL_START_DATE));

    DefaultsPage page = new DefaultsPage();
    page.setPreferenceStore(preferences);
    page.createContents(shell);//from w  w w .java2 s. co m

    page.performDefaults();

    assertEquals(expectedDate, page.startDate.getSelection());
}

From source file:org.eclipsetrader.ui.internal.charts.DefaultsPageTest.java

License:Open Source License

public void testSaveStartDate() throws Exception {
    PreferenceStore preferences = new PreferenceStore();

    DefaultsPage page = new DefaultsPage();
    page.setPreferenceStore(preferences);
    page.createContents(shell);//from w  w w  .  j av a2s . c  o m

    page.startDate.setSelection(new SimpleDateFormat("yyyyMMdd").parse("20090620"));
    page.performOk();

    assertEquals("20090620", preferences.getString(UIActivator.PREFS_INITIAL_BACKFILL_START_DATE));
}

From source file:org.jamon.eclipse.editor.preferences.PreferencesInitializer.java

License:Mozilla Public License

private void loadFromStandardPreferences(IPreferenceStore preferenceStore) {
    InputStream is = getClass().getResourceAsStream("jamon.syntax.default.preferences");
    if (is != null) {
        try {//  www. j  a v  a2s.  com
            PreferenceStore ps = new PreferenceStore();
            ps.load(is);
            for (String name : ps.preferenceNames()) {
                preferenceStore.setDefault(name, ps.getString(name));
            }
        } catch (IOException e) {
            EclipseUtils.logError(e);
        } finally {
            EclipseUtils.closeQuiety(is);
        }
    }
}