### Eclipse Workspace Patch 1.0
#P org.eclipse.core.resources
Index: src/org/eclipse/core/internal/resources/ICoreConstants.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ICoreConstants.java,v
retrieving revision 1.31
diff -u -r1.31 ICoreConstants.java
--- src/org/eclipse/core/internal/resources/ICoreConstants.java 20 Jan 2010 17:02:26 -0000 1.31
+++ src/org/eclipse/core/internal/resources/ICoreConstants.java 9 Sep 2010 19:20:30 -0000
@@ -64,6 +64,16 @@
*/
static final int M_VIRTUAL = 0x80000;
/**
+ * Marks this resource as flatten.
+ * @since 3.7
+ */
+ static final int M_FLATTEN = 0x400000;
+ /**
+ * Marks this resource as floating.
+ * @since 3.7
+ */
+ static final int M_FLOATING = 0x800000;
+ /**
* The file has no content description.
* @since 3.0
*/
Index: src/org/eclipse/core/internal/resources/Project.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Project.java,v
retrieving revision 1.173
diff -u -r1.173 Project.java
--- src/org/eclipse/core/internal/resources/Project.java 27 Apr 2010 09:16:15 -0000 1.173
+++ src/org/eclipse/core/internal/resources/Project.java 9 Sep 2010 19:20:30 -0000
@@ -1112,7 +1112,7 @@
if (parent != null && !parent.exists() && parent.getType() == FOLDER)
((Folder) parent).ensureExists(Policy.monitorFor(null));
if (!toLink.exists() || !toLink.isLinked()) {
- if (newLink.isGroup())
+ if (newLink.isVirtual())
((Folder) toLink).create(IResource.REPLACE | IResource.VIRTUAL, true, null);
else
toLink.createLink(newLink.getLocationURI(), IResource.REPLACE | IResource.ALLOW_MISSING_LOCAL, null);
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.190
diff -u -r1.190 Resource.java
--- src/org/eclipse/core/internal/resources/Resource.java 20 Apr 2010 15:48:36 -0000 1.190
+++ src/org/eclipse/core/internal/resources/Resource.java 9 Sep 2010 19:20:32 -0000
@@ -17,6 +17,14 @@
*******************************************************************************/
package org.eclipse.core.internal.resources;
+import org.eclipse.core.internal.utils.Messages;
+import org.eclipse.core.internal.utils.Policy;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.OperationCanceledException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;
@@ -663,10 +671,13 @@
ResourceInfo info = workspace.createResource(this, false);
if ((updateFlags & IResource.HIDDEN) != 0)
info.set(M_HIDDEN);
+ if ((updateFlags & IResource.FLATTEN) != 0)
+ info.set(M_FLATTEN);
+
info.set(M_LINK);
localLocation = FileUtil.canonicalURI(localLocation);
LinkDescription linkDescription = new LinkDescription(this, localLocation);
- if (linkDescription.isGroup())
+ if (linkDescription.isVirtual())
info.set(M_VIRTUAL);
getLocalManager().link(this, localLocation, fileInfo);
monitor.worked(Policy.opWork * 5 / 100);
@@ -2064,7 +2075,7 @@
info.setDirectory(currentResource.getType() == IResource.FOLDER);
fileInfo = info;
}
- IFileInfo[] filtered = parent.filterChildren(new IFileInfo[] {fileInfo}, throwExeception);
+ Object[] filtered = parent.filterChildren(new Object[] {fileInfo}, throwExeception);
if (filtered.length == 0)
return true;
}
@@ -2073,11 +2084,20 @@
}
return false;
}
-
- public IFileInfo[] filterChildren(IFileInfo[] list, boolean throwException) throws CoreException {
+
+ /**
+ * Filter the list of file entries according to the existing resource filters
+ * @param list can be either an array of IFileInfo or IFileStore
+ * @param throwException
+ * @return the filtered list (either an array of IFileInfo or IFileStore
+ * @throws CoreException
+ */
+ public Object[] filterChildren(Object[] list, boolean throwException) throws CoreException {
Project project = (Project) getProject();
if (project == null)
return list;
+ if (list.length == 0)
+ return list;
final ProjectDescription description = project.internalGetDescription();
if (description == null)
return list;
@@ -2181,4 +2201,89 @@
setLinkLocation(URIUtil.toURI(location.toPortableString()), updateFlags, monitor);
}
}
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see IContainer#isFlatten()
+ */
+ public boolean isFloating() {
+ ResourceInfo info = getResourceInfo(false, false);
+ return info != null && info.isSet(M_FLOATING);
+ }
+
+ /*
+ * Set the floating flag
+ */
+ public void setFloating(boolean floating) {
+ ResourceInfo info = getResourceInfo(true, true);
+ if (info != null) {
+ if (floating)
+ info.isSet(M_FLOATING);
+ else
+ info.clear(M_FLOATING);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see IContainer#isFlatten()
+ */
+ public boolean isFlatten() {
+ ResourceInfo info = getResourceInfo(false, false);
+ return info != null && info.isSet(M_FLATTEN);
+ }
+
+ /**
+ *
+ * @exception CoreException
+ *
+ * @see #isFlatten()
+ * @since 3.7
+ */
+ public void setFlatten(boolean flatten, int updateFlags, IProgressMonitor monitor) throws CoreException {
+ monitor = Policy.monitorFor(monitor);
+ try {
+ String message = NLS.bind(Messages.resources_settingFlattenFlag, getFullPath());
+ monitor.beginTask(message, Policy.totalWork);
+ Policy.checkCanceled(monitor);
+ checkValidPath(path, FOLDER | PROJECT, true);
+ final ISchedulingRule rule = workspace.getRuleFactory().createRule(this);
+ try {
+ workspace.prepareOperation(rule, monitor);
+ workspace.beginOperation(true);
+ monitor.worked(Policy.opWork * 5 / 100);
+ ResourceInfo info = getResourceInfo(true, true);
+ // ignore attempts to set flatten flag on anything except projects and folders
+ if (info.getType() != PROJECT && info.getType() != FOLDER)
+ return;
+
+ if (flatten)
+ info.set(ICoreConstants.M_FLATTEN);
+ else {
+ info.clear(ICoreConstants.M_FLATTEN);
+ }
+ //refresh to update resources below this container location
+ if (getType() != IResource.FILE) {
+ //refresh either in background or foreground
+ if ((updateFlags & IResource.BACKGROUND_REFRESH) != 0) {
+ workspace.refreshManager.refresh(this);
+ monitor.worked(Policy.opWork * 90 / 100);
+ } else {
+ refreshLocal(DEPTH_INFINITE, Policy.subMonitorFor(monitor, Policy.opWork * 90 / 100));
+ }
+ } else
+ monitor.worked(Policy.opWork * 90 / 100);
+ } catch (OperationCanceledException e) {
+ workspace.getWorkManager().operationCanceled();
+ throw e;
+ } finally {
+ workspace.endOperation(rule, true, Policy.subMonitorFor(monitor, Policy.endOpWork));
+ }
+ } finally {
+ monitor.done();
+ }
+ }
+
}
Index: src/org/eclipse/core/internal/resources/Workspace.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Workspace.java,v
retrieving revision 1.235
diff -u -r1.235 Workspace.java
--- src/org/eclipse/core/internal/resources/Workspace.java 10 Mar 2010 21:45:36 -0000 1.235
+++ src/org/eclipse/core/internal/resources/Workspace.java 9 Sep 2010 19:20:33 -0000
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.core.internal.resources;
+import org.eclipse.core.resources.IResource;
+
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
@@ -985,6 +987,8 @@
info.set(M_TEAM_PRIVATE_MEMBER);
if ((updateFlags & IResource.HIDDEN) != 0)
info.set(M_HIDDEN);
+ if ((updateFlags & IResource.FLATTEN) != 0)
+ info.set(M_FLATTEN);
// if ((updateFlags & IResource.VIRTUAL) != 0)
// info.set(M_VIRTUAL);
return info;
#P org.eclipse.ui.ide
Index: plugin.properties
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/plugin.properties,v
retrieving revision 1.157
diff -u -r1.157 plugin.properties
--- plugin.properties 1 Jun 2010 19:22:30 -0000 1.157
+++ plugin.properties 9 Sep 2010 19:20:34 -0000
@@ -93,6 +93,8 @@
GoToResourceAction.label = &Resource...
DecoratorLinkedResource.label = Linked Resources
DecoratorLinkedResource.description = Adds an icon decoration to linked resources.
+DecoratorFloatingResource.label = Floating Resources
+DecoratorFloatingResource.description = Adds an icon decoration to floating resources.
DecoratorVirtualResource.label = Virtual Folders
DecoratorVirtualResource.description = Shows an icon for virtual folders.
DecoratorSpecificContentType.label = File Icons Based On Content Analysis
Index: plugin.xml
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/plugin.xml,v
retrieving revision 1.304
diff -u -r1.304 plugin.xml
--- plugin.xml 12 May 2010 20:15:28 -0000 1.304
+++ plugin.xml 9 Sep 2010 19:20:36 -0000
@@ -376,6 +376,23 @@
lightweight="true"
adaptable="true"
location="BOTTOM_RIGHT"
+ label="%DecoratorFloatingResource.label"
+ class="org.eclipse.ui.internal.ide.FloatingResourceDecorator"
+ state="true"
+ id="org.eclipse.ui.FloatingResourceDecorator">
+
+ %DecoratorFloatingResource.description
+
+
+
+
+
+
+ LinkedResourceDecorator.
+ */
+ public FloatingResourceDecorator() {
+ }
+
+ /**
+ * @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 linked resource overlay if the given element is a linked
+ * 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.isFloating())
+ decoration.addOverlay(FLOATING);
+ }
+
+}
Index: src/org/eclipse/ui/internal/ide/IDEWorkbenchMessages.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/IDEWorkbenchMessages.java,v
retrieving revision 1.89
diff -u -r1.89 IDEWorkbenchMessages.java
--- src/org/eclipse/ui/internal/ide/IDEWorkbenchMessages.java 12 May 2010 13:26:39 -0000 1.89
+++ src/org/eclipse/ui/internal/ide/IDEWorkbenchMessages.java 9 Sep 2010 19:20:37 -0000
@@ -613,6 +613,7 @@
public static String ResourceInfo_folder;
public static String ResourceInfo_project;
public static String ResourceInfo_linkedFile;
+ public static String ResourceInfo_floatingFile;
public static String ResourceInfo_linkedFolder;
public static String ResourceInfo_virtualFolder;
public static String ResourceInfo_unknown;
@@ -622,6 +623,8 @@
public static String ResourceInfo_fileNotExist;
public static String ResourceInfo_path;
public static String ResourceInfo_lastModified;
+ public static String ResourceInfo_folderHierarchy;
+ public static String ResourceInfo_flatten;
public static String ResourceInfo_fileEncodingTitle;
public static String ResourceInfo_fileContentEncodingFormat;
public static String ResourceInfo_fileContainerEncodingFormat;
Index: src/org/eclipse/ui/internal/ide/LinkedResourceDecorator.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/LinkedResourceDecorator.java,v
retrieving revision 1.13
diff -u -r1.13 LinkedResourceDecorator.java
--- src/org/eclipse/ui/internal/ide/LinkedResourceDecorator.java 20 Jan 2010 17:02:29 -0000 1.13
+++ src/org/eclipse/ui/internal/ide/LinkedResourceDecorator.java 9 Sep 2010 19:20:37 -0000
@@ -87,7 +87,7 @@
return;
}
IResource resource = (IResource) element;
- if (resource.isLinked() && !resource.isVirtual()) {
+ if (resource.isLinked() && !resource.isVirtual() && !resource.isFloating()) {
IFileInfo fileInfo = null;
URI location = resource.getLocationURI();
if (location != null) {
Index: src/org/eclipse/ui/internal/ide/messages.properties
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/messages.properties,v
retrieving revision 1.214
diff -u -r1.214 messages.properties
--- src/org/eclipse/ui/internal/ide/messages.properties 18 May 2010 12:18:07 -0000 1.214
+++ src/org/eclipse/ui/internal/ide/messages.properties 9 Sep 2010 19:20:38 -0000
@@ -570,6 +570,7 @@
ResourceInfo_locked = L&ocked
ResourceInfo_archive = Ar&chive
ResourceInfo_derived = Deri&ved
+ResourceInfo_flatten = &Flatten
ResourceInfo_type = &Type:
ResourceInfo_location = &Location:
ResourceInfo_resolvedLocation = Resolved locatio&n:
@@ -632,6 +633,7 @@
ResourceInfo_folder = Folder
ResourceInfo_project = Project
ResourceInfo_linkedFile = Linked File
+ResourceInfo_floatingFile = Floating File
ResourceInfo_linkedFolder = Linked Folder
ResourceInfo_virtualFolder = Virtual Folder
ResourceInfo_unknown = Unknown
@@ -642,6 +644,7 @@
ResourceInfo_fileNotExist = {0} - (does not exist)
ResourceInfo_path = &Path:
ResourceInfo_lastModified = Last &modified:
+ResourceInfo_folderHierarchy = Folder hierarchy:
ResourceInfo_fileEncodingTitle = Default encoding for &text files
ResourceInfo_fileContentEncodingFormat = &Default (determined from content: {0})
ResourceInfo_fileContainerEncodingFormat = Default (&inherited from container: {0})
Index: src/org/eclipse/ui/internal/ide/dialogs/IDEResourceInfoUtils.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/IDEResourceInfoUtils.java,v
retrieving revision 1.24
diff -u -r1.24 IDEResourceInfoUtils.java
--- src/org/eclipse/ui/internal/ide/dialogs/IDEResourceInfoUtils.java 5 Mar 2010 16:01:11 -0000 1.24
+++ src/org/eclipse/ui/internal/ide/dialogs/IDEResourceInfoUtils.java 9 Sep 2010 19:20:38 -0000
@@ -60,6 +60,8 @@
private static String FOLDER_LABEL = IDEWorkbenchMessages.ResourceInfo_folder;
private static String LINKED_FILE_LABEL = IDEWorkbenchMessages.ResourceInfo_linkedFile;
+
+ private static String FLOATING_FILE_LABEL = IDEWorkbenchMessages.ResourceInfo_floatingFile;
private static String LINKED_FOLDER_LABEL = IDEWorkbenchMessages.ResourceInfo_linkedFolder;
@@ -351,6 +353,9 @@
IContentDescription description) {
if (resource.getType() == IResource.FILE) {
+ if (resource.isFloating()) {
+ return FLOATING_FILE_LABEL;
+ }
if (resource.isLinked()) {
return LINKED_FILE_LABEL;
}
Index: src/org/eclipse/ui/internal/ide/dialogs/ResourceInfoPage.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/ResourceInfoPage.java,v
retrieving revision 1.48
diff -u -r1.48 ResourceInfoPage.java
--- src/org/eclipse/ui/internal/ide/dialogs/ResourceInfoPage.java 10 May 2010 14:01:35 -0000 1.48
+++ src/org/eclipse/ui/internal/ide/dialogs/ResourceInfoPage.java 9 Sep 2010 19:20:39 -0000
@@ -67,6 +67,8 @@
*/
public class ResourceInfoPage extends PropertyPage {
+ private Button flattenBox;
+
private Button editableBox;
private Button executableBox;
@@ -86,6 +88,8 @@
private boolean previousArchiveValue;
private boolean previousDerivedValue;
+
+ private boolean previousFlattenValue;
private int previousPermissionsValue;
@@ -104,7 +108,7 @@
private static String ARCHIVE = IDEWorkbenchMessages.ResourceInfo_archive;
private static String DERIVED = IDEWorkbenchMessages.ResourceInfo_derived;
-
+
private static String TYPE_TITLE = IDEWorkbenchMessages.ResourceInfo_type;
private static String LOCATION_TITLE = IDEWorkbenchMessages.ResourceInfo_location;
@@ -116,6 +120,10 @@
private static String PATH_TITLE = IDEWorkbenchMessages.ResourceInfo_path;
private static String TIMESTAMP_TITLE = IDEWorkbenchMessages.ResourceInfo_lastModified;
+
+ private static String FOLDER_HIERARCHY_TITLE = IDEWorkbenchMessages.ResourceInfo_folderHierarchy;
+
+ private static String FLATTEN = IDEWorkbenchMessages.ResourceInfo_flatten;
private static String FILE_ENCODING_TITLE = IDEWorkbenchMessages.WorkbenchPreference_encoding;
@@ -196,7 +204,7 @@
Composite locationComposite = new Composite(basicInfoComposite,
SWT.NULL);
layout = new GridLayout();
- layout.numColumns = 2;
+ layout.numColumns = resource.isFloating() ? 1:2;
layout.marginWidth = 0;
layout.marginHeight = 0;
locationComposite.setLayout(layout);
@@ -221,24 +229,26 @@
locationValue.setBackground(locationValue.getDisplay().getSystemColor(
SWT.COLOR_WIDGET_BACKGROUND));
- Button editButton = new Button(locationComposite, SWT.PUSH);
- editButton.setText(EDIT_TITLE);
- setButtonLayoutData(editButton);
- ((GridData) editButton.getLayoutData()).verticalAlignment = SWT.TOP;
- int locationValueHeight = locationValue.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).y;
- int editButtonHeight = editButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).y;
- int verticalIndent = (editButtonHeight - locationValueHeight) / 2 ;
- ((GridData) locationTitle.getLayoutData()).verticalIndent = verticalIndent;
- ((GridData) locationValue.getLayoutData()).verticalIndent = verticalIndent;
- editButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- editLinkLocation();
- }
-
- public void widgetSelected(SelectionEvent e) {
- editLinkLocation();
- }
- });
+ if (!resource.isFloating()) {
+ Button editButton = new Button(locationComposite, SWT.PUSH);
+ editButton.setText(EDIT_TITLE);
+ setButtonLayoutData(editButton);
+ ((GridData) editButton.getLayoutData()).verticalAlignment = SWT.TOP;
+ int locationValueHeight = locationValue.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).y;
+ int editButtonHeight = editButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).y;
+ int verticalIndent = (editButtonHeight - locationValueHeight) / 2 ;
+ ((GridData) locationTitle.getLayoutData()).verticalIndent = verticalIndent;
+ ((GridData) locationValue.getLayoutData()).verticalIndent = verticalIndent;
+ editButton.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ editLinkLocation();
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ editLinkLocation();
+ }
+ });
+ }
// displayed in all cases since the link can be changed to a path variable any time by the user in this dialog
Label resolvedLocationTitle = new Label(basicInfoComposite,
@@ -311,6 +321,18 @@
timeStampValue.setLayoutData(new GridData(GridData.FILL_HORIZONTAL
| GridData.GRAB_HORIZONTAL));
+ if (resource instanceof IContainer)
+ {
+ Label folderHierarchyLabel = new Label(basicInfoComposite, SWT.NONE);
+ folderHierarchyLabel.setText(FOLDER_HIERARCHY_TITLE);
+
+ flattenBox = new Button(basicInfoComposite, SWT.CHECK | SWT.RIGHT);
+ flattenBox.setAlignment(SWT.LEFT);
+ flattenBox.setText(FLATTEN);
+ previousFlattenValue = ((IContainer) resource).isFlatten();
+ flattenBox.setSelection(previousFlattenValue);
+ }
+
return basicInfoComposite;
}
@@ -899,6 +921,10 @@
this.derivedBox.setSelection(false);
}
+ if (this.flattenBox != null) {
+ this.flattenBox.setSelection(false);
+ }
+
if (permissionBoxes != null) {
int defaultPermissionValues = getDefaulPermissions(resource.getType() == IResource.FOLDER);
setPermissionsSelection(defaultPermissionValues);
@@ -1000,6 +1026,15 @@
derivedBox.setSelection(isDerived);
}
}
+ if (this.flattenBox != null) {
+ boolean localFlattenValue = flattenBox.getSelection();
+ if (previousFlattenValue != localFlattenValue) {
+ ((IContainer)resource).setFlatten(localFlattenValue, 0, null);
+ boolean isFlatten = ((IContainer)resource).isFlatten();
+ previousFlattenValue = isFlatten;
+ flattenBox.setSelection(isFlatten);
+ }
+ }
} catch (CoreException exception) {
ErrorDialog.openError(getShell(),
IDEWorkbenchMessages.InternalError, exception