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.andmore.internal.wizards.templates.InstallDependencyPage.java
License:Open Source License
private void validatePage() { if (mTemplate == null) { return;/*from w w w .jav a 2 s . c om*/ } IStatus status = null; List<Pair<String, Integer>> dependencies = mTemplate.getDependencies(); if (dependencies.size() > 1 || dependencies.size() == 1 && !dependencies.get(0).getFirst().equals(SUPPORT_LIBRARY_NAME)) { status = new Status(IStatus.WARNING, AndmoreAndroidPlugin.PLUGIN_ID, "Unsupported template dependency: Upgrade your Android Eclipse plugin"); } setPageComplete(status == null || status.getSeverity() != IStatus.ERROR); if (status != null) { setMessage(status.getMessage(), status.getSeverity() == IStatus.ERROR ? IMessageProvider.ERROR : IMessageProvider.WARNING); } else { setErrorMessage(null); setMessage(null); } }
From source file:org.eclipse.andmore.internal.wizards.templates.NewProjectPage.java
License:Open Source License
private void validatePage() { IStatus status = mValues.template.validateTemplate(mValues.minSdkLevel, mValues.getBuildApi()); if (status != null && !status.isOK()) { updateDecorator(mApplicationDec, null, true); updateDecorator(mPackageDec, null, true); updateDecorator(mProjectDec, null, true); updateDecorator(mThemeDec, null, true); /* These never get marked with errors: updateDecorator(mBuildTargetDec, null, true); updateDecorator(mMinSdkDec, null, true); updateDecorator(mTargetSdkDec, null, true); *///from w ww . j a v a 2s .co m } else { IStatus appStatus = validateAppName(); if (appStatus != null && (status == null || appStatus.getSeverity() > status.getSeverity())) { status = appStatus; } IStatus projectStatus = validateProjectName(); if (projectStatus != null && (status == null || projectStatus.getSeverity() > status.getSeverity())) { status = projectStatus; } IStatus packageStatus = validatePackageName(); if (packageStatus != null && (status == null || packageStatus.getSeverity() > status.getSeverity())) { status = packageStatus; } IStatus locationStatus = ProjectContentsPage.validateLocationInWorkspace(mValues); if (locationStatus != null && (status == null || locationStatus.getSeverity() > status.getSeverity())) { status = locationStatus; } if (status == null || status.getSeverity() != IStatus.ERROR) { if (mValues.target == null) { status = new Status(IStatus.WARNING, AndmoreAndroidPlugin.PLUGIN_ID, "Select an Android build target version"); } } if (status == null || status.getSeverity() != IStatus.ERROR) { if (mValues.minSdk == null || mValues.minSdk.isEmpty()) { status = new Status(IStatus.WARNING, AndmoreAndroidPlugin.PLUGIN_ID, "Select a minimum SDK version"); } else { AndroidVersion version = mValues.target.getVersion(); if (version.isPreview()) { if (version.getCodename().equals(mValues.minSdk) == false) { status = new Status(IStatus.ERROR, AndmoreAndroidPlugin.PLUGIN_ID, "Preview platforms require the min SDK version to match their codenames."); } } else if (mValues.target.getVersion().compareTo(mValues.minSdkLevel, version.isPreview() ? mValues.minSdk : null) < 0) { status = new Status(IStatus.WARNING, AndmoreAndroidPlugin.PLUGIN_ID, "The minimum SDK version is higher than the build target version"); } if (status == null || status.getSeverity() != IStatus.ERROR) { if (mValues.targetSdkLevel < mValues.minSdkLevel) { status = new Status(IStatus.ERROR, AndmoreAndroidPlugin.PLUGIN_ID, "The target SDK version should be at least as high as the minimum SDK version"); } } } } IStatus themeStatus = validateTheme(); if (themeStatus != null && (status == null || themeStatus.getSeverity() > status.getSeverity())) { status = themeStatus; } } setPageComplete(status == null || status.getSeverity() != IStatus.ERROR); if (status != null) { setMessage(status.getMessage(), status.getSeverity() == IStatus.ERROR ? IMessageProvider.ERROR : IMessageProvider.WARNING); } else { setErrorMessage(null); setMessage(null); } }
From source file:org.eclipse.andmore.internal.wizards.templates.NewTemplatePage.java
License:Open Source License
private void validatePage() { int minSdk = getMinSdk(); int buildApi = getBuildApi(); IStatus status = mValues.getTemplateHandler().validateTemplate(minSdk, buildApi); if (status == null || status.isOK()) { if (mChooseProject && mValues.project == null) { status = new Status(IStatus.ERROR, AndmoreAndroidPlugin.PLUGIN_ID, "Please select an Android project."); }// w w w. ja v a 2 s . c om } for (Parameter parameter : mShowingTemplate.getParameters()) { if (parameter.type == Parameter.Type.SEPARATOR) { continue; } IInputValidator validator = parameter.getValidator(mValues.project); if (validator != null) { ControlDecoration decoration = mDecorations.get(parameter.id); String value = parameter.value == null ? "" : parameter.value.toString(); String error = validator.isValid(value); if (error != null) { IStatus s = new Status(IStatus.ERROR, AndmoreAndroidPlugin.PLUGIN_ID, error); if (decoration != null) { updateDecorator(decoration, s, parameter.help); } if (status == null || status.isOK()) { status = s; } } else if (decoration != null) { updateDecorator(decoration, null, parameter.help); } } if (status == null || status.isOK()) { if (parameter.control instanceof Combo) { status = validateCombo(status, parameter, minSdk, buildApi); } } } setPageComplete(status == null || status.getSeverity() != IStatus.ERROR); if (status != null) { setMessage(status.getMessage(), status.getSeverity() == IStatus.ERROR ? IMessageProvider.ERROR : IMessageProvider.WARNING); } else { setErrorMessage(null); setMessage(null); } }
From source file:org.eclipse.andmore.traceview.editors.TraceviewEditor.java
License:Apache License
@Override public void doSaveAs() { Shell shell = getSite().getShell();//from ww w. j a v a2 s . c om final IEditorInput input = getEditorInput(); final IEditorInput newInput; if (input instanceof FileEditorInput) { // the file is part of the current workspace FileEditorInput fileEditorInput = (FileEditorInput) input; SaveAsDialog dialog = new SaveAsDialog(shell); IFile original = fileEditorInput.getFile(); if (original != null) { dialog.setOriginalFile(original); } dialog.create(); if (original != null && !original.isAccessible()) { String message = String.format("The original file ''%s'' has been deleted or is not accessible.", original.getName()); dialog.setErrorMessage(null); dialog.setMessage(message, IMessageProvider.WARNING); } if (dialog.open() == Window.CANCEL) { return; } IPath filePath = dialog.getResult(); if (filePath == null) { return; } IWorkspace workspace = ResourcesPlugin.getWorkspace(); IFile file = workspace.getRoot().getFile(filePath); if (copy(shell, fileEditorInput.getURI(), file.getLocationURI()) == null) { return; } try { file.refreshLocal(IResource.DEPTH_ZERO, null); } catch (CoreException e) { // TODO Auto-generated catch block e.printStackTrace(); } newInput = new FileEditorInput(file); setInput(newInput); setPartName(newInput.getName()); } else if (input instanceof FileStoreEditorInput) { // the file is not part of the current workspace FileStoreEditorInput fileStoreEditorInput = (FileStoreEditorInput) input; FileDialog dialog = new FileDialog(shell, SWT.SAVE); IPath oldPath = URIUtil.toPath(fileStoreEditorInput.getURI()); if (oldPath != null) { dialog.setFileName(oldPath.lastSegment()); dialog.setFilterPath(oldPath.toOSString()); } String path = dialog.open(); if (path == null) { return; } // Check whether file exists and if so, confirm overwrite final File localFile = new File(path); if (localFile.exists()) { MessageDialog overwriteDialog = new MessageDialog(shell, "Save As", null, String.format("%s already exists.\nDo you want to replace it?", path), MessageDialog.WARNING, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 1); // 'No' // is // the // default if (overwriteDialog.open() != Window.OK) { return; } } IFileStore destFileStore = copy(shell, fileStoreEditorInput.getURI(), localFile.toURI()); if (destFileStore != null) { IFile file = getWorkspaceFile(destFileStore); if (file != null) { newInput = new FileEditorInput(file); } else { newInput = new FileStoreEditorInput(destFileStore); } setInput(newInput); setPartName(newInput.getName()); } } }
From source file:org.eclipse.birt.report.data.oda.sampledb.ui.profile.SampleDbSelectionPageHelper.java
License:Open Source License
void createCustomControl(Composite parent) { // create the composite to hold the widgets Composite content = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2;//from www. j a v a2 s. c o m content.setLayout(layout); new Label(content, SWT.LEFT).setText(Messages.getMessage("datasource.page.driver.class")); //$NON-NLS-1$ m_driverClass = new Label(content, SWT.LEFT); m_driverClass.setText(SampleDBConstants.DRIVER_CLASS); //$NON-NLS-1$ new Label(content, SWT.LEFT).setText(Messages.getMessage("datasource.page.url")); //$NON-NLS-1$ m_driverURL = new Label(content, SWT.LEFT); m_driverURL.setText(SampleDBConstants.DRIVER_URL);//$NON-NLS-1$ new Label(content, SWT.LEFT).setText(Messages.getMessage("datasource.page.user")); //$NON-NLS-1$ m_sampleUser = new Label(content, SWT.LEFT); m_sampleUser.setText(SampleDBJDBCConnectionFactory.getDbUser());//$NON-NLS-1$ setMessage(DEFAULT_MESSAGE, IMessageProvider.NONE); if (this.m_wizardPage != null) { if (this.m_wizardPage.getPreviousPage().getClass().toString().contains("DataSourceSelectionPage")) { setMessage(DEFAULT_MESSAGE, IMessageProvider.NONE); } else { setMessage(Messages.getMessage("datasource.page.warning"), IMessageProvider.WARNING); } } PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), CONEXT_ID_DATASOURCE_SAMPLEDB); }
From source file:org.eclipse.birt.report.designer.ui.dialogs.StyleBuilder.java
License:Open Source License
public void setTitleMessage(String newMessage, int newType) { Image newImage = null;/*from w w w . ja v a 2s . c o m*/ if (newMessage != null) { switch (newType) { case IMessageProvider.NONE: break; case IMessageProvider.INFORMATION: newImage = JFaceResources.getImage(DLG_IMG_MESSAGE_INFO); break; case IMessageProvider.WARNING: newImage = JFaceResources.getImage(DLG_IMG_MESSAGE_WARNING); break; case IMessageProvider.ERROR: newImage = JFaceResources.getImage(DLG_IMG_MESSAGE_ERROR); break; } } showTitleMessage(newMessage, newImage); }
From source file:org.eclipse.birt.report.designer.ui.preferences.StatusUtil.java
License:Open Source License
/** * Applies the status to the status line of a dialog page. * /*from w w w .j av a2s .c o m*/ * @param page * the dialog page * @param status * the status to apply */ public static void applyToStatusLine(DialogPage page, IStatus status) { if (status == null) { page.setMessage(null, IMessageProvider.NONE); page.setErrorMessage(null); return; } String message = status.getMessage(); if (message != null && message.length() == 0) { message = null; } switch (status.getSeverity()) { case IStatus.OK: page.setMessage(message, IMessageProvider.NONE); page.setErrorMessage(null); break; case IStatus.WARNING: page.setMessage(message, IMessageProvider.WARNING); page.setErrorMessage(null); break; case IStatus.INFO: page.setMessage(message, IMessageProvider.INFORMATION); page.setErrorMessage(null); break; default: page.setMessage(null); page.setErrorMessage(message); break; } }
From source file:org.eclipse.bpel.apache.ode.deploy.ui.pages.ProcessPage.java
License:Open Source License
public void resourceChanged(IResourceChangeEvent event) { IResourceDeltaVisitor rdv = new IResourceDeltaVisitor() { public boolean visit(IResourceDelta delta) { IResource res = delta.getResource(); if ("bpel".equalsIgnoreCase(res.getFileExtension())) { //$NON-NLS-1$ Display.getDefault().syncExec(new Runnable() { public void run() { mainform.setMessage("Associated BPEL and/or WSDL has been changed, click to update!", IMessageProvider.WARNING); }//from w w w .j a va 2s.co m }); } return true; // visit the children } }; try { event.getDelta().accept(rdv); } catch (CoreException e) { // ignore } }
From source file:org.eclipse.bpel.ui.wizards.NewBpelFileTemplatePage.java
License:Open Source License
/** * Validates the page data and updates the page state in consequence. *//*from ww w . j av a 2 s .co m*/ private void updateStatus() { String errorMsg = validatePage(); setPageComplete(errorMsg == null); setErrorMessage(errorMsg); // Specific behavior for the empty template // The created file will be marked as invalid String msg = null; Template tpl = getSelectedTemplate(); String tplKey = tpl == null ? null : tpl.getKey(); if (Templates.TEMPLATE_KEY_EMPTY.equals(tplKey)) msg = "Beware, empty processes are marked as invalid by the BPEL validator."; setMessage(msg, IMessageProvider.WARNING); }
From source file:org.eclipse.cdt.internal.ui.preferences.PathEntryVariableDialog.java
License:Open Source License
/** * Validates the current variable value, and updates this dialog's message. * //from w w w . j a va 2 s . c om * @return true if the value is valid, false otherwise */ private boolean validateVariableValue() { boolean allowFinish = false; // if the current validationStatus is ERROR, no additional validation applies if (validationStatus == IMessageProvider.ERROR) return false; // assumes everything will be ok String message = standardMessage; int newValidationStatus = IMessageProvider.NONE; if (variableValue.length() == 0) { // the variable value is empty if (locationEntered) { // a location value was entered before and is now empty newValidationStatus = IMessageProvider.ERROR; message = PreferencesMessages.PathEntryVariableDialog_variableValueEmptyMessage; } } else if (!Path.EMPTY.isValidPath(variableValue)) { // the variable value is an invalid path message = PreferencesMessages.PathEntryVariableDialog_variableValueInvalidMessage; newValidationStatus = IMessageProvider.ERROR; } else if (!new Path(variableValue).isAbsolute()) { // the variable value is a relative path message = PreferencesMessages.PathEntryVariableDialog_pathIsRelativeMessage; newValidationStatus = IMessageProvider.ERROR; } else if (!new File(variableValue).exists()) { // the path does not exist (warning) message = PreferencesMessages.PathEntryVariableDialog_pathDoesNotExistMessage; newValidationStatus = IMessageProvider.WARNING; allowFinish = true; } else { allowFinish = true; } // overwrite the current validation status / message only if everything is ok (clearing them) // or if we have a more serious problem than the current one if (validationStatus == IMessageProvider.NONE || newValidationStatus > validationStatus) { validationStatus = newValidationStatus; validationMessage = message; } setMessage(validationMessage, validationStatus); return allowFinish; }