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:net.sourceforge.taggerplugin.dialog.TagDialog.java
License:Open Source License
/** * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) *///from w w w . j a va2 s . c o m protected void createButtonsForButtonBar(Composite parent) { // create OK and Cancel buttons createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); nameTxt.setFocus(); if (tag != null) { // set the edit data nameTxt.setText(tag.getName()); descTxt.setText(tag.getDescription()); } }
From source file:net.sourceforge.tagsea.powerpoint.actions.TagPowerpointDialog.java
License:Open Source License
protected void createButtonsForButtonBar(Composite parent) { // create OK and Cancel buttons by default createButton(parent, IDialogConstants.OK_ID, "Ok", true); getButton(IDialogConstants.OK_ID).setEnabled(false); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); refreshStatus();//from w w w. jav a 2 s.co m }
From source file:net.sourceforge.tagsea.resources.ui.TextWaypointCreateDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { // create OK and Cancel buttons by default createButton(parent, IDialogConstants.OK_ID, "Add", true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:net.sourceforge.texlipse.actions.InputQueryDialog.java
License:Open Source License
/** * Same kind of constructor as in InputDialog. * This class just doesn't create extra components. * /*w w w .j a v a 2s.c om*/ * @param title dialog title * @param message dialog message * @param def default text for the textfield * @param vali validator for the text */ public InputQueryDialog(Shell shell, String title, String message, String def, IInputValidator vali) { super(shell, title, null, message, QUESTION, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0); initialText = def; input = def; validator = vali; }
From source file:net.sourceforge.texlipse.actions.InputQueryDialog.java
License:Open Source License
/** * Convenience method to open a simple "enter text" dialog. * This version uses the workbench default "ok" and "cancel" labels * as button texts./*w ww. j ava 2 s .c o m*/ * * @param title dialog title * @param message dialog message * @return query dialog */ public static InputQueryDialog createQuery(String title, String message) { return createQuery(title, message, IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL); }
From source file:net.sourceforge.texlipse.properties.StringListFieldEditor.java
License:Open Source License
/** * Creates and returns a new item for the list. * This implementation opens a question dialog, where user can * enter a new item.//from ww w . j av a 2 s . c om * * @return the string the user wanted to add, or null * if the cancel button was pressed or the string was an empty one */ protected String getNewInputObject() { InputQueryDialog dialog = InputQueryDialog.createQuery("Enter string", "Please enter keyword", IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL); dialog.setValidator(this); int code = dialog.open(); if (code == Window.OK) { String g = dialog.getInput(); if (g != null && g.length() == 0) { return null; } return g; } return null; }
From source file:net.tourbook.preferences.PrefPageTourTypes.java
License:Open Source License
private void onDeleteTourType() { final TourTypeColorDefinition selectedColorDefinition = getSelectedColorDefinition(); final TourType selectedTourType = selectedColorDefinition.getTourType(); // confirm deletion final String[] buttons = new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }; final MessageDialog dialog = new MessageDialog(this.getShell(), Messages.Pref_TourTypes_Dlg_delete_tour_type_title, null, NLS.bind(Messages.Pref_TourTypes_Dlg_delete_tour_type_msg, selectedTourType.getName()), MessageDialog.QUESTION, buttons, 1); if (dialog.open() != Window.OK) { setFocusToViewer();//from ww w . j av a 2 s . c o m return; } // remove entity from the db if (deleteTourType(selectedTourType)) { // update model _dbTourTypes.remove(selectedTourType); _colorDefinitions.remove(selectedColorDefinition); // update UI _tourTypeViewer.remove(selectedColorDefinition); _isModified = true; } setFocusToViewer(); }
From source file:net.tourbook.ui.UI.java
License:Open Source License
/** * @param file//w ww. j a v a 2 s . c om * @return Returns <code>true</code> when the file should be overwritten, otherwise * <code>false</code> */ public static boolean confirmOverwrite(final File file) { final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); final MessageDialog dialog = new MessageDialog(// shell, Messages.app_dlg_confirmFileOverwrite_title, null, NLS.bind(Messages.app_dlg_confirmFileOverwrite_message, file.getPath()), MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.CANCEL_LABEL }, 0); dialog.open(); return dialog.getReturnCode() == 0; }
From source file:net.tourbook.ui.UI.java
License:Open Source License
public static boolean confirmOverwrite(final FileCollisionBehavior fileCollision, final File file) { final boolean[] isOverwrite = { false }; final int fileCollisionValue = fileCollision.value; if (fileCollisionValue == FileCollisionBehavior.REPLACE_ALL) { // overwrite is already confirmed isOverwrite[0] = true;/* ww w .j av a2 s . c o m*/ } else if (fileCollisionValue == FileCollisionBehavior.ASK || fileCollisionValue == FileCollisionBehavior.REPLACE || fileCollisionValue == FileCollisionBehavior.KEEP) { Display.getDefault().syncExec(new Runnable() { @Override public void run() { final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); final MessageDialog dialog = new MessageDialog(// shell, Messages.app_dlg_confirmFileOverwrite_title, null, NLS.bind(Messages.app_dlg_confirmFileOverwrite_message, file.getPath()), MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL, IDialogConstants.CANCEL_LABEL }, 0); dialog.open(); final int returnCode = dialog.getReturnCode(); switch (returnCode) { case -1: // dialog was canceled case 4: fileCollision.value = FileCollisionBehavior.DIALOG_IS_CANCELED; break; case 0: // YES fileCollision.value = FileCollisionBehavior.REPLACE; isOverwrite[0] = true; break; case 1: // YES_TO_ALL fileCollision.value = FileCollisionBehavior.REPLACE_ALL; isOverwrite[0] = true; break; case 2: // NO fileCollision.value = FileCollisionBehavior.KEEP; break; case 3: // NO_TO_ALL fileCollision.value = FileCollisionBehavior.KEEP_ALL; break; default: break; } } }); } return isOverwrite[0]; }
From source file:net.tourbook.ui.views.tourDataEditor.TourDataEditorView.java
License:Open Source License
/** * @param isConfirmSave/*from w ww . j a va2 s. c om*/ * @return Returns <code>true</code> when the tour was saved, <code>false</code> when the tour * is not saved but canceled */ private boolean saveTourConfirmation() { if (_isTourDirty == false) { return true; } // show the tour data editor try { getSite().getPage().showView(ID, null, IWorkbenchPage.VIEW_VISIBLE); } catch (final PartInitException e) { e.printStackTrace(); } // confirm save/discard/cancel final int returnCode = new MessageDialog(Display.getCurrent().getActiveShell(), Messages.tour_editor_dlg_save_tour_title, null, NLS.bind(Messages.tour_editor_dlg_save_tour_message, TourManager.getTourDateFull(_tourData)), MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0)// .open(); if (returnCode == 0) { // button YES: save tour saveTourIntoDB(); return true; } else if (returnCode == 1) { // button NO: discard modifications discardModifications(); return true; } else { // button CANCEL / dialog is canceled: tour is not saved and not discarded return false; } }