Java Code Examples for org.eclipse.jdt.core.IPackageFragmentRoot#isReadOnly()

The following examples show how to use org.eclipse.jdt.core.IPackageFragmentRoot#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: ReorgPolicyFactory.java    From eclipse.jdt.ls with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public boolean canEnable() throws JavaModelException {
	if (!super.canEnable()) {
		return false;
	}
	IPackageFragmentRoot[] roots= getPackageFragmentRoots();
	for (int i= 0; i < roots.length; i++) {
		IPackageFragmentRoot root= roots[i];
		if (root.isReadOnly() && !root.isArchive() && !root.isExternal()) {
			final ResourceAttributes attributes= roots[i].getResource().getResourceAttributes();
			if (attributes == null || attributes.isReadOnly()) {
				return false;
			}
		}
	}
	return roots.length > 0;
}
 
Example 2
Source File: ReorgPolicyFactory.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public boolean canEnable() throws JavaModelException {
	if (!super.canEnable())
		return false;
	IPackageFragmentRoot[] roots= getPackageFragmentRoots();
	for (int i= 0; i < roots.length; i++) {
		IPackageFragmentRoot root= roots[i];
		if (root.isReadOnly() && !root.isArchive() && !root.isExternal()) {
			final ResourceAttributes attributes= roots[i].getResource().getResourceAttributes();
			if (attributes == null || attributes.isReadOnly())
				return false;
		}
	}
	return roots.length > 0;
}
 
Example 3
Source File: PasteAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private boolean isWritable(IPackageFragmentRoot packageFragmentRoot) {
	try {
		return packageFragmentRoot.exists() && ! packageFragmentRoot.isArchive() && ! packageFragmentRoot.isReadOnly()
				&& packageFragmentRoot.getKind() == IPackageFragmentRoot.K_SOURCE;
	} catch (JavaModelException e) {
		return false;
	}
}
 
Example 4
Source File: PackageBrowseAdapter.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
static boolean canAddPackageRoot(IPackageFragmentRoot root) throws JavaModelException{
	if (! root.exists())
		return false;
	if (root.isArchive())
		return false;
	if (root.isExternal())
		return false;
	if (root.isReadOnly())
		return false;
	if (! root.isStructureKnown())
		return false;
	return true;
}