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.ebayopensource.turmeric.eclipse.ui.SOABasePage.java
License:Open Source License
/** * Update the message of the wizard page along with the appropriate icon. If * the status is not OK, then the page will be marked as not completed. * * @param status the status//from www.j a v a 2 s .c o m * @param controls the controls */ public void updatePageStatus(final IStatus status, Control... controls) { String message = null; int messageType = WizardPage.NONE; if (status != null) { switch (status.getSeverity()) { case IStatus.WARNING: messageType = IMessageProvider.WARNING; break; case IStatus.INFO: messageType = IMessageProvider.INFORMATION; break; case IStatus.ERROR: messageType = IMessageProvider.ERROR; break; } if (status != null) { message = ValidateUtil.getBasicFormattedUIErrorMessage(status); } } if (messageType == IMessageProvider.ERROR) { setErrorMessage(message); updateStatus(message, controls); } else { updateStatus(null); setMessage(message, messageType); } setPageComplete(status == null || status.getSeverity() != IStatus.ERROR); }
From source file:org.ebayopensource.vjet.eclipse.core.test.ui.VjoWizardTests.java
License:Open Source License
/** * @Test/* w w w .j a v a2 s .c o m*/ * @Description("Bug8610: Test whether the given path is unexisting and the * returned message level.") */ public void testUnexistingProjectLocation() { // Test unexisting project location. IPath path = new Path("c:\randomFolderNameWithBlank and_"); Object[] values = ProjectWizardFirstPage.validateNonExistingProjectPath(path); assertNotNull(values); assertEquals("There are 2 returned values after validating the unexisting path", values.length, 2); assertEquals("The warning message is not correct", (String) values[0], NewWizardMessages.ScriptProjectWizardFirstPage_Unexist_Location_message); assertEquals("The warning message is not correct", ((Integer) values[1]).intValue(), IMessageProvider.WARNING); }
From source file:org.ebayopensource.vjet.eclipse.internal.ui.preferences.VjetSdkPreferencePage.java
License:Open Source License
protected Control createContents(Composite ancestor) { initializeDialogUnits(ancestor);// ww w .j a v a 2s. c o m noDefaultAndApplyButton(); GridLayout layout = new GridLayout(); layout.numColumns = 1; layout.marginHeight = 0; layout.marginWidth = 0; ancestor.setLayout(layout); SWTFactory.createWrapLabel(ancestor, "", 1, 300); // SWTFactory.createWrapLabel(ancestor, JREMessages.JREsPreferencePage_2, 1, 300); SWTFactory.createVerticalSpacer(ancestor, 1); fJREBlock = new InstalledSdksBlock(); fJREBlock.createControl(ancestor); Control control = fJREBlock.getControl(); GridData data = new GridData(GridData.FILL_BOTH); data.horizontalSpan = 1; control.setLayoutData(data); // fJREBlock.restoreColumnSettings(JDIDebugUIPlugin.getDefault().getDialogSettings(), IJavaDebugHelpContextIds.JRE_PREFERENCE_PAGE); fCompliance = new Link(ancestor, SWT.NONE); fCompliance.setText("VJET SDK"); fCompliance.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fCompliance.setVisible(false); fCompliance.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { } public void widgetSelected(SelectionEvent e) { openCompliancePreferencePage(); } }); // PlatformUI.getWorkbench().getHelpSystem().setHelp(ancestor, IJavaDebugHelpContextIds.JRE_PREFERENCE_PAGE); initDefaultVM(); fJREBlock.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { ISdkEnvironment install = getCurrentDefaultVM(); if (install == null) { setValid(false); // setErrorMessage(JREMessages.JREsPreferencePage_13); setErrorMessage("Error"); } else { //if we change the VM make sure the compliance level supports //generated class files String compliance = getCurrentCompilerCompliance(); if (!supportsCurrentCompliance(install, compliance)) { setMessage("Warning", IMessageProvider.WARNING); // setMessage(MessageFormat.format(JREMessages.JREsPreferencePage_0, new String[] {compliance}), IMessageProvider.WARNING); fCompliance.setVisible(true); } else { setMessage(null); fCompliance.setVisible(false); } setValid(true); setErrorMessage(null); } } }); applyDialogFont(ancestor); return ancestor; }
From source file:org.ebayopensource.vjet.eclipse.internal.ui.preferences.VjetSdkPreferencePage.java
License:Open Source License
public boolean isValid() { String compliance = getCurrentCompilerCompliance(); if (!supportsCurrentCompliance(getCurrentDefaultVM(), compliance)) { // setMessage(MessageFormat.format(JREMessages.JREsPreferencePage_0, new String[] {compliance}), IMessageProvider.WARNING); setMessage("", IMessageProvider.WARNING); // fCompliance.setVisible(true); } else {//from w ww . j a va2 s .c o m setMessage(null); // fCompliance.setVisible(false); } return super.isValid(); }
From source file:org.eclipse.acceleo.internal.ide.ui.wizards.module.AcceleoModuleWizardPage.java
License:Open Source License
/** * {@inheritDoc}/*ww w . jav a2 s. c o m*/ * * @see org.eclipse.acceleo.internal.ide.ui.wizards.module.IAcceleoModuleCompositeListener#applyToStatusLine(org.eclipse.core.runtime.IStatus) */ public void applyToStatusLine(IStatus status) { String message = status.getMessage(); if (message != null && message.length() == 0) { message = null; } switch (status.getSeverity()) { case IStatus.OK: setMessage(message, IMessageProvider.NONE); setErrorMessage(null); setPageComplete(true); break; case IStatus.WARNING: setMessage(message, IMessageProvider.WARNING); setErrorMessage(null); setPageComplete(true); break; case IStatus.INFO: setMessage(message, IMessageProvider.INFORMATION); setErrorMessage(null); setPageComplete(true); break; default: setMessage(null); setErrorMessage(message); setPageComplete(false); break; } }
From source file:org.eclipse.acceleo.internal.ide.ui.wizards.project.AcceleoModulesCreationPage.java
License:Open Source License
/** * {@inheritDoc}//from w w w . j av a 2 s. c o m * * @see org.eclipse.acceleo.internal.ide.ui.wizards.module.IAcceleoModuleCompositeListener#applyToStatusLine(org.eclipse.core.runtime.IStatus) */ public void applyToStatusLine(IStatus status) { String message = status.getMessage(); if (message != null && message.length() == 0) { message = null; } switch (status.getSeverity()) { case IStatus.OK: setMessage(message, IMessageProvider.NONE); setErrorMessage(null); setPageComplete(true); break; case IStatus.WARNING: setMessage(message, IMessageProvider.WARNING); setErrorMessage(null); setPageComplete(true); break; case IStatus.INFO: setMessage(message, IMessageProvider.INFORMATION); setErrorMessage(null); setPageComplete(true); break; default: setMessage(null); setErrorMessage(message); setPageComplete(false); break; } this.checkDuplicates(); this.treeViewer.refresh(); }
From source file:org.eclipse.acceleo.internal.ide.ui.wizards.project.AcceleoProjectPage.java
License:Open Source License
/** * Checks if the environment is compatible with Acceleo. */// ww w . j a va2s . c om private void checkCompatibleEnvironment() { if (executionEnvJREButton.getSelection()) { String text = executionEnvJRECombo.getText(); if (!"J2SE-1.5".equals(text) && !"JavaSE-1.6".equals(text) && !"JavaSE-1.7".equals(text)) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ this.setMessage(AcceleoUIMessages.getString("AcceleoProjectPage.NotJava5or6or7"), //$NON-NLS-1$ IMessageProvider.WARNING); } else { this.setMessage(null); } } else { this.setMessage(AcceleoUIMessages.getString("AcceleoProjectPage.NotJava5or6or7"), //$NON-NLS-1$ IMessageProvider.WARNING); } }
From source file:org.eclipse.acceleo.ui.interpreter.view.InterpreterView.java
License:Open Source License
/** * Converts an IStatus severity to a IMessageProviderSeverity. * /* w w w .ja v a2 s . co m*/ * @param statusSeverity * The status severity to be converted. * @return The corresponding IMessageProvider severity. */ private int convertStatusToMessageSeverity(int statusSeverity) { int severity = IMessageProvider.NONE; switch (statusSeverity) { case IStatus.INFO: severity = IMessageProvider.INFORMATION; break; case IStatus.WARNING: severity = IMessageProvider.WARNING; break; case IStatus.ERROR: severity = IMessageProvider.ERROR; break; default: severity = IMessageProvider.NONE; } return severity; }
From source file:org.eclipse.ajdt.internal.ui.wizards.exports.AJJarManifestWizardPage.java
License:Open Source License
public boolean isPageComplete() { boolean isPageComplete = true; setMessage(null);/*from w w w .j a v a 2 s . com*/ if (!fJarPackage.areGeneratedFilesExported()) return true; if (fJarPackage.isManifestGenerated() && fJarPackage.isManifestSaved()) { if (fJarPackage.getManifestLocation().toString().length() == 0) isPageComplete = false; else { IPath location = fJarPackage.getManifestLocation(); if (!location.toString().startsWith("/")) { //$NON-NLS-1$ setErrorMessage(JarPackagerMessages.JarManifestWizardPage_error_manifestPathMustBeAbsolute); return false; } IResource resource = findResource(location); if (resource != null && resource.getType() != IResource.FILE) { setErrorMessage( JarPackagerMessages.JarManifestWizardPage_error_manifestMustNotBeExistingContainer); return false; } resource = findResource(location.removeLastSegments(1)); if (resource == null || resource.getType() == IResource.FILE) { setErrorMessage(JarPackagerMessages.JarManifestWizardPage_error_manifestContainerDoesNotExist); return false; } } } if (!fJarPackage.isManifestGenerated()) { if (fJarPackage.isManifestAccessible()) { Manifest manifest = null; try { manifest = fJarPackage.getManifestProvider().create(fJarPackage); } catch (CoreException ex) { // nothing reported in the wizard } if (manifest != null && manifest.getMainAttributes().getValue(Attributes.Name.MANIFEST_VERSION) == null) setMessage(JarPackagerMessages.JarManifestWizardPage_warning_noManifestVersion, IMessageProvider.WARNING); } else { if (fJarPackage.getManifestLocation().toString().length() == 0) setErrorMessage(JarPackagerMessages.JarManifestWizardPage_error_noManifestFile); else setErrorMessage(JarPackagerMessages.JarManifestWizardPage_error_invalidManifestFile); return false; } } Set selectedPackages = getPackagesForSelectedResources(fJarPackage); if (fJarPackage.isJarSealed() && !selectedPackages.containsAll(Arrays.asList(fJarPackage.getPackagesToUnseal()))) { setErrorMessage(JarPackagerMessages.JarManifestWizardPage_error_unsealedPackagesNotInSelection); return false; } if (!fJarPackage.isJarSealed() && !selectedPackages.containsAll(Arrays.asList(fJarPackage.getPackagesToSeal()))) { setErrorMessage(JarPackagerMessages.JarManifestWizardPage_error_sealedPackagesNotInSelection); return false; } if (!fJarPackage.isMainClassValid(getContainer()) || (fJarPackage.getManifestMainClass() == null && fMainClassText.getText().length() > 0)) { setErrorMessage(JarPackagerMessages.JarManifestWizardPage_error_invalidMainClass); return false; } setErrorMessage(null); return isPageComplete; }
From source file:org.eclipse.andmore.android.codeutils.codegeneration.DefineSqlOpenHelperPage.java
License:Apache License
/** * Create composite group to display SQL Open Helper parameters. * //ww w . j a v a 2 s . co m * @param mainComposite * parent composite. */ private void createOpenHelperSection(Composite mainComposite) { // check box for generating SQL Open Helper ckbGenerateSQLOpenHelper = new Button(mainComposite, SWT.CHECK); ckbGenerateSQLOpenHelper.setText(CodeUtilsNLS.UI_PersistenceWizardPageCreateNewSQLOpenHelper); ckbGenerateSQLOpenHelper.setSelection(true); sqlOpenHelperGroup = new Group(mainComposite, SWT.NONE); sqlOpenHelperGroup.setText(CodeUtilsNLS.UI_PersistenceWizardPageSQLOpenHelperGroupTitle); int numColumns = 5; sqlOpenHelperGroup.setLayout(new GridLayout(numColumns, false)); sqlOpenHelperGroup.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false)); /* Class selection for SQLOpenHelper */ createTypeNameControls(sqlOpenHelperGroup, numColumns); /* Package selection for SQLOpenHelper */ createContainerControls(sqlOpenHelperGroup, numColumns); createPackageControls(sqlOpenHelperGroup, numColumns); ckbGenerateSQLOpenHelper.setEnabled(true); ((ActivityBasedOnTemplate) getBuildBlock()).setCreateOpenHelper(true); // add Listener for the check box of the open helper enablement ckbGenerateSQLOpenHelper.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { boolean selected = ckbGenerateSQLOpenHelper.getSelection(); ((ActivityBasedOnTemplate) getBuildBlock()).setCreateOpenHelper(selected); if (!selected) { setMessage(CodeUtilsNLS.UI_DefineSqlOpenHelperPage_WarningNoOpenHelperSelected, IMessageProvider.WARNING); } else { setMessage(null); } // get the check box which dispatched the event Button checkBox = event.widget != null ? (Button) event.widget : null; // proceed in case there is a check box if (checkBox != null) { // flag indicating whether to enable/disable the controls boolean enabled = checkBox.getSelection(); // enable/disable the children of panelEnablementGroup field setCompositeChildremEnabled(sqlOpenHelperGroup, enabled); } setOpenHelperDefined(); getWizard().getContainer().updateButtons(); } }); }