List of usage examples for org.eclipse.jface.dialogs IMessageProvider ERROR
int ERROR
To view the source code for org.eclipse.jface.dialogs IMessageProvider ERROR.
Click Source Link
From source file:cn.dockerfoundry.ide.eclipse.server.ui.internal.wizards.DockerFoundryServiceWizardPage.java
License:Open Source License
/** Returns the list of available services, or null if the user cancelled the monitor. */ private List<AvailableService> updateConfiguration() { final List<AvailableService> result = new ArrayList<AvailableService>(); try {// w ww .jav a 2 s .c o m final GetServiceOfferingsRunnable runnable = new GetServiceOfferingsRunnable(); // Begin retrieving the service offerings ProgressMonitorDialog monitorDlg = new ProgressMonitorDialog(getShell()); monitorDlg.run(true, true, runnable); // If the user cancelled service acquisition, then just return null. if (runnable.isUserCancelled()) { return null; } if (runnable.getServiceOfferingResult() != null) { int index = 0; for (DockerContainerElement o : runnable.getServiceOfferingResult()) { String name = o.getName(); String image = "Image: " + o.getImage(); result.add(new AvailableService(name, image, index, o)); index++; } } } catch (InvocationTargetException e) { IStatus status = cloudServer.error(NLS.bind( Messages.DockerFoundryServiceWizardPage_ERROR_CONFIG_RETRIVE, e.getCause().getMessage()), e); StatusManager.getManager().handle(status, StatusManager.LOG); setMessage(status.getMessage(), IMessageProvider.ERROR); } catch (InterruptedException e) { if (Logger.WARNING) { Logger.println(Logger.WARNING_LEVEL, this, "updateConfiguration", //$NON-NLS-1$ "Failed to load the list of available services."); //$NON-NLS-1$ } } return result; }
From source file:com.android.ide.eclipse.adt.internal.assetstudio.ChooseAssetTypePage.java
License:Open Source License
private void validatePage() { String error = null;//ww w. j av a2 s.c o m if (mValues.project == null) { error = "Please select an Android project."; } else { String outputName = getOutputName(); if (outputName == null || outputName.length() == 0) { error = "Please enter a name"; } else { ResourceNameValidator validator = ResourceNameValidator.create(true, ResourceFolderType.DRAWABLE); error = validator.isValid(outputName); } } setPageComplete(error == null); if (error != null) { setMessage(error, IMessageProvider.ERROR); } else { setErrorMessage(null); setMessage(null); } }
From source file:com.android.ide.eclipse.adt.internal.assetstudio.ConfigureAssetSetPage.java
License:Open Source License
private boolean validatePage() { String error = null;// w w w . j a va2s .c o m //String warning = null; if (mImageRadio.getSelection()) { String path = mValues.imagePath != null ? mValues.imagePath.getPath() : null; if (path == null || path.length() == 0) { error = "Select an image"; } else if (path.equals(DEFAULT_LAUNCHER_ICON)) { // Silent } else if (!(new File(path).exists())) { error = String.format("%1$s does not exist", path); } else { // Preserve across wizard sessions sImagePath = path; } } else if (mTextRadio.getSelection()) { if (mValues.text.length() == 0) { error = "Enter text"; } } else { assert mClipartRadio.getSelection(); if (mValues.clipartName == null) { error = "Select clip art"; } } setPageComplete(error == null); if (error != null) { setMessage(error, IMessageProvider.ERROR); //} else if (warning != null) { // setMessage(warning, IMessageProvider.WARNING); } else { setErrorMessage(null); setMessage(null); } return error == null; }
From source file:com.android.ide.eclipse.adt.internal.editors.manifest.model.UiClassAttributeNode.java
License:Open Source License
/** * Sets the error messages. If message is <code>null</code>, the message is removed. * @param message the message to set, or <code>null</code> to remove the current message * @param textWidget the {@link Text} widget associated to the message. *//* w w w . j av a 2s . c om*/ private final void setErrorMessage(String message, Text textWidget) { if (message != null) { setHasError(true); getManagedForm().getMessageManager().addMessage(textWidget, message, null /* data */, IMessageProvider.ERROR, textWidget); } else { setHasError(false); getManagedForm().getMessageManager().removeMessage(textWidget, textWidget); } }
From source file:com.android.ide.eclipse.adt.internal.editors.manifest.model.UiManifestPkgAttrNode.java
License:Open Source License
@Override protected void onAddValidators(final Text text) { ModifyListener listener = new ModifyListener() { @Override/*from ww w .j a v a 2 s. c o m*/ public void modifyText(ModifyEvent e) { String package_name = text.getText(); if (package_name.indexOf('.') < 1) { getManagedForm().getMessageManager().addMessage(text, "Package name should contain at least two identifiers.", null /* data */, IMessageProvider.ERROR, text); } else { getManagedForm().getMessageManager().removeMessage(text, text); } } }; text.addModifyListener(listener); // Make sure the validator removes its message(s) when the widget is disposed text.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { getManagedForm().getMessageManager().removeMessage(text, text); } }); // Finally call the validator once to make sure the initial value is processed listener.modifyText(null); }
From source file:com.android.ide.eclipse.adt.internal.editors.resources.uimodel.UiColorValueNode.java
License:Open Source License
@Override protected void onAddValidators(final Text text) { ModifyListener listener = new ModifyListener() { public void modifyText(ModifyEvent e) { String color = text.getText(); if (RGBA_REGEXP.matcher(color).matches()) { getManagedForm().getMessageManager().removeMessage(text, text); } else { getManagedForm().getMessageManager().addMessage(text, "Accepted color formats are one of #RGB, #ARGB, #RRGGBB or #AARRGGBB.", null /* data */, IMessageProvider.ERROR, text); }//w ww. j av a 2 s . c o m } }; text.addModifyListener(listener); // Make sure the validator removes its message(s) when the widget is disposed text.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { getManagedForm().getMessageManager().removeMessage(text, text); } }); // Finally call the validator once to make sure the initial value is processed listener.modifyText(null); }
From source file:com.android.ide.eclipse.adt.internal.editors.values.uimodel.UiColorValueNode.java
License:Open Source License
@Override protected void onAddValidators(final Text text) { ModifyListener listener = new ModifyListener() { @Override/*from ww w.java2s . c o m*/ public void modifyText(ModifyEvent e) { String color = text.getText(); if (RGBA_REGEXP.matcher(color).matches()) { getManagedForm().getMessageManager().removeMessage(text, text); } else { getManagedForm().getMessageManager().addMessage(text, "Accepted color formats are one of #RGB, #ARGB, #RRGGBB or #AARRGGBB.", null /* data */, IMessageProvider.ERROR, text); } } }; text.addModifyListener(listener); // Make sure the validator removes its message(s) when the widget is disposed text.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { getManagedForm().getMessageManager().removeMessage(text, text); } }); // Finally call the validator once to make sure the initial value is processed listener.modifyText(null); }
From source file:com.android.ide.eclipse.adt.internal.welcome.UsagePermissionPage.java
License:Open Source License
private void validatePage() { String error = null;// w w w . ja v a 2 s .co m if (!mYesRadio.getSelection() && !mNoRadio.getSelection()) { error = "Select Yes or No"; } setPageComplete(error == null); if (error != null) { setMessage(error, IMessageProvider.ERROR); } else { setErrorMessage(null); setMessage(null); } }
From source file:com.android.ide.eclipse.adt.internal.welcome.WelcomeWizardPage.java
License:Open Source License
private void validatePage() { String error = null;/*from w w w .ja va 2 s .com*/ String warning = null; if (isCreateNew()) { // Make sure that the target installation directory is empty or doesn't exist // (and that it can be created) String path = mNewDirText.getText().trim(); if (path.length() == 0) { error = "Please enter a new directory to install the SDK into"; } else { File file = new File(path); if (file.exists()) { if (file.isDirectory()) { if (!file.canWrite()) { error = "Missing write permission in target directory"; } File[] children = file.listFiles(); if (children != null && children.length > 0) { warning = "The directory is not empty"; } } else { error = "The target must be a directory"; } } else { File parent = file.getParentFile(); if (parent == null || !parent.exists()) { error = "The parent directory does not exist"; } else if (!parent.canWrite()) { error = "No write permission in parent directory"; } } } if (error == null && !mInstallLatestCheckbox.getSelection() && !mInstallCommonCheckbox.getSelection()) { error = "You must choose at least one Android version to install"; } } else { // Make sure that the existing installation directory exists and is valid String path = mExistingDirText.getText().trim(); if (path.length() == 0) { error = "Please enter an existing SDK installation directory"; } else { File file = new File(path); if (!file.exists()) { error = "The chosen installation directory does not exist"; } else { final AtomicReference<String> errorReference = new AtomicReference<String>(); final AtomicReference<String> warningReference = new AtomicReference<String>(); AdtPlugin.getDefault().checkSdkLocationAndId(path, new AdtPlugin.CheckSdkErrorHandler() { @Override public boolean handleError(CheckSdkErrorHandler.Solution solution, String message) { message = message.replaceAll("\n", " "); //$NON-NLS-1$ //$NON-NLS-2$ errorReference.set(message); return false; // Apply/OK must be disabled } @Override public boolean handleWarning(CheckSdkErrorHandler.Solution solution, String message) { message = message.replaceAll("\n", " "); //$NON-NLS-1$ //$NON-NLS-2$ warningReference.set(message); return true; // Apply/OK must be enabled } }); error = errorReference.get(); if (warning == null) { warning = warningReference.get(); } } } } setPageComplete(error == null); if (error != null) { setMessage(error, IMessageProvider.ERROR); } else if (warning != null) { setMessage(warning, IMessageProvider.WARNING); } else { setErrorMessage(null); setMessage(null); } }
From source file:com.android.ide.eclipse.adt.internal.wizards.newproject.ApplicationInfoPage.java
License:Open Source License
private void validatePage() { IStatus status = validatePackage(mValues.packageName); if (status == null || status.getSeverity() != IStatus.ERROR) { IStatus validActivity = validateActivity(); if (validActivity != null) { status = validActivity;/* www. j ava 2s .c o m*/ } } if (status == null || status.getSeverity() != IStatus.ERROR) { IStatus validMinSdk = validateMinSdk(); if (validMinSdk != null) { status = validMinSdk; } } if (status == null || status.getSeverity() != IStatus.ERROR) { IStatus validSourceFolder = validateSourceFolder(); if (validSourceFolder != null) { status = validSourceFolder; } } // If creating a test project to go along with the main project, also validate // the additional test project parameters if (status == null || status.getSeverity() != IStatus.ERROR) { if (mValues.createPairProject) { IStatus validTestProject = ProjectNamePage.validateProjectName(mValues.testProjectName); if (validTestProject != null) { status = validTestProject; } if (status == null || status.getSeverity() != IStatus.ERROR) { IStatus validTestLocation = validateTestProjectLocation(); if (validTestLocation != null) { status = validTestLocation; } } if (status == null || status.getSeverity() != IStatus.ERROR) { IStatus validTestPackage = validatePackage(mValues.testPackageName); if (validTestPackage != null) { status = new Status(validTestPackage.getSeverity(), AdtPlugin.PLUGIN_ID, validTestPackage.getMessage() + " (in test package)"); } } if (status == null || status.getSeverity() != IStatus.ERROR) { if (mValues.projectName.equals(mValues.testProjectName)) { status = new Status(IStatus.ERROR, AdtPlugin.PLUGIN_ID, "The main project name and the test project name must be different."); } } } } // -- 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); } }