List of usage examples for org.eclipse.jface.dialogs ErrorDialog AUTOMATED_MODE
boolean AUTOMATED_MODE
To view the source code for org.eclipse.jface.dialogs ErrorDialog AUTOMATED_MODE.
Click Source Link
From source file:com.google.dart.tools.ui.actions.MessageDialogHelper.java
License:Open Source License
/** * Convenience method to open a standard information dialog. If this application is running * headlessly, log an error instead.//from ww w . j a v a2s . co m * * @param parent the parent shell of the dialog, or <code>null</code> if none * @param title the dialog's title, or <code>null</code> if none * @param message the message */ public static void openInformation(Shell shell, String title, String message) { if (ErrorDialog.AUTOMATED_MODE) { DartToolsPlugin.logErrorMessage(title + ": " + message); } else { MessageDialog.openInformation(shell, title, message); } }
From source file:com.google.dart.tools.ui.internal.refactoring.ServerRefactoringWizard.java
License:Open Source License
@Override public boolean performFinish() { boolean valid = super.performFinish(); // if not testing, proceed by default if (!ErrorDialog.AUTOMATED_MODE) { return valid; }//from w ww. ja va2s. c o m // log error if not valid if (!valid) { RefactoringStatus status = null; try { status = ReflectionUtils.getFieldObject(this, "fConditionCheckingStatus"); } catch (Throwable e) { } DartToolsPlugin.logErrorMessage("Refactoring operation failed: " + status); } // don't show error page/dialog return true; }
From source file:com.google.dart.ui.test.HeadlessTestManager.java
License:Open Source License
public void install() { oldAutomatedValue = ErrorDialog.AUTOMATED_MODE; ErrorDialog.AUTOMATED_MODE = true; }
From source file:com.google.dart.ui.test.HeadlessTestManager.java
License:Open Source License
public void uninstall() { ErrorDialog.AUTOMATED_MODE = oldAutomatedValue; }
From source file:com.mentor.nucleus.bp.cli.BPCLIWorkbenchAdvisor.java
License:Open Source License
/** * We override this to hide the workbench. We do this because we are running * from the command line and we don't really want't or need to see it. */// w w w .j a v a 2 s . com @Override public void preWindowOpen(IWorkbenchWindowConfigurer configurer) { try { originalAutobuildSetting = WorkspaceUtil.setAutobuilding(false); } catch (CoreException e) { BPCLIPreferences.logError("Failed to disable autobuilding", e); //$NON-NLS-2$ } // Unless running in debug mode hide the workbench if (!debug) { configurer.setShellStyle(SWT.NONE); Point sizeZero = new Point(0, 0); configurer.setInitialSize(sizeZero); configurer.setShowFastViewBars(false); configurer.setShowMenuBar(false); configurer.setShowPerspectiveBar(false); configurer.setShowCoolBar(false); // This is how we make sure no BridgePoint dialogs are // displayed. Eclipse error dialogs are suppressed using the // --launcher.suppressErrors Eclipse command-line option CoreUtil.IsRunningHeadless = true; ErrorDialog.AUTOMATED_MODE = true; // This should be what the --launcher.suppressErrors // command-line option does. Setting it here also. } else { configurer.setShowFastViewBars(true); configurer.setShowMenuBar(true); configurer.setShowPerspectiveBar(true); configurer.setShowCoolBar(true); } }
From source file:com.mentor.nucleus.bp.cli.Build.java
License:Open Source License
@Override public Object start(IApplicationContext context) throws Exception { try {/* w w w . j ava 2s.c o m*/ CommandLineOption[] cmdLineOptions = new CommandLineOption[] { new CommandLineOption("-project", "", "The name of the project that will be built."), // This option is not yet supported. It is commented out until support is added. // new CommandLineOption("-mcOutputFolder", "", // "The output folder for model compiler artifacts."), new CommandLineOption("-buildConfig", "", "The CDT build configuration to use."), new CommandLineOption("-prebuildOnly", false, "Run ONLY the BridgePoint Model Compiler pre-builder."), new CommandLineOption("-cleanCLI", false, "Performs a clean build on the project."), new CommandLineOption("-debugCLI", false, "Launch a workbench and leave it open after executing the command."), new CommandLineOption("-help", false, "Display usage information.") }; BPCLIPreferences cmdLine = new BPCLIPreferences(context, cmdLineOptions); if (cmdLine.getBooleanValue("-help")) { cmdLine.usage("Build"); } else { BPCLIWorkbenchAdvisor.redirectSystemOutput(cmdLine); BuildWorkbenchAdvisor workbenchAdvisor = new BuildWorkbenchAdvisor(cmdLine); System.out.println("Starting CLI Build"); if (workbenchAdvisor.prebuilderOnly) { // if prebuildOnly then don't create the workbench. if (!workbenchAdvisor.debug) { Job.getJobManager().suspend(); CoreUtil.IsRunningHeadless = true; ErrorDialog.AUTOMATED_MODE = true; // This should be what the --launcher.suppressErrors // command-line option does. Setting it here also. workbenchAdvisor.performCLIBuild(); } } else { workbenchAdvisor.createAndRunWorkbench(); } } } catch (BPCLIException err) { BPCLIPreferences.logError("Error during build: " + err.getMessage(), null); } catch (Exception err) { BPCLIPreferences.logError("Error during build: " + err.getMessage(), err); } return IApplication.EXIT_OK; }
From source file:com.vmware.vfabric.ide.eclipse.tcserver.tests.ui.NewServerWizard.java
License:Open Source License
void pressFinish(boolean errorDialogExpected, String errorMessageRegex) { boolean errorDialogAutomatedMode = ErrorDialog.AUTOMATED_MODE; ErrorDialog.AUTOMATED_MODE = false;/*www . j a v a 2 s . c o m*/ try { assertTrue(isFinishEnabled()); // to fail quick bot.button("Finish").click(); if (errorDialogExpected) { bot.waitUntil(Conditions.shellIsActive("Server Error"), 10000); SWTBotShell serverErrorDialog = bot.shell("Server Error"); assertNotNull(serverErrorDialog); @SuppressWarnings({ "unchecked", "rawtypes" }) Matcher matcher = allOf(widgetOfType(Label.class), withRegex(errorMessageRegex)); @SuppressWarnings("unchecked") SWTBotLabel label = new SWTBotLabel((Label) serverErrorDialog.bot().widget(matcher)); assertNotNull(label); serverErrorDialog.close(); // an error occurred, cancel the wizard pressCancel(); } bot.waitUntil(SWTBotUtils.widgetIsDisposed(shell), 10000); } finally { ErrorDialog.AUTOMATED_MODE = errorDialogAutomatedMode; } }
From source file:com.windowtester.runtime.swt.internal.junit.SWTExecutionMonitor.java
License:Open Source License
/** * Set automation flags.//from w w w. j a v a 2 s . c om */ private void setAutomationFlags() { // wrapped call in syncExec, to prevent NPE while // setting flag Display.getDefault().syncExec(new Runnable() { public void run() { automatedMode = ErrorDialog.AUTOMATED_MODE; ErrorDialog.AUTOMATED_MODE = false; } }); }
From source file:com.windowtester.runtime.swt.internal.junit.SWTExecutionMonitor.java
License:Open Source License
/** * Reset automation flags (to previous value). */ private void resetAutomationFlags() { ErrorDialog.AUTOMATED_MODE = automatedMode; }
From source file:de.hentschel.visualdbc.interactive.proving.ui.test.testCase.swtbot.SWTBotOpenProofCommandTest.java
License:Open Source License
/** * Executes the tests for {@link #testOpenProofs_ModelEditor_noResets()} * and {@link #testOpenProofs_ModelEditor_withResets()} * @param allowProofResets Allow proof resets? *//*from w w w. j av a 2 s. c o m*/ protected void doTestOpenProofs_ModelEditor(boolean allowProofResets) { boolean oldAutomatedMode = ErrorDialog.AUTOMATED_MODE; boolean oldResetProofs = InteractiveProvingPreferences.isResetProofIfNewOpened(); try { // Set reset setting InteractiveProvingPreferences.setResetProofIfNewOpened(allowProofResets); // Allow error dialogs ErrorDialog.AUTOMATED_MODE = false; // Create and fill project IProject project = TestUtilsUtil .createProject("SWTBotOpenProofCommandTest_testOpenProofs_ModelEditor_" + allowProofResets); BundleUtil.extractFromBundleToWorkspace(Activator.PLUGIN_ID, "data/SimpleProofModelDifferentContainment", project); final IFile modelFile = project.getFile("SimpleProofModel.dbc"); // Open editor SWTWorkbenchBot bot = new SWTWorkbenchBot(); TestUtilsUtil.closeWelcomeView(bot); TestUtilsUtil.openEditor(modelFile); SWTBotEditor editor = bot.editorByTitle(modelFile.getName()); SWTBotTree tree = editor.bot().tree(); tree.select(0); // Make sure that no connection is established String resourceString = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true) .toString(); String modelString = "Dbc Model de.hentschel.visualdbc.dbcmodel.diagram.custom.test.simpleProofModel"; DbcModel model = (DbcModel) TestUtilsUtil.getObjectInTree(tree, resourceString, modelString); DbcClass mCDemo = (DbcClass) model.getType("MCDemo"); DbcMethod inc = mCDemo.getMethod("inc(x : int)"); DbcOperationContract c0 = inc.getOperationContracts().get(0); DbcMethod init = mCDemo.getMethod("init(u : int)"); DbcOperationContract c1 = init.getOperationContracts().get(0); assertNotNull(model); assertFalse(InteractiveConnectionUtil.isOpened(model)); // Get proofs String mCDemoString = "Dbc Class MCDemo"; String[] c1EnsuresPostPath = { resourceString, modelString, mCDemoString, "Dbc Proof EnsuresPost" }; DbcProof c1EnsuresPost = (DbcProof) TestUtilsUtil.getObjectInTree(tree, c1EnsuresPostPath); assertEquals(c1, c1EnsuresPost.getTarget()); assertEquals("EnsuresPost", c1EnsuresPost.getObligation()); String[] c0EnsuresPostPath = { resourceString, modelString, "Dbc Proof EnsuresPost" }; DbcProof c0EnsuresPost = (DbcProof) TestUtilsUtil.getObjectInTree(tree, c0EnsuresPostPath); assertEquals(c0, c0EnsuresPost.getTarget()); assertEquals("EnsuresPost", c0EnsuresPost.getObligation()); String[] incPreservesInvPath = { resourceString, modelString, mCDemoString, "Dbc Proof PreservesInv" }; DbcProof incPreservesInv = (DbcProof) TestUtilsUtil.getObjectInTree(tree, incPreservesInvPath); assertEquals(inc, incPreservesInv.getTarget()); assertEquals("PreservesInv", incPreservesInv.getObligation()); String[] incInvalidPath = { resourceString, modelString, mCDemoString, "Dbc Proof InvalidObligation" }; DbcProof incInvalid = (DbcProof) TestUtilsUtil.getObjectInTree(tree, incInvalidPath); assertEquals(inc, incInvalid.getTarget()); assertEquals("InvalidObligation", incInvalid.getObligation()); String[] noTargetPath = { resourceString, modelString, mCDemoString, "Dbc Proof NoProofTarget" }; DbcProof noTarget = (DbcProof) TestUtilsUtil.getObjectInTree(tree, noTargetPath); assertNull(noTarget.getTarget()); assertEquals("NoProofTarget", noTarget.getObligation()); String[] c1RespectsModifiesPath = { resourceString, modelString, mCDemoString, "Dbc Proof RespectsModifies" }; DbcProof c1RespectsModifies = (DbcProof) TestUtilsUtil.getObjectInTree(tree, c1RespectsModifiesPath); assertEquals(c1, c1RespectsModifies.getTarget()); assertEquals("RespectsModifies", c1RespectsModifies.getObligation()); // Open proof: EnsuresPost on c1 TestInteractiveProvingUtil.openProof(startProofListener, tree, c1EnsuresPostPath); compareOpenProofCalls(model, "EnsuresPost", null, null); assertEquals(DbcProofStatus.OPEN, c1EnsuresPost.getStatus()); // Open proof again: EnsuresPost on c1 TestInteractiveProvingUtil.openProof(startProofListener, tree, c1EnsuresPostPath); compareOpenProofCalls(model, "EnsuresPost", null, null); // Open proof: RespectsModifies on c1 TestInteractiveProvingUtil.openProof(startProofListener, tree, c1RespectsModifiesPath); compareOpenProofCalls(model, "RespectsModifies", null, null); // Open proof: EnsuresPost on c0 TestInteractiveProvingUtil.openProof(startProofListener, tree, c0EnsuresPostPath); compareOpenProofCalls(model, null, "EnsuresPost", null); // Open proof: EnsuresPost on c1 and c0 SWTBotTreeItem firstItem = TestUtilsUtil.selectInTree(tree, c0EnsuresPostPath); SWTBotTreeItem secondItem = TestUtilsUtil.selectInTree(tree, c1EnsuresPostPath); tree.select(firstItem, secondItem); TestInteractiveProvingUtil.openProof(startProofListener, tree, 2); compareOpenProofCalls(model, "EnsuresPost", "EnsuresPost", null); // Open proof: PreservesInv on inc TestInteractiveProvingUtil.openProof(startProofListener, tree, incPreservesInvPath); compareOpenProofCalls(model, null, null, "PreservesInv"); // Open proof: invalid on inc TestInteractiveProvingUtil.openProof(startProofListener, tree, incInvalidPath); compareOpenProofCalls(model, null, null, null); SWTBotShell errorShell = bot.shell("Problem Occurred"); assertEquals("The obligation \"InvalidObligation\" is invalid.\nValid obligations are:\n -PreservesInv", errorShell.bot().label(2).getText()); errorShell.bot().button("OK").click(); // Open proof: noTarget TestInteractiveProvingUtil.openProof(startProofListener, tree, noTargetPath); compareOpenProofCalls(model, null, null, null); errorShell = bot.shell("Problem Occurred"); assertEquals("Proof target not defined.", errorShell.bot().label(2).getText()); errorShell.bot().button("OK").click(); // Get data source model instances IDSConnection connection = InteractiveConnectionUtil.openConnection(model, null); IDSClass dsMCDemo = connection.getClass("MCDemo"); LoggingMethod dsInc = (LoggingMethod) dsMCDemo.getMethod("inc(x : int)"); LoggingOperationContract dsC0 = (LoggingOperationContract) dsInc.getOperationContracts().get(0); LoggingMethod dsInit = (LoggingMethod) dsMCDemo.getMethod("init(u : int)"); LoggingOperationContract dsC1 = (LoggingOperationContract) dsInit.getOperationContracts().get(0); if (allowProofResets) { compareProofStati(c1EnsuresPost, c0EnsuresPost, incPreservesInv, incInvalid, noTarget, c1RespectsModifies, DbcProofStatus.OPEN, DbcProofStatus.OPEN, DbcProofStatus.OPEN, DbcProofStatus.OPEN, DbcProofStatus.FULFILLED, DbcProofStatus.OPEN); } else { compareProofStati(c1EnsuresPost, c0EnsuresPost, incPreservesInv, incInvalid, noTarget, c1RespectsModifies, DbcProofStatus.OPEN, DbcProofStatus.FULFILLED, DbcProofStatus.FAILED, DbcProofStatus.OPEN, DbcProofStatus.FULFILLED, DbcProofStatus.OPEN); } // Close proof: c1EnsuresPost ((ExecutableProof) dsC1.getInteractiveProof(c1EnsuresPost.getObligation())).closeProof(); if (allowProofResets) { compareProofStati(c1EnsuresPost, c0EnsuresPost, incPreservesInv, incInvalid, noTarget, c1RespectsModifies, DbcProofStatus.FULFILLED, DbcProofStatus.OPEN, DbcProofStatus.OPEN, DbcProofStatus.OPEN, DbcProofStatus.FULFILLED, DbcProofStatus.OPEN); } else { compareProofStati(c1EnsuresPost, c0EnsuresPost, incPreservesInv, incInvalid, noTarget, c1RespectsModifies, DbcProofStatus.FULFILLED, DbcProofStatus.FULFILLED, DbcProofStatus.FAILED, DbcProofStatus.OPEN, DbcProofStatus.FULFILLED, DbcProofStatus.OPEN); } // Close proof again: c1EnsuresPost ((ExecutableProof) dsC1.getInteractiveProof(c1EnsuresPost.getObligation())).closeProof(); if (allowProofResets) { compareProofStati(c1EnsuresPost, c0EnsuresPost, incPreservesInv, incInvalid, noTarget, c1RespectsModifies, DbcProofStatus.FULFILLED, DbcProofStatus.OPEN, DbcProofStatus.OPEN, DbcProofStatus.OPEN, DbcProofStatus.FULFILLED, DbcProofStatus.OPEN); } else { compareProofStati(c1EnsuresPost, c0EnsuresPost, incPreservesInv, incInvalid, noTarget, c1RespectsModifies, DbcProofStatus.FULFILLED, DbcProofStatus.FULFILLED, DbcProofStatus.FAILED, DbcProofStatus.OPEN, DbcProofStatus.FULFILLED, DbcProofStatus.OPEN); } // Close proof again: c1RespectsModifies ((ExecutableProof) dsC1.getInteractiveProof(c1RespectsModifies.getObligation())).closeProof(); if (allowProofResets) { compareProofStati(c1EnsuresPost, c0EnsuresPost, incPreservesInv, incInvalid, noTarget, c1RespectsModifies, DbcProofStatus.FULFILLED, DbcProofStatus.OPEN, DbcProofStatus.OPEN, DbcProofStatus.OPEN, DbcProofStatus.FULFILLED, DbcProofStatus.FULFILLED); } else { compareProofStati(c1EnsuresPost, c0EnsuresPost, incPreservesInv, incInvalid, noTarget, c1RespectsModifies, DbcProofStatus.FULFILLED, DbcProofStatus.FULFILLED, DbcProofStatus.FAILED, DbcProofStatus.OPEN, DbcProofStatus.FULFILLED, DbcProofStatus.FULFILLED); } // Close proof again: c0EnsuresPost ((ExecutableProof) dsC0.getInteractiveProof(c0EnsuresPost.getObligation())).closeProof(); if (allowProofResets) { compareProofStati(c1EnsuresPost, c0EnsuresPost, incPreservesInv, incInvalid, noTarget, c1RespectsModifies, DbcProofStatus.FULFILLED, DbcProofStatus.FULFILLED, DbcProofStatus.OPEN, DbcProofStatus.OPEN, DbcProofStatus.FULFILLED, DbcProofStatus.FULFILLED); } else { compareProofStati(c1EnsuresPost, c0EnsuresPost, incPreservesInv, incInvalid, noTarget, c1RespectsModifies, DbcProofStatus.FULFILLED, DbcProofStatus.FULFILLED, DbcProofStatus.FAILED, DbcProofStatus.OPEN, DbcProofStatus.FULFILLED, DbcProofStatus.FULFILLED); } // Close proof again: incPreservesInv ((ExecutableProof) dsInc.getInteractiveProof(incPreservesInv.getObligation())).closeProof(); compareProofStati(c1EnsuresPost, c0EnsuresPost, incPreservesInv, incInvalid, noTarget, c1RespectsModifies, DbcProofStatus.FULFILLED, DbcProofStatus.FULFILLED, DbcProofStatus.FULFILLED, DbcProofStatus.OPEN, DbcProofStatus.FULFILLED, DbcProofStatus.FULFILLED); // Test initial references of dsC1 IDbcFinder finder = FinderUtil.getDbcFinder(connection, model); assertNotNull(finder); List<IDSProvableReference> allowedReferences = new LinkedList<IDSProvableReference>(); compareProofReferences(finder, c1EnsuresPost, allowedReferences); // Add reference dsC1 to dsInc allowedReferences.add(new MemoryProvableReference(dsInc, "KindA")); ((ExecutableProof) dsC1.getInteractiveProof(c1EnsuresPost.getObligation())) .addReferences(new MemoryProvableReference(dsInc, "KindA")); compareProofReferences(finder, c1EnsuresPost, allowedReferences); // Add reference dsC1 to dsInit allowedReferences.add(new MemoryProvableReference(dsInit, "KindB")); ((ExecutableProof) dsC1.getInteractiveProof(c1EnsuresPost.getObligation())) .addReferences(new MemoryProvableReference(dsInit, "KindB")); compareProofReferences(finder, c1EnsuresPost, allowedReferences); // Add reference dsC1 to dsInit with other kind allowedReferences.add(new MemoryProvableReference(dsInit, "KindC")); ((ExecutableProof) dsC1.getInteractiveProof(c1EnsuresPost.getObligation())) .addReferences(new MemoryProvableReference(dsInit, "KindC")); compareProofReferences(finder, c1EnsuresPost, allowedReferences); // Add multiple references allowedReferences.add(new MemoryProvableReference(dsInit, "KindD")); allowedReferences.add(new MemoryProvableReference(dsInc, "KindE")); ((ExecutableProof) dsC1.getInteractiveProof(c1EnsuresPost.getObligation())).addReferences( new MemoryProvableReference(dsInit, "KindC"), new MemoryProvableReference(dsInit, "KindD"), new MemoryProvableReference(dsInc, "KindE")); compareProofReferences(finder, c1EnsuresPost, allowedReferences); // Remove reference allowedReferences.remove(new MemoryProvableReference(dsInit, "KindD")); ((ExecutableProof) dsC1.getInteractiveProof(c1EnsuresPost.getObligation())) .removeReferences(new MemoryProvableReference(dsInit, "KindD")); compareProofReferences(finder, c1EnsuresPost, allowedReferences); // Remove multiple references allowedReferences.remove(new MemoryProvableReference(dsInit, "KindB")); allowedReferences.remove(new MemoryProvableReference(dsInc, "KindA")); ((ExecutableProof) dsC1.getInteractiveProof(c1EnsuresPost.getObligation())).removeReferences( new MemoryProvableReference(dsInit, "KindD"), new MemoryProvableReference(dsInit, "KindB"), new MemoryProvableReference(dsInc, "KindA")); compareProofReferences(finder, c1EnsuresPost, allowedReferences); // Test proof resets based on the status values IDSFinder dsFinder = FinderUtil.getDSFinder(connection); assertNotNull(dsFinder); EditingDomain domain = ((DbcmodelEditor) editor.getReference().getEditor(true)).getEditingDomain(); doTestStatusBasedRest(domain, model, tree, c1EnsuresPost, c1EnsuresPostPath, allowProofResets, dsFinder, DbcProofStatus.FAILED); doTestStatusBasedRest(domain, model, tree, c1EnsuresPost, c1EnsuresPostPath, allowProofResets, dsFinder, DbcProofStatus.OPEN); doTestStatusBasedRest(domain, model, tree, c1EnsuresPost, c1EnsuresPostPath, allowProofResets, dsFinder, DbcProofStatus.FULFILLED); // Test proof resets based on references doTestReferenceBasedTest(domain, model, tree, c1EnsuresPost, c1EnsuresPostPath, allowProofResets, dsFinder, c1EnsuresPost.getTarget()); // Test opening a proof with initial references DbcProof proof = c0EnsuresPost; IDSProvable dsProvable = dsFinder.findProvable(proof.getTarget()); if (dsProvable instanceof LoggingMethod) { ((LoggingMethod) dsProvable).removeProof(proof.getObligation()); ((LoggingMethod) dsProvable) .setInitialReferenceToAdd(new MemoryProvableReference(dsProvable, "Initial Reference")); } else if (dsProvable instanceof LoggingOperationContract) { ((LoggingOperationContract) dsProvable).removeProof(proof.getObligation()); ((LoggingOperationContract) dsProvable) .setInitialReferenceToAdd(new MemoryProvableReference(dsProvable, "Initial Reference")); } assertFalse(dsProvable.hasInteractiveProof(proof.getObligation())); TestInteractiveProvingUtil.openProof(startProofListener, tree, c0EnsuresPostPath); compareOpenProofCalls(model, null, "EnsuresPost", null); assertEquals(1, proof.getProofReferences().size()); assertEquals(proof.getTarget(), proof.getProofReferences().get(0).getTarget()); assertEquals("Initial Reference", proof.getProofReferences().get(0).getKind()); } catch (DSException e) { e.printStackTrace(); fail(e.getMessage()); } catch (CoreException e) { e.printStackTrace(); fail(e.getMessage()); } finally { ErrorDialog.AUTOMATED_MODE = oldAutomatedMode; InteractiveProvingPreferences.setResetProofIfNewOpened(oldResetProofs); // Close editor new SWTWorkbenchBot().closeAllEditors(); } }