final boolean[] result= new boolean[1]; removeProject= false; fOutputLocation[0]= project.getOutputLocation(); Display.getDefault().syncExec(new Runnable() { public void run() { Shell sh= shell != null ? shell : JavaPlugin.getActiveWorkbenchShell();  String title= NewWizardMessages.getString("ClasspathModifier.ChangeOutputLocationDialog.title"); MessageDialog dialog;  IPath newOutputFolder= null; String message; if (fDesiredOutputLocation.segmentCount() == 1) { String outputFolderName= PreferenceConstants.getPreferenceStore().getString(PreferenceConstants.SRCBIN_BINNAME); newOutputFolder= fDesiredOutputLocation.append(outputFolderName); newOutputFolder= getValidPath(newOutputFolder, validator); message= NewWizardMessages.getFormattedString("ClasspathModifier.ChangeOutputLocationDialog.project.outputLocation", newOutputFolder); dialog= new MessageDialog(sh, title, null, message, MessageDialog.QUESTION, new String[] { IDialogConstants.OK_LABEL}, 0); } else { newOutputFolder= fDesiredOutputLocation; newOutputFolder= getValidPath(newOutputFolder, validator); if (editingOutputFolder && newOutputFolder != null) { fOutputLocation[0]= newOutputFolder; result[0]= true; return; } message= NewWizardMessages.getString("ClasspathModifier.ChangeOutputLocationDialog.project.message"); removeProject= true; dialog= new MessageDialog(sh, title, null, message, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL}, 0); }  int code= dialog.open(); boolean ok= code == IDialogConstants.OK_ID; if (ok) { if (newOutputFolder != null) { fOutputLocation[0]= newOutputFolder; } } result[0]= ok; } });
final boolean[] result= { false }; fRemoveProject= false; fOutputLocation= project.getOutputLocation(); Display.getDefault().syncExec(new Runnable() { public void run() { Shell sh= shell != null ? shell : JavaPlugin.getActiveWorkbenchShell();  String title= NewWizardMessages.getString("ClasspathModifier.ChangeOutputLocationDialog.title");  if (fDesiredOutputLocation.segmentCount() == 1) { String outputFolderName= PreferenceConstants.getPreferenceStore().getString(PreferenceConstants.SRCBIN_BINNAME); IPath newOutputFolder= fDesiredOutputLocation.append(outputFolderName); newOutputFolder= getValidPath(newOutputFolder, validator); String message= NewWizardMessages.getFormattedString("ClasspathModifier.ChangeOutputLocationDialog.project.outputLocation", newOutputFolder); fRemoveProject= true; if (MessageDialog.openQuestion(sh, title, message)) { fOutputLocation= newOutputFolder; result[0]= true; } } else { IPath newOutputFolder= fDesiredOutputLocation; newOutputFolder= getValidPath(newOutputFolder, validator); if (editingOutputFolder) { fOutputLocation= newOutputFolder; result[0]= true; return; } String message= NewWizardMessages.getString("ClasspathModifier.ChangeOutputLocationDialog.project.message"); fRemoveProject= true; if (MessageDialog.openQuestion(sh, title, message)) { fOutputLocation= newOutputFolder; result[0]= true; } } } });
            public boolean doQuery(final boolean editingOutputFolder,  final OutputFolderValidator validator, final IJavaProject project) throws JavaModelException {                final boolean[] result= new boolean[1];                removeProject= false;                fOutputLocation[0]= project.getOutputLocation();                Display.getDefault().syncExec(new Runnable() {                    public void run() {                                                Shell sh= shell != null ? shell : JavaPlugin.getActiveWorkbenchShell();                                                String title= NewWizardMessages.getString("ClasspathModifier.ChangeOutputLocationDialog.title"); //$NON-NLS-1$$                        MessageDialog dialog;                                                IPath newOutputFolder= null;                        String message;                        if (fDesiredOutputLocation.segmentCount() == 1) {                            String outputFolderName= PreferenceConstants.getPreferenceStore().getString(PreferenceConstants.SRCBIN_BINNAME);                            newOutputFolder= fDesiredOutputLocation.append(outputFolderName);                            newOutputFolder= getValidPath(newOutputFolder, validator);                            message= NewWizardMessages.getFormattedString("ClasspathModifier.ChangeOutputLocationDialog.project.outputLocation", newOutputFolder); //$NON-NLS-1$                            dialog= new MessageDialog(sh, title, null, message, MessageDialog.QUESTION, new String[] { IDialogConstants.OK_LABEL}, 0);                        } else {                            newOutputFolder= fDesiredOutputLocation;                            newOutputFolder= getValidPath(newOutputFolder, validator);                            if (editingOutputFolder && newOutputFolder != null) {                                fOutputLocation[0]= newOutputFolder;                                result[0]= true;                                return; // show no dialog                            }                            message= NewWizardMessages.getString("ClasspathModifier.ChangeOutputLocationDialog.project.message"); //$NON-NLS-1$                            removeProject= true;                            dialog= new MessageDialog(sh, title, null, message, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL}, 0);                        }                                                int code= dialog.open();                        boolean ok= code == IDialogConstants.OK_ID;                        if (ok) {                            if (newOutputFolder != null) {                                fOutputLocation[0]= newOutputFolder;                            }                        }                        result[0]= ok;                    }                });                return result[0];            }