private void initializeResource(IResource resource) { fKind= RESOURCE; fDirty= false; fReadOnly= Resources.isReadOnly(resource); fModificationStamp= resource.getModificationStamp(); } }
private boolean isReadOnly() { return Resources.isReadOnly(fProject.getResource()); }
private boolean isReadOnly() { return Resources.isReadOnly(fProject.getResource()); }
private boolean isReadOnly() { return Resources.isReadOnly(fProject.getResource()); }
@Override protected int determineOperation(Object target, int operation, TransferData transferType, int operations) { boolean isPackageFragment= target instanceof IPackageFragment; boolean isJavaProject= target instanceof IJavaProject; boolean isPackageFragmentRoot= target instanceof IPackageFragmentRoot; boolean isContainer= target instanceof IContainer; if (!(isPackageFragment || isJavaProject || isPackageFragmentRoot || isContainer)) return DND.DROP_NONE; if (isContainer) { IContainer container= (IContainer)target; if (container.isAccessible() && !Resources.isReadOnly(container)) return DND.DROP_COPY; } else { IJavaElement element= (IJavaElement)target; if (!element.isReadOnly()) return DND.DROP_COPY; } return DND.DROP_NONE; }
public void validateDrop(Object target, DropTargetEvent event, int operation) { event.detail= DND.DROP_NONE; boolean isPackageFragment= target instanceof IPackageFragment; boolean isJavaProject= target instanceof IJavaProject; boolean isPackageFragmentRoot= target instanceof IPackageFragmentRoot; boolean isContainer= target instanceof IContainer; if (!(isPackageFragment || isJavaProject || isPackageFragmentRoot || isContainer)) return; if (isContainer) { IContainer container= (IContainer)target; if (container.isAccessible() && !Resources.isReadOnly(container)) event.detail= DND.DROP_COPY; } else { IJavaElement element= (IJavaElement)target; if (!element.isReadOnly()) event.detail= DND.DROP_COPY; } return; }
@Override protected int determineOperation(Object target, int operation, TransferData transferType, int operations) { boolean isPackageFragment= target instanceof IPackageFragment; boolean isJavaProject= target instanceof IJavaProject; boolean isPackageFragmentRoot= target instanceof IPackageFragmentRoot; boolean isContainer= target instanceof IContainer; if (!(isPackageFragment || isJavaProject || isPackageFragmentRoot || isContainer)) return DND.DROP_NONE; if (isContainer) { IContainer container= (IContainer)target; if (container.isAccessible() && !Resources.isReadOnly(container)) return DND.DROP_COPY; } else { IJavaElement element= (IJavaElement)target; if (!element.isReadOnly()) return DND.DROP_COPY; } return DND.DROP_NONE; }
for (int i= 0; i < resources.length; i++) { IResource resource= resources[i]; if (resource.getType() == IResource.FILE && isReadOnly(resource)) readOnlyFiles.add(resource);
for (int i= 0; i < resources.length; i++) { IResource resource= resources[i]; if (resource.getType() == IResource.FILE && isReadOnly(resource)) readOnlyFiles.add(resource);
private static boolean hasReadOnlyResourcesAndSubResources(IResource resource) throws CoreException { if (resource.isLinked()) //we don't want to count these because we never actually delete linked resources return false; if (Resources.isReadOnly(resource)) return true; if (resource instanceof IContainer) return hasReadOnlyResourcesAndSubResources(((IContainer)resource).members()); return false; } }
private static boolean hasReadOnlyResourcesAndSubResources(IResource resource) throws CoreException { if (resource.isLinked()) //we don't want to count these because we never actually delete linked resources return false; if (Resources.isReadOnly(resource)) return true; if (resource instanceof IContainer) return hasReadOnlyResourcesAndSubResources(((IContainer)resource).members()); return false; } }
private static boolean hasReadOnlyResourcesAndSubResources(IResource resource) throws CoreException { if (resource.isLinked()) //we don't want to count these because we never actually delete linked resources return false; if (Resources.isReadOnly(resource)) return true; if (resource instanceof IContainer) return hasReadOnlyResourcesAndSubResources(((IContainer)resource).members()); return false; } }
public void initializeValidationData(IProgressMonitor pm) { IResource resource= getResource(getModifiedElement()); if (resource != null) { fModificationStamp= getModificationStamp(resource); fReadOnly= Resources.isReadOnly(resource); } }
for (int i= 0; i < resources.length; i++) { IResource resource= resources[i]; if (resource.getType() == IResource.FILE && isReadOnly(resource)) readOnlyFiles.add(resource);
private void initializeFile(IFile file) { fTextFileBuffer= getBuffer(file); if (fTextFileBuffer == null) { initializeResource(file); } else { IDocument document= fTextFileBuffer.getDocument(); fDirty= fTextFileBuffer.isDirty(); fReadOnly= Resources.isReadOnly(file); if (document instanceof IDocumentExtension4) { fKind= DOCUMENT; fModificationStamp= ((IDocumentExtension4)document).getModificationStamp(); } else { fKind= RESOURCE; fModificationStamp= file.getModificationStamp(); } } } private void initializeResource(IResource resource) {
return (resource != null && Resources.isReadOnly(resource)); case IJavaElement.PACKAGE_FRAGMENT: IResource packResource= ReorgUtils.getResource(javaElement); return false; IPackageFragment pack= (IPackageFragment)javaElement; if (Resources.isReadOnly(packResource)) return true; Object[] nonJava= pack.getNonJavaResources(); if (pfrResource == null) return false; if (Resources.isReadOnly(pfrResource)) return true; Object[] nonJava1= root.getNonJavaResources();
return (Resources.isReadOnly(resource)); case IJavaElement.PACKAGE_FRAGMENT: IResource packResource= ReorgUtils.getResource(javaElement); return false; IPackageFragment pack= (IPackageFragment)javaElement; if (Resources.isReadOnly(packResource)) return true; Object[] nonJava= pack.getNonJavaResources(); if (pfrResource == null) return false; if (Resources.isReadOnly(pfrResource)) return true; Object[] nonJava1= root.getNonJavaResources();
String message= Messages.format(RefactoringCoreMessages.RenamePackageRefactoring_Packagered_only, fPackage.getElementName()); result.addFatalError(message); } else if (Resources.isReadOnly(fPackage.getResource())) { String message= Messages.format(RefactoringCoreMessages.RenamePackageRefactoring_resource_read_only, fPackage.getElementName()); result.addError(message);
String message= Messages.format(RefactoringCoreMessages.RenamePackageRefactoring_Packagered_only, getElementLabel(fPackage)); result.addFatalError(message); } else if (Resources.isReadOnly(fPackage.getResource())) { String message= Messages.format(RefactoringCoreMessages.RenamePackageRefactoring_resource_read_only, getElementLabel(fPackage)); result.addError(message);
String message= Messages.format(RefactoringCoreMessages.RenamePackageRefactoring_Packagered_only, getElementLabel(fPackage)); result.addFatalError(message); } else if (Resources.isReadOnly(fPackage.getResource())) { String message= Messages.format(RefactoringCoreMessages.RenamePackageRefactoring_resource_read_only, getElementLabel(fPackage)); result.addError(message);