Java Code Examples for org.eclipse.jdt.core.IOpenable#isConsistent()
The following examples show how to use
org.eclipse.jdt.core.IOpenable#isConsistent() .
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: ReorgPolicyFactory.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
@Override protected RefactoringStatus verifyDestination(IJavaElement javaElement) throws JavaModelException { Assert.isNotNull(javaElement); if (!fCheckDestination) { return new RefactoringStatus(); } if (!javaElement.exists()) { return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_doesnotexist0); } if (javaElement instanceof IJavaModel) { return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_jmodel); } if (javaElement.isReadOnly()) { return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_readonly); } if (!javaElement.isStructureKnown()) { return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_structure); } if (javaElement instanceof IOpenable) { IOpenable openable= (IOpenable) javaElement; if (!openable.isConsistent()) { return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_inconsistent); } } if (javaElement instanceof IPackageFragmentRoot) { IPackageFragmentRoot root= (IPackageFragmentRoot) javaElement; if (root.isArchive()) { return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_archive); } if (root.isExternal()) { return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_external); } } if (ReorgUtils.isInsideCompilationUnit(javaElement)) { return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_cannot); } IContainer destinationAsContainer= getDestinationAsContainer(); if (destinationAsContainer == null || isChildOfOrEqualToAnyFolder(destinationAsContainer)) { return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_not_this_resource); } if (containsLinkedResources() && !ReorgUtils.canBeDestinationForLinkedResources(javaElement)) { return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_linked); } return new RefactoringStatus(); }
Example 2
Source File: ReorgPolicyFactory.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override protected RefactoringStatus verifyDestination(IJavaElement javaElement) throws JavaModelException { Assert.isNotNull(javaElement); if (!fCheckDestination) return new RefactoringStatus(); if (!javaElement.exists()) return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_doesnotexist0); if (javaElement instanceof IJavaModel) return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_jmodel); if (javaElement.isReadOnly()) return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_readonly); if (!javaElement.isStructureKnown()) return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_structure); if (javaElement instanceof IOpenable) { IOpenable openable= (IOpenable) javaElement; if (!openable.isConsistent()) return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_inconsistent); } if (javaElement instanceof IPackageFragmentRoot) { IPackageFragmentRoot root= (IPackageFragmentRoot) javaElement; if (root.isArchive()) return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_archive); if (root.isExternal()) return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_external); } if (ReorgUtils.isInsideCompilationUnit(javaElement)) { return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_cannot); } IContainer destinationAsContainer= getDestinationAsContainer(); if (destinationAsContainer == null || isChildOfOrEqualToAnyFolder(destinationAsContainer)) return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_not_this_resource); if (containsLinkedResources() && !ReorgUtils.canBeDestinationForLinkedResources(javaElement)) return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_linked); return new RefactoringStatus(); }