List of usage examples for org.eclipse.jface.dialogs MessageDialog openConfirm
public static boolean openConfirm(Shell parent, String title, String message)
From source file:com.nextep.designer.vcs.ui.handlers.OpenTypedObjectAction.java
License:Open Source License
@Override public void run() { final IStructuredSelection sel = (IStructuredSelection) selectionProvider.getSelection(); if (!sel.isEmpty()) { // Warning before opening too many editors if (sel.size() > WARN_DIALOG_ABOVE) { final boolean confirmed = MessageDialog.openConfirm(page.getWorkbenchWindow().getShell(), MessageFormat.format(UIMessages.getString("editItemWarnCountTitle"), sel.size()), //$NON-NLS-1$ MessageFormat.format(UIMessages.getString("editItemWarnCount"), sel.size(), sel.size())); //$NON-NLS-1$ if (!confirmed) { return; }//from w w w . ja v a 2 s . c om } // If OK, we open everything final Iterator<?> selIt = sel.iterator(); while (selIt.hasNext()) { final Object o = selIt.next(); if ((o instanceof ITypedObject) && !(o instanceof IConnector<?, ?>)) { final ITypedObject t = (ITypedObject) o; UIControllerFactory.getController(t.getType()).defaultOpen(t); } } } }
From source file:com.nextep.designer.vcs.ui.handlers.RemoveHandler.java
License:Open Source License
@Override protected boolean checkAndConfirm(List<IVersionable<?>> selectedVersions) { final boolean confirmed = MessageDialog.openConfirm( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), VCSUIMessages.getString("handler.remove.title"), //$NON-NLS-1$ MessageFormat.format(VCSUIMessages.getString("handler.remove.confirmMsg"), //$NON-NLS-1$ selectedVersions.size())); return confirmed; }
From source file:com.nextep.designer.vcs.ui.navigators.VersionableDropAssistant.java
License:Open Source License
@SuppressWarnings("unchecked") @Override// ww w . java 2 s.c o m public IStatus handleDrop(CommonDropAdapter aDropAdapter, DropTargetEvent aDropTargetEvent, Object aTarget) { final IVersionContainer c = (IVersionContainer) aTarget; // Performing drop here boolean confirmed = MessageDialog.openConfirm( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), VCSUIMessages.getString("movingVersionableConfirmTitle"), MessageFormat.format(VCSUIMessages //$NON-NLS-1$ .getString("movingVersionableConfirm"), c.getName())); //$NON-NLS-1$ if (confirmed) { ISelection s = (ISelection) aDropTargetEvent.data; if (s instanceof StructuredSelection) { List<IVersionable<?>> toMove = new ArrayList<IVersionable<?>>(); for (Object o : ((IStructuredSelection) s).toArray()) { fillVersionablesFromObject(toMove, o); } getViewUIService().move(toMove, c); return Status.OK_STATUS; } } return Status.CANCEL_STATUS; }
From source file:com.nextep.designer.vcs.ui.services.VersionUIHelper.java
License:Open Source License
/** * Changes the password of this repository user * /*from w ww .j av a 2s . c o m*/ * @param user repository user for password update * @param newPassword new password to assign to this user */ public static void changeUserPassword(IRepositoryUser user, String newPassword) { boolean confirm = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "Change user password", MessageFormat.format(VCSUIMessages.getString("userConfirmChangePassword"), user.getName(), newPassword)); if (confirm) { try { HibernateUtil.getInstance().getSession() .createSQLQuery("update REP_USERS set password=? where user_id=?").setString(0, newPassword) .setLong(1, user.getUID().rawId()).executeUpdate(); } catch (HibernateException e) { log.error("Error while updating user password", e); throw e; } log.info("Password changed for user '" + user.getName() + "'"); } else { log.info("Aborted password change."); } }
From source file:com.nextep.designer.vcs.ui.validators.UserCommitValidator.java
License:Open Source License
@Override public IStatus validate(IVersioningOperationContext context) { // Building list final StringBuilder b = new StringBuilder(); boolean containsOtherUser = fillOtherUserBuffer(context.getVersionables(), b); if (containsOtherUser) { // Ask for confirmation final boolean force = MessageDialog.openConfirm( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), VCSUIMessages.getString("checkInDifferentUserForceTitle"), //$NON-NLS-1$ MessageFormat.format(VCSUIMessages.getString("checkInDifferentUserForce"), b.toString() //$NON-NLS-1$ ));/*from w w w. j a v a2 s.co m*/ // User has canceled the process if (!force) { return Status.CANCEL_STATUS; } } return Status.OK_STATUS; }
From source file:com.nokia.carbide.cpp.internal.pi.wizards.ui.util.SdkChooserBase.java
License:Open Source License
private void handleRemoveSdk() { TableItem[] items = sdkTable.getSelection(); if (items.length > 0) { ISymbianSDK sdk = (ISymbianSDK) items[0].getData(); if (sdk != null) { if (MessageDialog.openConfirm(composite.getShell(), Messages.getString("SdkChooserBase.confirm.delete") + sdk.getUniqueId(), //$NON-NLS-1$ Messages.getString("SdkChooserBase.confirm.message"))) { //$NON-NLS-1$ if (getSDKManager().removeSDK(sdk.getUniqueId())) { getSDKList().remove(sdk); getSDKManager().updateCarbideSDKCache(); propagateSdkFromManager(); }//from w w w .j a v a 2 s. c o m } } } }
From source file:com.nokia.carbide.cpp.internal.project.ui.actions.ModifyMultiImageSourceActionBase.java
License:Open Source License
/** * Commit the view, with querying and merge on conflict. *//*from w ww. ja v a 2s. co m*/ protected void commitStanza(IView view) { while (true) { try { view.commit(); break; } catch (IllegalStateException e) { if (view.merge()) continue; boolean overwrite = MessageDialog.openConfirm(shell, Messages.getString("ModifyMultiImageSourceActionBase.EditConflictTitle"), //$NON-NLS-1$ MessageFormat.format(Messages.getString("ModifyMultiImageSourceActionBase.EditConflictMsg"), //$NON-NLS-1$ new Object[] { modelFile.getLocation() })); if (overwrite) { view.forceSynchronized(); } else { break; } } } }
From source file:com.nokia.carbide.cpp.internal.project.ui.actions.RemoveMBMMIFFileEntryActionBase.java
License:Open Source License
/** * @param view//from ww w. ja va 2s .co m */ protected void removeMbmMifEntryInView(IView view) { IMultiImageSource source = findMultiImageSource(view, mbmMifFileEntry.getTargetFilePath()); boolean doit = MessageDialog.openConfirm(getShell(), Messages.getString("RemoveMBMMIFFileEntryActionBase.DeleteEntryTitle"), //$NON-NLS-1$ MessageFormat.format(Messages.getString("RemoveMBMMIFFileEntryActionBase.DeleteEntryDescription"), //$NON-NLS-1$ new Object[] { mbmMifFileEntry.getTargetFilePath() })); if (doit) { getMultiImageSources(view).remove(source); commitStanza(view); } }
From source file:com.nokia.carbide.cpp.internal.project.ui.mmpEditor.dialogs.Utilities.java
License:Open Source License
/** * Check if this path has a drive letter rendering it invalid for use in an MMP file. * All files must be on the SDK drive. This routine tries to convert the * path to a suitable path. If it can't be, it prompts the user to approve * stripping the drive letter. If the user doesn't approve then null is returned. *//*from w w w .ja v a 2s. c o m*/ public static IPath validateandConfirmMMPPath(IPath path, ICarbideBuildConfiguration buildConfig, EMMPPathContext pathContext, MMPViewPathHelper pathHelper, Shell shell) { IPath result = path; try { result = pathHelper.convertProjectOrFullPathToMMP(pathContext, path); } catch (InvalidDriveInMMPPathException e) { IPath epocRoot = new Path(buildConfig.getSDK().getEPOCROOT()); String epocRootDevice = epocRoot.getDevice(); String title = Messages.getString("Utilities.InvalidMMPPathTitle"); //$NON-NLS-1$ boolean stripDevice; if (epocRootDevice != null) { String fmt = Messages.getString("Utilities.InvalidMMPPathDifferentDriveMessage"); //$NON-NLS-1$ String msg = MessageFormat.format(fmt, epocRootDevice, path.getDevice()); stripDevice = MessageDialog.openConfirm(shell, title, msg); } else { String fmt = Messages.getString("Utilities.InvalidMMPPathNoDriveMessage"); //$NON-NLS-1$ String msg = MessageFormat.format(fmt, path.getDevice()); stripDevice = MessageDialog.openConfirm(shell, title, msg); } if (stripDevice) { result = e.getPathNoDevice(); } else { result = null; } } return result; }
From source file:com.nokia.carbide.cpp.sdk.ui.shared.AddSDKDialog.java
License:Open Source License
@Override protected void okPressed() { if (deviceIDtext.getText().length() > 0) { if (!isValidIDName(deviceIDtext.getText())) { return; }/*from w ww . j a v a 2 s .c om*/ } else { MessageDialog.openError(getShell(), Messages.getString("AddSDKDialog.Missing_SDK_ID"), //$NON-NLS-1$ Messages.getString("AddSDKDialog.Enter_SDK_ID")); //$NON-NLS-1$ return; } if (epocRootText.getText().length() > 1) { if (HostOS.IS_WIN32 && epocRootText.getText().charAt(1) != ':') { MessageDialog.openError(getShell(), Messages.getString("AddSDKDialog.Malformed_EPOCROOT"), //$NON-NLS-1$ Messages.getString("AddSDKDialog.EPOCROOT_drive_spec")); //$NON-NLS-1$ return; } if (epocRootText.getText().toUpperCase().endsWith("EPOC32") //$NON-NLS-1$ || epocRootText.getText().toUpperCase().endsWith("EPOC32\\")) { //$NON-NLS-1$ if (!MessageDialog.openConfirm(getShell(), Messages.getString("AddSDKDialog.Possible_wrong_epocroot"), //$NON-NLS-1$ Messages.getString("AddSDKDialog.EPOCROOT_Should_Point"))) { //$NON-NLS-1$ return; } } else { File epocRootFile = new File(epocRootText.getText()); if (!epocRootFile.exists()) { if (!MessageDialog.openConfirm(getShell(), Messages.getString("AddSDKDialog.EPOCROOT_does_not_exist"), //$NON-NLS-1$ Messages.getString("AddSDKDialog.EPOCROOT_does_not_exist_msg"))) { //$NON-NLS-1$ return; } } if (epocRootFile.toString().indexOf(" ") != -1) { // Paths should not have spaces... MessageDialog.openError(getShell(), "EPOC Root Contains Spaces", //$NON-NLS-1$ Messages.getString("AddSDKDialog.EPOCROOT_contains_spaces")); //$NON-NLS-1$ return; } } } else { if (epocRootText.getText().length() == 1 && epocRootText.getText().charAt(0) == '\\') { // OK - Currently accept only a '\'. May need to reconsider side-effects } else { MessageDialog.openError(getShell(), Messages.getString("AddSDKDialog.Missing_EPOCROOT"), //$NON-NLS-1$ Messages.getString("AddSDKDialog.Please_enter_an_EPOCROOT")); //$NON-NLS-1$ return; } } // No objections raised, write the new device entry Version osVersion = new Version("9.4.0"); //$NON-NLS-1$ ISymbianSDK sdk = SymbianSDKFactory.createInstance(deviceIDtext.getText(), epocRootText.getText(), osVersion); ((SymbianSDK) sdk).setEnabled(true); SDKCorePlugin.getSDKManager().addSDK(sdk); List<ISymbianSDK> sdkList = SDKCorePlugin.getSDKManager().getSDKList(); if (sdkList != null) { sdkList.add(sdk); } super.okPressed(); }