List of usage examples for org.eclipse.jface.preference IPreferenceStore setValue
void setValue(String name, boolean value);
From source file:com.mentor.nucleus.bp.debug.engine.VerifierAuditTest.java
License:Open Source License
public void testVerifierAudit_runAllTests() 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);//from w w w .j av a 2 s .c om IPreferenceStore Console_store = DebugUIPlugin.getDefault().getPreferenceStore(); Console_store.setValue(IDebugPreferenceConstants.CONSOLE_LIMIT_CONSOLE_OUTPUT, false); Console_store.setValue(IDebugPreferenceConstants.CONSOLE_WRAP, true); Console_store.setValue(IDebugPreferenceConstants.CONSOLE_WIDTH, 150); // launch the domain DebugUITestUtilities.setLogActivityAndLaunchForElement(component, m_bp_tree.getControl().getMenu(), m_sys.getName()); Function_c runAllTests = 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("runAllTests"); } }); assertNotNull(runAllTests); openPerspectiveAndView("com.mentor.nucleus.bp.debug.ui.DebugPerspective", BridgePointPerspective.ID_MGC_BP_EXPLORER); BPDebugUtils.executeElement(runAllTests); DebugUITestUtilities.waitForExecution(); ComponentInstance_c engine = ComponentInstance_c.getOneI_EXEOnR2955(component); assertNotNull(engine); // wait for the execution to complete DebugUITestUtilities.waitForBPThreads(m_sys); DebugUITestUtilities.processDebugEvents(); // wait until we get output that says all tests complete, this should // always occur if not intervention will be required while (!DebugUITestUtilities.getConsoleText().contains("All tests complete")) { while (PlatformUI.getWorkbench().getDisplay().readAndDispatch()) ; } // compare the trace File expectedResults = new File(m_workspace_path + "expected_results/verifier/Warning_runAllTests.result"); String expected_results = TestUtil.getTextFileContents(expectedResults); // 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); }
From source file:com.mentor.nucleus.bp.io.mdl.test.StaleProxyExportTestGenerics.java
License:Open Source License
public void testStaleProxyExport() throws Exception { // Turn off autobuild so the model compiler won't run on this imported project WorkspaceUtil.setAutobuilding(false); // Load from git this.loadProject("watchGenerics"); BaseTest.dispatchEvents(0);//from w w w . j a v a 2s . c om String result = getLogViewResult(""); if (!result.equals("")) { fail(".log file is not empty after import."); } final IProject projectHandle = ResourcesPlugin.getWorkspace().getRoot().getProject("watchGenerics"); projectHandle.close(new NullProgressMonitor()); projectHandle.open(new NullProgressMonitor()); PersistenceManager.getRootComponent(projectHandle).loadComponentAndChildren(new NullProgressMonitor()); assertTrue("Failed to locate the imported project (watchGenerics).", projectHandle != null); String exportFilename = "watch_exportGenerics.xtuml"; BaseTest.ensureFolderExists(m_workspace_path + "actual_results/"); String exportPath = m_workspace_path + "actual_results/" + exportFilename; String expectedResultsPath = m_workspace_path + "expected_results/" + exportFilename; IPreferenceStore store = CorePlugin.getDefault().getPreferenceStore(); store.setValue(BridgePointPreferencesStore.EXPORT_OAL, "always"); //$NON-NLS-1$ SystemModel_c system = SystemModel_c.SystemModelInstance(Ooaofooa.getDefaultInstance(), new ClassQueryInterface_c() { public boolean evaluate(Object candidate) { return ((SystemModel_c) candidate).getName().equals(projectHandle.getProject().getName()); } }); Package_c[] cps = Package_c.getManyEP_PKGsOnR1405(system); Package_c cp = null; for (int i = 0; i < cps.length; i++) { if (cps[i].getName().equalsIgnoreCase("System Library")) { cp = cps[i]; break; } } assertTrue("Failed to locate the System Library component package.", cp != null); // add the cp to the selection Selection.getInstance().clear(); Selection.getInstance().addToSelection(cp); result = getLogViewResult(""); if (!result.equals("")) { fail(".log file is not empty before the model export."); } // export with persisted OAL TestingUtilities.exportModelUsingWizard( m_workspace_path + (generateResults ? "expected_results" : "actual_results") + "/" + exportFilename, true); /* This part of the test is temporarily removed see issue dts0100753682 // We expect an error log at this point result = getLogViewResult(""); if(!result.equals("")) { fail("Expected an error log containing messages: \"Unable to locate PMC\"."); } else { // Reset the log, there should be no errors after this Platform.getLogFileLocation().toFile().delete(); } end see dts0100753682 */ // if this is an actual test run if (!generateResults) { // compare the exported model to the expected result TestingUtilities.fileSizesCompare(expectedResultsPath, exportPath); } }
From source file:com.mentor.nucleus.bp.test.common.BaseTest.java
License:Open Source License
protected void setupProject(String projectName) { // during project setup // disable the resource change // listener//from w w w . j a va2 s . c o m ComponentResourceListener.setIgnoreResourceChangesMarker(true); if (projectName == null) { projectName = defaultProjectName; } if (projectName != null) { if (!projectExists(projectName)) { IdAssigner.setSeedOfAllInstances(projectName.hashCode()); try { project = TestingUtilities.createProject(projectName); } catch (CoreException e) { fail(e.getMessage()); } // get the SystemModel_c instance related to the // newly created project m_sys = getSystemModel(projectName); IdAssigner.setSeedOfAllInstances(0); } else { project = getProjectHandle(projectName); } } ComponentResourceListener.setIgnoreResourceChangesMarker(false); // Change default for the parse on resource change prefernece to "never" // so that dialog will not appear during tests. IPreferenceStore store = CorePlugin.getDefault().getPreferenceStore(); store.setValue(BridgePointPreferencesStore.PARSE_ALL_ON_RESOURCE_CHANGE, "never"); //$NON-NLS-1$ // Never show the "editing derived input" confirmation dialog during unit tests. String lineNumbers = AbstractDecoratedTextEditorPreferenceConstants.EDITOR_WARN_IF_INPUT_DERIVED; EditorsUI.getPreferenceStore().setValue(lineNumbers, false); }
From source file:com.mentor.nucleus.bp.ui.canvas.test.ODMSTest.java
License:Open Source License
@Override public void initialSetup() throws Exception { setModelName("odms"); IPreferenceStore store = CorePlugin.getDefault().getPreferenceStore(); store.setValue(BridgePointPreferencesStore.DISABLE_GRADIENTS, true); loadProject("odms"); }
From source file:com.mentor.nucleus.bp.ui.text.editor.SyntaxHighlightingPreferencesStore.java
License:Open Source License
public void saveModel(IPreferenceStore store, IPreferenceModel model) { if (!(model instanceof SyntaxHighlightingPreferences)) { throw new IllegalArgumentException("Cannot save instance of " + model.getClass().getName()); }//from w ww .jav a2s . com SyntaxHighlightingPreferences prefs = (SyntaxHighlightingPreferences) model; try { store.setValue(BACKGROUND_IS_SYSTEM_COLOR, prefs.isSystemColor); PreferenceConverter.setValue(store, BACKGROUND_RGB, prefs.backgroundRGB); int[] tokenTypes = prefs.getTokenTypes(); store.setValue(TOKEN_TYPE_COUNT, tokenTypes.length); for (int i = 0; i < tokenTypes.length; i++) { TokenTypeInfo tokenTypeInfo = prefs.getTokenTypeInfo(tokenTypes[i]); TextAttribute tAttribute = tokenTypeInfo.getTextAttribute(); store.setValue(TOKEN_TYPE_ID + i, tokenTypeInfo.getTypeId()); store.setValue(TOKEN_DESCRIPTION + tokenTypeInfo.getTypeId(), tokenTypeInfo.getTypeDescription()); store.setValue(TOKEN_FOREGROUND + tokenTypeInfo.getTypeId(), getRGBString(tAttribute.getForeground().getRGB())); store.setValue(TOKEN_IS_BOLD + tokenTypeInfo.getTypeId(), tokenTypeInfo.isBold()); } } catch (Exception e) { } }
From source file:com.microsoft.tfs.client.common.ui.dialogs.vc.GatedCheckinDialog.java
License:Open Source License
private void saveUserSettings() { final IPreferenceStore prefs = TFSCommonUIClientPlugin.getDefault().getPreferenceStore(); prefs.setValue(UIPreferenceConstants.GATED_CONFIRMATION_LAST_BUILD_DEFINITION, selectedBuildDefinitionUri); /*//from w ww . jav a 2 s . co m * Only set the preserve local changes button default if it's enabled. */ if (allowKeepCheckedOut) { prefs.setValue(UIPreferenceConstants.GATED_CONFIRMATION_PRESERVE_PENDING_CHANGES, preserveLocalChanges); } }
From source file:com.microsoft.tfs.client.common.ui.prefs.LabelDecoratorPreferencePage.java
License:Open Source License
@Override public boolean performOk() { final IPreferenceStore prefs = TFSCommonUIClientPlugin.getDefault().getPreferenceStore(); prefs.setValue(UIPreferenceConstants.LABEL_DECORATION_DECORATE_FOLDERS, decorateFolders.getSelection()); prefs.setValue(UIPreferenceConstants.LABEL_DECORATION_SHOW_CHANGESET, decorateWithChangeset.getSelection()); prefs.setValue(UIPreferenceConstants.LABEL_DECORATION_SHOW_SERVER_ITEM, decorateWithServerItem.getSelection()); prefs.setValue(UIPreferenceConstants.LABEL_DECORATION_SHOW_IGNORED_STATUS, decorateWithIgnoredStatus.getSelection()); return super.performOk(); }
From source file:com.microsoft.tfs.client.common.ui.prefs.MainPreferencePage.java
License:Open Source License
@Override public boolean performOk() { final IPreferenceStore store = getPreferenceStore(); store.setValue(UIPreferenceConstants.RECONNECT_AT_STARTUP, reconnectButton.getSelection()); store.setValue(UIPreferenceConstants.CONNECT_MAPPED_PROJECTS_AT_IMPORT, connectAtImportButton.getSelection()); store.setValue(UIPreferenceConstants.ACCEPT_UNTRUSTED_CERTIFICATES, acceptUntrustedCertificatesButton.getSelection()); if (showBrowserPreference()) { store.setValue(UIPreferenceConstants.EMBEDDED_WEB_BROWSER_TYPE, getEmbeddedBrowserType()); }/*from ww w . j a v a2 s . co m*/ return super.performOk(); }
From source file:com.microsoft.tfs.client.common.ui.prefs.SourceControlPreferencePage.java
License:Open Source License
@Override public boolean performOk() { final IPreferenceStore store = getPreferenceStore(); store.setValue(UIPreferenceConstants.GET_LATEST_ON_CHECKOUT, autoGetButton.getSelection()); store.setValue(UIPreferenceConstants.SHOW_DELETED_ITEMS, showDeletedItemsButton.getSelection()); store.setValue(UIPreferenceConstants.AUTO_RESOLVE_CONFLICTS, autoResolveButton.getSelection()); /* Unchanged is default, we need not set the value here */ if (lockLevelCheckOutButton.getSelection()) { store.setValue(UIPreferenceConstants.CHECKOUT_LOCK_LEVEL, UIPreferenceConstants.CHECKOUT_LOCK_LEVEL_CHECKOUT); } else if (lockLevelCheckInButton.getSelection()) { store.setValue(UIPreferenceConstants.CHECKOUT_LOCK_LEVEL, UIPreferenceConstants.CHECKOUT_LOCK_LEVEL_CHECKIN); } else {/* ww w .j av a 2s. co m*/ store.setValue(UIPreferenceConstants.CHECKOUT_LOCK_LEVEL, UIPreferenceConstants.CHECKOUT_LOCK_LEVEL_UNCHANGED); } store.setValue(UIPreferenceConstants.HIDE_ALL_FILES_UP_TO_DATE_MESSAGE, notifyButton.getSelection() ? MessageDialogWithToggle.ALWAYS : MessageDialogWithToggle.NEVER); store.setValue(UIPreferenceConstants.PROMPT_BEFORE_CHECKIN, checkinMessageButton.getSelection() ? MessageDialogWithToggle.NEVER : MessageDialogWithToggle.ALWAYS); store.setValue(UIPreferenceConstants.PROMPT_BEFORE_CHECKOUT, checkoutPromptButton.getSelection()); store.setValue(UIPreferenceConstants.CHECKOUT_FOREGROUND, checkoutForegroundButton.getSelection()); return super.performOk(); }
From source file:com.microsoft.tfs.client.common.ui.teambuild.buildstatus.BuildStatusAlerter.java
License:Open Source License
private void notifyUser(final IQueuedBuild queuedBuild) { /*//from w w w .ja va2s .c o m * We only notify users for completed gated checkin builds. These must * be 2010 builds and must have been built from a shelveset. */ final IBuildDetail detail = queuedBuild.getBuild(); if (detail == null || !detail.isBuildFinished() || !detail.getReason().contains(BuildReason.CHECK_IN_SHELVESET)) { return; } /* * Investigate the build status to determine whether unshelve or * reconcile should be offered. */ boolean notify = false; if ((detail.getStatus().contains(BuildStatus.SUCCEEDED) && getPreference(UIPreferenceConstants.BUILD_NOTIFICATION_SUCCESS) == true) || (detail.getStatus().contains(BuildStatus.PARTIALLY_SUCCEEDED) && getPreference(UIPreferenceConstants.BUILD_NOTIFICATION_PARTIALLY_SUCCEEDED) == true) || (detail.getStatus().contains(BuildStatus.FAILED) && getPreference(UIPreferenceConstants.BUILD_NOTIFICATION_FAILURE) == true)) { notify = true; } /* Nothing to do */ if (!notify) { return; } final TFSServer server = TFSCommonUIClientPlugin.getDefault().getProductPlugin().getServerManager() .getDefaultServer(); final TFSRepository repository = TFSCommonUIClientPlugin.getDefault().getProductPlugin() .getRepositoryManager().getDefaultRepository(); if (server == null || repository == null) { log.warn("Notified of build completion, but currently working offline from TFS"); //$NON-NLS-1$ return; } Display.getDefault().syncExec(new Runnable() { @Override public void run() { final Shell workbenchShell = ShellUtils.getWorkbenchShell(); if (workbenchShell == null) { log.error("Could not locate workbench shell for build status notification"); //$NON-NLS-1$ return; } final BuildStatusNotificationDialog notificationDialog = new BuildStatusNotificationDialog( workbenchShell); notificationDialog.setConnection(server.getConnection()); notificationDialog.setQueuedBuild(queuedBuild); /* * If an action was taken (return code is OK) then remove from * the watched build list. */ if (notificationDialog.open() == IDialogConstants.OK_ID) { server.getBuildStatusManager().removeWatchedBuild(queuedBuild); } /* Handle "never show again" preference */ if (notificationDialog.getNeverShow()) { final IPreferenceStore prefs = TFSCommonUIClientPlugin.getDefault().getPreferenceStore(); prefs.setValue(UIPreferenceConstants.BUILD_NOTIFICATION_SUCCESS, false); prefs.setValue(UIPreferenceConstants.BUILD_NOTIFICATION_FAILURE, false); prefs.setValue(UIPreferenceConstants.BUILD_NOTIFICATION_PARTIALLY_SUCCEEDED, false); } } }); }