Java Code Examples for org.eclipse.jface.dialogs.IDialogConstants#YES_LABEL
The following examples show how to use
org.eclipse.jface.dialogs.IDialogConstants#YES_LABEL .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NativeBinaryDestinationPage.java From thym with Eclipse Public License 1.0 | 6 votes |
@Override public String queryOverwrite(String pathString) { final MessageDialog dialog = new MessageDialog(getShell(), "Overwrite Files?", null, pathString+ " already exists. Would you like to overwrite it?", MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0); String[] response = new String[] { YES, NO, CANCEL }; //most likely to be called from non-ui thread getControl().getDisplay().syncExec(new Runnable() { public void run() { dialog.open(); } }); return dialog.getReturnCode() < 0 ? CANCEL : response[dialog .getReturnCode()]; }
Example 2
Source File: ValidationDialog.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override protected Control createButtonBar(Composite parent) { Composite blank = new Composite(parent, SWT.NONE); blank.setLayoutData(new GridData(1,1)); Composite buttonbar = new Composite(parent, SWT.None); buttonbar.setLayout(new GridLayout(3,false)); buttonbar.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false)); if(messageType == YES_NO_SEEDETAILS || messageType == YES_NO){ super.createButton(buttonbar, YES, IDialogConstants.YES_LABEL, false); super.createButton(buttonbar, NO, IDialogConstants.NO_LABEL, true); } if(messageType == OK_SEEDETAILS || messageType == OK_ONLY){ super.createButton(buttonbar, OK, IDialogConstants.OK_LABEL, true); } if(messageType == YES_NO_SEEDETAILS || messageType == OK_SEEDETAILS ){ super.createButton(buttonbar, SEE_DETAILS, seeDetails, false); } return buttonBar; }
Example 3
Source File: ImportTracePackageWizardPage.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
private int promptForExperimentRename(TracePackageExperimentElement experimentElement) { String dialogMessage = MessageFormat.format(Messages.ImportTracePackageWizardPage_ExperimentAlreadyExists, experimentElement.getImportName()); final MessageDialog dialog = new MessageDialog(getContainer().getShell(), Messages.ImportTracePackageWizardPage_AlreadyExistsTitle, null, dialogMessage, MessageDialog.QUESTION, new String[] { IDialogConstants.NO_LABEL, IDialogConstants.YES_LABEL }, 3) { @Override protected int getShellStyle() { return super.getShellStyle() | SWT.SHEET; } }; return dialog.open(); }
Example 4
Source File: CommitToTagsWarningDialog.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
protected Button createButton(Composite parent, int id, String label, boolean defaultButton) { Button button; if (id == IDialogConstants.OK_ID) { button = super.createButton(parent, id, IDialogConstants.YES_LABEL, defaultButton); } else if (id == IDialogConstants.CANCEL_ID) { button = super.createButton(parent, id, IDialogConstants.NO_LABEL, defaultButton); } else { button = super.createButton(parent, id, label, defaultButton); } return button; }
Example 5
Source File: ExportElementDialog.java From birt with Eclipse Public License 1.0 | 5 votes |
private int confirmOverride( String confirmTitle, String confirmMsg ) { String[] buttons = new String[]{ IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; if ( confirmTitle == null || confirmTitle.trim( ).length( ) == 0 ) { confirmTitle = Messages.getString( "ExportElementDialog.WarningMessageDuplicate.Title" ); //$NON-NLS-1$ } if ( confirmMsg == null || confirmMsg.trim( ).length( ) == 0 ) { confirmMsg = Messages.getFormattedString( "ExportElementDialog.WarningMessageDuplicate.Message", //$NON-NLS-1$ buttons ); } MessageDialog dialog = new MessageDialog( UIUtil.getDefaultShell( ), confirmTitle, null, confirmMsg, MessageDialog.QUESTION, buttons, 0 ); return dialog.open( ); }
Example 6
Source File: UnmanageAction.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
DeleteProjectDialog(Shell parentShell, IProject[] projects) { super( parentShell, getTitle(projects), null, // accept the default window icon getMessage(projects), MessageDialog.QUESTION, new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL}, 0); // yes is the default }
Example 7
Source File: WizardFolderImportPage.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * 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. * * @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()]; }
Example 8
Source File: YesNoToAllDialog.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override protected Control createButtonBar(Composite parent) { Composite blank = new Composite(parent, SWT.NONE); blank.setLayoutData(new GridData(1,1)); Composite buttonbar = new Composite(parent, SWT.None); buttonbar.setLayout(new GridLayout(4,false)); buttonbar.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false)); super.createButton(buttonbar, NO_TO_ALL, Messages.noToAll, false); super.createButton(buttonbar, NO, IDialogConstants.NO_LABEL, true); super.createButton(buttonbar, YES, IDialogConstants.YES_LABEL, false); super.createButton(buttonbar, YES_TO_ALL, Messages.yesToAll, false); return buttonBar; }
Example 9
Source File: MessageDialogScrollable.java From MergeProcessor with Apache License 2.0 | 5 votes |
/** * @param kind * @return */ private static String[] getButtonLabels(int kind) { String[] dialogButtonLabels; switch (kind) { case ERROR: // fall through to WARNING case INFORMATION: // fall through to WARNING case WARNING: { dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL }; break; } case CONFIRM: { dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }; break; } case QUESTION: { dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }; break; } case QUESTION_WITH_CANCEL: { dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; break; } default: { throw new IllegalArgumentException("Illegal value for kind in MessageDialog.open()"); //$NON-NLS-1$ } } return dialogButtonLabels; }
Example 10
Source File: DialogUtils.java From saros with GNU General Public License v2.0 | 5 votes |
/** * Opens a MessageDialog of the type {@link MessageDialog#QUESTION} and dispatches a call to * forceActive (which gives a visual hint on the task-bar that the application wants focus). * * @param shell the parent shell * @param dialogTitle the dialog title, or <code>null</code> if none * @param dialogMessage the dialog message * @return true if the user answered with YES */ public static boolean openQuestionMessageDialog( Shell shell, String dialogTitle, String dialogMessage) { MessageDialog md = new MessageDialog( shell, dialogTitle, null, dialogMessage, MessageDialog.QUESTION, new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL}, 0); return openWindow(md) == 0; }
Example 11
Source File: MessageDialogWithPrompt.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected static String[] getButtonLabelsFor(int kind) { String[] dialogButtonLabels; switch (kind) { case ERROR: case INFORMATION: case WARNING: { dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL }; break; } case CONFIRM: { dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }; break; } case QUESTION: { dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }; break; } case QUESTION_WITH_CANCEL: { dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; break; } default: { throw new IllegalArgumentException("Illegal value for kind in MessageDialog.open()"); //$NON-NLS-1$ } } return dialogButtonLabels; }
Example 12
Source File: SimpleDialogsHelper.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public boolean promptYesNo(String title, String question, boolean yesIsDefault) { MessageDialogRunnable mdr = new MessageDialogRunnable( null, title, null, question, MessageDialog.QUESTION, new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL}, yesIsDefault ? 0 : 1); SVNUIPlugin.getStandardDisplay().syncExec(mdr); return mdr.getResult() == 0; }
Example 13
Source File: DeleteResourceAndCloseEditorAction.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
DeleteProjectDialog(Shell parentShell, IResource[] projects) { super(parentShell, getTitle(projects), null, // accept the // default window // icon getMessage(projects), MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); // yes is the // default this.projects = projects; setShellStyle(getShellStyle() | SWT.SHEET); }
Example 14
Source File: DialogWithUrls.java From WebpifyYourAndroidApp with Apache License 2.0 | 5 votes |
static String[] getButtonLabels(int kind) { String[] dialogButtonLabels; switch (kind) { case ERROR: case INFORMATION: case WARNING: { dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL }; break; } case CONFIRM: { dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }; break; } case QUESTION: { dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }; break; } case QUESTION_WITH_CANCEL: { dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; break; } default: { throw new IllegalArgumentException("Illegal value for kind in MessageDialog.open()"); //$NON-NLS-1$ } } return dialogButtonLabels; }
Example 15
Source File: ConfirmationDialogFuture.java From neoscada with Eclipse Public License 1.0 | 5 votes |
private Boolean showDialog ( final ConfirmationCallback cb, final Display display, final Shell parentShell, final String dialogTitle ) { switch ( cb.getConfirmationType () ) { case CONFIRM: return MessageDialog.openConfirm ( parentShell, dialogTitle, cb.getLabel () ) ? true : null; case ERROR: MessageDialog.openError ( parentShell, dialogTitle, cb.getLabel () ); return true; case WARNING: MessageDialog.openWarning ( parentShell, dialogTitle, cb.getLabel () ); return true; case INFORMATION: MessageDialog.openInformation ( parentShell, dialogTitle, cb.getLabel () ); return true; case QUESTION: return MessageDialog.openQuestion ( parentShell, dialogTitle, cb.getLabel () ); case QUESTION_WITH_CANCEL: { final MessageDialog dialog = new MessageDialog ( parentShell, dialogTitle, null, cb.getLabel (), MessageDialog.QUESTION_WITH_CANCEL, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0 ); final int result = dialog.open (); if ( result == 2 /*CANCEL*/) { return null; } else { return result == Window.OK; } } default: throw new IllegalArgumentException ( String.format ( "Unable to process type: %s", cb.getConfirmationType () ) ); } }
Example 16
Source File: SVNHistoryPage.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * Ask the user to confirm the overwrite of the file if the file has been * modified since last commit */ private boolean confirmOverwrite() { IFile file = (IFile) resource; if(file != null && file.exists()) { ISVNLocalFile svnFile = SVNWorkspaceRoot.getSVNFileFor(file); try { if(svnFile.isDirty()) { String title = Policy.bind("HistoryView.overwriteTitle"); //$NON-NLS-1$ String msg = Policy.bind("HistoryView.overwriteMsg"); //$NON-NLS-1$ final MessageDialog dialog = new MessageDialog(getSite().getShell(), title, null, msg, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.CANCEL_LABEL}, 0); final int[] result = new int[ 1]; getSite().getShell().getDisplay().syncExec(new Runnable() { public void run() { result[ 0] = dialog.open(); } }); if(result[ 0] != 0) { // cancel return false; } } } catch(SVNException e) { SVNUIPlugin.log(e.getStatus()); } } return true; }
Example 17
Source File: OptionsConfigurationBlock.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
protected boolean processChanges(IWorkbenchPreferenceContainer container) { IScopeContext currContext= fLookupOrder[0]; List<Key> changedOptions= new ArrayList<Key>(); boolean needsBuild= getChanges(currContext, changedOptions); if (changedOptions.isEmpty()) { return true; } if (needsBuild) { int count= getRebuildCount(); if (count > fRebuildCount) { needsBuild= false; // build already requested fRebuildCount= count; } } boolean doBuild= false; if (needsBuild) { String[] strings= getFullBuildDialogStrings(fProject == null); if (strings != null) { if (ResourcesPlugin.getWorkspace().getRoot().getProjects().length == 0) { doBuild= true; // don't bother the user } else { MessageDialog dialog= new MessageDialog(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; // 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 incrementRebuildCount(); container.registerUpdateJob(CoreUtility.getBuildJob(fProject)); } } else { // apply changes right away try { fManager.applyChanges(); } catch (BackingStoreException e) { JavaPlugin.log(e); return false; } if (doBuild) { CoreUtility.getBuildJob(fProject).schedule(); } } return true; }
Example 18
Source File: WizardSaveAsPage.java From birt with Eclipse Public License 1.0 | 4 votes |
/** * Get the saving path * * @return the saving path */ public IPath getResult( ) { IPath path = resourceGroup.getContainerFullPath( ) .append( resourceGroup.getResource( ) ); // If the user does not supply a file extension and if the save // as dialog was provided a default file name append the extension // of the default filename to the new name if ( path.getFileExtension( ) == null ) { if ( originalFile != null && originalFile.getFileExtension( ) != null ) path = path.addFileExtension( originalFile.getFileExtension( ) ); else if ( originalName != null ) { int pos = originalName.lastIndexOf( '.' ); if ( ++pos > 0 && pos < originalName.length( ) ) path = path.addFileExtension( originalName.substring( pos ) ); } } // If the path already exists then confirm overwrite. IFile file = ResourcesPlugin.getWorkspace( ).getRoot( ).getFile( path ); if ( file.exists( ) ) { String[] buttons = new String[]{ IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; String question = Messages.getFormattedString( "WizardSaveAsPage.OverwriteQuestion", //$NON-NLS-1$ new Object[]{ path.toOSString( ) } ); MessageDialog d = new MessageDialog( getShell( ), Messages.getString( "WizardSaveAsPage.Question" ), //$NON-NLS-1$ null, question, MessageDialog.QUESTION, buttons, 0 ); int overwrite = d.open( ); switch ( overwrite ) { case 0 : // Yes break; case 1 : // No return null; case 2 : // Cancel default : return Path.EMPTY; } } return path; }
Example 19
Source File: ImportProjectWizardPage.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
/** * 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. * * @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()]; }
Example 20
Source File: PublishResourceWizard.java From birt with Eclipse Public License 1.0 | 4 votes |
private boolean publishiLibrary( ) { // copy to library folder if ( !( new File( filePath ).exists( ) ) ) { ExceptionUtil.openError( Messages.getString( "PublishResourceAction.wizard.errorTitle" ), //$NON-NLS-1$ Messages.getString( "PublishResourceAction.wizard.message.SourceFileNotExist" ) ); //$NON-NLS-1$ return false; } File targetFile = getTargetFile( ); if ( targetFile == null ) { ExceptionUtil.openError( Messages.getString( "PublishResourceAction.wizard.errorTitle" ), //$NON-NLS-1$ Messages.getString( "PublishResourceAction.wizard.notvalidfolder" ) ); //$NON-NLS-1$ return false; } if ( new File( filePath ).compareTo( targetFile ) == 0 ) { ExceptionUtil.openError( Messages.getString( "PublishResourceAction.wizard.errorTitle" ), //$NON-NLS-1$ Messages.getString( "PublishResourceAction.wizard.message" ) ); //$NON-NLS-1$ return false; } int overwrite = Window.OK; try { if ( targetFile.exists( ) ) { String[] buttons = new String[]{ IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; String question = Messages.getFormattedString( "SaveAsDialog.overwriteQuestion", //$NON-NLS-1$ new Object[]{ targetFile.getAbsolutePath( ) } ); MessageDialog d = new MessageDialog( UIUtil.getDefaultShell( ), Messages.getString( "SaveAsDialog.Question" ), //$NON-NLS-1$ null, question, MessageDialog.QUESTION, buttons, 0 ); overwrite = d.open( ); } if ( overwrite == Window.OK && ( targetFile.exists( ) || ( !targetFile.exists( ) && targetFile.createNewFile( ) ) ) ) { doCopy( filePath, targetFile ); IReportResourceSynchronizer synchronizer = ReportPlugin.getDefault( ) .getResourceSynchronizerService( ); if ( synchronizer != null ) { synchronizer.notifyResourceChanged( new ReportResourceChangeEvent( this, Path.fromOSString( targetFile.getAbsolutePath( ) ), IReportResourceChangeEvent.NewResource ) ); } } } catch ( IOException e ) { ExceptionUtil.handle( e ); } return overwrite != 2; }