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

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

Introduction

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

Prototype

@Override
    public void setValue(String name, boolean value) 

Source Link

Usage

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

License:Open Source License

@Override
public void copyPropertyStore(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;
    String temp = null;//from www  . j a v a  2  s.c om
    try {
        temp = project
                .getPersistentProperty(new QualifiedName(ProjectBuildPropertyData.QUALIFIER, definesProperty));
        if (temp != null) {
            tempStorage.setValue(definesProperty, temp);
        }

        temp = project.getPersistentProperty(
                new QualifiedName(ProjectBuildPropertyData.QUALIFIER, undefinesProperty));
        if (temp != null) {
            tempStorage.setValue(undefinesProperty, temp);
        }
    } catch (CoreException ce) {
        ErrorReporter.logExceptionStackTrace(ce);
    }

}

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

License:Open Source License

@Override
public void copyPropertyStore(final IProject project, final PreferenceStore tempStorage) {
    String temp = null;//from w  ww.  j a va  2s .c  o  m
    for (int i = 0; i < TITANFlagsOptionsData.PROPERTIES.length; i++) {
        try {
            temp = project.getPersistentProperty(
                    new QualifiedName(ProjectBuildPropertyData.QUALIFIER, TITANFlagsOptionsData.PROPERTIES[i]));
            if (temp != null) {
                tempStorage.setValue(TITANFlagsOptionsData.PROPERTIES[i], temp);
            }
        } catch (CoreException ce) {
            ErrorReporter.logExceptionStackTrace(ce);
        }
    }
}

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

License:Open Source License

@Override
public void copyPropertyStore(final IProject project, final PreferenceStore tempStorage) {
    String temp = null;/* www .j  ava  2 s .c om*/
    try {
        temp = project.getPersistentProperty(new QualifiedName(ProjectBuildPropertyData.QUALIFIER,
                TTCN3PreprocessorOptionsData.TTCN3_PREPROCESSOR_PROPERTY));
    } catch (CoreException ce) {
        ErrorReporter.logExceptionStackTrace(ce);
    }
    if (temp != null) {
        tempStorage.setValue(TTCN3PreprocessorOptionsData.TTCN3_PREPROCESSOR_PROPERTY, temp);
    }
}

From source file:org.eclipse.vjet.eclipse.internal.ui.preferences.formatting.JavaPreview.java

License:Open Source License

/**
 * Create a new Java preview/*from  www .  j av a 2  s  .co m*/
 * @param workingValues
 * @param parent
 */
public JavaPreview(Map workingValues, Composite parent) {
    VjoTextTools tools = VjetUIPlugin.getDefault().getTextTools();
    fPreviewDocument = new Document();
    fWorkingValues = workingValues;
    tools.setupDocumentPartitioner(fPreviewDocument, IJavaScriptPartitions.JAVA_PARTITIONING);

    PreferenceStore prioritizedSettings = new PreferenceStore();
    prioritizedSettings.setValue(VjetPlugin.COMPILER_SOURCE, VjetPlugin.VERSION_1_5);
    prioritizedSettings.setValue(VjetPlugin.COMPILER_COMPLIANCE, VjetPlugin.VERSION_1_5);
    prioritizedSettings.setValue(VjetPlugin.COMPILER_CODEGEN_TARGET_PLATFORM, VjetPlugin.VERSION_1_5);
    prioritizedSettings.setValue(VjetPlugin.COMPILER_PB_ASSERT_IDENTIFIER, VjetPlugin.ERROR);

    IPreferenceStore[] chain = { prioritizedSettings, VjetUIPlugin.getDefault().getPreferenceStore(),
            EditorsUI.getPreferenceStore() };
    fPreferenceStore = new ChainedPreferenceStore(chain);
    fSourceViewer = new JavaSourceViewer(parent, null, null, false,
            SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER, fPreferenceStore);
    fViewerConfiguration = new SimpleJavascriptSourceViewerConfiguration(tools.getColorManager(),
            fPreferenceStore, null, IJavaScriptPartitions.JAVA_PARTITIONING, true);
    fSourceViewer.configure(fViewerConfiguration);
    fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(JFaceResources.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);
}

From source file:org.eclipse.wst.jsdt.internal.ui.preferences.formatter.JavaPreview.java

License:Open Source License

/**
 * Create a new Java preview/*  w  w w.ja v  a  2 s. c  o m*/
 * @param workingValues
 * @param parent
 */
public JavaPreview(Map workingValues, Composite parent) {
    JavaScriptTextTools tools = JavaScriptPlugin.getDefault().getJavaTextTools();
    fPreviewDocument = new Document();
    fWorkingValues = workingValues;
    tools.setupJavaDocumentPartitioner(fPreviewDocument, IJavaScriptPartitions.JAVA_PARTITIONING);

    PreferenceStore prioritizedSettings = new PreferenceStore();
    prioritizedSettings.setValue(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_5);
    prioritizedSettings.setValue(JavaScriptCore.COMPILER_COMPLIANCE, JavaScriptCore.VERSION_1_5);
    prioritizedSettings.setValue(JavaScriptCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaScriptCore.VERSION_1_5);
    prioritizedSettings.setValue(JavaScriptCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaScriptCore.ERROR);

    IPreferenceStore[] chain = { prioritizedSettings,
            JavaScriptPlugin.getDefault().getCombinedPreferenceStore() };
    fPreferenceStore = new ChainedPreferenceStore(chain);
    fSourceViewer = new JavaSourceViewer(parent, null, null, false,
            SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER, fPreferenceStore);
    fViewerConfiguration = new SimpleJavaSourceViewerConfiguration(tools.getColorManager(), fPreferenceStore,
            null, IJavaScriptPartitions.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);
}

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

License:Open Source License

public void testGetDefaultYearsStartDate() throws Exception {
    PreferenceStore preferences = new PreferenceStore();
    preferences.setValue(UIActivator.PREFS_INITIAL_BACKFILL_METHOD, 1);
    preferences.setValue(UIActivator.PREFS_INITIAL_BACKFILL_YEARS, 5);

    Calendar c = Calendar.getInstance();
    c.set(Calendar.MILLISECOND, 0);
    c.add(Calendar.YEAR, -preferences.getInt(UIActivator.PREFS_INITIAL_BACKFILL_YEARS));

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

    assertEquals(c.getTime(), job.getDefaultStartDate());
}

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 . j  av a2 s  .  c o  m*/

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

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

License:Open Source License

public void testSelectBackfillMethodFromPreferences() throws Exception {
    PreferenceStore preferences = new PreferenceStore();
    preferences.setValue(UIActivator.PREFS_INITIAL_BACKFILL_METHOD, 1);

    DefaultsPage page = new DefaultsPage();
    page.setPreferenceStore(preferences);
    page.createContents(shell);/* ww  w .j av a2s . co m*/

    page.performDefaults();

    assertFalse(page.useStartDate.getSelection());
    assertTrue(page.useYears.getSelection());
}

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 . j  av a2 s.  c o m*/

    page.performDefaults();

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

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

License:Open Source License

public void testSelectYearsFromPreferences() throws Exception {
    PreferenceStore preferences = new PreferenceStore();
    preferences.setValue(UIActivator.PREFS_INITIAL_BACKFILL_YEARS, 5);

    DefaultsPage page = new DefaultsPage();
    page.setPreferenceStore(preferences);
    page.createContents(shell);/*  w  ww .j  av  a  2s . com*/

    page.performDefaults();

    assertEquals(5, page.years.getSelection());
}