List of usage examples for org.eclipse.jface.dialogs MessageDialog WARNING
int WARNING
To view the source code for org.eclipse.jface.dialogs MessageDialog WARNING.
Click Source Link
From source file:org.eclipse.oomph.setup.ui.wizards.ConfigurationProcessor.java
License:Open Source License
protected boolean handleWorkspace() { if (setupWizard.isSimple()) { int answer = new MessageDialog(setupWizard.getShell(), "Configuration Handling", null, "The configuration contains a workspace that can only be handled by the advanced mode of the installer.", MessageDialog.WARNING, installation == null ? // new String[] { "Switch to Advanced Mode", "Cancel" } : // new String[] { "Switch to Avanced Mode", "Apply only Installation", "Cancel" }, 0).open();// www . ja v a 2s . c o m switch (answer) { case 0: { if (configuration != null) { setupWizard.addAppliedConfigurationResource(configuration.eResource()); } Collection<? extends Resource> configurationResources = setupWizard .getAppliedConfigurationResources(); handleSwitchToAdvancedMode(); setupWizard.setConfigurationResources(configurationResources); return false; } case 1: { if (installation != null) { return true; } return false; } default: { return false; } } } List<Stream> projectStreams = new ArrayList<Stream>(); for (Stream stream : workspace.getStreams()) { if (stream.eIsProxy()) { addStatus(IStatus.ERROR, stream, "The referenced stream cannot be resolved"); } else { Project project = stream.getProject(); if (project == null) { addStatus(IStatus.ERROR, stream, "The referenced stream is not contained by a project"); } else { Project rootProject = project; ProjectCatalog projectCatalog = null; for (ProjectContainer projectContainer = project .getProjectContainer(); projectContainer != null; projectContainer = projectContainer .getProjectContainer()) { if (projectContainer instanceof Project) { rootProject = (Project) projectContainer; } else if (projectContainer instanceof ProjectCatalog) { projectCatalog = (ProjectCatalog) projectContainer; break; } } if (projectCatalog == null) { ProjectContainer logicalProjectContainer = rootProject.getLogicalProjectContainer(); if (logicalProjectContainer == null) { addStatus(IStatus.ERROR, stream, "The referenced stream's root project is not contained by a project catalog and it doesn't specify a logical project container: " + EcoreUtil.getURI(rootProject)); } else if (logicalProjectContainer.eIsProxy()) { addStatus(IStatus.ERROR, stream, "The referenced stream's root project is not contained by a project catalog and its logical project container cannot be resolved: " + EcoreUtil.getURI(logicalProjectContainer)); } else if (logicalProjectContainer instanceof Project) { addStatus(IStatus.ERROR, stream, "The referenced stream's root project is not contained by a project catalog and is not contained by its logical project container: " + EcoreUtil.getURI(logicalProjectContainer)); } else { // Try to add the catalog. ProjectCatalog logicalProjectCatalog = (ProjectCatalog) logicalProjectContainer; if (handleStream(logicalProjectCatalog, stream)) { // If the project is in that catalog, we're all good. if (logicalProjectCatalog.getProjects().contains(rootProject)) { projectStreams.add(stream); } // Try to add the root project to the user extension project of the catalog. else if (handleUserProject(logicalProjectCatalog, rootProject)) { projectStreams.add(stream); } else { addStatus(IStatus.ERROR, stream, "Cannot add the stream's root project: " + EcoreUtil.getURI(rootProject)); addStatus(IStatus.ERROR, stream, "The target project catalog does not contain an extensible user project: " + EcoreUtil.getURI(logicalProjectCatalog)); } } else { // Errors already handled. } } } else { if (handleStream(projectCatalog, stream)) { projectStreams.add(stream); } else { // Errors already handled. } } } } } if (projectStreams.isEmpty() ? applyNoStreams() : applyStreams(projectStreams)) { return applyWorkspace(); } return false; }
From source file:org.eclipse.osee.coverage.action.ConfigureCoverageMethodsAction.java
License:Open Source License
@Override public void run() { try {// w w w . java 2 s. com if (!CoverageUtil.getBranchFromUser(false)) { return; } CoveragePackageArtifactListDialog dialog = new CoveragePackageArtifactListDialog( "Open Coverage Package", "Select Coverage Package"); dialog.setInput(OseeCoveragePackageStore.getCoveragePackageArtifacts(CoverageUtil.getBranch())); if (dialog.open() == 0) { Artifact coveragePackageArtifact = (Artifact) dialog.getResult()[0]; bulkLoadCoveragePackage(coveragePackageArtifact); OseeCoveragePackageStore packageStore = new OseeCoveragePackageStore(coveragePackageArtifact); CoverageOptionManagerStore optionsStore = new CoverageOptionManagerStore(packageStore); Result isSaveable = optionsStore.isSaveable(); if (isSaveable.isFalse()) { AWorkbench.popup(isSaveable); return; } String coverageOptions = null; StoreLocation storeLocation = optionsStore.getStoreLocation(); if (storeLocation == StoreLocation.None) { MessageDialog localGlobalDialog = new MessageDialog(Displays.getActiveShell(), "Question", null, "No Custom Coverage Methods Configured, Configure Now?", MessageDialog.WARNING, new String[] { "Save local to Coverage Pacakge", "Save globally for Branch", "Cancel" }, 0); int result = localGlobalDialog.open(); if (result == 0) { storeLocation = StoreLocation.Local; } else if (result == 1) { storeLocation = StoreLocation.Global; } else { return; } coverageOptions = CoverageOptionManagerDefault.instance().toXml(); } else { coverageOptions = optionsStore.getCoverageOptions(); } // Recheck save after option has been chosen optionsStore = new CoverageOptionManagerStore(packageStore); isSaveable = optionsStore.isSaveable(); if (isSaveable.isFalse()) { AWorkbench.popup(isSaveable); return; } boolean successOrCancel = false; // Keep allowing user to enter options until valid while (!successOrCancel) { EntryDialog entryDiag = new EntryDialog(getText(), "Edit Configure Options"); entryDiag.setFillVertically(true); entryDiag.setEntry(coverageOptions); if (entryDiag.open() == 0) { coverageOptions = entryDiag.getEntry(); try { CoverageOptionManager manager = new CoverageOptionManager(coverageOptions); if (manager.get().isEmpty()) { throw new OseeArgumentException("No options specified"); } if (manager.get(CoverageOptionManager.Not_Covered.getName()) == null) { throw new OseeArgumentException("Can't remove Not_Covered item"); } Set<String> names = new HashSet<String>(); for (CoverageOption option : manager.get()) { if (names.contains(option.getName())) { throw new OseeArgumentException("Multiple options with same name [%s]", option.getName()); } else { names.add(option.getName()); } } optionsStore.store(coverageOptions, storeLocation); successOrCancel = true; } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, "Invalid coverage options\n\n" + ex.getLocalizedMessage(), ex); } } else { successOrCancel = true; } } } } catch (OseeCoreException ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } }
From source file:org.eclipse.papyrus.diagram.common.util.MultiDiagramUtil.java
License:Open Source License
/** * Perform delete diagram./* w ww .j a va 2s .c o m*/ * * @param diagram * the diagram * @param confirm * the confirm * * @return the diagram */ // @unused public static Diagram performDeleteDiagram(Diagram diagram, boolean confirm) { if (diagram == null) { return null; } // Get upper diagram to open in case the one deleted is active. Diagram diagramToOpen = getUpperDiagram(diagram); if (diagramToOpen == null || diagramToOpen.equals(diagram)) { // This is the uppest diagram we'll look for a diagram at the same // level diagramToOpen = getOtherDiagram(diagram); if (diagramToOpen == null) { // no suitable diagram to open return null; } } // The diagram is Ok to be deleted. Ask user confirmation. if (confirm) { MessageDialog confirmDialog = new MessageDialog(Display.getCurrent().getActiveShell(), "Delete diagram?", null, "Are oyu sure you want to delete the selected diagram?", MessageDialog.WARNING, new String[] { "Yes", "No" }, 1); int result = confirmDialog.open(); if (result == Window.CANCEL) { return null; } } if (!isDiagramActive(diagram)) { // If the diagram to delete is not active it can be deleted without // problems. deleteDiagramAndSave(diagram); } else { // If the diagram to delete is active, a complex process must be // folowed to delete it. // Close all diagram editors that have the diagram to be deleted // active. EditingDomainRegistry.getInstance().setChangingCachedEditors(true); closeEditorsThatShowDiagram(diagram); // Delete diagram deleteDiagramAndSave(diagram); // Open its upper diagram try { openDiagram(diagramToOpen); } catch (ExecutionException ex) { IStatus status = new Status(IStatus.ERROR, Activator.ID, "Can't open diagram"); Activator.getDefault().getLog().log(status); return null; } finally { EditingDomainRegistry.getInstance().setChangingCachedEditors(false); } } return diagramToOpen; }
From source file:org.eclipse.papyrus.documentation.view.CommentsComposite.java
License:Open Source License
private void showMessageDialog() { MessageDialog dialog = new MessageDialog(getShell(), "Rich Text Edition unavailable", null, "Your operating system does not support the SWT Browser component, thus you are not able to edit documentation using rich text capabilities.\n" + "You should try installing XULRunner in your environment so that you can enable Rich Text Edition, and then restart your application.\n" + "To install XulRunner, have a look at : <a>http://www.eclipse.org/atf/downloads/base_files/manualXulrunner_section.php</a>.", MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL }, 0) { @Override//from w w w . j a v a 2s . co m protected Control createMessageArea(Composite composite) { Image image = getImage(); if (image != null) { imageLabel = new Label(composite, SWT.NULL); image.setBackground(imageLabel.getBackground()); imageLabel.setImage(image); GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING).applyTo(imageLabel); } // create message if (message != null) { Link messageLink = new Link(composite, getMessageLabelStyle()); messageLink.setText(message); messageLink.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { try { PlatformUI.getWorkbench().getBrowserSupport().createBrowser(null) .openURL(new URL(event.text)); okPressed(); } catch (PartInitException e) { // TODO log } catch (MalformedURLException e) { // TODO log } } }); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false) .hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT) .applyTo(messageLink); } return composite; } }; dialog.open(); }
From source file:org.eclipse.papyrus.infra.gmfdiag.navigation.CreateDiagramWithNavigationHandler.java
License:Open Source License
public Object execute(ExecutionEvent event) throws ExecutionException { NavigableElement navElement = getNavigableElementWhereToCreateDiagram(); if (navElement == null) { InformationDialog dialog = new InformationDialog(Display.getCurrent().getActiveShell(), "Impossible diagram creation", "It is not possible to create this diagram on the selected element.", null, null, SWT.OK, MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL }); dialog.open();/*from w w w .j a va 2 s. co m*/ } else { createDiagram(navElement); } return null; }
From source file:org.eclipse.pde.internal.ui.wizards.imports.PluginImportWizard.java
License:Open Source License
@Override public boolean performFinish() { page1.storeSettings();/* w w w. jav a 2 s.co m*/ ((BaseImportWizardSecondPage) page1.getNextPage()).storeSettings(); final IPluginModelBase[] models = getModelsToImport(); int launchedConfiguration = getConflictingConfigurationsCount(models); if (launchedConfiguration > 0) { String message = launchedConfiguration == 1 ? PDEUIMessages.PluginImportWizard_runningConfigDesc : PDEUIMessages.PluginImportWizard_runningConfigsDesc; MessageDialog dialog = new MessageDialog(getShell(), PDEUIMessages.PluginImportWizard_runningConfigsTitle, null, message, MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0); if (dialog.open() != IDialogConstants.OK_ID) return false; } if (page1.getImportType() == PluginImportOperation.IMPORT_FROM_REPOSITORY) { if (getContainer().getCurrentPage() instanceof BaseImportWizardSecondPage) { // ensure to set the models to import when finished is pressed without advancing to the repository pages page1.configureBundleImportPages(models); } } // finish contributed pages if (!page1.finishPages()) { return false; } doImportOperation(page1.getImportType(), models, page2.forceAutoBuild(), launchedConfiguration > 0, page1.getAlternateSourceLocations(), page1.getImportDescriptions()); return true; }
From source file:org.eclipse.php.composer.ui.editor.composer.AuthorSection.java
License:Open Source License
@SuppressWarnings("unchecked") private void handleRemove() { StructuredSelection selection = ((StructuredSelection) authorViewer.getSelection()); Iterator<Object> it = selection.iterator(); String[] names = new String[selection.size()]; List<Person> persons = new ArrayList<Person>(); for (int i = 0; it.hasNext(); i++) { Person person = (Person) it.next(); persons.add(person);/*from www. jav a 2 s . co m*/ names[i] = person.getName(); } String title = selection.size() > 1 ? Messages.AuthorSection_RemoveDialogTitlePlural : Messages.AuthorSection_RemoveDialogTitle; MessageDialog diag = new MessageDialog(authorViewer.getTable().getShell(), title, null, NLS.bind(Messages.AuthorSection_RemoveDialogMessage, StringUtils.join(names, ", ")), //$NON-NLS-1$ MessageDialog.WARNING, new String[] { Messages.AuthorSection_YesButton, Messages.AuthorSection_NoButton }, 0); if (diag.open() == Dialog.OK) { for (Person person : persons) { composerPackage.getAuthors().remove(person); } } }
From source file:org.eclipse.php.composer.ui.editor.composer.DependencySection.java
License:Open Source License
@SuppressWarnings("unchecked") private void handleRemove() { StructuredSelection selection = ((StructuredSelection) dependencyViewer.getSelection()); Iterator<Object> it = selection.iterator(); String[] names = new String[selection.size()]; List<VersionedPackage> deps = new ArrayList<VersionedPackage>(); for (int i = 0; it.hasNext(); i++) { VersionedPackage dep = (VersionedPackage) it.next(); deps.add(dep);//w w w . j a v a 2 s . c o m names[i] = dep.getName(); } String title = selection.size() > 1 ? Messages.DependencySection_RemoveDialogTitlePlural : Messages.DependencySection_RemoveDialogTitle; MessageDialog diag = new MessageDialog(dependencyViewer.getTable().getShell(), title, null, NLS.bind(Messages.DependencySection_RemoveDialogMessage, StringUtils.join(names, ", ")), //$NON-NLS-1$ MessageDialog.WARNING, new String[] { Messages.DependencySection_YesButton, Messages.DependencySection_NoButton }, 0); if (diag.open() == Dialog.OK) { for (VersionedPackage dep : deps) { dependencies.remove(dep); } } }
From source file:org.eclipse.php.composer.ui.editor.composer.RepositoriesSection.java
License:Open Source License
@SuppressWarnings("unchecked") private void handleRemove() { StructuredSelection selection = ((StructuredSelection) repositoryViewer.getSelection()); Iterator<Object> it = selection.iterator(); String[] names = new String[selection.size()]; List<Repository> repos = new ArrayList<Repository>(); for (int i = 0; it.hasNext(); i++) { Repository repo = (Repository) it.next(); repos.add(repo);/*from www .j a v a 2s . co m*/ names[i] = repo.getName(); } String title = selection.size() > 1 ? Messages.RepositoriesSection_RemoveDialogTitlePlural : Messages.RepositoriesSection_RemoveDialogTitle; MessageDialog diag = new MessageDialog(repositoryViewer.getTable().getShell(), title, null, NLS.bind(Messages.RepositoriesSection_RemoveDialogMessage, StringUtils.join(names, ", ")), //$NON-NLS-1$ MessageDialog.WARNING, new String[] { Messages.RepositoriesSection_YesButton, Messages.RepositoriesSection_NoButton }, 0); if (diag.open() == Dialog.OK) { for (Repository repo : repos) { composerPackage.getRepositories().remove(repo); } } }
From source file:org.eclipse.php.composer.ui.editor.composer.ScriptsSection.java
License:Open Source License
private void handleRemove() { Object element = ((StructuredSelection) scriptsViewer.getSelection()).getFirstElement(); ScriptsController controller = (ScriptsController) scriptsViewer.getLabelProvider(); if (element instanceof Script) { String text = controller.getText(element); MessageDialog diag = new MessageDialog(scriptsViewer.getTree().getShell(), Messages.ScriptsSection_RemoveEventDialogTitle, null, NLS.bind(Messages.ScriptsSection_RemoveEventDialogMessage, text), MessageDialog.WARNING, new String[] { Messages.ScriptsSection_YesButton, Messages.ScriptsSection_NoButton }, 0); if (diag.open() == Dialog.OK) { composerPackage.getScripts().remove((Script) element); }//from w ww. j a v a2 s . com } else if (element instanceof HandlerValue) { String text = controller.getText(element); Script script = (Script) ((ScriptsController) scriptsViewer.getContentProvider()).getParent(element); if (script != null) { int index = -1; // find selection index TreeItem selectedItem = scriptsViewer.getTree().getSelection()[0]; TreeItem[] items = selectedItem.getParentItem().getItems(); for (int i = 0; i < items.length; i++) { if (items[i] == selectedItem) { index = i; break; } } assert index != -1 && index < script.size(); String event = controller.getText(script); MessageDialog diag = new MessageDialog(scriptsViewer.getTree().getShell(), Messages.ScriptsSection_RemoveHandlerDialogTitle, null, NLS.bind(Messages.ScriptsSection_RemoveHandlerDialogMessage, text, event), MessageDialog.WARNING, new String[] { Messages.ScriptsSection_YesButton, Messages.ScriptsSection_NoButton }, 0); if (diag.open() == Dialog.OK) { script.remove(index); } } } }