Java Code Examples for org.eclipse.jdt.internal.ui.dialogs.StatusInfo#OK_STATUS
The following examples show how to use
org.eclipse.jdt.internal.ui.dialogs.StatusInfo#OK_STATUS .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ModifyDialog.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private IStatus validateProfileName() { final String name= fProfileNameField.getText().trim(); if (fProfile.isBuiltInProfile()) { if (fProfile.getName().equals(name)) { return new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, FormatterMessages.ModifyDialog_BuiltIn_Status); } } if (fProfile.isSharedProfile()) { if (fProfile.getName().equals(name)) { return new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, FormatterMessages.ModifyDialog_Shared_Status); } } if (name.length() == 0) { return new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, FormatterMessages.ModifyDialog_EmptyName_Status); } return StatusInfo.OK_STATUS; }
Example 2
Source File: UserLibraryPreferencePage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private IStatus validateSettings() { String name= fNameField.getText(); if (name.length() == 0) { return new StatusInfo(IStatus.ERROR, PreferencesMessages.UserLibraryPreferencePage_LibraryNameDialog_name_error_entername); } for (int i= 0; i < fExistingLibraries.size(); i++) { CPUserLibraryElement curr= fExistingLibraries.get(i); if (curr != fElementToEdit && name.equals(curr.getName())) { return new StatusInfo(IStatus.ERROR, Messages.format(PreferencesMessages.UserLibraryPreferencePage_LibraryNameDialog_name_error_exists, name)); } } IStatus status= ResourcesPlugin.getWorkspace().validateName(name, IResource.FILE); if (status.matches(IStatus.ERROR)) { return new StatusInfo(IStatus.ERROR, "Name contains invalid characters."); //$NON-NLS-1$ } return StatusInfo.OK_STATUS; }
Example 3
Source File: CleanUpSelectionDialog.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public void updateStatus(IStatus status) { int count= 0; for (int i= 0; i < fPages.length; i++) { count+= fPages[i].getSelectedCleanUpCount(); } if (count == 0) { super.updateStatus(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, getEmptySelectionMessage())); } else { if (status == null) { super.updateStatus(StatusInfo.OK_STATUS); } else { super.updateStatus(status); } } }
Example 4
Source File: RenameTypeWizardSimilarElementsPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private IStatus validateSettings() { final String name= fNameField.getText(); if (name.length() == 0) { return new StatusInfo(IStatus.ERROR, RefactoringMessages.RenameTypeWizardSimilarElementsPage_name_empty); } IStatus status= JavaConventionsUtil.validateIdentifier(name, fElementToEdit); if (status.matches(IStatus.ERROR)) return status; if (!Checks.startsWithLowerCase(name)) return new StatusInfo(IStatus.WARNING, RefactoringMessages.RenameTypeWizardSimilarElementsPage_name_should_start_lowercase); if (fElementToEdit instanceof IMember && ((IMember) fElementToEdit).getDeclaringType() != null) { IType type= ((IMember) fElementToEdit).getDeclaringType(); if (fElementToEdit instanceof IField) { final IField f= type.getField(name); if (f.exists()) return new StatusInfo(IStatus.ERROR, RefactoringMessages.RenameTypeWizardSimilarElementsPage_field_exists); } if (fElementToEdit instanceof IMethod) { final IMethod m= type.getMethod(name, ((IMethod) fElementToEdit).getParameterTypes()); if (m.exists()) return new StatusInfo(IStatus.ERROR, RefactoringMessages.RenameTypeWizardSimilarElementsPage_method_exists); } } // cannot check local variables; no .getLocalVariable(String) in IMember return StatusInfo.OK_STATUS; }
Example 5
Source File: ExternalizeWizardPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private IStatus validateKey(String val) { if (fSubstitution.getState() != NLSSubstitution.EXTERNALIZED) { return StatusInfo.OK_STATUS; } if (val == null || val.length() == 0) { return new StatusInfo(IStatus.ERROR, NLSUIMessages.ExternalizeWizardPage_NLSInputDialog_Error_empty_key); } if (fNLSRefactoring.isEclipseNLS()) { if (!Character.isJavaIdentifierStart(val.charAt(0))) return new StatusInfo(IStatus.ERROR, NLSUIMessages.ExternalizeWizardPage_NLSInputDialog_Error_invalid_EclipseNLS_key); for (int i= 1, length= val.length(); i < length; i++) { if (!Character.isJavaIdentifierPart(val.charAt(i))) return new StatusInfo(IStatus.ERROR, NLSUIMessages.ExternalizeWizardPage_NLSInputDialog_Error_invalid_EclipseNLS_key); } } else { // validation so keys don't contain spaces for (int i= 0; i < val.length(); i++) { if (Character.isWhitespace(val.charAt(i))) { return new StatusInfo(IStatus.ERROR, NLSUIMessages.ExternalizeWizardPage_NLSInputDialog_Error_invalid_key); } } } return StatusInfo.OK_STATUS; }
Example 6
Source File: NLSAccessorConfigurationDialog.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public NLSAccessorConfigurationDialog(Shell parent, NLSRefactoring refactoring) { super(parent); fRefactoring= refactoring; fStati= new IStatus[] { StatusInfo.OK_STATUS, StatusInfo.OK_STATUS, StatusInfo.OK_STATUS, StatusInfo.OK_STATUS, StatusInfo.OK_STATUS }; setTitle(NLSUIMessages.NLSAccessorConfigurationDialog_title); AccessorAdapter updateListener= new AccessorAdapter(); ICompilationUnit cu= refactoring.getCu(); fAccessorPackage= new SourceFirstPackageSelectionDialogField(NLSUIMessages.NLSAccessorConfigurationDialog_accessor_path, NLSUIMessages.NLSAccessorConfigurationDialog_accessor_package, NLSUIMessages.NLSAccessorConfigurationDialog_browse1, NLSUIMessages.NLSAccessorConfigurationDialog_browse2, NLSUIMessages.NLSAccessorConfigurationDialog_default_package, NLSUIMessages.NLSAccessorConfigurationDialog_accessor_dialog_title, NLSUIMessages.NLSAccessorConfigurationDialog_accessor_dialog_message, NLSUIMessages.NLSAccessorConfigurationDialog_accessor_dialog_emtpyMessage, cu, updateListener, refactoring.getAccessorClassPackage()); fAccessorClassName= createStringButtonField(NLSUIMessages.NLSAccessorConfigurationDialog_className, NLSUIMessages.NLSAccessorConfigurationDialog_browse6, updateListener); fSubstitutionPattern= createStringField(NLSUIMessages.NLSAccessorConfigurationDialog_substitutionPattern, updateListener); fResourceBundlePackage= new SourceFirstPackageSelectionDialogField(NLSUIMessages.NLSAccessorConfigurationDialog_property_path, NLSUIMessages.NLSAccessorConfigurationDialog_property_package, NLSUIMessages.NLSAccessorConfigurationDialog_browse3, NLSUIMessages.NLSAccessorConfigurationDialog_browse4, NLSUIMessages.NLSAccessorConfigurationDialog_default_package, NLSUIMessages.NLSAccessorConfigurationDialog_property_dialog_title, NLSUIMessages.NLSAccessorConfigurationDialog_property_dialog_message, NLSUIMessages.NLSAccessorConfigurationDialog_property_dialog_emptyMessage, cu, updateListener, fRefactoring.getResourceBundlePackage()); fResourceBundleFile= createStringButtonField(NLSUIMessages.NLSAccessorConfigurationDialog_property_file_name, NLSUIMessages.NLSAccessorConfigurationDialog_browse5, updateListener); initFields(); }
Example 7
Source File: ChangeExceptionsControl.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private IStatus checkException(final IType type) throws JavaModelException { ITypeHierarchy hierarchy= type.newSupertypeHierarchy(new NullProgressMonitor()); IType curr= type; while (curr != null) { String name= curr.getFullyQualifiedName(); if ("java.lang.Throwable".equals(name)) //$NON-NLS-1$ return StatusInfo.OK_STATUS; curr= hierarchy.getSuperclass(curr); } return JavaUIStatus.createError(IStatus.ERROR, RefactoringMessages.ChangeExceptionsControl_not_exception, null); }
Example 8
Source File: ConvertIterableLoopOperation.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private IStatus checkExpressionCondition() { Expression expression= getForStatement().getExpression(); if (!(expression instanceof MethodInvocation)) return SEMANTIC_CHANGE_WARNING_STATUS; MethodInvocation invoc= (MethodInvocation)expression; IMethodBinding methodBinding= invoc.resolveMethodBinding(); if (methodBinding == null) return ERROR_STATUS; ITypeBinding declaringClass= methodBinding.getDeclaringClass(); if (declaringClass == null) return ERROR_STATUS; String qualifiedName= declaringClass.getQualifiedName(); String methodName= invoc.getName().getIdentifier(); if (qualifiedName.startsWith("java.util.Enumeration")) { //$NON-NLS-1$ if (!methodName.equals("hasMoreElements")) //$NON-NLS-1$ return SEMANTIC_CHANGE_WARNING_STATUS; } else if (qualifiedName.startsWith("java.util.Iterator")) { //$NON-NLS-1$ if (!methodName.equals("hasNext")) //$NON-NLS-1$ return SEMANTIC_CHANGE_WARNING_STATUS; return checkIteratorCondition(); } else { return SEMANTIC_CHANGE_WARNING_STATUS; } return StatusInfo.OK_STATUS; }
Example 9
Source File: ConvertIterableLoopOperation.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private IStatus checkIteratorCondition() { List<Expression> initializers= getForStatement().initializers(); if (initializers.size() != 1) return SEMANTIC_CHANGE_WARNING_STATUS; Expression expression= initializers.get(0); if (!(expression instanceof VariableDeclarationExpression)) return SEMANTIC_CHANGE_WARNING_STATUS; VariableDeclarationExpression declaration= (VariableDeclarationExpression)expression; List<VariableDeclarationFragment> variableDeclarationFragments= declaration.fragments(); if (variableDeclarationFragments.size() != 1) return SEMANTIC_CHANGE_WARNING_STATUS; VariableDeclarationFragment declarationFragment= variableDeclarationFragments.get(0); Expression initializer= declarationFragment.getInitializer(); if (!(initializer instanceof MethodInvocation)) return SEMANTIC_CHANGE_WARNING_STATUS; MethodInvocation methodInvocation= (MethodInvocation)initializer; String methodName= methodInvocation.getName().getIdentifier(); if (!"iterator".equals(methodName) || methodInvocation.arguments().size() != 0) //$NON-NLS-1$ return SEMANTIC_CHANGE_WARNING_STATUS; return StatusInfo.OK_STATUS; }
Example 10
Source File: NLSAccessorConfigurationDialog.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private void setValid(int idx) { fStati[idx]= StatusInfo.OK_STATUS; }