List of usage examples for org.eclipse.jface.dialogs IDialogConstants NO_ID
int NO_ID
To view the source code for org.eclipse.jface.dialogs IDialogConstants NO_ID.
Click Source Link
From source file:de.loskutov.eclipse.jdepend.views.SaveToFileAction.java
License:Open Source License
@Override public void run() { IPreferenceStore prefs = JDepend4EclipsePlugin.getDefault().getPreferenceStore(); boolean shouldAsk = prefs.getBoolean(JDependConstants.SAVE_TO_SHOW_OPTIONS); /*//from w ww . j a va 2s . com * Show dialog if prefs is set, asking for open in editor */ boolean saveAsXml = prefs.getBoolean(JDependConstants.SAVE_AS_XML); if (shouldAsk) { MessageDialogWithToggle dialogWithToggle = MessageDialogWithToggle.openYesNoCancelQuestion(getShell(), "Save JDepend output", "Save JDepend output as XML (and not as plain text)?", "Remember and do not ask me again", false, prefs, JDependConstants.SAVE_TO_SHOW_OPTIONS); int returnCode = dialogWithToggle.getReturnCode(); if (returnCode != IDialogConstants.YES_ID && returnCode != IDialogConstants.NO_ID) { return; } saveAsXml = returnCode == IDialogConstants.YES_ID; prefs.setValue(JDependConstants.SAVE_AS_XML, saveAsXml); } /* * open file selection dialog (external) */ File file = getFileFromUser(saveAsXml); if (file == null) { return; } /* * if selected file exists, ask for override/append/another file */ int overrideOrAppend = checkForExisting(file); if (overrideOrAppend == CANCEL) { return; } IFile iFile = getWorkspaceFile(file); /* * if selected file is in the workspace, checkout it or show error message */ if (iFile != null && !checkout(iFile, overrideOrAppend)) { return; } /* * save it */ doSave(file, overrideOrAppend); }
From source file:de.plugins.eclipse.depclipse.handlers.SaveJDependOutput.java
License:Open Source License
@Override public Object execute(ExecutionEvent event) throws ExecutionException { prefs = DepclipsePlugin.getDefault().getPreferenceStore(); boolean shouldAsk = prefs.getBoolean(JDependPreferenceConstants.SAVE_TO_SHOW_OPTIONS); /*//from ww w . j a v a 2 s . co m * Show dialog if prefs is set, asking for open in editor */ boolean saveAsXml = prefs.getBoolean(JDependPreferenceConstants.SAVE_AS_XML); if (shouldAsk) { MessageDialogWithToggle dialogWithToggle = MessageDialogWithToggle.openYesNoCancelQuestion(getShell(), Messages.SaveJDependOutput_Save_JDepend_output, Messages.SaveJDependOutput_Save_JDepend_output_as_XML, Messages.SaveJDependOutput_Remember_and_do_not_ask_me_again, false, prefs, JDependPreferenceConstants.SAVE_TO_SHOW_OPTIONS); int returnCode = dialogWithToggle.getReturnCode(); if (returnCode != IDialogConstants.YES_ID && returnCode != IDialogConstants.NO_ID) { return null; } saveAsXml = returnCode == IDialogConstants.YES_ID; prefs.setValue(JDependPreferenceConstants.SAVE_AS_XML, saveAsXml); } /* * open file selection dialog (external) */ File file = getFileFromUser(saveAsXml); if (file == null) { return null; } /* * if selected file exists, ask for override/append/another file */ int overrideOrAppend = checkForExisting(file); if (overrideOrAppend == CANCEL) { return null; } IFile iFile = getWorkspaceFile(file); /* * if selected file is in the workspace, checkout it or show error * message */ if (iFile != null && !checkout(iFile, overrideOrAppend)) { return null; } /* * save it */ doSave(file, overrideOrAppend); return null; }
From source file:de.tobject.findbugs.actions.FindBugsAction.java
License:Open Source License
protected static void askUserToSwitch(IWorkbenchPart part, int warningsNumber) { final IPreferenceStore store = FindbugsPlugin.getDefault().getPreferenceStore(); String message = "FindBugs analysis finished, " + warningsNumber + " warnings found.\n\nSwitch to the FindBugs perspective?"; MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoCancelQuestion(null, "FindBugs analysis finished", message, "Remember the choice and do not ask me in the future", false, store, FindBugsConstants.ASK_ABOUT_PERSPECTIVE_SWITCH); boolean remember = dialog.getToggleState(); int returnCode = dialog.getReturnCode(); if (returnCode == IDialogConstants.YES_ID) { if (remember) { store.setValue(FindBugsConstants.SWITCH_PERSPECTIVE_AFTER_ANALYSIS, true); }/*www .ja v a2 s. c o m*/ switchPerspective(part); } else if (returnCode == IDialogConstants.NO_ID) { if (remember) { store.setValue(FindBugsConstants.SWITCH_PERSPECTIVE_AFTER_ANALYSIS, false); } } }
From source file:eclipse.testframework.ui.util.DialogCheck.java
License:Open Source License
/** * Asserts that a given dialog is not null and that it passes * certain visual tests. These tests will be verified manually * by the tester using an input dialog. Use this assert method * to verify a dialog's sizing, initial focus, or accessiblity. * To ensure that both the input dialog and the test dialog are * accessible by the tester, the getShell() method should be used * when creating the test dialog./*from ww w .ja v a2 s . co m*/ * * Example usage: * <code>Dialog dialog = new AboutDialog( DialogCheck.getShell() ); * DialogCheck.assertDialog(dialog, this);</code> * * @param dialog the test dialog to be verified. */ public static void assertDialog(Dialog dialog) { Assert.assertNotNull(dialog); if (_verifyDialog.getShell() == null) { //force the creation of the verify dialog getShell(); } if (_verifyDialog.open(dialog) == IDialogConstants.NO_ID) { Assert.assertTrue(_verifyDialog.getFailureText(), false); } }
From source file:eclipse.testframework.ui.util.VerifyDialog.java
License:Open Source License
protected void createButtonsForButtonBar(Composite parent) { _yesButton = createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true); createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, false); }
From source file:eclipse.testframework.ui.util.VerifyDialog.java
License:Open Source License
protected void buttonPressed(int buttonId) { if (IDialogConstants.YES_ID == buttonId) { setReturnCode(IDialogConstants.YES_ID); if (_testDialog.getShell() != null) { _testDialog.close();//ww w . j a va2 s . c o m } close(); } else if (IDialogConstants.NO_ID == buttonId) { handleFailure(); } }
From source file:eclipse.testframework.ui.util.VerifyDialog.java
License:Open Source License
public int open() { _failureText = "Testing dialog is required, use VerifyDialog::open(Dialog)"; return IDialogConstants.NO_ID; }
From source file:eclipse.testframework.ui.util.VerifyDialog.java
License:Open Source License
private void handleFailure() { IDialogTestPass test = _dialogTests[TEST_TYPE]; StringBuffer text = new StringBuffer(); String label = test.label();/*from w ww . j a va 2s . co m*/ label = label.substring(0, label.indexOf("&")) + label.substring(label.indexOf("&") + 1); text.append(label).append(" failed on the ").append(SWT.getPlatform()).append(" platform:\n"); String failureMessages[] = test.failureTexts(); for (int i = 0; i < test.checkListTexts().size(); i++) { if (!_checkList[i].getSelection()) { text.append("- ").append(failureMessages[i]).append("\n"); } } FailureDialog dialog = new FailureDialog(getShell()); dialog.create(); dialog.setText(text.toString()); if (dialog.open() == IDialogConstants.OK_ID) { _failureText = dialog.toString(); setReturnCode(IDialogConstants.NO_ID); if (_testDialog.getShell() != null) { _testDialog.close(); } close(); } }
From source file:eu.geclipse.ui.internal.transfer.TransferResumeDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(final Composite parent) { // create OK and Cancel buttons by default createButton(parent, IDialogConstants.OK_ID, "Resume selected", true); createButton(parent, IDialogConstants.NO_ID, "Abandon all transfers", false); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:eu.geclipse.ui.internal.transfer.TransferResumeDialog.java
License:Open Source License
@Override protected void buttonPressed(final int buttonId) { super.buttonPressed(buttonId); if (IDialogConstants.NO_ID == buttonId) { noPressed();// w w w. ja v a2s .com } }