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:gov.nasa.arc.spife.ui.timeline.action.dialog.GoToTimeDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { // create OK and Cancel buttons by default okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); okButton.setEnabled(true);//from w w w . j a v a 2 s .co m createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); /* * do this here because setting the text will set enablement on the ok * button */ textEditor.getEditorControl().setFocus(); }
From source file:gov.nasa.ensemble.common.ui.ide.navigator.EnsembleOpenResourceDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(final Composite parent) { // increment the number of columns in the button bar GridLayout parentLayout = (GridLayout) parent.getLayout(); parentLayout.numColumns++;/*from ww w . j a v a2s . c o m*/ parentLayout.makeColumnsEqualWidth = false; final Composite openComposite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.horizontalSpacing = 0; layout.marginWidth = 0; layout.marginHeight = 0; openComposite.setLayout(layout); Button okButton = createButton(openComposite, IDialogConstants.OK_ID, IDEWorkbenchMessages.OpenResourceDialog_openButton_text, true); // Arrow down button for Open With menu ((GridLayout) openComposite.getLayout()).numColumns++; openWithButton = new Button(openComposite, SWT.PUSH); // openWithButton.setToolTipText(IDEWorkbenchMessages.OpenResourceDialog_openWithButton_toolTip); openWithButton.setImage(WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_LCL_BUTTON_MENU)); GridData data = new GridData(SWT.CENTER, SWT.FILL, false, true); openWithButton.setLayoutData(data); openWithButton.addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { showOpenWithMenu(openComposite); } }); openWithButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { showOpenWithMenu(openComposite); } }); Button cancelButton = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); GridData cancelLayoutData = (GridData) cancelButton.getLayoutData(); GridData okLayoutData = (GridData) okButton.getLayoutData(); int buttonWidth = Math.max(cancelLayoutData.widthHint, okLayoutData.widthHint); cancelLayoutData.widthHint = buttonWidth; okLayoutData.widthHint = buttonWidth; if (openComposite.getDisplay().getDismissalAlignment() == SWT.RIGHT) { // Make the default button the right-most button. // See also special code in org.eclipse.jface.dialogs.Dialog#initializeBounds() openComposite.moveBelow(null); if (Util.isCarbon()) { okLayoutData.horizontalIndent = -10; } } }
From source file:gov.nasa.ensemble.common.ui.wizard.AbstractEnsembleProjectExportWizardPage.java
License:Open Source License
@Override public String queryOverwrite(String pathString) { Path path = new Path(pathString); String messageString;//ww w.j a va2 s . c o m //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) { // PATH_TO_FILE already exists. Would you like to overwrite it? //messageString = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_existsQuestion, pathString); IFolder folder = ResourcesPlugin.getWorkspace().getRoot().getFolder(path); IPath location = folder.getLocation(); File file = null; if (location == null) { file = new File(pathString); } else { file = location.toFile(); } messageString = getDialogQuestionText(file); } else { messageString = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_overwriteNameAndPathQuestion, path.lastSegment(), path.removeLastSegments(1).toOSString()); String osString = path.toOSString(); Date date = new Date(new File(osString).lastModified()); messageString += System.getProperty("line.separator") + System.getProperty("line.separator") + "'" + path.lastSegment() + "' was last modified on: " + date; } final MessageDialog dialog = new MessageDialog(getShellForMessageDialog(), 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. WidgetUtils.runInDisplayThread(getShell(), new Runnable() { @Override public void run() { dialog.open(); } }); return dialog.getReturnCode() < 0 ? CANCEL : response[dialog.getReturnCode()]; }
From source file:gov.nasa.ensemble.common.ui.wizard.DefaultOverwriteQueryImpl.java
License:Open Source License
@Override public String queryOverwrite(String pathString) { if (alwaysOverwrite) { return ALL; }// www . j a v a2 s . co m final String returnCode[] = { CANCEL }; final String msg = NLS.bind(IDEWorkbenchMessages.CopyFilesAndFoldersOperation_overwriteQuestion, pathString); final String[] options = { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; shell.getDisplay().syncExec(new Runnable() { @Override public void run() { MessageDialog dialog = new MessageDialog(shell, IDEWorkbenchMessages.CopyFilesAndFoldersOperation_question, null, msg, MessageDialog.QUESTION, options, 0) { @Override protected int getShellStyle() { return super.getShellStyle() | SWT.SHEET; } }; dialog.open(); int returnVal = dialog.getReturnCode(); String[] returnCodes = { YES, ALL, NO, CANCEL }; returnCode[0] = returnVal == -1 ? CANCEL : returnCodes[returnVal]; } }); if (returnCode[0] == ALL) { alwaysOverwrite = true; } else if (returnCode[0] == CANCEL) { canceled = true; } return returnCode[0]; }
From source file:gov.nasa.ensemble.core.plan.editor.MultiPagePlanEditor.java
License:Open Source License
/** * Is the user editing the plan the "custodian" of the plan? * @param plan a plan/*ww w . j a v a2 s.c o m*/ * @return whether this editor user is the custodian of the given plan */ private boolean checkCustodian(EPlan plan) { if (PlanEditorPreferences.isCheckCustodian()) { String worldPermissions = WrapperUtils.getAttributeValue(plan, PermissionConstants.WORLD_PERMISSIONS_KEY); if (worldPermissions == null || !PermissionConstants.PERMISSION_EDIT_BY_ROLE.equals(worldPermissions)) { String custodian = WrapperUtils.getAttributeValue(plan, EditorPlugin.ATTRIBUTE_CUSTODIAN); String ensembleUser = AuthenticationUtil.getEnsembleUser(); if ((custodian != null) && (ensembleUser != null) && !custodian.equals(ensembleUser)) { IWorkbenchWindow window = getEditorSite().getWorkbenchWindow(); String message = "The custodian of this plan is " + custodian + ", " + "but your username is " + ensembleUser + ". " + "Are you sure you want to save?"; MessageDialog dialog = new MessageDialog(window.getShell(), "Custodian/User mismatch", null, message, MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 1); return 0 == dialog.open(); } } } return true; }
From source file:gov.redhawk.ide.codegen.ui.internal.GeneratorDialog.java
License:Open Source License
/** * {@inheritDoc}//from w w w .ja v a2 s.c o m */ @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); this.okButton.setEnabled(false); // do this here because setting the text will set enablement on the ok // button this.repIdViewer.getControl().setFocus(); this.repIdViewer.setInput(this.repIds); if (this.value != null) { for (final String rep : this.repIds) { if (this.value.getRepId().equals(rep)) { this.repIdViewer.setSelection(new StructuredSelection(Collections.singletonList(rep))); break; } } } }
From source file:gov.redhawk.ide.codegen.ui.internal.PropertyDialog.java
License:Open Source License
/** * {@inheritDoc}//www. j a v a 2s . co m */ @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); this.okButton.setEnabled(false); // do this here because setting the text will set enablement on the ok button this.idText.getControl().setFocus(); this.idText.setInput(this.desc.getPropertyDescriptors()); if (this.value != null) { String id = this.value.getId(); if (id == null) { id = ""; } this.idText.getCombo().setText(id); String valueStr = this.value.getValue(); if (valueStr == null) { valueStr = ""; } this.valueText.setText(valueStr); } }
From source file:gov.redhawk.ide.sdr.ui.internal.handlers.LaunchDomainManagerWithOptionsDialog.java
License:Open Source License
/** * Creates the Cancel button for this wizard dialog. Creates a standard (<code>SWT.PUSH</code>) * button and registers for its selection events. Note that the number of * columns in the button bar composite is incremented. The Cancel button is * created specially to give it a removeable listener. * // w w w. ja v a 2 s . com * @param parent * the parent button bar * @return the new Cancel button */ private Button createCancelButton(final Composite parent) { // increment the number of columns in the button bar ((GridLayout) parent.getLayout()).numColumns++; final Button button = new Button(parent, SWT.PUSH); button.setText(IDialogConstants.CANCEL_LABEL); setButtonLayoutData(button); button.setFont(parent.getFont()); button.setData(new Integer(IDialogConstants.CANCEL_ID)); button.addSelectionListener(this.cancelListener); return button; }
From source file:gov.redhawk.ide.spd.internal.ui.InternalErrorDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { // create OK and Details buttons createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true); createDetailsButton(parent);//from w ww .j ava2 s . com }
From source file:gov.redhawk.ide.ui.wizard.RedhawkImportWizardPage1.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. * /*from www . j a v a2s. c o m*/ * @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) { 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() { public void run() { dialog.open(); } }); return (dialog.getReturnCode() < 0) ? CANCEL : response[dialog.getReturnCode()]; }