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

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

Introduction

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

Prototype

void setValue(String name, boolean value);

Source Link

Document

Sets the current value of the boolean-valued preference with the given name.

Usage

From source file:com.mentor.nucleus.bp.als.oal.test.TestSelectWhere.java

License:Open Source License

public void testSelectAnyFromWhereSelectedIOp1() throws RecognitionException, TokenStreamException {
    IPreferenceStore store = CorePlugin.getDefault().getPreferenceStore();
    store.setValue(BridgePointPreferencesStore.ALLOW_OPERATIONS_IN_WHERE, false);

    String act = "select any My_Class from instances of The_Class where (selected.get_A() == 0);"; //$NON-NLS-1$
    String x = parseAction(act, ACTIVITY_TYPE_FUNC, TEST_OAL);
    String lines[] = x.split("\n");//$NON-NLS-1$
    assertEquals(":1:71-71: Operation calls are not allowed inside a where condition.", lines[0]); //$NON-NLS-1$
    assertEquals(":1:77-77: Expression within Select Where clause does not yield boolean result", lines[1]); //$NON-NLS-1$
    assertEquals("line 1:79: expecting Semicolon, found 'null'", lines[2]); //$NON-NLS-1$
    validateBlkStmtVal(1, 0, 0);/*  w ww. jav  a  2 s  . co  m*/
    Variable_c[] vars = Variable_c.VariableInstances(modelRoot);
    assertEquals(0, vars.length);
}

From source file:com.mentor.nucleus.bp.als.oal.test.TestSelectWhere.java

License:Open Source License

public void testSelectAnyFromWhereSelectedIOp1Allowed() throws RecognitionException, TokenStreamException {
    IPreferenceStore store = CorePlugin.getDefault().getPreferenceStore();
    store.setValue(BridgePointPreferencesStore.ALLOW_OPERATIONS_IN_WHERE, true);

    /* NOTE: See this file's history for why some tests are omitted.*/
}

From source file:com.mentor.nucleus.bp.als.oal.test.TestSelectWhere_Generics.java

License:Open Source License

public void testSelectAnyFromWhereSelectedIOp1Allowed() throws RecognitionException, TokenStreamException {
    IPreferenceStore store = CorePlugin.getDefault().getPreferenceStore();
    store.setValue(BridgePointPreferencesStore.ALLOW_OPERATIONS_IN_WHERE, true);

    String act = "select any My_Class from instances of The_Class where (selected.get_A() == 0);"; //$NON-NLS-1$
    String x = parseAction(act, ACTIVITY_TYPE_FUNC, TEST_OAL);
    assertEquals("", x); //$NON-NLS-1$
}

From source file:com.mentor.nucleus.bp.als.oal.test.TestSelect_Generics.java

License:Open Source License

public TestSelect_Generics() {
    super();/*from w w w . j  a  v a2s. com*/
    IPreferenceStore store = CorePlugin.getDefault().getPreferenceStore();
    store.setValue(BridgePointPreferencesStore.ALLOW_OPERATIONS_IN_WHERE, true);
}

From source file:com.mentor.nucleus.bp.core.common.BridgePointPreferencesStore.java

License:Open Source License

public void saveModel(IPreferenceStore store, IPreferenceModel model) {
    if (!(model instanceof BridgePointPreferencesModel)) {
        throw new IllegalArgumentException("Cannot save instance of " + model.getClass().getName());
    }//from w w w .  j av a2 s .co  m

    BridgePointPreferencesModel prefs = (BridgePointPreferencesModel) model;

    store.setValue(PARSE_ALL_ON_RESOURCE_CHANGE, prefs.parseAllOnResourceChange);
    store.setValue(ALLOW_INT_TO_REAL_PROMOTION, prefs.allowIntToRealPromotion);
    store.setValue(ALLOW_REAL_TO_INT_COERCION, prefs.allowRealToIntCoercion);
    store.setValue(ALLOW_IMPLICIT_COMPONENT_ADDRESSING, prefs.allowImplicitComponentAddressing);
    store.setValue(ALLOW_OPERATIONS_IN_WHERE, prefs.allowOperationsInWhere);
    store.setValue(ENABLE_ERROR_FOR_EMPTY_SYNCHRONOUS_MESSAGE, prefs.enableErrorForEmptySynchronousMessage);
    store.setValue(ENABLE_ERROR_FOR_EMPTY_SYNCHRONOUS_MESSAGE_REALIZED,
            prefs.enableErrorForEmptySynchronousMessageRealized);
    store.setValue(DISABLE_GRADIENTS, prefs.disableGradients);
    store.setValue(INVERT_GRADIENTS, prefs.invertGradients);
    store.setValue(GRADIENT_BASE_COLOR, prefs.gradientBaseColor);
    store.setValue(EXPORT_OAL, prefs.exportOAL);
    store.setValue(EXPORT_GRAPHICS, prefs.exportGraphics);
    store.setValue(MESSAGE_DIRECTION, prefs.messageDirection);
    store.setValue(SHOW_TRANSITION_ACTIONS, prefs.showTransitionActions);
    store.setValue(SHOW_EVENT_PARAMETERS, prefs.showEventParameters);
    store.setValue(ENABLE_FIXED_LENGTH_ARRAYS, prefs.enableFLAs);
    store.setValue(ENABLE_DYNAMICALLY_SIZED_ARRAYS, prefs.enableDSAs);
    store.setValue(ENABLE_DETERMINISTIC_VERIFIER, prefs.enableDeterministicVerifier);
    store.setValue(ENABLE_INSTANCE_REFERENCES, prefs.enableInstanceReferences);

    store.setValue(ENABLE_VERIFIER_AUDIT, prefs.enableVerifierAudit);
    store.setValue(ENABLE_SELECT_AUDIT, prefs.enableSelectAudit);
    store.setValue(ENABLE_RELATE_AUDIT, prefs.enableRelateAudit);
    store.setValue(ENABLE_UNRELATE_AUDIT, prefs.enableUnrelateAudit);
    store.setValue(ENABLE_DELETE_AUDIT, prefs.enableDeleteAudit);
    store.setValue(START_UP_TIME, prefs.startUpTime);

    store.setValue(SHOW_GRID, prefs.showGrid);
    store.setValue(SNAP_TO_GRID, prefs.snapToGrid);
    store.setValue(GRID_SPACING, prefs.gridSpacing);
    store.setValue(DEFAULT_ROUTING_STYLE, prefs.defaultRoutingStyle);
    store.setValue(EMIT_RTO_DATA, prefs.emitRTOData);
    store.setValue(SHOW_SYNC_DELETION_DIALOG, prefs.showReferenceRemovalDialog);
    store.setValue(SHOW_SYNC_REPORT, prefs.showReferenceSyncReport);
    store.setValue(USE_DEFAULT_NAME_FOR_CREATION, prefs.useDefaultNamesForNewModelElements);
}

From source file:com.mentor.nucleus.bp.core.CorePlugin.java

License:Open Source License

/**
 * Sets 'parse all on resource change' to "Always"
 * Used by unit tests/*from www.j  a  va  2  s  .co  m*/
 *
 */
public static void enableParseAllOnResourceChange() {
    IPreferenceStore store = getDefault().getPreferenceStore();
    store.setValue(BridgePointPreferencesStore.PARSE_ALL_ON_RESOURCE_CHANGE, MessageDialogWithToggle.ALWAYS);
}

From source file:com.mentor.nucleus.bp.core.CorePlugin.java

License:Open Source License

/**
 * Sets 'parse all on resource change' to "Never"
 * Used by unit tests/*  w ww .j  a v  a 2s. c  o m*/
 *
 */
public static void disableParseAllOnResourceChange() {
    IPreferenceStore store = getDefault().getPreferenceStore();
    store.setValue(BridgePointPreferencesStore.PARSE_ALL_ON_RESOURCE_CHANGE, MessageDialogWithToggle.NEVER);
}

From source file:com.mentor.nucleus.bp.debug.engine.VerifierAuditTest.java

License:Open Source License

public void testVerifierAudit() throws InterruptedException {
    IPreferenceStore store = CorePlugin.getDefault().getPreferenceStore();
    store.setValue(BridgePointPreferencesStore.ENABLE_VERIFIER_AUDIT, true);
    store.setValue(BridgePointPreferencesStore.ENABLE_SELECT_AUDIT, 0);
    store.setValue(BridgePointPreferencesStore.ENABLE_RELATE_AUDIT, 0);
    store.setValue(BridgePointPreferencesStore.ENABLE_UNRELATE_AUDIT, 0);
    store.setValue(BridgePointPreferencesStore.ENABLE_DELETE_AUDIT, 0);
    Component_c component = Component_c
            .getOneC_COnR8001(PackageableElement_c.getManyPE_PEsOnR8000(Package_c.getOneEP_PKGOnR1405(m_sys)));
    assertNotNull(component);/*from   w ww .  j  av a2  s .com*/

    // launch the domain
    DebugUITestUtilities.setLogActivityAndLaunchForElement(component, m_bp_tree.getControl().getMenu(),
            m_sys.getName());

    Function_c testSixCases = Function_c.getOneS_SYNCOnR8001(
            PackageableElement_c.getManyPE_PEsOnR8000(
                    Package_c.getManyEP_PKGsOnR8001(PackageableElement_c.getManyPE_PEsOnR8003(component))),
            new ClassQueryInterface_c() {

                public boolean evaluate(Object candidate) {
                    return ((Function_c) candidate).getName().equals("testSixCases");
                }

            });
    assertNotNull(testSixCases);

    openPerspectiveAndView("com.mentor.nucleus.bp.debug.ui.DebugPerspective",
            BridgePointPerspective.ID_MGC_BP_EXPLORER);

    BPDebugUtils.executeElement(testSixCases);

    DebugUITestUtilities.waitForExecution();
    ComponentInstance_c engine = ComponentInstance_c.getOneI_EXEOnR2955(component);
    assertNotNull(engine);

    // wait for the execution to complete
    DebugUITestUtilities.waitForBPThreads(m_sys);

    // compare the trace
    File expectedResults = new File(m_workspace_path + "expected_results/verifier/Ignore_testSixCases.result");
    String expected_results = TestUtil.getTextFileContents(expectedResults);
    // get the text representation of the debug tree
    String actual_results = DebugUITestUtilities.getConsoleText(expected_results);
    assertEquals(expected_results, actual_results);

}

From source file:com.mentor.nucleus.bp.debug.engine.VerifierAuditTest.java

License:Open Source License

public void testVerifierAudit_Warning() throws InterruptedException {
    IPreferenceStore store = CorePlugin.getDefault().getPreferenceStore();
    store.setValue(BridgePointPreferencesStore.ENABLE_VERIFIER_AUDIT, true);
    store.setValue(BridgePointPreferencesStore.ENABLE_SELECT_AUDIT, 1);
    store.setValue(BridgePointPreferencesStore.ENABLE_RELATE_AUDIT, 1);
    store.setValue(BridgePointPreferencesStore.ENABLE_UNRELATE_AUDIT, 1);
    store.setValue(BridgePointPreferencesStore.ENABLE_DELETE_AUDIT, 1);

    Component_c component = Component_c
            .getOneC_COnR8001(PackageableElement_c.getManyPE_PEsOnR8000(Package_c.getOneEP_PKGOnR1401(m_sys)));
    assertNotNull(component);/* ww  w  .java 2s  . c om*/

    // launch the domain
    DebugUITestUtilities.setLogActivityAndLaunchForElement(component, m_bp_tree.getControl().getMenu(),
            m_sys.getName());

    Function_c testSixCases = Function_c.getOneS_SYNCOnR8001(
            PackageableElement_c.getManyPE_PEsOnR8000(
                    Package_c.getManyEP_PKGsOnR8001(PackageableElement_c.getManyPE_PEsOnR8003(component))),
            new ClassQueryInterface_c() {

                public boolean evaluate(Object candidate) {
                    return ((Function_c) candidate).getName().equals("testSixCases");
                }

            });

    assertNotNull(testSixCases);

    openPerspectiveAndView("com.mentor.nucleus.bp.debug.ui.DebugPerspective",
            BridgePointPerspective.ID_MGC_BP_EXPLORER);

    BPDebugUtils.executeElement(testSixCases);

    DebugUITestUtilities.waitForExecution();
    ComponentInstance_c engine = ComponentInstance_c.getOneI_EXEOnR2955(component);
    assertNotNull(engine);

    // wait for the execution to complete
    DebugUITestUtilities.waitForBPThreads(m_sys);

    // compare the trace
    File expectedResults = new File(m_workspace_path + "expected_results/verifier/Warning_testSixCases.result");
    String expected_results = TestUtil.getTextFileContents(expectedResults);
    // get the text representation of the debug tree
    String actual_results = DebugUITestUtilities.getConsoleText(expected_results);
    assertEquals(expected_results, actual_results);

}

From source file:com.mentor.nucleus.bp.debug.engine.VerifierAuditTest.java

License:Open Source License

public void testVerifierAudit_Fatal() throws InterruptedException {
    IPreferenceStore store = CorePlugin.getDefault().getPreferenceStore();
    store.setValue(BridgePointPreferencesStore.ENABLE_VERIFIER_AUDIT, true);
    store.setValue(BridgePointPreferencesStore.ENABLE_SELECT_AUDIT, 2);
    store.setValue(BridgePointPreferencesStore.ENABLE_RELATE_AUDIT, 2);
    store.setValue(BridgePointPreferencesStore.ENABLE_UNRELATE_AUDIT, 2);
    store.setValue(BridgePointPreferencesStore.ENABLE_DELETE_AUDIT, 2);
    store.getBoolean("mine");

    IPreferenceStore Console_store = DebugUIPlugin.getDefault().getPreferenceStore();

    Component_c component = Component_c
            .getOneC_COnR8001(PackageableElement_c.getManyPE_PEsOnR8000(Package_c.getOneEP_PKGOnR1401(m_sys)));
    assertNotNull(component);/*from   ww  w  .  j ava  2 s  . c  om*/

    // launch the domain
    DebugUITestUtilities.setLogActivityAndLaunchForElement(component, m_bp_tree.getControl().getMenu(),
            m_sys.getName());

    Function_c testSixCases = Function_c.getOneS_SYNCOnR8001(
            PackageableElement_c.getManyPE_PEsOnR8000(
                    Package_c.getManyEP_PKGsOnR8001(PackageableElement_c.getManyPE_PEsOnR8003(component))),
            new ClassQueryInterface_c() {

                public boolean evaluate(Object candidate) {
                    return ((Function_c) candidate).getName().equals("testSixCases");
                }

            });

    assertNotNull(testSixCases);

    openPerspectiveAndView("com.mentor.nucleus.bp.debug.ui.DebugPerspective",
            BridgePointPerspective.ID_MGC_BP_EXPLORER);

    BPDebugUtils.executeElement(testSixCases);

    DebugUITestUtilities.waitForExecution();
    ComponentInstance_c engine = ComponentInstance_c.getOneI_EXEOnR2955(component);
    assertNotNull(engine);
    DebugUITestUtilities.stepOver(engine, 10);
    // wait for the execution to complete
    DebugUITestUtilities.waitForBPThreads(m_sys);

    // compare the trace

    String fileName = m_workspace_path + "expected_results/verifier/Fatal_testSixCases.result";

    IPath expected_path = new Path(fileName);
    File expected_fh = expected_path.toFile();

    String expected_results = TestUtil.getTextFileContents(expected_fh);
    // get the text representation of the debug tree
    String actual_results = DebugUITestUtilities.getConsoleText(expected_results);

    String regex = "\r\n";
    String regex1 = "\n";

    String replacement = "\n";

    expected_results = expected_results.replaceAll(regex, replacement);
    expected_results = expected_results.replaceAll(regex1, replacement);

    actual_results = actual_results.replaceAll(regex, replacement);
    actual_results = actual_results.replaceAll(regex1, replacement);

    assertEquals(expected_results, actual_results);

}