List of usage examples for org.eclipse.jface.dialogs Dialog open
public int open()
From source file:org.eclipse.emf.ecp.rap.spi.util.RAPWrapper.java
License:Open Source License
/** * {@inheritDoc}/*from w ww.ja v a2 s . c om*/ * * @see org.eclipse.emf.ecp.edit.internal.swt.util.DialogWrapper#openDialog(org.eclipse.jface.dialogs.Dialog, * org.eclipse.emf.ecp.edit.spi.swt.util.ECPDialogExecutor) * @since 1.5 */ @Override public void openDialog(final Dialog dialog, final ECPDialogExecutor callBack) { dialog.setBlockOnOpen(false); dialog.open(); dialog.getShell().addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent event) { callBack.handleResult(dialog.getReturnCode()); } }); }
From source file:org.eclipse.emf.emfstore.client.ui.views.users.command.AssignProjectRolesCommandHandler.java
License:Open Source License
@Override public void handle() throws EmfStoreException { ProjectInfo projectInfo = requireSelection(ProjectInfo.class); AssignRolesWizard wizard = new AssignRolesWizard(projectInfo, ((ServerInfo) projectInfo.eContainer()).getLastUsersession().getPermissionSetCache()); Shell shell = getShell();//from www . j a v a 2 s . c om Dialog dialog = new WizardDialog(shell, wizard); dialog.open(); }
From source file:org.eclipse.emf.search.ui.internal.replace.provisional.TextualModelSearchRefactoringOperation.java
License:Open Source License
/** * Opens the refactoring dialog for the refactoring wizard passed to the constructor. * The method first checks the initial conditions of the refactoring. If the condition * checking returns a status with a severity of {@link RefactoringStatus#FATAL} then * a message dialog is opened containing the corresponding status message. No wizard * dialog is opened in this situation. If the condition checking passes then the * refactoring dialog is opened. /*from w ww .j a va 2 s .c om*/ * <p> * The methods ensures that the workspace lock is held while the condition checking, * change creation and change execution is performed. Clients can't make any assumption * about the thread in which these steps are executed. However the framework ensures * that the workspace lock is transfered to the thread in which the execution of the * steps takes place. * </p> * @param parent the parent shell for the dialog or <code>null</code> if the dialog * is a top level dialog * @param dialogTitle the dialog title of the message box presenting the failed * condition check (if any) * * @return {@link #INITIAL_CONDITION_CHECKING_FAILED} if the initial condition checking * failed and no wizard dialog was presented. Otherwise either {@link IDialogConstants#OK_ID} * or {@link IDialogConstants#CANCEL_ID} is returned depending on whether the user * has pressed the OK or cancel button on the wizard dialog. * * @throws InterruptedException if the initial condition checking got canceled by * the user. */ public int run(final Shell parent, final String dialogTitle) throws InterruptedException { Assert.isNotNull(dialogTitle); final Refactoring refactoring = fWizard.getRefactoring(); final IJobManager manager = Job.getJobManager(); final int[] result = new int[1]; final InterruptedException[] canceled = new InterruptedException[1]; Runnable r = new Runnable() { public void run() { try { // we are getting the block dialog for free if we pass in null manager.beginRule(ResourcesPlugin.getWorkspace().getRoot(), null); refactoring.setValidationContext(parent); fInitialConditions = checkInitialConditions(refactoring, parent, dialogTitle); if (fInitialConditions.hasFatalError()) { String message = fInitialConditions.getMessageMatchingSeverity(RefactoringStatus.FATAL); MessageDialog.openInformation(parent, dialogTitle, message); result[0] = INITIAL_CONDITION_CHECKING_FAILED; } else { fWizard.setInitialConditionCheckingStatus(fInitialConditions); Dialog dialog = new ModelSearchWizardDialog(parent, fWizard); dialog.create(); IWizardContainer wizardContainer = (IWizardContainer) dialog; if (wizardContainer.getCurrentPage() == null) /* * Don't show the dialog at all if there are no user * input pages and change creation was cancelled. */ result[0] = Window.CANCEL; else result[0] = dialog.open(); } } catch (InterruptedException e) { canceled[0] = e; } catch (OperationCanceledException e) { canceled[0] = new InterruptedException(e.getMessage()); } finally { manager.endRule(ResourcesPlugin.getWorkspace().getRoot()); refactoring.setValidationContext(null); } } }; BusyIndicator.showWhile(parent.getDisplay(), r); if (canceled[0] != null) throw canceled[0]; return result[0]; }
From source file:org.eclipse.imp.releng.CopyrightAdder.java
License:Open Source License
public void addCopyrights() { // final IPreferenceStore prefStore= ReleaseEngineeringPlugin.getInstance().getPreferenceStore(); fReleaseTool.collectMetaData(true);//from w w w. jav a 2s . co m fChangedFiles.clear(); fTopChange = new CompositeChange("Copyright additions"); fSrcRoots.clear(); List<FeatureInfo> featureInfos = fReleaseTool.getFeatureInfos(); final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); SelectFeatureInfosDialog sfid = new SelectFeatureInfosDialog(shell, featureInfos); if (sfid.open() != Dialog.OK) { return; } IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot(); Set<IProject> projects = new HashSet<IProject>(); for (FeatureInfo featureInfo : sfid.getSelectedFeatures()) { for (PluginInfo plugin : featureInfo.fPluginInfos) { projects.add(wsRoot.getProject(plugin.fProjectName)); } } collectProjectSourceRoots(projects); fModCount = 0; traverseSrcRootsAddCopyrights(fTopChange); if (fTopChange.getChildren().length == 0) { MessageDialog.openInformation(shell, "No changes needed", "No source files lack a copyright notice."); return; } Dialog d = new ConfirmChangedFilesDialog(shell, fTopChange); if (d.open() == Dialog.OK) { ReleaseTool.doPerformChange(fTopChange, "Adding copyright notices", fChangedFiles); ReleaseEngineeringPlugin.getMsgStream().println("Modified " + fModCount + " files."); } }
From source file:org.eclipse.imp.releng.WorkbenchReleaseTool.java
License:Open Source License
@Override protected Set<IProject> selectFeatureProjects(final Set<IProject> allFeatureProjects) { final Set<IProject> selectedFeatureProjects = new HashSet<IProject>(); Dialog featureDialog = new SelectFeatureProjectsDialog(getShell(), allFeatureProjects, selectedFeatureProjects);// w w w . j ava 2s . com if (featureDialog.open() == Dialog.OK) return selectedFeatureProjects; return Collections.emptySet(); }
From source file:org.eclipse.imp.releng.WorkbenchReleaseTool.java
License:Open Source License
public void run() { Shell shell = getShell();//from ww w. ja v a 2s.com Dialog d = new Dialog(shell) { @Override protected Control createDialogArea(Composite parent) { Composite area = (Composite) super.createDialogArea(parent); GridLayout grid = new GridLayout(3, true); area.setLayout(grid); Button saveFeatureProjectSetsButton = new Button(area, SWT.PUSH); saveFeatureProjectSetsButton.setText("Save Feature Project Sets..."); Button checkOutButton = new Button(area, SWT.PUSH); checkOutButton.setText("Check out..."); return area; } }; d.open(); }
From source file:org.eclipse.imp.releng.WorkbenchReleaseTool.java
License:Open Source License
@Override protected boolean doConfirm(final Set<PluginInfo> changedPlugins, final Set<PluginInfo> unchangedPlugins) { Shell shell = getShell();/*w ww . j a v a 2 s. c o m*/ if (changedPlugins.isEmpty()) { MessageDialog.openInformation(shell, "No plugins to release", "No plugins in the selected features have any changes to release!"); return false; } else { Dialog confirmDialog = new ConfirmChangedPluginsDialog(shell, changedPlugins, unchangedPlugins); return (confirmDialog.open() == Dialog.OK); } }
From source file:org.eclipse.imp.releng.WorkbenchReleaseTool.java
License:Open Source License
protected boolean confirmDirtyFiles(final Set<IFile> dirtyFiles) { if (dirtyFiles.isEmpty()) { return true; }/*from w w w . java 2s . c o m*/ Shell shell = getShell(); Dialog d = new ConfirmDirtyFilesDialog(shell, dirtyFiles); return (d.open() == Dialog.OK); }
From source file:org.eclipse.imp.releng.WorkbenchReleaseTool.java
License:Open Source License
@Override public void updateFeatureList() { collectMetaData(true);/* w w w . j a va2s. com*/ if (fFeatureInfos.size() == 0) return; Dialog d = new UpdateSiteFeatureSetDialog(getShell(), fUpdateSiteInfos, this); d.open(); }
From source file:org.eclipse.jdt.internal.debug.ui.actions.AddAdvancedAction.java
License:Open Source License
/** * Prompts for a project to add.//w ww. ja v a 2s.com * * @see IAction#run() */ @Override public void run() { Dialog dialog = new RuntimeClasspathAdvancedDialog(getShell(), fActions, getViewer()); dialog.open(); }