Java Code Examples for org.eclipse.core.resources.IResource#getResourceAttributes()
The following examples show how to use
org.eclipse.core.resources.IResource#getResourceAttributes() .
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: RenameResourceAndCloseEditorAction.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
/** * Check if the supplied resource is read only or null. If it is then ask * the user if they want to continue. Return true if the resource is not * read only or if the user has given permission. * * @return boolean */ private boolean checkReadOnlyAndNull(IResource currentResource) { // Do a quick read only and null check if (currentResource == null) { return false; } // Do a quick read only check final ResourceAttributes attributes = currentResource .getResourceAttributes(); if (attributes != null && attributes.isReadOnly()) { return MessageDialog.openQuestion(shellProvider.getShell(), CHECK_RENAME_TITLE, MessageFormat.format(CHECK_RENAME_MESSAGE, new Object[] { currentResource.getName() })); } return true; }
Example 2
Source File: RenameResourceAndCloseEditorAction.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * Check if the supplied resource is read only or null. If it is then ask * the user if they want to continue. Return true if the resource is not * read only or if the user has given permission. * * @return boolean */ private boolean checkReadOnlyAndNull(IResource currentResource) { // Do a quick read only and null check if (currentResource == null) { return false; } // Do a quick read only check final ResourceAttributes attributes = currentResource .getResourceAttributes(); if (attributes != null && attributes.isReadOnly()) { return MessageDialog.openQuestion(shellProvider.getShell(), CHECK_RENAME_TITLE, MessageFormat.format(CHECK_RENAME_MESSAGE, new Object[] { currentResource.getName() })); } return true; }
Example 3
Source File: RenameResourceAction.java From gama with GNU General Public License v3.0 | 5 votes |
/** * Check if the supplied resource is read only or null. If it is then ask the user if they want to continue. Return * true if the resource is not read only or if the user has given permission. * * @return boolean */ private boolean checkReadOnlyAndNull(final IResource currentResource) { // Do a quick read only and null check if (currentResource == null) { return false; } // Do a quick read only check final ResourceAttributes attributes = currentResource.getResourceAttributes(); if (attributes != null && attributes.isReadOnly()) { return MessageDialog.openQuestion(WorkbenchHelper.getShell(), CHECK_RENAME_TITLE, MessageFormat.format(CHECK_RENAME_MESSAGE, new Object[] { currentResource.getName() })); } return true; }
Example 4
Source File: Resources.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
static void setReadOnly(IResource resource, boolean readOnly) { ResourceAttributes resourceAttributes = resource.getResourceAttributes(); if (resourceAttributes == null) // not supported on this platform for this resource return; resourceAttributes.setReadOnly(readOnly); try { resource.setResourceAttributes(resourceAttributes); } catch (CoreException e) { JavaPlugin.log(e); } }
Example 5
Source File: DocumentAdapter.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public boolean isReadOnly() { if (fTextFileBuffer != null) return !fTextFileBuffer.isCommitable(); IResource resource= getUnderlyingResource(); if (resource == null) return true; final ResourceAttributes attributes= resource.getResourceAttributes(); return attributes == null ? false : attributes.isReadOnly(); }
Example 6
Source File: PyChange.java From Pydev with Eclipse Public License 1.0 | 5 votes |
public static boolean isReadOnly(IResource resource) { ResourceAttributes resourceAttributes = resource.getResourceAttributes(); if (resourceAttributes == null) { return false; } return resourceAttributes.isReadOnly(); }
Example 7
Source File: Resources.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public static boolean isReadOnly(IResource resource) { ResourceAttributes resourceAttributes = resource.getResourceAttributes(); if (resourceAttributes == null) // not supported on this platform for this resource return false; return resourceAttributes.isReadOnly(); }
Example 8
Source File: AbstractFileStore.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
@Override public boolean isReadOnly() { final IResource resource = getResource(); return resource != null && resource.exists() && resource.getResourceAttributes() != null && resource.getResourceAttributes().isReadOnly(); }