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:com.android.ide.eclipse.adt.internal.wizards.newproject.ImportPage.java
License:Open Source License
private void validatePage() { IStatus status = null;// w ww. ja v a 2s . 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; } else { status = ProjectNamePage.validateProjectName(project.getProjectName()); if (status != null && !status.isOK()) { // Need to insert project name to make it clear which project name // is in violation if (mValues.importProjects.size() > 1) { String message = String.format("%1$s: %2$s", project.getProjectName(), status.getMessage()); status = new Status(status.getSeverity(), AdtPlugin.PLUGIN_ID, message); } break; } else { status = null; // Don't leave non null status with isOK() == true } } } } // -- 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.adt.internal.wizards.newproject.ProjectNamePage.java
License:Open Source License
private void validatePage() { IStatus status = null;//from w ww . j a v a 2 s . c om // 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 (mValues.mode != Mode.SAMPLE) { status = validateProjectName(mValues.projectName); } if (status == null || status.getSeverity() != IStatus.ERROR) { IStatus validLocation = validateLocation(); if (validLocation != null) { status = validLocation; } } if (!mCheckedSdkUptodate) { // Ensure that we have a recent enough version of the Tools that the right templates // are available File file = new File(AdtPlugin.getOsSdkFolder(), OS_SDK_TOOLS_LIB_FOLDER + File.separator + FN_PROJECT_PROGUARD_FILE); if (!file.exists()) { status = new Status(IStatus.ERROR, AdtPlugin.PLUGIN_ID, String.format("You do not have the latest version of the " + "SDK Tools installed: Please update. (Missing %1$s)", file.getPath())); } else { mCheckedSdkUptodate = true; } } // -- 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.adt.internal.wizards.newproject.SampleSelectionPage.java
License:Open Source License
private void validatePage() { IStatus status = null;/*from w w w . j a va 2 s . c o m*/ if (mValues.samples == null || mValues.samples.size() == 0) { status = new Status(IStatus.ERROR, AdtPlugin.PLUGIN_ID, "The chosen SDK does not contain any samples"); } else if (mValues.chosenSample == null) { status = new Status(IStatus.ERROR, AdtPlugin.PLUGIN_ID, "Choose a sample"); } else if (!mValues.chosenSample.exists()) { status = new Status(IStatus.ERROR, AdtPlugin.PLUGIN_ID, String.format("Sample does not exist: %1$s", mValues.chosenSample.getPath())); } else { status = ProjectNamePage.validateProjectName(mValues.projectName); } // -- 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.adt.internal.wizards.newproject.SdkSelectionPage.java
License:Open Source License
private void validatePage() { String error = null;//from w w w . j ava 2s. c om if (AdtPlugin.getDefault().getSdkLoadStatus() == LoadStatus.LOADING) { error = "The SDK is still loading; please wait."; } if (error == null && mValues.target == null) { error = "An SDK Target must be specified."; } if (error == null && mValues.mode == Mode.SAMPLE) { // Make sure this SDK target contains samples if (mValues.samples == null || mValues.samples.size() == 0) { error = "This target has no samples. Please select another target."; } } // -- update UI & enable finish if there's no error setPageComplete(error == null); if (error != null) { setMessage(error, IMessageProvider.ERROR); } else { setErrorMessage(null); setMessage(null); } }
From source file:com.android.ide.eclipse.adt.internal.wizards.newproject.TestTargetPage.java
License:Open Source License
private void validatePage() { String error = null;//from www . j a v a 2 s . com if (!mValues.testingSelf) { if (mValues.testedProject == null) { error = "Please select an existing Android project as a test target."; } else if (mValues.projectName.equals(mValues.testedProject.getName())) { error = "The main project name and the test project name must be different."; } } // -- update UI & enable finish if there's no error setPageComplete(error == null); if (error != null) { setMessage(error, IMessageProvider.ERROR); } else { setErrorMessage(null); setMessage(null); } }
From source file:com.android.ide.eclipse.adt.internal.wizards.newxmlfile.ChooseConfigurationPage.java
License:Open Source License
/** * Validates the fields, displays errors and warnings. * Enables the finish button if there are no errors. *//*from w w w . j a v a 2s .c om*/ private void validatePage() { String error = null; String warning = null; // -- validate folder configuration if (error == null) { ConfigurationState state = mConfigSelector.getState(); if (state == ConfigurationState.INVALID_CONFIG) { ResourceQualifier qual = mConfigSelector.getInvalidQualifier(); if (qual != null) { error = String.format("The qualifier '%1$s' is invalid in the folder configuration.", qual.getName()); } } else if (state == ConfigurationState.REGION_WITHOUT_LANGUAGE) { error = "The Region qualifier requires the Language qualifier."; } } // -- validate generated path if (error == null) { String wsFolderPath = getWsFolderPath(); if (!wsFolderPath.startsWith(RES_FOLDER_ABS)) { error = String.format("Target folder must start with %1$s.", RES_FOLDER_ABS); } } // -- validate destination file doesn't exist if (error == null) { IFile file = mValues.getDestinationFile(); if (file != null && file.exists()) { warning = "The destination file already exists"; } } // -- update UI & enable finish if there's no error 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.newxmlfile.NewXmlFileCreationPage.java
License:Open Source License
/** * Validates the fields, displays errors and warnings. * Enables the finish button if there are no errors. *//*from w w w. j av a 2 s .c o m*/ private void validatePage() { String error = null; String warning = null; // -- validate type TypeInfo type = mValues.type; if (error == null) { if (type == null) { error = "One of the types must be selected (e.g. layout, values, etc.)"; } } // -- validate project if (mValues.project == null) { error = "Please select an Android project."; } // -- validate type API level if (error == null) { IAndroidTarget target = Sdk.getCurrent().getTarget(mValues.project); int currentApiLevel = 1; if (target != null) { currentApiLevel = target.getVersion().getApiLevel(); } assert type != null; if (type.getTargetApiLevel() > currentApiLevel) { error = "The API level of the selected type (e.g. AppWidget, etc.) is not " + "compatible with the API level of the project."; } } // -- validate filename if (error == null) { String fileName = mValues.getFileName(); assert type != null; ResourceFolderType folderType = type.getResFolderType(); error = ResourceNameValidator.create(true, folderType).isValid(fileName); } // -- validate destination file doesn't exist if (error == null) { IFile file = mValues.getDestinationFile(); if (file != null && file.exists()) { warning = "The destination file already exists"; } } // -- update UI & enable finish if there's no error 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.templates.ActivityPage.java
License:Open Source License
private void validatePage() { IStatus status = null;/* ww w . j a v a2 s.c o m*/ 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, mValues.getBuildApi()); } } 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.adt.internal.wizards.templates.InstallDependencyPage.java
License:Open Source License
private void validatePage() { if (mTemplate == null) { return;//www . j av a2 s.c o m } 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, AdtPlugin.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:com.android.ide.eclipse.adt.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); *//* ww w . ja va 2 s .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, 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"); } if (status == null || status.getSeverity() != IStatus.ERROR) { if (mValues.targetSdkLevel < mValues.minSdkLevel) { status = new Status(IStatus.ERROR, AdtPlugin.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); } }