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 25770 Details for
Bug 3979
[CVS Decorator] show version info works incorrectly for subpackages (1GFDIEB)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch to add proper patch decoration once dependencies are fixed
org.eclipse.team.cvs.ui.patch86159.txt (text/plain), 15.56 KB, created by
Michael Valenta
on 2005-08-05 14:36:01 EDT
(
hide
)
Description:
Patch to add proper patch decoration once dependencies are fixed
Filename:
MIME Type:
Creator:
Michael Valenta
Created:
2005-08-05 14:36:01 EDT
Size:
15.56 KB
patch
obsolete
>Index: plugin.xml >=================================================================== >RCS file: /home/eclipse/org.eclipse.team.cvs.ui/plugin.xml,v >retrieving revision 1.202 >diff -u -r1.202 plugin.xml >--- plugin.xml 14 Jun 2005 19:13:12 -0000 1.202 >+++ plugin.xml 5 Jul 2005 20:02:38 -0000 >@@ -733,7 +733,6 @@ > point="org.eclipse.ui.decorators"> > <decorator > lightweight="true" >- objectClass="org.eclipse.core.resources.IResource" > adaptable="true" > location="BOTTOM_RIGHT" > label="%DecoratorStandard.name" >@@ -743,6 +742,9 @@ > <description> > %DecoratorStandard.desc > </description> >+ <enablement> >+ <objectClass name="org.eclipse.core.internal.resources.mapping.ResourceMapping"/> >+ </enablement> > </decorator> > </extension> > <!-- *************** View Actions **************** --> >Index: src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java,v >retrieving revision 1.10 >diff -u -r1.10 CVSDecoration.java >--- src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java 30 Jun 2005 19:39:08 -0000 1.10 >+++ src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java 5 Jul 2005 20:02:39 -0000 >@@ -77,8 +77,6 @@ > private String fileFormatter; > private String folderFormatter; > private String projectFormatter; >- private String dirtyTextIndicator; >- private String addedTextIndicator; > private String resourceName; > > // Images cached for better performance >@@ -252,22 +250,27 @@ > } > bindings.put(CVSDecoratorConfiguration.RESOURCE_NAME, getResourceName()); > bindings.put(CVSDecoratorConfiguration.FILE_KEYWORD, getKeywordSubstitution()); >- if (resourceType != IResource.FILE && location != null) { >- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_HOST, location.getHost()); >- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_METHOD, location.getMethod().getName()); >- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_USER, location.getUsername()); >- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_ROOT, location.getRootDirectory()); >- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_REPOSITORY, repository); >- >- RepositoryManager repositoryManager = CVSUIPlugin.getPlugin().getRepositoryManager(); >- RepositoryRoot root = repositoryManager.getRepositoryRootFor(location); >- CVSUIPlugin.getPlugin().getRepositoryManager(); >- String label = root.getName(); >- if (label == null) { >- label = location.getLocation(true); >+ if (resourceType != IResource.FILE) { >+ if (location != null) { >+ bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_HOST, location.getHost()); >+ bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_METHOD, location.getMethod().getName()); >+ bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_USER, location.getUsername()); >+ bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_ROOT, location.getRootDirectory()); >+ >+ RepositoryManager repositoryManager = CVSUIPlugin.getPlugin().getRepositoryManager(); >+ RepositoryRoot root = repositoryManager.getRepositoryRootFor(location); >+ CVSUIPlugin.getPlugin().getRepositoryManager(); >+ String label = root.getName(); >+ if (label == null) { >+ label = location.getLocation(true); >+ } >+ bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_LABEL, label); > } >- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_LABEL, label); >- } >+ if (repository != null) { >+ bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_REPOSITORY, repository); >+ } >+ } >+ > CVSDecoratorConfiguration.decorate(this, getTextFormatter(), bindings); > } > >@@ -430,4 +433,61 @@ > public void setVirtualFolder(boolean virtualFolder) { > this.virtualFolder = virtualFolder; > } >+ >+ public ICVSRepositoryLocation getLocation() { >+ return location; >+ } >+ >+ public void combine(CVSDecoration resourceDecoration) { >+ // dirty if any are dirty >+ if (resourceDecoration.isDirty()) >+ setDirty(true); >+ // ignored only if all are ignored >+ if (isIgnored() && !resourceDecoration.isIgnored()) >+ setIgnored(false); >+ // added only if all are added >+ if (isAdded() && !resourceDecoration.isAdded()) >+ setAdded(false); >+ // remote if any have a remote >+ if (resourceDecoration.isHasRemote()) >+ setHasRemote(true); >+ // Only new if all are new >+ if (isNewResource() && !resourceDecoration.isNewResource()) >+ setNewResource(false); >+ // Only watch-edit enabled if all are >+ if (isWatchEditEnabled() && !resourceDecoration.isWatchEditEnabled()) >+ setWatchEditEnabled(false); >+ // Only read-only if all are >+ if (isReadOnly() && !resourceDecoration.isReadOnly()) >+ setReadOnly(false); >+ // Only virtual if all are >+ if (isVirtualFolder() && !resourceDecoration.isVirtualFolder()) >+ setVirtualFolder(false); >+ // TODO what about needsMerge >+ // Can only have a revision for a direct mapping to a single file >+ if (getRevision() != null) { >+ revision = null; >+ } >+ // Can only have a keyword substitution mode for a direct mapping to a single file >+ if (getKeywordSubstitution() != null) { >+ keywordSubstitution = null; >+ } >+ // Will only show the tag if it is the same for all >+ if (getTag() != null) { >+ if (resourceDecoration.getTag() == null || !getTag().equals(resourceDecoration.getTag())) { >+ setTag(null); >+ } >+ } >+ // Can only have a repository path for a single folder >+ if (repository != null) >+ repository = null; >+ if (getLocation() != null) { >+ if (resourceDecoration.getLocation() == null || !getLocation().equals(resourceDecoration.getLocation())) { >+ setLocation(null); >+ } >+ } >+ // Assume the folder type for multiple resource mappings >+ resourceType = IResource.FOLDER; >+ >+ } > } >Index: src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java,v >retrieving revision 1.53 >diff -u -r1.53 CVSLightweightDecorator.java >--- src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java 27 Apr 2005 14:19:05 -0000 1.53 >+++ src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java 5 Jul 2005 20:02:39 -0000 >@@ -14,6 +14,8 @@ > import java.text.SimpleDateFormat; > import java.util.*; > >+import org.eclipse.core.internal.resources.mapping.ResourceMapping; >+import org.eclipse.core.internal.resources.mapping.ResourceTraversal; > import org.eclipse.core.resources.*; > import org.eclipse.core.runtime.*; > import org.eclipse.jface.preference.IPreferenceStore; >@@ -70,7 +72,7 @@ > > /** > * This method will ensure that the fonts and colors used by the decorator >- * are cached in the registries. This avoids having to syncExec when >+ * are cached in the registry. This avoids having to syncExec when > * decorating since we ensure that the fonts and colors are pre-created. > * > * @param fonts fonts ids to cache >@@ -137,13 +139,15 @@ > * @param object the object to find the resource for > * @return the resource for the given object, or null > */ >- private IResource getResource(Object object) { >- if (object instanceof IResource) { >- return (IResource) object; >+ private ResourceMapping getResourceMapping(Object object) { >+ if (object instanceof ResourceMapping) { >+ return (ResourceMapping) object; > } > if (object instanceof IAdaptable) { >- return (IResource) ((IAdaptable) object).getAdapter( >- IResource.class); >+ Object adapter = ((IAdaptable) object).getAdapter( >+ ResourceMapping.class); >+ if (adapter instanceof ResourceMapping) >+ return (ResourceMapping) adapter; > } > return null; > } >@@ -154,23 +158,23 @@ > * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object, org.eclipse.jface.viewers.IDecoration) > */ > public void decorate(Object element, IDecoration decoration) { >- IResource resource = getResource(element); >- if (resource == null || resource.getType() == IResource.ROOT) >+ ResourceMapping mapping = getResourceMapping(element); >+ if (mapping == null) > return; > >- CVSTeamProvider cvsProvider = getCVSProviderFor(resource); >- if (cvsProvider == null) >+ if (!isMappedToCVS(mapping)) > return; > > try { >- CVSDecoration cvsDecoration = decorate(resource, true /* include dirty check */); >- cvsDecoration.setWatchEditEnabled(cvsProvider.isWatchEditEnabled()); >- cvsDecoration.apply(decoration); >- } catch(CVSException e) { >+ CVSDecoration cvsDecoration = decorate(mapping); >+ // cvsDecoration.setWatchEditEnabled(cvsProvider.isWatchEditEnabled()); TODO: >+ if (cvsDecoration != null) >+ cvsDecoration.apply(decoration); >+ } catch(CoreException e) { > handleException(e); > } catch (IllegalStateException e) { > // This is thrown by Core if the workspace is in an illegal state >- // If we are not active, ignore it. Otherwise, propogate it. >+ // If we are not active, ignore it. Otherwise, propagate it. > // (see bug 78303) > if (Platform.getBundle(CVSUIPlugin.ID).getState() == Bundle.ACTIVE) { > throw e; >@@ -178,7 +182,56 @@ > } > } > >- public static CVSDecoration decorate(IResource resource, boolean includeDirtyCheck) throws CVSException { >+ private boolean isMappedToCVS(ResourceMapping mapping) { >+ IProject[] projects = mapping.getProjects(); >+ boolean mappedProjectFound = false; >+ for (int i = 0; i < projects.length; i++) { >+ IProject project = projects[i]; >+ if (getCVSProviderFor(project) == null) { >+ // We do not handle the case where the mapping is mapped to CVS and another provider >+ if (RepositoryProvider.isShared(project)) >+ return false; >+ } else { >+ mappedProjectFound = true; >+ } >+ } >+ return mappedProjectFound; >+ } >+ >+ private boolean isMappedToCVS(IResource resource) { >+ return getCVSProviderFor(resource.getProject()) != null; >+ } >+ >+ private CVSDecoration decorate(ResourceMapping mapping) throws CoreException { >+ CVSDecoration result = null; >+ ResourceTraversal[] traversals = mapping.getTraversals(null, null); >+ for (int i = 0; i < traversals.length; i++) { >+ ResourceTraversal traversal = traversals[i]; >+ IResource[] resources = traversal.getResources(); >+ for (int j = 0; j < resources.length; j++) { >+ IResource resource = resources[j]; >+ if (resource != null && isMappedToCVS(resource)) { >+ CVSDecoration resourceDecoration = decorate(resource, traversal.getDepth(), true /* include dirty check */); >+ if (result == null) { >+ result = resourceDecoration; >+ } else { >+ result.combine(resourceDecoration); >+ } >+ } >+ } >+ } >+ return result; >+ } >+ >+ public static CVSDecoration decorate(IResource resource) throws CVSException { >+ try { >+ return decorate(resource, IResource.DEPTH_INFINITE, true); >+ } catch (CoreException e) { >+ throw CVSException.wrapException(e); >+ } >+ } >+ >+ public static CVSDecoration decorate(IResource resource, int depth, boolean includeDirtyCheck) throws CoreException { > IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore(); > ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource); > CVSDecoration cvsDecoration = new CVSDecoration(resource.getName()); >@@ -193,7 +246,7 @@ > boolean computeDeepDirtyCheck = store.getBoolean(ICVSUIConstants.PREF_CALCULATE_DIRTY); > int type = resource.getType(); > if (type == IResource.FILE || computeDeepDirtyCheck) { >- cvsDecoration.setDirty(CVSLightweightDecorator.isDirty(resource)); >+ cvsDecoration.setDirty(CVSLightweightDecorator.isDirty(resource, depth)); > } > } > // Tag >@@ -232,7 +285,24 @@ > return cvsDecoration; > } > >- private static void extractContainerProperties(IContainer resource, CVSDecoration cvsDecoration) throws CVSException { >+ private static boolean isDirty(IResource resource, int depth) throws CoreException { >+ if (depth == IResource.DEPTH_INFINITE || resource.getType() == IResource.FILE) { >+ return CVSLightweightDecorator.isDirty(resource); >+ } >+ if (depth == IResource.DEPTH_ONE && resource.getType() != IResource.FILE) { >+ IContainer container = (IContainer)resource; >+ IResource[] members = container.members(); >+ for (int i = 0; i < members.length; i++) { >+ IResource member = members[i]; >+ if (member.getType() == IResource.FILE && CVSLightweightDecorator.isDirty(member)) { >+ return true; >+ } >+ } >+ } >+ return false; >+ } >+ >+ private static void extractContainerProperties(IContainer resource, CVSDecoration cvsDecoration) throws CVSException { > ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(resource); > FolderSyncInfo folderInfo = folder.getFolderSyncInfo(); > if (folderInfo != null) { >Index: src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipantLabelDecorator.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipantLabelDecorator.java,v >retrieving revision 1.12 >diff -u -r1.12 CVSParticipantLabelDecorator.java >--- src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipantLabelDecorator.java 20 Apr 2005 17:32:55 -0000 1.12 >+++ src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipantLabelDecorator.java 5 Jul 2005 20:02:39 -0000 >@@ -11,6 +11,7 @@ > package org.eclipse.team.internal.ccvs.ui.subscriber; > > import org.eclipse.core.resources.IResource; >+import org.eclipse.core.runtime.CoreException; > import org.eclipse.jface.util.IPropertyChangeListener; > import org.eclipse.jface.util.PropertyChangeEvent; > import org.eclipse.jface.viewers.*; >@@ -67,7 +68,11 @@ > * @return > */ > protected CVSDecoration getDecoration(IResource resource) throws CVSException { >- return CVSLightweightDecorator.decorate(resource, false /* do not include dirty check */); >+ try { >+ return CVSLightweightDecorator.decorate(resource, IResource.DEPTH_ZERO, false /* do not include dirty check */); >+ } catch (CoreException e) { >+ throw CVSException.wrapException(e); >+ } > } > > public Image decorateImage(Image base, Object element) {
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 3979
: 25770