List of usage examples for org.eclipse.jface.dialogs MessageDialog CONFIRM
int CONFIRM
To view the source code for org.eclipse.jface.dialogs MessageDialog CONFIRM.
Click Source Link
From source file:org.eclipse.osee.define.traceability.operations.UiRenameConfirmer.java
License:Open Source License
private MessageDialog createDialog(final Map<Artifact, String> nameUpdateRequired) { MessageDialog dialog = new XTableDialog(Displays.getActiveShell(), "Rename Artifacts", null, "The following artifacts will be renamed.\n Select OK to continue with rename or Cancel to abort.", MessageDialog.CONFIRM, new String[] { "Ok", "Cancel" }, 0, nameUpdateRequired); return dialog; }
From source file:org.eclipse.papyrus.customization.properties.ui.CustomizationDialog.java
License:Open Source License
protected void deleteAction() { RemoveContextAction action = new RemoveContextAction(); IStructuredSelection selection = (IStructuredSelection) availableContextsViewer.getSelection(); if (selection.isEmpty()) { return;//from ww w . j ava2s . c om } Object element = selection.getFirstElement(); if (element instanceof Context) { Context sourceContext = (Context) element; if (ConfigurationManager.instance.isPlugin(sourceContext)) { Activator.log.warn(Messages.CustomizationDialog_cannotDeletePluginContext); //Plugin context cannot be deleted return; } MessageDialog dialog = new MessageDialog(getShell(), Messages.CustomizationDialog_deleteContext, null, Messages.CustomizationDialog_deleteContextConfirmation1 + sourceContext.getName() + Messages.CustomizationDialog_deleteContextConfirmation2, MessageDialog.CONFIRM, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 2); int result = dialog.open(); if (result == 0) { //0 is "Yes" (It is *not* the same 0 as Window.OK) action.removeContext(sourceContext); availableContextsViewer.setInput(ConfigurationManager.instance.getContexts()); } } }
From source file:org.eclipse.rap.examples.pages.MessageDialogUtil.java
License:Open Source License
private static String[] getButtonLabels(int kind) { String[] dialogButtonLabels;//ww w . j a v a 2 s .c o m switch (kind) { case MessageDialog.ERROR: case MessageDialog.INFORMATION: case MessageDialog.WARNING: { dialogButtonLabels = new String[] { IDialogConstants.get().OK_LABEL }; break; } case MessageDialog.CONFIRM: { dialogButtonLabels = new String[] { IDialogConstants.get().OK_LABEL, IDialogConstants.get().CANCEL_LABEL }; break; } case MessageDialog.QUESTION: { dialogButtonLabels = new String[] { IDialogConstants.get().YES_LABEL, IDialogConstants.get().NO_LABEL }; break; } case MessageDialog.QUESTION_WITH_CANCEL: { dialogButtonLabels = new String[] { IDialogConstants.get().YES_LABEL, IDialogConstants.get().NO_LABEL, IDialogConstants.get().CANCEL_LABEL }; break; } default: { throw new IllegalArgumentException("Illegal value for kind in MessageDialog.open()"); } } return dialogButtonLabels; }
From source file:org.eclipse.ui.internal.keys.KeysPreferencePage.java
License:Open Source License
protected final void performDefaults() { // Ask the user to confirm final String title = Util.translateString(RESOURCE_BUNDLE, "restoreDefaultsMessageBoxText"); //$NON-NLS-1$ final String message = Util.translateString(RESOURCE_BUNDLE, "restoreDefaultsMessageBoxMessage"); //$NON-NLS-1$ final boolean confirmed = MessageDialog.open(MessageDialog.CONFIRM, getShell(), title, message, SWT.SHEET); if (confirmed) { // Fix the scheme in the local changes. final String defaultSchemeId = bindingService.getDefaultSchemeId(); final Scheme defaultScheme = localChangeManager.getScheme(defaultSchemeId); try {//from ww w . j a v a 2s .co m localChangeManager.setActiveScheme(defaultScheme); } catch (final NotDefinedException e) { // At least we tried.... } // Fix the bindings in the local changes. final Binding[] currentBindings = localChangeManager.getBindings(); final int currentBindingsLength = currentBindings.length; final Set trimmedBindings = new HashSet(); for (int i = 0; i < currentBindingsLength; i++) { final Binding binding = currentBindings[i]; if (binding.getType() != Binding.USER) { trimmedBindings.add(binding); } } final Binding[] trimmedBindingArray = (Binding[]) trimmedBindings .toArray(new Binding[trimmedBindings.size()]); localChangeManager.setBindings(trimmedBindingArray); // Apply the changes. try { bindingService.savePreferences(defaultScheme, trimmedBindingArray); } catch (final IOException e) { logPreferenceStoreException(e); } } setScheme(localChangeManager.getActiveScheme()); // update the scheme update(true); super.performDefaults(); }
From source file:org.eclipse.ui.internal.keys.NewKeysPreferencePage.java
License:Open Source License
protected final void performDefaults() { // Ask the user to confirm final String title = NewKeysPreferenceMessages.RestoreDefaultsMessageBoxText; final String message = NewKeysPreferenceMessages.RestoreDefaultsMessageBoxMessage; final boolean confirmed = MessageDialog.open(MessageDialog.CONFIRM, getShell(), title, message, SWT.SHEET); if (confirmed) { long startTime = 0L; if (DEBUG) { startTime = System.currentTimeMillis(); }/* w ww . java2 s . c o m*/ fFilteredTree.setRedraw(false); BusyIndicator.showWhile(fFilteredTree.getViewer().getTree().getDisplay(), new Runnable() { public void run() { keyController.setDefaultBindings(fBindingService); } }); fFilteredTree.setRedraw(true); if (DEBUG) { final long elapsedTime = System.currentTimeMillis() - startTime; Tracing.printTrace(TRACING_COMPONENT, "performDefaults:model in " //$NON-NLS-1$ + elapsedTime + "ms"); //$NON-NLS-1$ } } super.performDefaults(); }
From source file:org.eclipse.ui.internal.statushandlers.InternalDialog.java
License:Open Source License
private boolean isPromptToClose() { IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore(); if (!store.contains(PREF_SKIP_GOTO_ACTION_PROMPT) || !store.getString(PREF_SKIP_GOTO_ACTION_PROMPT).equals(MessageDialogWithToggle.ALWAYS)) { MessageDialogWithToggle dialog = MessageDialogWithToggle.open(MessageDialog.CONFIRM, getShell(), ProgressMessages.JobErrorDialog_CloseDialogTitle, ProgressMessages.JobErrorDialog_CloseDialogMessage, ProgressMessages.JobErrorDialog_DoNotShowAgainMessage, false, store, PREF_SKIP_GOTO_ACTION_PROMPT, SWT.SHEET); return dialog.getReturnCode() == Window.OK; }/*from w w w .java2 s . c o m*/ return true; }
From source file:org.jkiss.dbeaver.ext.exasol.manager.ExasolConnectionManager.java
License:Apache License
@Override protected void addObjectModifyActions(List<DBEPersistAction> actionList, ObjectChangeCommand command, Map<String, Object> options) { ExasolConnection con = command.getObject(); Map<Object, Object> com = command.getProperties(); if (com.containsKey("description")) { actionList.add(Comment(con)); }/*from www. j a v a2 s . co m*/ // url, username or password have changed if (com.containsKey("url") | com.containsKey("userName") | com.containsKey("password")) { // possible loss of information - warn if ((com.containsKey("url") | com.containsKey("userName")) & !con.getUserName().isEmpty() & con.getPassword().isEmpty()) { int result = new UITask<Integer>() { protected Integer runTask() { ConfirmationDialog dialog = new ConfirmationDialog(UIUtils.getActiveWorkbenchShell(), ExasolMessages.dialog_connection_alter_title, null, ExasolMessages.dialog_connection_alter_message, MessageDialog.CONFIRM, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0, ExasolMessages.dialog_general_continue, false); return dialog.open(); } }.execute(); if (result != IDialogConstants.YES_ID) { throw new IllegalStateException("User abort"); } } StringBuilder script = new StringBuilder( String.format("ALTER CONNECTION %s ", DBUtils.getQuotedIdentifier(con))); script.append(" '" + ExasolUtils.quoteString(con.getConnectionString()) + "' "); if (!(con.getUserName().isEmpty() | con.getPassword().isEmpty())) { script.append(String.format(" USER '%s' IDENTIFIED BY '%s'", ExasolUtils.quoteString(con.getUserName()), ExasolUtils.quoteString(con.getPassword()))); } actionList.add(new SQLDatabasePersistAction("alter Connection", script.toString())); } }
From source file:org.jkiss.dbeaver.ext.exasol.manager.ExasolSchemaManager.java
License:Apache License
@Override protected void addObjectDeleteActions(List<DBEPersistAction> actions, ObjectDeleteCommand command, Map<String, Object> options) { int result = new UITask<Integer>() { protected Integer runTask() { ConfirmationDialog dialog = new ConfirmationDialog(UIUtils.getActiveWorkbenchShell(), ExasolMessages.dialog_schema_drop_title, null, ExasolMessages.dialog_schema_drop_message, MessageDialog.CONFIRM, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0, ExasolMessages.dialog_general_continue, false); return dialog.open(); }/*from w w w .j a va2 s . co m*/ }.execute(); if (result != IDialogConstants.YES_ID) { throw new IllegalStateException("User abort"); } actions.add(new SQLDatabasePersistAction("Drop schema", "DROP SCHEMA " + DBUtils.getQuotedIdentifier(command.getObject()) + " CASCADE") //$NON-NLS-1$ ); }
From source file:org.jkiss.dbeaver.ui.actions.navigator.NavigatorHandlerObjectDelete.java
License:Open Source License
private ConfirmResult confirmObjectDelete(final IWorkbenchWindow workbenchWindow, final DBNNode node, final boolean viewScript) { if (deleteAll != null) { return deleteAll ? ConfirmResult.YES : ConfirmResult.NO; }/* www . j av a2 s. com*/ ResourceBundle bundle = DBeaverActivator.getCoreResourceBundle(); String objectType = node instanceof DBNLocalFolder ? DBeaverPreferences.CONFIRM_LOCAL_FOLDER_DELETE : DBeaverPreferences.CONFIRM_ENTITY_DELETE; String titleKey = ConfirmationDialog.RES_CONFIRM_PREFIX + objectType + "_" //$NON-NLS-1$ + ConfirmationDialog.RES_KEY_TITLE; String messageKey = ConfirmationDialog.RES_CONFIRM_PREFIX + objectType + "_" //$NON-NLS-1$ + ConfirmationDialog.RES_KEY_MESSAGE; String nodeTypeName = node.getNodeType(); MessageDialog dialog = new MessageDialog(workbenchWindow.getShell(), UIUtils.formatMessage(bundle.getString(titleKey), nodeTypeName, node.getNodeName()), DBeaverIcons.getImage(UIIcon.REJECT), UIUtils.formatMessage(bundle.getString(messageKey), nodeTypeName.toLowerCase(), node.getNodeName()), MessageDialog.CONFIRM, null, 0) { @Override protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true); createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, false); if (structSelection.size() > 1) { createButton(parent, IDialogConstants.YES_TO_ALL_ID, IDialogConstants.YES_TO_ALL_LABEL, false); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); } if (viewScript) { createButton(parent, IDialogConstants.DETAILS_ID, CoreMessages.actions_navigator_view_script_button, false); } } }; int result = dialog.open(); switch (result) { case IDialogConstants.YES_ID: return ConfirmResult.YES; case IDialogConstants.YES_TO_ALL_ID: deleteAll = true; return ConfirmResult.YES; case IDialogConstants.NO_ID: return ConfirmResult.NO; case IDialogConstants.CANCEL_ID: case -1: deleteAll = false; return ConfirmResult.NO; case IDialogConstants.DETAILS_ID: return ConfirmResult.DETAILS; default: log.warn("Unsupported confirmation dialog result: " + result); //$NON-NLS-1$ return ConfirmResult.NO; } }
From source file:org.kalypso.model.wspm.pdb.db.PdbUpdater.java
License:Open Source License
private IStatus handleCreate() { /* ask user what to do */ final String msg = String.format(Messages.getString("PdbUpdater_5"), STR_CREATE); //$NON-NLS-1$ final MessageDialog dialog = new MessageDialog(m_shell, WINDOW_TITLE, null, msg, MessageDialog.CONFIRM, new String[] { Messages.getString("PdbUpdater_6"), IDialogConstants.CANCEL_LABEL }, 1); //$NON-NLS-1$ if (dialog.open() != Window.OK) return Status.CANCEL_STATUS; /* Do update */ final String dbType = m_connection.getSettings().getType(); final UpdateScript createScript = UpdateScriptExtenions.getScript(new Version(0, 0, 0), dbType); if (createScript == null) throw new IllegalStateException("Missing create script"); //$NON-NLS-1$ final UpdateScript[] scripts = new UpdateScript[] { createScript }; return executeScripts(scripts, Messages.getString("PdbUpdater_7")); //$NON-NLS-1$ }