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:com.android.ide.eclipse.auidt.internal.wizards.newproject.ImportPage.java
License:Open Source License
private void validatePage() { IStatus status = null;//from ww w .j a va2 s . co m // Validate project name -- unless we're creating a sample, in which case // the user will get a chance to pick the name on the Sample page if (mProjectPaths == null || mProjectPaths.isEmpty()) { status = new Status(IStatus.ERROR, AdtPlugin.PLUGIN_ID, "Select a directory to search for existing Android projects"); } else if (mValues.importProjects == null || mValues.importProjects.isEmpty()) { status = new Status(IStatus.ERROR, AdtPlugin.PLUGIN_ID, "Select at least one project"); } else { for (ImportedProject project : mValues.importProjects) { if (mCheckboxTableViewer.getGrayed(project)) { status = new Status(IStatus.ERROR, AdtPlugin.PLUGIN_ID, String.format( "Cannot import %1$s because the project name is in use", project.getProjectName())); break; } } } // -- update UI & enable finish if there's no error 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:com.android.ide.eclipse.auidt.internal.wizards.templates.ActivityPage.java
License:Open Source License
private void validatePage() { IStatus status = null;//from ww w . ja v a 2s. c om if (mValues.createActivity) { if (mList.getSelectionCount() < 1) { status = new Status(IStatus.ERROR, AdtPlugin.PLUGIN_ID, "Select an activity type"); } else { TemplateHandler templateHandler = mValues.activityValues.getTemplateHandler(); status = templateHandler.validateTemplate(mValues.minSdkLevel); } } 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:com.android.ide.eclipse.auidt.internal.wizards.templates.NewProjectPage.java
License:Open Source License
private void validatePage() { IStatus status = mValues.template.validateTemplate(mValues.minSdkLevel); if (status != null && !status.isOK()) { updateDecorator(mApplicationDec, null, true); updateDecorator(mPackageDec, null, true); updateDecorator(mProjectDec, null, true); } else {//from w ww .j ava 2 s . com 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 = validateProjectLocation(); 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, AdtPlugin.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, AdtPlugin.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, AdtPlugin.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, AdtPlugin.PLUGIN_ID, "The minimum SDK version is higher than the build target version"); } } } } 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:com.android.ide.eclipse.auidt.internal.wizards.templates.NewTemplatePage.java
License:Open Source License
private void validatePage() { int currentMinSdk = getMinSdk(); int minSdk = currentMinSdk; IStatus status = mValues.getTemplateHandler().validateTemplate(minSdk); if (status == null || status.isOK()) { if (mChooseProject && mValues.project == null) { status = new Status(IStatus.ERROR, AdtPlugin.PLUGIN_ID, "Please select an Android project."); }//from www . j ava2 s.c om } for (Parameter parameter : mParameters) { 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, AdtPlugin.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) { Combo combo = (Combo) parameter.control; Integer[] optionIds = (Integer[]) combo.getData(ATTR_MIN_API); int index = combo.getSelectionIndex(); if (index != -1 && index < optionIds.length) { Integer requiredMinSdk = optionIds[index]; if (requiredMinSdk > currentMinSdk) { status = new Status(IStatus.ERROR, AdtPlugin.PLUGIN_ID, String.format( "This template requires a minimum SDK version of at " + "least %1$d, and the current min version is %2$d", requiredMinSdk, currentMinSdk)); } } } } } 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:com.android.ide.eclipse.traceview.editors.TraceviewEditor.java
License:Apache License
@Override public void doSaveAs() { Shell shell = getSite().getShell();//from w ww.j a va 2 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(IFile.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:com.aptana.formatter.ui.util.StatusUtil.java
License:Open Source License
/** * Applies the status to the status line of a dialog page. *///ww w . ja v a 2 s.c om public static void applyToStatusLine(DialogPage page, IStatus status) { String message = status.getMessage(); 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: if (message.length() == 0) { message = null; } page.setMessage(null); page.setErrorMessage(message); break; } }
From source file:com.aptana.ide.security.internal.linux.StorageLoginDialog.java
License:Open Source License
protected boolean validatePassword() { String password1 = password.getText(); if ((password1 == null) || (password1.length() == 0)) { setMessage(Messages.messageEmptyPassword, IMessageProvider.ERROR); return false; }/*w w w . jav a 2s .c om*/ if (confirm != null) { String password2 = confirm.getText(); if (!password1.equals(password2)) { setMessage(Messages.messageNoMatch, IMessageProvider.WARNING); return false; } } setMessage("", IMessageProvider.NONE); //$NON-NLS-1$ return true; }
From source file:com.aptana.internal.ui.text.spelling.StatusUtil.java
License:Open Source License
/** * Applies the status to the status line of a dialog page. * /*from w ww.j a v a2s.co m*/ * @param page * the dialog page * @param status * the status to apply */ public static void applyToStatusLine(DialogPage page, IStatus status) { 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:com.astra.ses.spell.database.db.ui.properties.pages.ProjectDatabasePropertiesPage.java
License:Open Source License
/*************************************************************************** * Check page values are correct as one is related to the other **************************************************************************/ private boolean validatePage() { ISpellDatabaseDriver selectedDriver = null; int selected = m_driverCombo.getSelectionIndex(); String driverName = m_driverCombo.getItem(selected); selectedDriver = DatabaseDriverManager.getInstance().getDriver(driverName); String newPath = m_path.getText(); if (!selectedDriver.checkDatabase(newPath)) { setMessage("The specified path does not contain a suitable " + selectedDriver.getName() + " database", IMessageProvider.WARNING); return false; } else {// w w w . ja va 2s. c o m setMessage(null); return true; } }
From source file:com.bdaum.zoom.lal.internal.lire.ui.dialogs.TextSearchDialog.java
License:Open Source License
@Override public void create() { super.create(); setTitle(Messages.TextSearchDialog_text_search); if (Job.getJobManager().find(Constants.INDEXING).length > 0) setMessage(Messages.TextSearchDialog_indexing_in_progress + '\n' + Messages.TextSearchDialog_specify_a_search_string, IMessageProvider.WARNING); else//w ww.j a va 2 s . c o m setMessage(Messages.TextSearchDialog_specify_a_search_string); fillValues(); updateButtons(); }