Java Code Examples for org.eclipse.jdt.core.ICompilationUnit#isReadOnly()
The following examples show how to use
org.eclipse.jdt.core.ICompilationUnit#isReadOnly() .
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: RefactoringAvailabilityTester.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public static boolean isInferTypeArgumentsAvailable(final IStructuredSelection selection) throws JavaModelException { if (selection.isEmpty()) return false; for (Iterator<?> iter= selection.iterator(); iter.hasNext();) { Object element= iter.next(); if (!(element instanceof IJavaElement)) return false; if (element instanceof ICompilationUnit) { ICompilationUnit unit= (ICompilationUnit) element; if (!unit.exists() || unit.isReadOnly()) return false; return true; } if (!isInferTypeArgumentsAvailable((IJavaElement) element)) return false; } return true; }
Example 2
Source File: RefactoringAvailabilityTester.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
public static boolean isRenameAvailable(final ICompilationUnit unit) { if (unit == null) { return false; } if (!unit.exists()) { return false; } if (!JavaModelUtil.isPrimary(unit)) { return false; } if (unit.isReadOnly()) { return false; } return true; }
Example 3
Source File: RefactoringAvailabilityTester.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public static boolean isExtractInterfaceAvailable(final IStructuredSelection selection) throws JavaModelException { if (selection.size() == 1) { Object first= selection.getFirstElement(); if (first instanceof IType) { return isExtractInterfaceAvailable((IType) first); } else if (first instanceof ICompilationUnit) { ICompilationUnit unit= (ICompilationUnit) first; if (!unit.exists() || unit.isReadOnly()) return false; return true; } } return false; }
Example 4
Source File: RefactoringAvailabilityTester.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public static boolean isRenameAvailable(final ICompilationUnit unit) { if (unit == null) return false; if (!unit.exists()) return false; if (!JavaModelUtil.isPrimary(unit)) return false; if (unit.isReadOnly()) return false; return true; }
Example 5
Source File: RefactoringAvailabilityTester.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public static boolean isUseSuperTypeAvailable(final IStructuredSelection selection) throws JavaModelException { if (selection.size() == 1) { final Object first= selection.getFirstElement(); if (first instanceof IType) { return isUseSuperTypeAvailable((IType) first); } else if (first instanceof ICompilationUnit) { ICompilationUnit unit= (ICompilationUnit) first; if (!unit.exists() || unit.isReadOnly()) return false; return true; } } return false; }