List of usage examples for org.eclipse.jface.dialogs IDialogConstants YES_ID
int YES_ID
To view the source code for org.eclipse.jface.dialogs IDialogConstants YES_ID.
Click Source Link
From source file:org.tigris.subversion.subclipse.ui.operations.ShowAnnotationOperation.java
License:Open Source License
/** * Returns true if the user wishes to always use the live annotate view, false otherwise. * @return/*from w w w .j av a 2 s . c om*/ */ private boolean promptForQuickDiffAnnotate() { //check whether we should ask the user. final IPreferenceStore store = SVNUIPlugin.getPlugin().getPreferenceStore(); final String option = store.getString(ISVNUIConstants.PREF_USE_QUICKDIFFANNOTATE); if (option.equals(MessageDialogWithToggle.ALWAYS)) return true; //use live annotate else if (option.equals(MessageDialogWithToggle.NEVER)) return false; //don't use live annotate final MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoQuestion(Utils.getShell(null), Policy.bind("AnnotateOperation_QDAnnotateTitle"), Policy.bind("AnnotateOperation_QDAnnotateMessage"), Policy.bind("AnnotateOperation_4"), false, store, ISVNUIConstants.PREF_USE_QUICKDIFFANNOTATE); final int result = dialog.getReturnCode(); switch (result) { //yes case IDialogConstants.YES_ID: case IDialogConstants.OK_ID: return true; } return false; }
From source file:org.wso2.developerstudio.eclipse.platform.ui.dialogs.TrustCertificateDialog.java
License:Open Source License
protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, false); createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true); createButton(parent, TEMP_ALLOW_ID, "Allow this once", false); }
From source file:org2.eclipse.php.internal.debug.core.launching.PHPLaunchUtilities.java
License:Open Source License
/** * Notify the existence of a previous PHP debug session in case the user launched a new session. * /*from w w w . j av a 2 s.com*/ * @param newLaunchConfiguration * @param newLaunch * @return True, if the launch can be continued; False, otherwise. * @throws CoreException */ public static boolean notifyPreviousLaunches(ILaunch newLaunch) throws CoreException { // In case the new launch is not a debug launch, we have no problem. if (!ILaunchManager.DEBUG_MODE.equals(newLaunch.getLaunchMode())) { return true; } // If there are no active debug launches, return true and continue with the new launch. if (!hasPHPDebugLaunch()) { return true; } // Check whether we should ask the user. final IPreferenceStore store = PHPDebugEPLPlugin.getDefault().getPreferenceStore(); String option = store.getString(ALLOW_MULTIPLE_LAUNCHES); if (MessageDialogWithToggle.ALWAYS.equals(option)) { // If always, then we should always allow the launch return true; } if (MessageDialogWithToggle.NEVER.equals(option)) { // We should never allow the launch, so display a message describing the situation. final Display disp = Display.getDefault(); disp.syncExec(new Runnable() { public void run() { MessageDialog.openInformation(disp.getActiveShell(), PHPDebugCoreMessages.PHPLaunchUtilities_phpLaunchTitle, PHPDebugCoreMessages.PHPLaunchUtilities_activeLaunchDetected); } }); return false; } final DialogResultHolder resultHolder = new DialogResultHolder(); final Display disp = Display.getDefault(); disp.syncExec(new Runnable() { public void run() { // Display a dialog to notify the existence of a previous active launch. MessageDialogWithToggle m = MessageDialogWithToggle.openYesNoQuestion(disp.getActiveShell(), PHPDebugCoreMessages.PHPLaunchUtilities_confirmation, PHPDebugCoreMessages.PHPLaunchUtilities_multipleLaunchesPrompt, PHPDebugCoreMessages.PHPLaunchUtilities_rememberDecision, false, store, ALLOW_MULTIPLE_LAUNCHES); resultHolder.setReturnCode(m.getReturnCode()); } }); switch (resultHolder.getReturnCode()) { case IDialogConstants.YES_ID: case IDialogConstants.OK_ID: return true; case IDialogConstants.NO_ID: return false; } return true; }
From source file:org2.eclipse.php.internal.debug.core.launching.PHPLaunchUtilities.java
License:Open Source License
private static boolean shouldSwitchToPreviousPerspective(String perspectiveID) { // check whether we should ask the user. IPreferenceStore store = PHPDebugEPLPlugin.getDefault().getPreferenceStore(); String option = store.getString(SWITCH_BACK_TO_PREVIOUS_PERSPECTIVE); if (MessageDialogWithToggle.ALWAYS.equals(option)) { return true; }//from w w w .jav a2s . c o m if (MessageDialogWithToggle.NEVER.equals(option)) { return false; } // Check whether the desired perspective is already active. IPerspectiveRegistry registry = PlatformUI.getWorkbench().getPerspectiveRegistry(); IPerspectiveDescriptor perspective = registry.findPerspectiveWithId(perspectiveID); if (perspective == null) { return false; } IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window != null) { IWorkbenchPage page = window.getActivePage(); if (page != null) { IPerspectiveDescriptor current = page.getPerspective(); if (current != null && current.getId().equals(perspectiveID)) { return false; } } // Ask the user whether to switch MessageDialogWithToggle m = MessageDialogWithToggle.openYesNoQuestion(window.getShell(), PHPDebugCoreMessages.PHPLaunchUtilities_PHPPerspectiveSwitchTitle, NLS.bind(PHPDebugCoreMessages.PHPLaunchUtilities_PHPPerspectiveSwitchMessage, new String[] { perspective.getLabel() }), PHPDebugCoreMessages.PHPLaunchUtilities_rememberDecision, false, store, SWITCH_BACK_TO_PREVIOUS_PERSPECTIVE); int result = m.getReturnCode(); switch (result) { case IDialogConstants.YES_ID: case IDialogConstants.OK_ID: return true; case IDialogConstants.NO_ID: return false; } } return false; }
From source file:org2.eclipse.php.internal.debug.core.launching.PHPLaunchUtilities.java
License:Open Source License
/** * Returns true in case a first line breakpoint should hit on a JIT remote sessions that have no reference in the * launch view. This method will prompt the user in case the option is set in the Debug preferences. * /*from w ww . ja v a 2s . c o m*/ * @param remoteIP * A remote IP to display when displaying the message. * @return True, if a JIT first line breakpoint should be set; False, otherwise. * @since Aptana PHP 1.1 */ public static boolean shouldBreakOnJitFirstLine(final String remoteIP) { final IPreferenceStore store = PHPDebugEPLPlugin.getDefault().getPreferenceStore(); String option = store.getString(IPHPDebugCorePreferenceKeys.BREAK_ON_FIRST_LINE_FOR_UNKNOWN_JIT); if (MessageDialogWithToggle.ALWAYS.equals(option)) { return true; } else if (MessageDialogWithToggle.PROMPT.equals(option)) { final DialogResultHolder resultHolder = new DialogResultHolder(); Display.getDefault().syncExec(new Runnable() { public void run() { Shell shell = getActiveShell(); MessageDialogWithToggle dialog = new PHPLaunchUtilities.BlinkingMessageDialogWithToggle(shell, PHPDebugCoreMessages.Debugger_incomingDebuggerJitRequestTitle, null, NLS.bind(PHPDebugCoreMessages.Debugger_incomingDebuggerJitRequest, new Object[] { remoteIP }), MessageDialogWithToggle.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0, PHPDebugCoreMessages.PHPLaunchUtilities_rememberDecision, false); dialog.setPrefStore(store); dialog.setPrefKey(IPHPDebugCorePreferenceKeys.BREAK_ON_FIRST_LINE_FOR_UNKNOWN_JIT); dialog.open(); resultHolder.setReturnCode(dialog.getReturnCode()); } }); if (resultHolder.getReturnCode() == IDialogConstants.YES_ID) { return true; } } return false; }
From source file:sernet.verinice.fei.rcp.FileElementDropAdapter.java
License:Open Source License
@Override public boolean run(Object data, final Object target) { try {//ww w. j a v a 2 s.c o m if (!checkRights()) { if (LOG.isDebugEnabled()) { LOG.debug("User is not allowed to perform this file drop."); } return false; } ByteArrayInputStream bai = new ByteArrayInputStream((byte[]) data); ObjectInputStream oi = new ObjectInputStream(bai); final String[] filePathes = (String[]) oi.readObject(); boolean startImport = true; boolean doConfirm = !Activator.getDefault().getPreferenceStore() .getBoolean(PreferenceConstants.FEI_DND_CONFIRM); if (doConfirm) { MessageDialogWithToggle dialog = InfoDialogWithShowToggle.openYesNoCancelQuestion( Messages.FileElementDropAdapter_0, getMessage(filePathes), Messages.FileElementDropAdapter_1, PreferenceConstants.FEI_DND_CONFIRM); startImport = IDialogConstants.YES_ID == dialog.getReturnCode(); } if (startImport) { IProgressService progressService = PlatformUI.getWorkbench().getProgressService(); progressService.run(true, true, new IRunnableWithProgress() { @Override public void run(IProgressMonitor arg0) throws InvocationTargetException, InterruptedException { try { importFiles(filePathes, (Group<CnATreeElement>) target); } catch (Exception e) { LOG.error("Error while importing data.", e); //$NON-NLS-1$ } } }); showResult(); } return true; } catch (Exception e) { LOG.error("Error while performing file drop", e); //$NON-NLS-1$ return false; } }
From source file:sernet.verinice.rcp.gsm.StartGsmExecuteProcess.java
License:Open Source License
@Override public void run(IAction action) { try {//from w ww .java2 s. c o m if (orgId != null) { boolean startProcess = true; boolean validateProcess = !Activator.getDefault().getPreferenceStore() .getBoolean(PreferenceConstants.INFO_PROCESS_VALIDATE); if (validateProcess) { startProcess = (IDialogConstants.YES_ID == validateOrganization()); } if (startProcess) { startProcess(); if (numberOfProcess > 0) { TaskChangeRegistry.tasksAdded(); } } } } catch (Exception e) { LOG.error("Error while creating process.", e); //$NON-NLS-1$ ExceptionUtil.log(e, Messages.StartGsmExecuteProcess_3); } }
From source file:sernet.verinice.rcp.InfoDialogWithShowToggle.java
License:Open Source License
public static InfoDialogWithShowToggle openYesNoCancelQuestion(Shell parent, String title, String message, String toggleMessage, IPreferenceStore store, String key) { InfoDialogWithShowToggle dialog = new InfoDialogWithShowToggle(parent, title, null, // accept the default window icon message, QUESTION_WITH_CANCEL, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0, // YES_LABEL is the default (first entry of array) toggleMessage, false);/* w w w . j a v a 2s .c om*/ dialog.setPrefStore(store); dialog.setPrefKey(key); boolean open = true; if (dialog.getPrefStore() != null && dialog.getPrefKey() != null && dialog.getPrefStore().contains(dialog.getPrefKey())) { open = !dialog.getPrefStore().getBoolean(dialog.getPrefKey()); } if (open) { dialog.open(); } else { dialog.setReturnCode(IDialogConstants.YES_ID); } return dialog; }
From source file:sernet.verinice.rcp.PerspectiveSwitcher.java
License:Open Source License
private boolean reallySwitch(Class<? extends IWorkbenchPart> clazz) { IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore(); boolean askNot = preferenceStore.getBoolean(PreferenceConstants.getDontAskBeforeSwitch(clazz)); boolean doSwitch = MessageDialogWithToggle.ALWAYS .equals(preferenceStore.getString(PreferenceConstants.getSwitch(clazz))); if (!askNot) { MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoCancelQuestion( PlatformUI.getWorkbench().getDisplay().getActiveShell(), Messages.PerspectiveSwitcher_6, Messages.PerspectiveSwitcher_7, Messages.PerspectiveSwitcher_8, false, Activator.getDefault().getPreferenceStore(), PreferenceConstants.getSwitch(clazz)); doSwitch = (dialog.getReturnCode() == IDialogConstants.OK_ID || dialog.getReturnCode() == IDialogConstants.YES_ID); if (dialog.getToggleState()) { preferenceStore.setValue(PreferenceConstants.getDontAskBeforeSwitch(clazz), true); // workaround because MessageDialogWithToggle dont't set the value if Button with NO_ID is clicked if (dialog.getReturnCode() == IDialogConstants.NO_ID) { preferenceStore.setValue(PreferenceConstants.getSwitch(clazz), MessageDialogWithToggle.NEVER); }/*from ww w. ja va 2s . c om*/ } } return doSwitch; }