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:eu.geclipse.jsdl.ui.widgets.SweepDeleteDialog.java
License:Open Source License
@Override protected Control createButtonBar(final Composite parent) { Composite buttonsComp = new Composite(parent, SWT.NONE); buttonsComp.setLayout(new GridLayout(0, true)); GridData gData = new GridData(GridData.FILL_BOTH); gData.verticalIndent = 10;/*from ww w . ja v a 2 s.c o m*/ gData.horizontalAlignment = SWT.END; buttonsComp.setLayoutData(gData); createButton(buttonsComp, IDialogConstants.SELECT_ALL_ID, Messages.getString("SweepDeleteDialog.delete_all_button"), //$NON-NLS-1$ true); createButton(buttonsComp, IDialogConstants.PROCEED_ID, Messages.getString("SweepDeleteDialog.delete_all_selected"), //$NON-NLS-1$ false); createButton(buttonsComp, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); return buttonsComp; }
From source file:eu.geclipse.ui.dialogs.AccessControlDialog.java
License:Open Source License
/** * Create the dialog buttons. We override the superclass' method to be * able to modify the 'OK' button label if the ACL can be saved as a whole, * and presenting only a 'Done' button if the entries are saved by the * sub-dialog {@link AccessControlRuleDialog}. *///from ww w .j a v a 2s. com @Override protected void createButtonsForButtonBar(final Composite parent) { // We just change the label of the OK button String buttonText = null; if (this.canSaveWholeACL) { buttonText = Messages.getString("AccessControlDialog.save_button_text"); //$NON-NLS-1$ } else { buttonText = Messages.getString("AccessControlDialog.done_button_text"); //$NON-NLS-1$ } createButton(parent, IDialogConstants.OK_ID, buttonText, true); // Avoid having a Cancel button if there is nothing to cancel if (this.canSaveWholeACL) { createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); } }
From source file:eu.geclipse.ui.dialogs.AccessControlRuleDialog.java
License:Open Source License
/** * Create the dialog buttons. We override the superclass' method to be able * to modify the OK button label if each entry has to be saved individually. *//*from ww w . j ava 2 s . c om*/ @Override protected void createButtonsForButtonBar(final Composite parent) { // We change just the label of the OK button String buttonText = null; if (this.withSaveButton) { buttonText = Messages.getString("AccessControlRuleDialog.save_button_text"); //$NON-NLS-1$ } else { buttonText = IDialogConstants.OK_LABEL; } // TODO reenable when write support is available Button button; button = createButton(parent, IDialogConstants.OK_ID, buttonText, true); button.setEnabled(false); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:eu.geclipse.ui.dialogs.PasswordDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(final Composite parent) { // create OK and Cancel buttons by default this.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 w w . j a v a2s.c o m this.text.setFocus(); if (this.value != null) { this.text.setText(this.value); this.text.selectAll(); } }
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.hydrologis.jgrass.uibuilder.jgrassdependent.GuiBuilderDialog.java
License:Open Source License
protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); /*/*from www .j a v a 2 s. com*/ * add the help button */ ((GridLayout) parent.getLayout()).numColumns++; Button helpButton = new Button(parent, SWT.PUSH); Image helpImg = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK); helpButton.setImage(helpImg); helpButton.setFont(JFaceResources.getDialogFont()); helpButton.setData(new Integer(HELP_ID)); helpButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { buttonPressed(((Integer) event.widget.getData()).intValue()); } }); }
From source file:eu.numberfour.n4js.product.N4JSApplication.java
License:Open Source License
/** * Return true if the argument directory is ok to use as a workspace and false otherwise. A version check will be * performed, and a confirmation box may be displayed on the argument shell if an older version is detected. * * @return true if the argument URL is ok to use as a workspace and false otherwise. *//*from w ww . j a v a 2 s. c o m*/ private boolean checkValidWorkspace(final Shell shell, final URL url) { // a null url is not a valid workspace if (url == null) { return false; } if (WORKSPACE_CHECK_REFERENCE_BUNDLE_VERSION == null) { // no reference bundle installed, no check possible return true; } final Version version = readWorkspaceVersion(url); // if the version could not be read, then there is not any existing // workspace data to trample, e.g., perhaps its a new directory that // is just starting to be used as a workspace if (version == null) { return true; } final Version ide_version = toMajorMinorVersion(WORKSPACE_CHECK_REFERENCE_BUNDLE_VERSION); final Version workspace_version = toMajorMinorVersion(version); final int versionCompareResult = workspace_version.compareTo(ide_version); // equality test is required since any version difference (newer // or older) may result in data being trampled if (versionCompareResult == 0) { return true; } // At this point workspace has been detected to be from a version // other than the current ide version -- find out if the user wants // to use it anyhow. int severity; String title; String message; if (versionCompareResult < 0) { // Workspace < IDE. Update must be possible without issues, // so only inform user about it. severity = INFORMATION; title = IDEApplication_versionTitle_olderWorkspace; message = NLS.bind(IDEApplication_versionMessage_olderWorkspace, url.getFile()); } else { // Workspace > IDE. It must have been opened with a newer IDE version. // Downgrade might be problematic, so warn user about it. severity = WARNING; title = IDEApplication_versionTitle_newerWorkspace; message = NLS.bind(IDEApplication_versionMessage_newerWorkspace, url.getFile()); } final MessageDialog dialog = new MessageDialog(shell, title, null, message, severity, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0); return dialog.open() == Window.OK; }
From source file:eu.numberfour.n4js.ui.export.AbstractExportToSingleFileWizardPage.java
License:Open Source License
/** * The default implementation of this <code>IOverwriteQuery</code> method asks the user whether the existing * resource at the given path should be overwritten. * * @param pathString/* w w w .ja va2 s . c om*/ * the path of the archive * @return the user's reply: one of <code>"YES"</code>, <code>"NO"</code>, <code>"ALL"</code>, or * <code>"CANCEL"</code> */ @Override public String queryOverwrite(String pathString) { IPath path = Path.fromOSString(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) { @Override protected int getShellStyle() { return super.getShellStyle() | SWT.SHEET; } }; 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() { @Override public void run() { dialog.open(); } }); return dialog.getReturnCode() < 0 ? CANCEL : response[dialog.getReturnCode()]; }
From source file:eu.numberfour.n4js.ui.organize.imports.MultiElementListSelectionDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { fBackButton = createButton(parent, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false); // XXX: Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=279425 boolean HAS_BUG_279425 = true; fNextButton = createButton(parent, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, !HAS_BUG_279425); fFinishButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.FINISH_LABEL, HAS_BUG_279425); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:eu.numberfour.n4js.ui.preferences.N4JSBuilderPreferencePage.java
License:Open Source License
/** * This method has been copied and adapted from org.eclipse.xtext.ui.preferences.OptionsConfigurationBlock. *///from w ww. jav a2s .c o m @Override protected boolean processChanges(IWorkbenchPreferenceContainer container) { boolean needsBuild = !getPreferenceChanges().isEmpty() | projectSpecificChanged; boolean doBuild = false; if (needsBuild) { int count = getRebuildCount(); if (count > rebuildCount) { needsBuild = false; rebuildCount = count; } } if (needsBuild) { String[] strings = getFullBuildDialogStrings(project == null); if (strings != null) { 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); int res = dialog.open(); if (res == 0) { doBuild = true; } else if (res != 1) { return false; } } } if (container != null) { if (doBuild) { incrementRebuildCount(); container.registerUpdateJob(getBuildJob(getProject())); } } else { if (doBuild) { getBuildJob(getProject()).schedule(); } } return true; }