List of usage examples for org.eclipse.jface.dialogs IDialogConstants CANCEL_LABEL
String CANCEL_LABEL
To view the source code for org.eclipse.jface.dialogs IDialogConstants CANCEL_LABEL.
Click Source Link
From source file:com.aptana.ide.core.ui.dialogs.InputURLDialog.java
License:Open Source License
protected void createButtonsForButtonBar(Composite parent) { // create OK and Cancel buttons by default okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); //do this here because setting the text will set enablement on the ok // button/*from w ww .j a va2 s . c o m*/ loadList(); combo.setFocus(); if (value != null) { combo.setText(value); setErrorMessage(null); if (validator.isValid(value) != null) { Control button = getButton(IDialogConstants.OK_ID); if (button != null) { button.setEnabled(false); } } } }
From source file:com.aptana.ide.core.ui.wizards.WizardFolderImportPage.java
License:Open Source License
/** * The <code>WizardDataTransfer</code> implementation of this <code>IOverwriteQuery</code> method asks the user * whether the existing resource at the given path should be overwritten. * // ww w .ja v a 2 s .com * @param pathString * @return the user's reply: one of <code>"YES"</code>, <code>"NO"</code>, <code>"ALL"</code>, or * <code>"CANCEL"</code> */ public String queryOverwrite(String pathString) { Path path = new Path(pathString); String messageString; // Break the message up if there is a file name and a directory // and there are at least 2 segments. if (path.getFileExtension() == null || path.segmentCount() < 2) { messageString = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_existsQuestion, pathString); } else { messageString = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_overwriteNameAndPathQuestion, path.lastSegment(), path.removeLastSegments(1).toOSString()); } final MessageDialog dialog = new MessageDialog(getContainer().getShell(), IDEWorkbenchMessages.Question, null, messageString, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL, IDialogConstants.CANCEL_LABEL }, 0); String[] response = new String[] { YES, ALL, NO, NO_ALL, CANCEL }; // run in syncExec because callback is from an operation, // which is probably not running in the UI thread. getControl().getDisplay().syncExec(new Runnable() { public void run() { dialog.open(); } }); return dialog.getReturnCode() < 0 ? CANCEL : response[dialog.getReturnCode()]; }
From source file:com.aptana.ide.debug.internal.ui.LaunchDebuggerPromptStatusHandler.java
License:Open Source License
/** * @see org.eclipse.debug.core.IStatusHandler#handleStatus(org.eclipse.core.runtime.IStatus, java.lang.Object) *///from w w w . j a v a 2s . c o m public Object handleStatus(IStatus status, Object source) throws CoreException { Shell shell = DebugUiPlugin.getActiveWorkbenchShell(); String title = Messages.LaunchDebuggerPromptStatusHandler_Title; String message = Messages.LaunchDebuggerPromptStatusHandler_DebuggerSessionIsActive; MessageDialog dlg = new MessageDialog(shell, title, null, message, MessageDialog.INFORMATION, new String[] { Messages.LaunchDebuggerPromptStatusHandler_CloseActiveSession, IDialogConstants.CANCEL_LABEL }, 1); return new Boolean(dlg.open() == 0); }
From source file:com.aptana.ide.editors.preferences.CodeAssistExpressionInfoDialog.java
License:Open Source License
/** * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) *///from w w w .j a v a2 s . c o m protected void createButtonsForButtonBar(Composite parent) { okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); okButton.setEnabled(validateErrorDescriptor()); }
From source file:com.aptana.ide.server.jetty.ShowPerspectiveClient.java
License:Open Source License
private boolean promptUser(String id) { Shell shell = JettyPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(); MessageDialogWithToggle dialog = new MessageDialogWithToggle(shell, Messages.ShowPerspectiveClient_1, null, // accept the default window icon MessageFormat.format(Messages.ShowPerspectiveClient_2, getPerspectiveName(id)), MessageDialogWithToggle.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0, // YES is the default null, false) {//from ww w .j a v a2s. c o m @Override protected Control createCustomArea(Composite parent) { try { URL url = JettyPlugin.getDefault().getBundle().getEntry("/icons/animation.gif"); //$NON-NLS-1$ url = FileLocator.toFileURL(url); Browser animation = new Browser(parent, SWT.NULL); animation.setText("<html>" + //$NON-NLS-1$ "<body style='margin: 0; padding:0; border: 1px solid black' >" + //$NON-NLS-1$ "<center>" + //$NON-NLS-1$ "<img src='" + url.toExternalForm() + "' />" + //$NON-NLS-1$ //$NON-NLS-2$ "</center>" + //$NON-NLS-1$ "</body>" + //$NON-NLS-1$ "</html>" //$NON-NLS-1$ ); GridData gridData = new GridData(SWT.CENTER, SWT.CENTER, true, false); gridData.widthHint = 311 + 2; // 2 for border gridData.heightHint = 169 + 2; // 2 for border animation.setLayoutData(gridData); return animation; } catch (IOException e) { } Label animation = new Label(parent, SWT.CENTER); animation.setImage(JettyPlugin.getImage("/icons/animation.gif")); //$NON-NLS-1$ GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false); animation.setLayoutData(gridData); return animation; } }; dialog.setPrefStore(JettyPlugin.getDefault().getPreferenceStore()); dialog.setPrefKey(getPrefKey(id)); dialog.open(); return (dialog.getReturnCode() == IDialogConstants.YES_ID); }
From source file:com.aptana.ide.syncing.ui.old.views.SmartSyncDialog.java
License:Open Source License
protected void createButtonsForButtonBar(Composite parent) { // create OK and Cancel buttons by default startSync = createButton(parent, IDialogConstants.PROCEED_ID, Messages.SmartSyncDialog_StartSync, true); GridData gridData = new GridData(SWT.FILL, SWT.END, false, false); GC gc = new GC(startSync); // calculates the ideal width gridData.widthHint = Math.max(gc.stringExtent(Messages.SmartSyncDialog_StartSync).x, gc.stringExtent(Messages.SmartSyncDialog_RunInBackground).x) + 50; gc.dispose();/* w ww . j av a 2 s .c o m*/ startSync.setLayoutData(gridData); startSync.addSelectionListener(this); saveLog = createButton(parent, IDialogConstants.DETAILS_ID, "Save Log...", false); //$NON-NLS-1$ saveLog.addSelectionListener(this); saveLog.setEnabled(false); cancel = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); cancel.addSelectionListener(this); }
From source file:com.aptana.ide.syncing.ui.views.SmartSyncDialog.java
License:Open Source License
/** * @see org.eclipse.jface.window.Window#open() *//* www. j av a2s . c o m*/ public int open() { if (sourceConnectionPoint instanceof IProjectProvider) { IProjectProvider projectProvider = (IProjectProvider) sourceConnectionPoint; IProject project = projectProvider.getProject(); if (project != null) { try { if (Boolean.TRUE.equals((Boolean) project.getSessionProperty(Synchronizer.SYNC_IN_PROGRESS))) { MessageDialog messageDialog = new MessageDialog(CoreUIUtils.getActiveShell(), Messages.SmartSyncDialog_SyncInProgressTitle, null, Messages.SmartSyncDialog_SyncInProgress, MessageDialog.QUESTION, new String[] { IDialogConstants.CANCEL_LABEL, Messages.SmartSyncDialog_ContinueLabel, }, 0); if (messageDialog.open() == 0) { return CANCEL; } } } catch (CoreException e) { } } } if (!compareInBackground) { super.open(); } load(true); return OK; }
From source file:com.aptana.ide.ui.io.actions.CopyFilesOperation.java
License:Open Source License
/** * @param sourceStore//from ww w. ja va2s . c om * the file to be copied * @param destinationStore * the destination location * @param monitor * the progress monitor * @return true if the file is successfully copied, false if the operation did not go through for any reason */ protected boolean copyFile(IFileStore sourceStore, IFileStore destinationStore, IProgressMonitor monitor) { if (sourceStore == null || CloakingUtils.isFileCloaked(sourceStore)) { return false; } boolean success = true; monitor.subTask(MessageFormat.format(Messages.CopyFilesOperation_Copy_Subtask, sourceStore.getName(), destinationStore.getName())); if (destinationStore.equals(sourceStore)) { destinationStore = getNewNameFor(destinationStore); if (destinationStore == null) { return false; } } try { IFileStore[] childStores = Utils.isDirectory(sourceStore) ? sourceStore.childStores(EFS.NONE, monitor) : new IFileStore[0]; if (Utils.exists(destinationStore) && sourceStore.getName().equals(destinationStore.getName())) { // a name conflict; ask to overwrite if (overwriteStatus != OverwriteStatus.YES_TO_ALL) { final IFileStore dStore = destinationStore; final IFileStore sStore = sourceStore; fShell.getDisplay().syncExec(new Runnable() { public void run() { MessageDialog dialog = new MessageDialog(fShell, Messages.CopyFilesOperation_OverwriteTitle, null, MessageFormat.format(Messages.CopyFilesOperation_OverwriteWarning, dStore.toString(), sStore.toString()), MessageDialog.CONFIRM, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0); int retCode = dialog.open(); switch (retCode) { case 0: // Yes overwriteStatus = OverwriteStatus.YES; break; case 1: // Yes to All overwriteStatus = OverwriteStatus.YES_TO_ALL; break; case 2: // No overwriteStatus = OverwriteStatus.NO; break; default: overwriteStatus = OverwriteStatus.CANCEL; } } }); switch (overwriteStatus) { case CANCEL: monitor.setCanceled(true); // let it fall through since it would return false as well case NO: return false; } } } SyncUtils.copy(sourceStore, null, destinationStore, EFS.NONE, monitor); // copy the children recursively IFileStore destChildStore; for (IFileStore childStore : childStores) { destChildStore = destinationStore.getChild(childStore.getName()); copyFile(childStore, destChildStore, monitor); } } catch (CoreException e) { IdeLog.logError(IOUIPlugin.getDefault(), MessageFormat .format(Messages.CopyFilesOperation_ERR_FailedToCopy, sourceStore, destinationStore), e); success = false; } return success; }
From source file:com.aptana.internal.ui.text.spelling.OptionsConfigurationBlock.java
License:Open Source License
protected boolean processChanges(IWorkbenchPreferenceContainer container) { final IScopeContext currContext = this.fLookupOrder[0]; final List /* <Key> */ changedOptions = new ArrayList(); boolean needsBuild = this.getChanges(currContext, changedOptions); if (changedOptions.isEmpty()) { return true; }/*from www . j a v a 2 s .c o m*/ if (needsBuild) { final int count = this.getRebuildCount(); if (count > this.fRebuildCount) { needsBuild = false; // build already requested this.fRebuildCount = count; } } boolean doBuild = false; if (needsBuild) { final String[] strings = this.getFullBuildDialogStrings(true); if (strings != null) { final MessageDialog dialog = new MessageDialog(this.getShell(), strings[0], null, strings[1], MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 2); final int res = dialog.open(); if (res == 0) { doBuild = true; } else if (res != 1) { return false; // cancel pressed } } } if (container != null) { // no need to apply the changes to the original store: will be done // by the page container if (doBuild) { // post build this.incrementRebuildCount(); //container.registerUpdateJob(CoreUtility.getBuildJob(fProject)) // ; } } else { // apply changes right away try { this.fManager.applyChanges(); } catch (final BackingStoreException e) { // JavaPlugin.log(e); return false; } if (doBuild) { // CoreUtility.getBuildJob(fProject).schedule(); } } return true; }
From source file:com.aptana.jira.ui.internal.SubmitTicketDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); getButton(IDialogConstants.OK_ID).setEnabled(false); }