Java Code Examples for org.eclipse.jface.dialogs.IDialogConstants#NO_LABEL
The following examples show how to use
org.eclipse.jface.dialogs.IDialogConstants#NO_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: 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 2
Source File: HyperlinkMessageDialog.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
public static String[] getButtonLabels(int kind) { switch (kind) { case ERROR: case INFORMATION: case WARNING: return new String[] { IDialogConstants.OK_LABEL }; case CONFIRM: return new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }; case QUESTION: return new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }; case QUESTION_WITH_CANCEL: return new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; default: throw new IllegalArgumentException("Illegal value for kind in HyperlinkMessageDialog.open()"); //$NON-NLS-1$ } }
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: JavadocWizard.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private void setAllJavadocLocations(IJavaProject[] projects, URL newURL) { Shell shell= getShell(); String[] buttonlabels= new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL }; for (int j= 0; j < projects.length; j++) { IJavaProject iJavaProject= projects[j]; String message= Messages.format(JavadocExportMessages.JavadocWizard_updatejavadoclocation_message, new String[] { BasicElementLabels.getJavaElementName(iJavaProject.getElementName()), BasicElementLabels.getPathLabel(fDestination, true) }); MessageDialog dialog= new MessageDialog(shell, JavadocExportMessages.JavadocWizard_updatejavadocdialog_label, null, message, MessageDialog.QUESTION, buttonlabels, 1); switch (dialog.open()) { case YES : JavaUI.setProjectJavadocLocation(iJavaProject, newURL); break; case YES_TO_ALL : for (int i= j; i < projects.length; i++) { iJavaProject= projects[i]; JavaUI.setProjectJavadocLocation(iJavaProject, newURL); j++; } break; case NO_TO_ALL : j= projects.length; break; case NO : default : break; } } }
Example 5
Source File: DeleteResourceAndCloseEditorAction.java From tmxeditor8 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 6
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 7
Source File: ImportTracePackageWizardPage.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private int promptForExperimentOverwrite(Entry<TracePackageExperimentElement, List<TracePackageTraceElement>> experimentEntry, List<TracePackageExperimentElement> experimentToRename) { List<TracePackageTraceElement> traceElements = experimentEntry.getValue(); StringBuilder builder = new StringBuilder(); for (int i = 0; i < traceElements.size(); i++) { builder.append(traceElements.get(i).getImportName()); if (i < traceElements.size() - 1) { builder.append(", "); //$NON-NLS-1$ } } String dialogMessage; if (experimentToRename.contains(experimentEntry.getKey())) { dialogMessage = MessageFormat.format(Messages.ImportTracePackageWizardPage_ExperimentAndTraceAlreadyExist, experimentEntry.getKey().getImportName(), builder.toString()); } else { dialogMessage = MessageFormat.format(Messages.ImportTracePackageWizardPage_TraceFromExperimentAlreadyExist, experimentEntry.getKey().getImportName(), builder.toString()); } 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 8
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 9
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 10
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 11
Source File: ReorgQueries.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private Runnable createQueryRunnable(final String question, final int[] result){ return new Runnable() { public void run() { MessageDialog dialog= new MessageDialog( fShell, fDialogTitle, null, question, MessageDialog.QUESTION, getButtonLabels(), 0); dialog.open(); switch (dialog.getReturnCode()) { case -1 : //MessageDialog closed without choice => cancel | no //see also https://bugs.eclipse.org/bugs/show_bug.cgi?id=48400 result[0]= fAllowCancel ? IDialogConstants.CANCEL_ID : IDialogConstants.NO_ID; break; case 0 : result[0]= IDialogConstants.YES_ID; break; case 1 : result[0]= IDialogConstants.NO_ID; break; case 2 : if (fAllowCancel) result[0]= IDialogConstants.CANCEL_ID; else Assert.isTrue(false); break; default : Assert.isTrue(false); break; } } private String[] getButtonLabels() { if (fAllowCancel) return new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; else return new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL}; } }; }
Example 12
Source File: PublishLibraryWizard.java From birt with Eclipse Public License 1.0 | 4 votes |
private boolean publishiLibrary( ) { // copy to library folder if ( !( new File( filePath ).exists( ) ) ) { ExceptionHandler.openErrorMessageBox( Messages.getString( "PublishLibraryAction.wizard.errorTitle" ), //$NON-NLS-1$ Messages.getString( "PublishLibraryAction.wizard.message.SourceFileNotExist" ) ); //$NON-NLS-1$ return true; } File targetFolder = new File( folderName ); if ( targetFolder.exists( ) && ( !targetFolder.isDirectory( ) ) ) { ExceptionHandler.openErrorMessageBox( Messages.getString( "PublishLibraryAction.wizard.errorTitle" ), //$NON-NLS-1$ Messages.getString( "PublishLibraryAction.wizard.notvalidfolder" ) ); //$NON-NLS-1$ //$NON-NLS-1$ return true; } boolean folderExists = targetFolder.exists( ); if ( !folderExists ) { folderExists = targetFolder.mkdirs( ); } if( !folderExists ) { ExceptionHandler.openErrorMessageBox( Messages.getString( "PublishLibraryAction.wizard.errorTitle" ), //$NON-NLS-1$ Messages.getString( "PublishLibraryAction.wizard.msgDirErr" ) ); //$NON-NLS-1$ return false; } File targetFile = new File( targetFolder, fileName ); if ( new File( filePath ).compareTo( targetFile ) == 0 ) { ExceptionHandler.openErrorMessageBox( Messages.getString( "PublishLibraryAction.wizard.errorTitle" ), //$NON-NLS-1$ Messages.getString( "PublishLibraryAction.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( ) ) ) ) { copyFile( filePath, targetFile ); IReportResourceSynchronizer synchronizer = ReportPlugin.getDefault( ) .getResourceSynchronizerService( ); if ( synchronizer != null ) { synchronizer.notifyResourceChanged( new ReportResourceChangeEvent( this, Path.fromOSString( targetFile.getAbsolutePath( ) ), IReportResourceChangeEvent.NewResource ) ); } } } catch ( IOException e ) { ExceptionHandler.handle( e ); } return overwrite != 1; }
Example 13
Source File: ReorgQueries.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private Runnable createQueryRunnable(final String question, final int[] result) { return new Runnable() { public void run() { int[] resultId= getResultIDs(); MessageDialog dialog= new MessageDialog( fShell, fDialogTitle, null, question, MessageDialog.QUESTION, getButtonLabels(), 0); dialog.open(); if (dialog.getReturnCode() == -1) { //MessageDialog closed without choice => cancel | no //see also https://bugs.eclipse.org/bugs/show_bug.cgi?id=48400 result[0]= fAllowCancel ? IDialogConstants.CANCEL_ID : IDialogConstants.NO_ID; } else { result[0]= resultId[dialog.getReturnCode()]; } } private String[] getButtonLabels() { if (YesYesToAllNoNoToAllQuery.this.fAllowCancel) return new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL, IDialogConstants.CANCEL_LABEL }; else return new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL}; } private int[] getResultIDs() { if (YesYesToAllNoNoToAllQuery.this.fAllowCancel) return new int[] { IDialogConstants.YES_ID, IDialogConstants.YES_TO_ALL_ID, IDialogConstants.NO_ID, IDialogConstants.NO_TO_ALL_ID, IDialogConstants.CANCEL_ID}; else return new int[] { IDialogConstants.YES_ID, IDialogConstants.YES_TO_ALL_ID, IDialogConstants.NO_ID, IDialogConstants.NO_TO_ALL_ID}; } }; }
Example 14
Source File: SaveAsDialog.java From birt with Eclipse Public License 1.0 | 4 votes |
protected void okPressed( ) { // Get new path. IPath path = support.getFileLocationFullPath( ) .append( support.getFileName( ) ); // If the user does not supply a file extension and the save // as dialog was provided a default file name, then append the extension // of the default filename to the new name if ( !ReportPlugin.getDefault( ) .isReportDesignFile( path.toOSString( ) ) ) { String[] parts = support.getInitialFileName( ).split( "\\." ); //$NON-NLS-1$ path = path.addFileExtension( parts[parts.length - 1] ); } // If the path already exists then confirm overwrite. File file = path.toFile( ); if ( file.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[]{ path.toOSString( ) } ); MessageDialog d = new MessageDialog( getShell( ), Messages.getString( "SaveAsDialog.Question" ), //$NON-NLS-1$ null, question, MessageDialog.QUESTION, buttons, 0 ); int overwrite = d.open( ); switch ( overwrite ) { case 0 : // Yes break; case 1 : // No return; case 2 : // Cancel default : cancelPressed( ); return; } } // Store path and close. result = path; close( ); }
Example 15
Source File: SVNOperation.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
/** * This method prompts the user to overwrite an existing resource. It uses the * <code>involvesMultipleResources</code> to determine what buttons to show. * @param project * @return */ protected boolean promptToOverwrite(final String title, final String msg) { if (!confirmOverwrite) { return true; } final String buttons[]; if (involvesMultipleResources()) { buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL}; } else { buttons = new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL}; } final Shell displayShell = getShell(); if (displayShell == null) { // We couldn't get a shell (perhaps due to shutdown) return false; } // run in syncExec because callback is from an operation, // which is probably not running in the UI thread. final int[] code = new int[] {0}; displayShell.getDisplay().syncExec( new Runnable() { public void run() { MessageDialog dialog = new MessageDialog(displayShell, title, null, msg, MessageDialog.QUESTION, buttons, 0); dialog.open(); code[0] = dialog.getReturnCode(); } }); if (involvesMultipleResources()) { switch (code[0]) { case 0://Yes return true; case 1://Yes to all confirmOverwrite = false; return true; case 2://No return false; case 3://Cancel default: throw new OperationCanceledException(); } } else { return code[0] == 0; } }
Example 16
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 17
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 18
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; }
Example 19
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 20
Source File: RemoveLinkedFolderDialog.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 2 votes |
/** * Creates a new remove linked folder dialog. * * @param shell the parent shell to use * @param folder the linked folder to remove */ RemoveLinkedFolderDialog(final Shell shell, final IFolder folder) { super(shell, NewWizardMessages.ClasspathModifierQueries_confirm_remove_linked_folder_label, null, Messages.format(NewWizardMessages.ClasspathModifierQueries_confirm_remove_linked_folder_message, new Object[] { BasicElementLabels.getPathLabel(folder.getFullPath(), false)}), MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL}, 0); // yes is the default Assert.isTrue(folder.isLinked()); }