List of usage examples for org.eclipse.jface.dialogs IMessageProvider WARNING
int WARNING
To view the source code for org.eclipse.jface.dialogs IMessageProvider WARNING.
Click Source Link
From source file:org.eclipse.pde.internal.ui.shared.target.EditDirectoryContainerPage.java
License:Open Source License
/** * Validate the input fields before a container is created/edited. * The page's enablement, message and completion should be updated. * /*from w ww . j a v a 2s .c o m*/ * @return whether the finish button should be enabled and container creation should continue */ protected boolean validateInput() { if (fInstallLocation.isDisposed()) return false; // Check if the text field is blank if (fInstallLocation.getText().trim().length() == 0) { setMessage(getDefaultMessage()); return false; } // Resolve any variables String locationString = null; try { locationString = VariablesPlugin.getDefault().getStringVariableManager() .performStringSubstitution(fInstallLocation.getText().trim()); } catch (CoreException e) { setMessage(e.getMessage(), IMessageProvider.WARNING); return true; } File location = new File(locationString); // Check if directory exists if (!location.isDirectory()) { setMessage(Messages.AddDirectoryContainerPage_6, IMessageProvider.WARNING); } else { setMessage(getDefaultMessage()); } return true; }
From source file:org.eclipse.pde.internal.ui.wizards.exports.BaseExportWizardPage.java
License:Open Source License
protected void pageChanged() { if (getMessage() != null) setMessage(null);/*from w w w. jav a2 s .co m*/ if (fOptionsTab != null) { String path = fOptionsTab.getAntBuildFileName(); String warningMessage = null; if (path != null && path.length() > 0 && "build.xml".equals(new Path(path).lastSegment())) //$NON-NLS-1$ warningMessage = PDEUIMessages.ExportOptionsTab_antReservedMessage; setMessage(warningMessage, IMessageProvider.WARNING); } String error = fExportPart.getSelectionCount() > 0 ? null : PDEUIMessages.ExportWizard_status_noselection; if (error == null) error = validateTabs(); setErrorMessage(error); setPageComplete(error == null); }
From source file:org.eclipse.pde.internal.ui.wizards.extension.PointSelectionPage.java
License:Open Source License
private void handlePointSelection(IPluginExtensionPoint element) { fCurrentPoint = element;//from w w w .ja va 2 s . co m fTemplateViewer.setInput(fCurrentPoint); fTemplateViewer.setSelection(StructuredSelection.EMPTY); String fullPointID = IdUtil.getFullId(fCurrentPoint, fModel); String description = XMLComponentRegistry.Instance().getDescription(fullPointID, XMLComponentRegistry.F_SCHEMA_COMPONENT); String name = XMLComponentRegistry.Instance().getName(fullPointID, XMLComponentRegistry.F_SCHEMA_COMPONENT); URL url = null; if ((description == null) || (name == null)) { url = SchemaRegistry.getSchemaURL(fCurrentPoint, fModel); } if (url != null) { SchemaAnnotationHandler handler = new SchemaAnnotationHandler(); SchemaUtil.parseURL(url, handler); description = handler.getDescription(); name = handler.getName(); } if (description == null) { setPointDescriptionText(PDEUIMessages.PointSelectionPage_noDescAvailable); } else { setPointDescriptionText(description); } if (name == null) { name = fullPointID; } // Check if the extension point is deprecated and display a warning SchemaRegistry reg = PDECore.getDefault().getSchemaRegistry(); ISchema schema = reg.getSchema(fCurrentPoint.getFullId()); if (schema != null && schema.isDeperecated()) { setMessage(NLS.bind(PDEUIMessages.NewExtensionWizard_PointSelectionPage_pluginDescription_deprecated, name), IMessageProvider.WARNING); } else { setMessage(null); setDescription(NLS.bind(PDEUIMessages.NewExtensionWizard_PointSelectionPage_pluginDescription, name)); } setDescriptionText(""); //$NON-NLS-1$ fTemplateLabel .setText(NLS.bind(PDEUIMessages.NewExtensionWizard_PointSelectionPage_contributedTemplates_label, name.toLowerCase(Locale.ENGLISH))); fDescLink.setText(NLS.bind(PDEUIMessages.PointSelectionPage_extPointDesc, name)); setSelectedNode(null); setPageComplete(true); XMLComponentRegistry.Instance().putDescription(fullPointID, description, XMLComponentRegistry.F_SCHEMA_COMPONENT); XMLComponentRegistry.Instance().putName(fullPointID, name, XMLComponentRegistry.F_SCHEMA_COMPONENT); }
From source file:org.eclipse.pde.internal.ui.wizards.feature.PatchSpecPage.java
License:Open Source License
protected String validateContent() { fFeatureToPatch = PDECore.getDefault().getFeatureModelManager().findFeatureModel(fFeatureIdText.getText(), fFeatureVersionText.getText()); if (fFeatureToPatch != null) { setMessage(null);//ww w .j a va2 s . c om return null; } setMessage(NLS.bind(PDEUIMessages.NewFeaturePatch_SpecPage_notFound, fFeatureIdText.getText(), fFeatureVersionText.getText()), IMessageProvider.WARNING); getContainer().updateButtons(); return null; }
From source file:org.eclipse.pde.internal.ui.wizards.plugin.FragmentContentPage.java
License:Open Source License
@Override protected void validatePage() { String errorMessage = validateProperties(); String warningMessage = null; if (errorMessage == null) { String pluginID = fNewVersion ? fPluginIdText_newV.getText().trim() : fPluginIdText_oldV.getText().trim(); if (pluginID.length() == 0) { errorMessage = PDEUIMessages.ContentPage_nopid; } else {//w ww . j a va 2 s .c om // If the PDE models are not initialized, initialize with option to cancel if (!PDECore.getDefault().areModelsInitialized()) { try { getContainer().run(true, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { // Target reloaded method clears existing models (which don't exist currently) and inits them with a progress monitor PDECore.getDefault().getModelManager().targetReloaded(monitor); if (monitor.isCanceled()) { throw new InterruptedException(); } } }); } catch (InvocationTargetException e) { } catch (InterruptedException e) { // Model initialization cancelled, target platform will be empty } } if (!(PluginRegistry.findModel(pluginID) instanceof IPluginModel)) { warningMessage = PDEUIMessages.ContentPage_pluginNotFound; } else { if (fNewVersion) { IStatus status = fVersionPart.validateFullVersionRangeText(false); if (status.getSeverity() != IStatus.OK) { errorMessage = status.getMessage(); } } else { errorMessage = validateVersion(fPluginVersion); } } } } if (errorMessage == null && warningMessage == null) { String eeid = fEEChoice.getText(); if (fEEChoice.isEnabled()) { IExecutionEnvironment ee = VMUtil.getExecutionEnvironment(eeid); if (ee != null && ee.getCompatibleVMs().length == 0) { warningMessage = PDEUIMessages.NewProjectCreationPage_invalidEE; } } } if (fInitialized) { setErrorMessage(errorMessage); setMessage(warningMessage, IMessageProvider.WARNING); } setPageComplete(errorMessage == null); }
From source file:org.eclipse.pde.internal.ui.wizards.plugin.PluginContentPage.java
License:Open Source License
protected void validatePage() { String errorMessage = validateProperties(); if (errorMessage == null && fGenerateActivator.getSelection()) { IStatus status = JavaConventions.validateJavaTypeName(fClassText.getText().trim(), PDEJavaHelper.getJavaSourceLevel(null), PDEJavaHelper.getJavaComplianceLevel(null)); if (status.getSeverity() == IStatus.ERROR) { errorMessage = status.getMessage(); } else if (status.getSeverity() == IStatus.WARNING) { setMessage(status.getMessage(), IMessageProvider.WARNING); }//w w w . ja va 2 s . c om } if (errorMessage == null) { String eeid = fEEChoice.getText(); if (fEEChoice.isEnabled()) { IExecutionEnvironment ee = VMUtil.getExecutionEnvironment(eeid); if (ee != null && ee.getCompatibleVMs().length == 0) { setMessage(PDEUIMessages.NewProjectCreationPage_invalidEE, IMessageProvider.WARNING); } } } setErrorMessage(errorMessage); setPageComplete(errorMessage == null); }
From source file:org.eclipse.pde.internal.ui.wizards.tools.ConvertPreferencesWizard.java
License:Open Source License
private IRunnableWithProgress getGenerateOperation() { return new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask(PDEUIMessages.ConvertPreferencesWizard_progress, 100); File prefsFile = page.getPreferencesFile(); if (prefsFile != null) { String sourceFilePath = prefsFile.getAbsolutePath(); String errorFilePath = sourceFilePath; if (prefsFile.exists()) { try { BufferedReader in = new BufferedReader(new FileReader(sourceFilePath)); // Build properties from the EPF file, ignoring any scope strings. Properties properties = new Properties(); try { String line; while ((line = in.readLine()) != null) { // ignore any lines that don't start with a separator if (line.length() > 0 && line.charAt(0) == IPath.SEPARATOR) { // find next separator so that we are skipping a scope such as /instance/ or /configuration/ int index = line.indexOf(IPath.SEPARATOR, 1); if (index > -1) { int keyIndex = line.indexOf('=', index); if (keyIndex > index + 1) { String key = line.substring(index + 1, keyIndex).trim(); String value = line.substring(keyIndex + 1).trim(); properties.put(key, value); } }/*from w w w .j a v a 2 s . c om*/ } } } finally { in.close(); } monitor.worked(50); // If there are preferences to save, look for a plugin_customization.ini file and either // overwrite it or merge it. if (properties.size() > 0) { // Ensure file exists in case it was deleted since we validated IFile customizationFile = page.getPluginCustomizeFile(); errorFilePath = customizationFile.getFullPath().toString(); if (!customizationFile.exists()) { byte[] bytes = "".getBytes(); //$NON-NLS-1$ InputStream source = new ByteArrayInputStream(bytes); customizationFile.create(source, IResource.NONE, null); } StringBuilder out = new StringBuilder(); // merging old and new content if (!fOverwrite) { BufferedReader existingFile = new BufferedReader( new InputStreamReader(customizationFile.getContents())); try { String line; while ((line = existingFile.readLine()) != null) { int index = line.indexOf('='); if (index > 1) { String key = line.substring(0, index).trim(); // If this key is not in the new preferences, then we want to preserve it. // If it is in the preferences, we'll be picking up the new value. if (!properties.containsKey(key)) { out.append(line); out.append('\n'); } } else { PDEPlugin.log(NLS.bind( PDEUIMessages.ConvertPreferencesWizard_skippedInvalidLine, fPreferencesFilePath)); PDEPlugin.log(" " + line); //$NON-NLS-1$ } } } finally { existingFile.close(); } } monitor.worked(20); Enumeration<Object> keys = properties.keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); Object value = properties.get(key); out.append(key + "=" + value); //$NON-NLS-1$ out.append('\n'); } // now write the (possibly merged) values from the string builder to the file InputStream resultStream = new ByteArrayInputStream(out.toString().getBytes()); customizationFile.setContents(resultStream, true, true, null); monitor.worked(30); } else { page.setMessage(PDEUIMessages.ConvertPreferencesWizard_errorNoPrefs, IMessageProvider.WARNING); } } catch (FileNotFoundException e) { page.setErrorMessage( NLS.bind(PDEUIMessages.ConvertPreferencesWizard_errorFile, errorFilePath)); PDEPlugin.logException(e); return; } catch (CoreException e) { page.setErrorMessage( NLS.bind(PDEUIMessages.ConvertPreferencesWizard_errorFile, errorFilePath)); PDEPlugin.logException(e); return; } catch (IOException e) { page.setErrorMessage( NLS.bind(PDEUIMessages.ConvertPreferencesWizard_errorFile, errorFilePath)); PDEPlugin.logException(e); return; } finally { monitor.done(); } } else { page.setErrorMessage(PDEUIMessages.ConvertPreferencesWizard_errorFileNotFound); } } else { page.setErrorMessage(PDEUIMessages.ConvertPreferencesWizard_errorNoFileSpecified); } } }; }
From source file:org.eclipse.pde.internal.visualization.dependency.views.VisualizationForm.java
License:Open Source License
private void configureFormText(final Form form, FormText text) { text.addHyperlinkListener(new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent e) { String is = (String) e.getHref(); try { ((FormText) e.widget).getShell().dispose(); int index = Integer.parseInt(is); IMessage[] messages = form.getChildrenMessages(); IMessage message = messages[index]; ErrorReporting error = (ErrorReporting) message.getData(); if (error != null) { error.handleError(); }//w ww . j a v a2 s.co m } catch (NumberFormatException ex) { } } }); text.setImage("error", getImage(IMessageProvider.ERROR)); text.setImage("warning", getImage(IMessageProvider.WARNING)); text.setImage("info", getImage(IMessageProvider.INFORMATION)); }
From source file:org.eclipse.php.composer.internal.ui.editors.GeneralPage.java
License:Open Source License
@Override public void setActive(boolean active) { if (active) { ScrolledForm form = getManagedForm().getForm(); try {//from w w w.ja v a 2s.c o m modelContainer.deserialize(document); } catch (JsonParseException e) { setError(e); } catch (IOException e) { Throwable cause = e.getCause(); if (cause instanceof JsonParseException) { setError((JsonParseException) cause); } else { form.setMessage(Messages.GeneralPage_ComposerJsonParseError, IMessageProvider.ERROR); } } if (modelContainer.isLoaded()) { if (canEdit) { model = modelContainer.getModel(); } else { form.setMessage(Messages.GeneralPage_CannotModifyWarning, IMessageProvider.WARNING); } } } }
From source file:org.eclipse.php.composer.internal.ui.preferences.ComposerPreferencePage.java
License:Open Source License
private boolean validatePage() { if (phpCombo.getText().isEmpty()) { setMessage(Messages.ComposerPreferencePage_PhpWarning, IMessageProvider.WARNING); return true; }/*www . j a v a2 s. com*/ if (useCustomButton.getSelection()) { if (!composerPharText.getText().isEmpty()) { File composerPhar = new File(composerPharText.getText()); if (!composerPhar.exists() || !ComposerPreferences.COMPOSER_PHAR.equals(composerPhar.getName())) { setErrorMessage(Messages.ComposerPreferencePage_PharError); return false; } } else { setErrorMessage(Messages.ComposerPreferencePage_PathEmptyError); return false; } } setMessage(null); setErrorMessage(null); return true; }