List of usage examples for org.eclipse.jface.dialogs Dialog open
public int open()
From source file:org.eclipse.wst.xml.ui.internal.handlers.CleanupdocumentHandler.java
License:Open Source License
public Object execute(ExecutionEvent event) throws ExecutionException { IEditorPart editor = HandlerUtil.getActiveEditor(event); ITextEditor textEditor = null;//from www .j ava2s .co m if (editor instanceof ITextEditor) textEditor = (ITextEditor) editor; else { Object o = editor.getAdapter(ITextEditor.class); if (o != null) textEditor = (ITextEditor) o; } if (textEditor != null) { final ITextEditor finalTextEditor = textEditor; Dialog cleanupDialog = new CleanupDialogXML(editor.getSite().getShell()); if (cleanupDialog.open() == Window.OK) { // setup runnable Runnable runnable = new Runnable() { public void run() { IStructuredCleanupProcessor cleanupProcessor = getCleanupProcessor(); if (cleanupProcessor != null) { IStructuredModel model = null; try { model = StructuredModelManager.getModelManager() .getExistingModelForEdit(finalTextEditor.getDocumentProvider() .getDocument(finalTextEditor.getEditorInput())); if (model != null) { cleanupProcessor.cleanupModel(model); } } finally { if (model != null) { model.releaseFromEdit(); } } } } }; // TODO: make independent of 'model'. IStructuredModel model = null; try { model = StructuredModelManager.getModelManager().getExistingModelForEdit( textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput())); if (model != null) { // begin recording ITextSelection selection = (ITextSelection) textEditor.getSelectionProvider() .getSelection(); model.beginRecording(this, SSEUIMessages.Cleanup_Document_UI_, SSEUIMessages.Cleanup_Document_UI_, selection.getOffset(), selection.getLength()); // tell the model that we are about to make a big // model change model.aboutToChangeModel(); // run BusyIndicator.showWhile( textEditor.getEditorSite().getWorkbenchWindow().getShell().getDisplay(), runnable); } } finally { if (model != null) { // tell the model that we are done with the big // model // change model.changedModel(); // end recording ITextSelection selection = (ITextSelection) textEditor.getSelectionProvider() .getSelection(); model.endRecording(this, selection.getOffset(), selection.getLength()); model.releaseFromEdit(); } } } } return null; }
From source file:org.ect.codegen.reo2ea.ca.popup.actions.HideMenu.java
License:Open Source License
public void run(IAction action) { // Activator.getDefault().log("Hide menu"); Dialog dialog = new WizardDialog(myShell, new HideWizard(automatonPart)); dialog.open(); }
From source file:org.ect.codegen.reo2ea.qia.actions.HideMenu.java
License:Open Source License
public void run(IAction action) { Dialog dialog = new WizardDialog(myShell, new HideWizard(automatonPart)); dialog.open(); }
From source file:org.ect.codegen.reo2ea.qia.actions.ImmediateActionMenu.java
License:Open Source License
public void run(IAction action) { Dialog dialog = new WizardDialog(myShell, new ImmediateActionWizard(automatonPart)); dialog.open(); }
From source file:org.jboss.tools.common.jdt.debug.ui.launching.RemoteJavaApplicationLaunchShortcut.java
License:Open Source License
private void showDialog(IResource resource) { VmModel[] vmModels = RemoteDebugUIActivator.getDefault().getCurrentDebugModels(); if (vmModels == null || vmModels.length == 0) { boolean question = MessageDialog.openQuestion(getShell(), "No remote Java Application Found", "Sorry, could not detect any running remote java applications.\nTry search again?"); if (question) { executeAction(resource);//from ww w.j a va 2s . co m } } else { boolean autoConnect = RemoteDebugUIActivator.getDefault().isAutoConnect(); if (autoConnect && vmModels.length == 1) { new RemoteLaunchAction(vmModels[0].getPort()).run(); } else { Dialog dialog = new LaunchRemoteApplicationDialog(getShell()); dialog.open(); } } }
From source file:org.jboss.tools.modeshape.rest.actions.DeleteServerAction.java
License:Open Source License
/** * {@inheritDoc}//from www. j av a 2 s .com * * @see org.eclipse.jface.action.Action#run() */ @Override public void run() { Dialog dialog = new DeleteServerDialog(this.shell, this.serversToDelete); if (dialog.open() == Window.OK) { boolean errorsOccurred = false; for (ModeShapeServer server : this.serversToDelete) { Status status = this.serverManager.removeServer(server); if (!status.isOk()) { Activator.getDefault().log(status); if (status.isError()) { errorsOccurred = true; } } } if (errorsOccurred) { MessageDialog.openError(this.shell, RestClientI18n.errorDialogTitle, RestClientI18n.deleteServerDialogErrorsOccurredMsg); } } }
From source file:org.jboss.tools.project.examples.internal.ProjectExamplesActivator.java
License:Open Source License
public static void showReadyWizard(final List<ProjectExampleWorkingCopy> projects) { IPreferenceStore store = ProjectExamplesActivator.getDefault().getPreferenceStore(); boolean showProjectReadyWizard = store.getBoolean(SHOW_PROJECT_READY_WIZARD); if (!showProjectReadyWizard) { boolean openWelcome = store.getBoolean(SHOW_README); if (openWelcome) { ProjectExamplesActivator.openWelcome(projects); }//from w w w . j a v a 2 s .c om boolean showQuickFix = store.getBoolean(SHOW_QUICK_FIX); if (showQuickFix) { List<IMarker> markers = getMarkers(projects); if (markers != null && markers.size() > 0) { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { Dialog dialog = new MarkerDialog(Display.getCurrent().getActiveShell(), projects); dialog.open(); } }); } } return; } Display.getDefault().asyncExec(new Runnable() { public void run() { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); IWizard wizard = new ProjectReadyWizard(projects); WizardDialog dialog = new WizardDialog(shell, wizard); dialog.open(); // Dialog dialog = new MarkerDialog(shell, projects); // dialog.open(); } }); }
From source file:org.jboss.tools.project.examples.ProjectExamplesActivator.java
License:Open Source License
public static void showReadyWizard(final List<ProjectExample> projects) { IPreferenceStore store = ProjectExamplesActivator.getDefault().getPreferenceStore(); boolean showProjectReadyWizard = store.getBoolean(SHOW_PROJECT_READY_WIZARD); if (!showProjectReadyWizard) { boolean openWelcome = store.getBoolean(SHOW_README); if (openWelcome) { ProjectExamplesActivator.openWelcome(projects); }/* w w w. j a v a 2s. c om*/ boolean showQuickFix = store.getBoolean(SHOW_QUICK_FIX); if (showQuickFix) { List<IMarker> markers = getMarkers(projects); if (markers != null && markers.size() > 0) { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { Dialog dialog = new MarkerDialog(Display.getCurrent().getActiveShell(), projects); dialog.open(); } }); } } return; } Display.getDefault().asyncExec(new Runnable() { public void run() { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); IWizard wizard = new ProjectReadyWizard(projects); WizardDialog dialog = new WizardDialog(shell, wizard); dialog.open(); // Dialog dialog = new MarkerDialog(shell, projects); // dialog.open(); } }); }
From source file:org.jboss.tools.project.examples.wizard.ProjectReadyWizard.java
License:Open Source License
@Override public boolean performFinish() { boolean openWelcome = readyPage.getShowReadme().isEnabled() && readyPage.getShowReadme().getSelection(); if (openWelcome) { ProjectExamplesActivator.openWelcome(projectExamples); }/*from w w w .ja v a 2s . c om*/ boolean showQuickFix = readyPage.getShowQuickFix().isEnabled() && readyPage.getShowQuickFix().getSelection(); if (showQuickFix) { Display.getCurrent().asyncExec(new Runnable() { @Override public void run() { Dialog dialog = new MarkerDialog( PlatformUI.getWorkbench().getModalDialogShellProvider().getShell(), projectExamples); dialog.open(); } }); } return true; }
From source file:org.jboss.tools.remote.debug.ui.launching.RemoteJavaApplicationLaunchShortcut.java
License:Open Source License
private void showDialog(IResource resource) { VmModel[] vmModels = RemoteDebugUIActivator.getDefault().getCurrentDebugModels(); if (vmModels == null || vmModels.length == 0) { boolean question = MessageDialog.openQuestion(getShell(), "No remote Java ApplicationFound", "Sorry, could not detect any running remote java applications.\nTry search again?"); if (question) { executeAction(resource);//from w ww. j av a2 s. co m } } else { boolean autoConnect = RemoteDebugUIActivator.getDefault().isAutoConnect(); if (autoConnect && vmModels.length == 1) { new RemoteLaunchAction(vmModels[0].getPort()).run(); } else { Dialog dialog = new LaunchRemoteApplicationDialog(getShell()); dialog.open(); } } }