Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 149890 Details for
Bug 290318
need a means to represent dead symbolic links in resource tree
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch_v01
290318.txt (text/plain), 25.42 KB, created by
Pawel Pogorzelski
on 2009-10-19 12:00:36 EDT
(
hide
)
Description:
Patch_v01
Filename:
MIME Type:
Creator:
Pawel Pogorzelski
Created:
2009-10-19 12:00:36 EDT
Size:
25.42 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.core.tests.resources >Index: src/org/eclipse/core/tests/filesystem/SymlinkTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/filesystem/SymlinkTest.java,v >retrieving revision 1.9 >diff -u -r1.9 SymlinkTest.java >--- src/org/eclipse/core/tests/filesystem/SymlinkTest.java 21 Aug 2008 08:54:27 -0000 1.9 >+++ src/org/eclipse/core/tests/filesystem/SymlinkTest.java 19 Oct 2009 15:30:46 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others. >+ * Copyright (c) 2007, 2009 Wind River Systems, Inc. and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -14,7 +14,7 @@ > *******************************************************************************/ > package org.eclipse.core.tests.filesystem; > >-import java.io.*; >+import java.io.OutputStream; > import org.eclipse.core.filesystem.*; > import org.eclipse.core.resources.IWorkspace; > import org.eclipse.core.resources.ResourcesPlugin; >@@ -115,13 +115,13 @@ > ensureDoesNotExist(aFile); > fetchFileInfos(); > >- assertFalse(ilFile.exists()); >+ assertTrue(ilFile.exists()); > assertFalse(ilFile.isDirectory()); >- assertFalse(illFile.exists()); >+ assertTrue(illFile.exists()); > assertFalse(illFile.isDirectory()); >- assertFalse(ilDir.exists()); >+ assertTrue(ilDir.exists()); > assertFalse(ilDir.isDirectory()); >- assertFalse(illDir.exists()); >+ assertTrue(illDir.exists()); > assertFalse(illDir.isDirectory()); > assertEquals(ilFile.getLastModified(), 0); > assertEquals(ilFile.getLength(), 0); >@@ -133,12 +133,16 @@ > assertEquals(illDir.getLength(), 0); > if (haveSymlinks()) { > assertTrue(ilFile.getAttribute(EFS.ATTRIBUTE_SYMLINK)); >+ assertFalse(ilFile.getAttribute(EFS.ATTRIBUTE_ACCESSIBLE)); > assertEquals(ilFile.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "aFile"); > assertTrue(ilDir.getAttribute(EFS.ATTRIBUTE_SYMLINK)); >+ assertFalse(ilDir.getAttribute(EFS.ATTRIBUTE_ACCESSIBLE)); > assertEquals(ilDir.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "aDir"); > assertTrue(illFile.getAttribute(EFS.ATTRIBUTE_SYMLINK)); >+ assertFalse(illFile.getAttribute(EFS.ATTRIBUTE_ACCESSIBLE)); > assertEquals(illFile.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "lFile"); > assertTrue(illDir.getAttribute(EFS.ATTRIBUTE_SYMLINK)); >+ assertFalse(illDir.getAttribute(EFS.ATTRIBUTE_ACCESSIBLE)); > assertEquals(illDir.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "lDir"); > } > } >@@ -170,7 +174,7 @@ > mkLink(baseStore, "l2", "l1", false); > IFileStore l1 = baseStore.getChild("l1"); > IFileInfo i1 = l1.fetchInfo(); >- assertFalse(i1.exists()); >+ assertTrue(i1.exists()); > assertFalse(i1.isDirectory()); > if (haveSymlinks()) { > assertTrue(i1.getAttribute(EFS.ATTRIBUTE_SYMLINK)); >@@ -192,7 +196,7 @@ > assertTrue(exceptionThrown); > assertTrue(i1.getAttribute(EFS.ATTRIBUTE_READ_ONLY)); > } >- assertFalse(i1.exists()); >+ assertTrue(i1.exists()); > > i1.setLastModified(12345); > exceptionThrown = false; >@@ -205,7 +209,7 @@ > //FIXME bug: putInfo neither sets attributes nor throws an exception for broken symbolic links > //assertTrue(exceptionThrown); > //assertEquals(i1.getLastModified(), 12345); >- assertFalse(i1.exists()); >+ assertTrue(i1.exists()); > > l1.delete(EFS.NONE, getMonitor()); > infos = baseStore.childInfos(EFS.NONE, getMonitor()); >#P org.eclipse.core.filesystem >Index: natives/localfile.h >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.filesystem/natives/localfile.h,v >retrieving revision 1.5 >diff -u -r1.5 localfile.h >--- natives/localfile.h 10 May 2007 13:53:51 -0000 1.5 >+++ natives/localfile.h 19 Oct 2009 15:30:47 -0000 >@@ -1,5 +1,5 @@ > /* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -35,6 +35,8 @@ > #define ATTRIBUTE_SYMLINK 0x20l > #undef ATTRIBUTE_LINK_TARGET > #define ATTRIBUTE_LINK_TARGET 0x40l >+#undef ATTRIBUTE_ACCESSIBLE >+#define ATTRIBUTE_ACCESSIBLE 0x80l > #undef SET_ATTRIBUTES > #define SET_ATTRIBUTES 0x01l > #undef SET_LAST_MODIFIED >Index: src/org/eclipse/core/filesystem/EFS.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/EFS.java,v >retrieving revision 1.16 >diff -u -r1.16 EFS.java >--- src/org/eclipse/core/filesystem/EFS.java 7 Apr 2008 08:55:40 -0000 1.16 >+++ src/org/eclipse/core/filesystem/EFS.java 19 Oct 2009 15:30:47 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2008 IBM Corporation and others. >+ * Copyright (c) 2005, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -170,9 +170,11 @@ > * <p> > * Broken symbolic links (which do not reference any valid file or directory) > * are being returned by {@link IFileStore#childInfos(int, IProgressMonitor)}, >- * but {@link IFileInfo#exists()} returns <code>false</code> for these. >- * Operations like reading or writing on broken symbolic links throw >- * a "file not found" exception. >+ * and {@link IFileInfo#exists()} returns <code>true</code> for these. The fact >+ * whether link is broken can be checked by calling {@link IFileInfo#getAttribute(int)} >+ * with {@link #ATTRIBUTE_ACCESSIBLE} which returns <code>false</code> in such >+ * cases. Operations like reading or writing on broken symbolic links throw >+ * a "file not found" exception. > * </p> > * > * @see IFileStore#fetchInfo() >@@ -202,6 +204,22 @@ > public static final int ATTRIBUTE_LINK_TARGET = 1 << 6; > > /** >+ * Attribute constant (value 1 <<7) indicating file accessibility. >+ * This attribute is set to <code>false</code> by file system implementation in >+ * case the file is present but its content cannot be reached. >+ * <p> >+ * Note that setting the accessible attribute does not cause a file to be >+ * marked as inaccessible. Rather, this attribute is set by file system >+ * implementations based on the current state of a file. >+ * </p> >+ * >+ * @see IFileInfo#getAttribute(int) >+ * @see FileInfo#setAttribute(int, boolean) >+ * @since org.eclipse.core.filesystem 1.3 >+ */ >+ public static final int ATTRIBUTE_ACCESSIBLE = 1 << 7; >+ >+ /** > * Scheme constant (value "file") indicating the local file system scheme. > * @see EFS#getLocalFileSystem() > */ >Index: natives/unix/localfile.c >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.filesystem/natives/unix/localfile.c,v >retrieving revision 1.9 >diff -u -r1.9 localfile.c >--- natives/unix/localfile.c 10 May 2007 13:53:51 -0000 1.9 >+++ natives/unix/localfile.c 19 Oct 2009 15:30:47 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -68,7 +68,7 @@ > JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_filesystem_local_LocalFileNatives_nativeAttributes > (JNIEnv *env, jclass clazz) { > #if defined(EFS_SYMLINK_SUPPORT) >- return ATTRIBUTE_READ_ONLY | ATTRIBUTE_EXECUTABLE | ATTRIBUTE_SYMLINK | ATTRIBUTE_LINK_TARGET; >+ return ATTRIBUTE_READ_ONLY | ATTRIBUTE_EXECUTABLE | ATTRIBUTE_SYMLINK | ATTRIBUTE_LINK_TARGET | ATTRIBUTE_ACCESSIBLE; > #else > return ATTRIBUTE_READ_ONLY | ATTRIBUTE_EXECUTABLE; > #endif >@@ -101,7 +101,12 @@ > mid = (*env)->GetMethodID(env, cls, "setExists", "(Z)V"); > if (mid == 0) return JNI_FALSE; > (*env)->CallVoidMethod(env, fileInfo, mid, JNI_TRUE); >- >+ >+ // set accessible attribute >+ mid = (*env)->GetMethodID(env, cls, "setAttribute", "(IZ)V"); >+ if (mid == 0) return JNI_FALSE; >+ (*env)->CallVoidMethod(env, fileInfo, mid, ATTRIBUTE_ACCESSIBLE, JNI_TRUE); >+ > // last modified > mid = (*env)->GetMethodID(env, cls, "setLastModified", "(J)V"); > if (mid == 0) return JNI_FALSE; >@@ -156,6 +161,31 @@ > mid = (*env)->GetMethodID(env, cls, "setStringAttribute", "(ILjava/lang/String;)V"); > if (mid == 0) return JNI_FALSE; > (*env)->CallVoidMethod(env, fileInfo, mid, ATTRIBUTE_LINK_TARGET, linkTarget); >+ >+ return JNI_TRUE; >+} >+ >+/* >+ * Set exists and non accessible in IFileInfo >+ */ >+jboolean setExistsNonAccessibleInFileInfo (JNIEnv *env, jobject fileInfo) { >+ jclass cls; >+ jmethodID mid; >+ >+ cls = (*env)->GetObjectClass(env, fileInfo); >+ if (cls == 0) return JNI_FALSE; >+ >+ // exists >+ mid = (*env)->GetMethodID(env, cls, "setExists", "(Z)V"); >+ if (mid == 0) return JNI_FALSE; >+ (*env)->CallVoidMethod(env, fileInfo, mid, JNI_TRUE); >+ >+ // set accessible attribute to false >+ mid = (*env)->GetMethodID(env, cls, "setAttribute", "(IZ)V"); >+ if (mid == 0) return JNI_FALSE; >+ (*env)->CallVoidMethod(env, fileInfo, mid, ATTRIBUTE_ACCESSIBLE, JNI_FALSE); >+ >+ return JNI_TRUE; > } > #endif > >@@ -175,10 +205,10 @@ > /* get stat */ > name = getByteArray(env, target); > #if defined(EFS_SYMLINK_SUPPORT) >- //do an lstat first to see if it is a symbolic link >+ // do an lstat first to see if it is a symbolic link > code = lstat((const char*)name, &info); > if (code == 0 && (info.st_mode & S_IFLNK) == S_IFLNK) { >- //symbolic link: read link target >+ // symbolic link: read link target > char buf[PATH_MAX+1]; > int len; > jbyteArray barr; >@@ -192,15 +222,20 @@ > linkTarget = getString(env, barr); > setSymlinkInFileInfo(env, fileInfo, linkTarget); > >- //stat link target (will fail for broken links) >+ // stat link target > code = stat((const char*)name, &info); >+ >+ // link is broken >+ if (code == -1) { >+ return setExistsNonAccessibleInFileInfo(env, fileInfo); >+ } > } > #else > code = stat((const char*)name, &info); > #endif > free(name); > >- /* test if an error occurred */ >+ // test if an error occurred > if (code == -1) > return 0; > return convertStatToFileInfo(env, info, fileInfo); >Index: src/org/eclipse/core/internal/filesystem/local/LocalFileSystem.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFileSystem.java,v >retrieving revision 1.18 >diff -u -r1.18 LocalFileSystem.java >--- src/org/eclipse/core/internal/filesystem/local/LocalFileSystem.java 27 Jun 2007 18:17:56 -0000 1.18 >+++ src/org/eclipse/core/internal/filesystem/local/LocalFileSystem.java 19 Oct 2009 15:30:47 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2007 IBM Corporation and others. >+ * Copyright (c) 2005, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -97,11 +97,11 @@ > String os = getOS(); > String arch = System.getProperty("osgi.arch", ""); //$NON-NLS-1$ //$NON-NLS-2$ > if (os.equals(Constants.OS_WIN32)) >- attributes |= EFS.ATTRIBUTE_ARCHIVE | EFS.ATTRIBUTE_HIDDEN; >+ attributes |= EFS.ATTRIBUTE_ARCHIVE | EFS.ATTRIBUTE_HIDDEN | EFS.ATTRIBUTE_ACCESSIBLE; > else if (os.equals(Constants.OS_LINUX) || (os.equals(Constants.OS_SOLARIS) && arch.equals(Constants.ARCH_SPARC))) >- attributes |= EFS.ATTRIBUTE_EXECUTABLE | EFS.ATTRIBUTE_SYMLINK | EFS.ATTRIBUTE_LINK_TARGET; >+ attributes |= EFS.ATTRIBUTE_EXECUTABLE | EFS.ATTRIBUTE_SYMLINK | EFS.ATTRIBUTE_LINK_TARGET | EFS.ATTRIBUTE_ACCESSIBLE; > else if (os.equals(Constants.OS_MACOSX) || os.equals(Constants.OS_HPUX) || os.equals(Constants.OS_QNX)) >- attributes |= EFS.ATTRIBUTE_EXECUTABLE; >+ attributes |= EFS.ATTRIBUTE_EXECUTABLE | EFS.ATTRIBUTE_ACCESSIBLE; > return attributes; > } > >Index: src/org/eclipse/core/filesystem/provider/FileInfo.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/provider/FileInfo.java,v >retrieving revision 1.12 >diff -u -r1.12 FileInfo.java >--- src/org/eclipse/core/filesystem/provider/FileInfo.java 7 Apr 2008 08:55:39 -0000 1.12 >+++ src/org/eclipse/core/filesystem/provider/FileInfo.java 19 Oct 2009 15:30:47 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2008 IBM Corporation and others. >+ * Copyright (c) 2005, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -35,7 +35,7 @@ > /** > * Bit field of file attributes > */ >- private int attributes = 0; >+ private int attributes = EFS.ATTRIBUTE_ACCESSIBLE; > > /** > * The last modified time. >Index: natives/unix/linux/Makefile_new >=================================================================== >RCS file: natives/unix/linux/Makefile_new >diff -N natives/unix/linux/Makefile_new >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ natives/unix/linux/Makefile_new 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,32 @@ >+#********************************************************************** >+# Copyright (c) 2000, 2004 IBM Corporation and others. >+# All rights reserved. This program and the accompanying materials >+# are made available under the terms of the Eclipse Public License v1.0 >+# which accompanies this distribution, and is available at >+# http://www.eclipse.org/legal/epl-v10.html >+#********************************************************************** >+# >+# makefile for libcore.so >+ >+CORE.C = ../localfile.c >+CORE.O = localfile.o >+LIB_NAME = liblocalfile.so >+LIB_NAME_FULL = liblocalfile_1_0_0.so >+ >+#Set this to be your OS type >+OS_TYPE = linux >+ >+#Set this to be the location of your JRE >+JAVA_HOME = /home/tzarna/java_install/j2sdk1.4.2_17 >+ >+JDK_INCLUDE = -I ${JAVA_HOME}/include -I ${JAVA_HOME}/include/${OS_TYPE} >+COMMON_INCLUDE = -I include >+#OPT_FLAGS=-g >+OPT_FLAGS=-O -s -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 >+ >+core : >+ gcc $(OPT_FLAGS) -fPIC -c $(JDK_INCLUDE) $(COMMON_INCLUDE) -o $(CORE.O) $(CORE.C) >+ gcc $(OPT_FLAGS) -shared -Wl,-soname,$(LIB_NAME) -o $(LIB_NAME_FULL) $(CORE.O) -lc >+ >+clean : >+ rm *.o *.so >#P org.eclipse.core.resources >Index: src/org/eclipse/core/resources/IResource.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.resources/src/org/eclipse/core/resources/IResource.java,v >retrieving revision 1.106 >diff -u -r1.106 IResource.java >--- src/org/eclipse/core/resources/IResource.java 9 Oct 2009 16:36:35 -0000 1.106 >+++ src/org/eclipse/core/resources/IResource.java 19 Oct 2009 15:30:49 -0000 >@@ -1595,9 +1595,9 @@ > > /** > * Returns whether this resource is accessible. For files and folders, >- * this is equivalent to existing; for projects, >- * this is equivalent to existing and being open. The workspace root >- * is always accessible. >+ * this is equivalent to existing and having reachable content; for projects, >+ * this is equivalent to existing, being open and having reachable content. >+ * The workspace root is always accessible. > * > * @return <code>true</code> if this resource is accessible, and > * <code>false</code> otherwise >Index: src/org/eclipse/core/resources/ResourceAttributes.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.resources/src/org/eclipse/core/resources/ResourceAttributes.java,v >retrieving revision 1.13 >diff -u -r1.13 ResourceAttributes.java >--- src/org/eclipse/core/resources/ResourceAttributes.java 7 Apr 2008 08:55:44 -0000 1.13 >+++ src/org/eclipse/core/resources/ResourceAttributes.java 19 Oct 2009 15:30:49 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2004, 2008 Red Hat Incorporated and others >+ * Copyright (c) 2004, 2009 Red Hat Incorporated and others > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -103,7 +103,7 @@ > } > > /** >- * Returns whether this ResourceAttributes object is marked read only. >+ * Returns whether this ResourceAttributes object is marked as symbolic link. > * > * @return <code>true</code> if this resource is marked as symbolic link, > * <code>false</code> otherwise >@@ -115,6 +115,18 @@ > } > > /** >+ * Returns whether this ResourceAttributes object is marked as accessible. >+ * >+ * @return <code>true</code> if this resource is marked as accessible, >+ * <code>false</code> otherwise >+ * @see #setAccessible(boolean) >+ * @since 3.6 >+ */ >+ public boolean isAccessible() { >+ return (attributes & EFS.ATTRIBUTE_ACCESSIBLE) != 0; >+ } >+ >+ /** > * Sets or unsets whether this ResourceAttributes object is marked archive. > * > * @param archive <code>true</code> to set it to be archive, >@@ -182,6 +194,18 @@ > } > > /** >+ * Sets or unsets whether this ResourceAttributes object is marked as accessible. >+ * >+ * @param accessible <code>true</code> to set it to be marked as accessible, >+ * <code>false</code> to unset >+ * @see #isAccessible() >+ * @since 3.6 >+ */ >+ public void setAccessible(boolean accessible) { >+ set(EFS.ATTRIBUTE_ACCESSIBLE, accessible); >+ } >+ >+ /** > * Returns a string representation of the attributes, suitable > * for debugging purposes only. > */ >Index: src/org/eclipse/core/internal/resources/Resource.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Resource.java,v >retrieving revision 1.172 >diff -u -r1.172 Resource.java >--- src/org/eclipse/core/internal/resources/Resource.java 9 Oct 2009 16:36:35 -0000 1.172 >+++ src/org/eclipse/core/internal/resources/Resource.java 19 Oct 2009 15:30:49 -0000 >@@ -1436,7 +1436,11 @@ > * @see IResource#isAccessible() > */ > public boolean isAccessible() { >- return exists(); >+ if (exists()) { >+ ResourceAttributes attributes = getLocalManager().attributes(this); >+ return attributes != null && attributes.isAccessible(); >+ } >+ return false; > } > > /* (non-Javadoc) >Index: src/org/eclipse/core/internal/utils/FileUtil.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.resources/src/org/eclipse/core/internal/utils/FileUtil.java,v >retrieving revision 1.19 >diff -u -r1.19 FileUtil.java >--- src/org/eclipse/core/internal/utils/FileUtil.java 17 Nov 2008 04:21:23 -0000 1.19 >+++ src/org/eclipse/core/internal/utils/FileUtil.java 19 Oct 2009 15:30:49 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2008 IBM Corporation and others. >+ * Copyright (c) 2005, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -144,6 +144,7 @@ > attributes.setExecutable(fileInfo.getAttribute(EFS.ATTRIBUTE_EXECUTABLE)); > attributes.setHidden(fileInfo.getAttribute(EFS.ATTRIBUTE_HIDDEN)); > attributes.setSymbolicLink(fileInfo.getAttribute(EFS.ATTRIBUTE_SYMLINK)); >+ attributes.setAccessible(fileInfo.getAttribute(EFS.ATTRIBUTE_ACCESSIBLE)); > return attributes; > } > >#P org.eclipse.ui.ide >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/plugin.xml,v >retrieving revision 1.287 >diff -u -r1.287 plugin.xml >--- plugin.xml 24 Apr 2009 17:30:51 -0000 1.287 >+++ plugin.xml 19 Oct 2009 15:30:55 -0000 >@@ -349,6 +349,23 @@ > </enablement> > </decorator> > <decorator >+ lightweight="true" >+ adaptable="true" >+ location="BOTTOM_RIGHT" >+ label="%DecoratorInaccessibleResource.label" >+ class="org.eclipse.ui.internal.ide.InaccessibleResourceDecorator" >+ state="true" >+ id="org.eclipse.ui.InaccessibleResourceDecorator"> >+ <description> >+ %DecoratorInaccessibleResource.description >+ </description> >+ <enablement> >+ <objectClass >+ name="org.eclipse.core.resources.IResource"> >+ </objectClass> >+ </enablement> >+ </decorator> >+ <decorator > adaptable="false" > class="org.eclipse.ui.internal.ide.ContentTypeDecorator" > id="org.eclipse.ui.ContentTypeDecorator" >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/plugin.properties,v >retrieving revision 1.147 >diff -u -r1.147 plugin.properties >--- plugin.properties 24 Apr 2009 17:34:44 -0000 1.147 >+++ plugin.properties 19 Oct 2009 15:30:54 -0000 >@@ -92,6 +92,8 @@ > GoToResourceAction.label = &Resource... > DecoratorLinkedResource.label = Linked Resources > DecoratorLinkedResource.description = Adds an icon decoration to linked resources. >+DecoratorInaccessibleResource.label = Inaccessible Resources >+DecoratorInaccessibleResource.description = Adds an icon decoration to inaccessible resources > DecoratorSpecificContentType.label = File Icons Based On Content Analysis > DecoratorSpecificContentType.description = Displays an icon based on the examination of the contents of a file. This yields a more precise answer than one derived simply from the file name. > OpenWorkspaceFileAction.label = Open Reso&urce... >Index: src/org/eclipse/ui/internal/ide/InaccessibleResourceDecorator.java >=================================================================== >RCS file: src/org/eclipse/ui/internal/ide/InaccessibleResourceDecorator.java >diff -N src/org/eclipse/ui/internal/ide/InaccessibleResourceDecorator.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/internal/ide/InaccessibleResourceDecorator.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,86 @@ >+/******************************************************************************* >+ * Copyright (c) 2009 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.internal.ide; >+ >+import org.eclipse.core.resources.IResource; >+import org.eclipse.jface.resource.ImageDescriptor; >+import org.eclipse.jface.viewers.IDecoration; >+import org.eclipse.jface.viewers.ILabelProviderListener; >+import org.eclipse.jface.viewers.ILightweightLabelDecorator; >+import org.eclipse.ui.plugin.AbstractUIPlugin; >+ >+/** >+ * A InaccessibleResourceDecorator decorates an element's image with a inaccessible >+ * resource overlay. >+ * >+ * @since 3.6 >+ */ >+public class InaccessibleResourceDecorator implements ILightweightLabelDecorator { >+ >+ private static final ImageDescriptor LINK_WARNING; >+ >+ static { >+ LINK_WARNING = AbstractUIPlugin.imageDescriptorFromPlugin( >+ IDEWorkbenchPlugin.IDE_WORKBENCH, >+ "$nl$/icons/full/ovr16/linkwarn_ovr.gif"); //$NON-NLS-1$ >+ } >+ >+ /** >+ * Creates a new <code>InaccessibleResourceDecorator</code>. >+ */ >+ public InaccessibleResourceDecorator() { >+ } >+ >+ /** >+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(ILabelProviderListener) >+ */ >+ public void addListener(ILabelProviderListener listener) { >+ } >+ >+ /** >+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose() >+ */ >+ public void dispose() { >+ // no resources to dispose >+ } >+ >+ /** >+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String) >+ */ >+ public boolean isLabelProperty(Object element, String property) { >+ return false; >+ } >+ >+ /** >+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(ILabelProviderListener) >+ */ >+ public void removeListener(ILabelProviderListener listener) { >+ } >+ >+ /** >+ * Adds the inaccessible overlay if the given element is an inaccessible resource. >+ * >+ * @param element element to decorate >+ * @param decoration The decoration we are adding to >+ * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(Object, IDecoration) >+ */ >+ public void decorate(Object element, IDecoration decoration) { >+ >+ if (element instanceof IResource == false) { >+ return; >+ } >+ IResource resource = (IResource) element; >+ if (!resource.isAccessible()) { >+ decoration.addOverlay(LINK_WARNING); >+ } >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 290318
: 149890