Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2003-10-24 13:21:39 +0000
committerJean Michel-Lemieux2003-10-24 13:21:39 +0000
commit730f6aba4c42f2275099a9f3a95718e05936a12c (patch)
treeeaf3ab1c6363cf01e21715c8a3cea3e024000b7f
parent58d7f9e1f85d8e1b357fe03a602d1e6adfca7d4e (diff)
downloadeclipse.platform.team-730f6aba4c42f2275099a9f3a95718e05936a12c.tar.gz
eclipse.platform.team-730f6aba4c42f2275099a9f3a95718e05936a12c.tar.xz
eclipse.platform.team-730f6aba4c42f2275099a9f3a95718e05936a12c.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.team.core/.classpath1
-rw-r--r--bundles/org.eclipse.team.core/.project1
-rw-r--r--bundles/org.eclipse.team.core/plugin.xml2
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ContentComparisonCriteria.java6
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteContentsCache.java4
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultFileModificationValidator.java3
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLContentHandler.java37
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLWriter.java32
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java4
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/AuthenticatedSite.java82
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/BaseIdentifierNotInitializedException.java31
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/IRemoteTargetResource.java120
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ISiteFactory.java42
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ISiteListener.java16
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ITargetRunnable.java18
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ITeamStatusConstants.java79
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/LocationMapping.java98
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/RemoteTargetSyncElement.java201
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ResourceState.java826
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/Site.java145
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/SynchronizedTargetProvider.java228
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/TargetManager.java274
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/TargetProvider.java218
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/UrlUtil.java81
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/messages.properties21
-rw-r--r--bundles/org.eclipse.team.cvs.core/.classpath3
-rw-r--r--bundles/org.eclipse.team.cvs.core/.project1
-rw-r--r--bundles/org.eclipse.team.cvs.core/plugin.xml1
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java226
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncInfo.java34
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java26
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java3
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java5
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java1
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java1
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RTag.java3
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemoteCommand.java23
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java33
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties7
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java34
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java7
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java14
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java159
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/FileContentCachingService.java17
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/FileModificationManager.java3
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java121
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java19
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SessionPropertySyncInfoCache.java26
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/BaserevInfo.java5
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/FolderSyncInfo.java11
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/BuildCleanupListener.java14
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/MoveDeleteHook.java98
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PrepareForReplaceVisitor.java7
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java4
-rw-r--r--bundles/org.eclipse.team.ui/.classpath1
-rw-r--r--bundles/org.eclipse.team.ui/.project1
-rw-r--r--bundles/org.eclipse.team.ui/plugin.properties16
-rw-r--r--bundles/org.eclipse.team.ui/plugin.xml90
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.java27
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java24
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java45
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialog.java7
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialogWithProjects.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PreferencePageContainerDialog.java10
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TeamSubscriberParticipantPage.java38
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ComparisonCriteriaActionGroup.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/ComparisonCriteriaActionGroup.java)2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/INavigableControl.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/INavigableControl.java)18
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/NavigateAction.java)2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenFileInSystemEditorAction.java53
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/OpenInCompareAction.java)2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/OpenWithActionGroup.java)14
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/RefactorActionGroup.java)30
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefreshAction.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/RefreshAction.java)25
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineCLabelContribution.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java14
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SyncViewerShowPreferencesAction.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SyncViewerShowPreferencesAction.java)2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ToggleViewLayoutAction.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/ToggleViewLayoutAction.java)2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetFilterActionGroup.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncInfoWorkingSetFilter.java1
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncSetContentProvider.java90
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncTableViewer.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncTreeViewer.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncViewerLabelProvider.java53
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncViewerSorter.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SynchronizeViewNode.java5
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetMainPage.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java15
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java98
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java5
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java88
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeView.java11
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeViewNode.java82
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ITeamSubscriberParticipantNode.java53
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipant.java28
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/AndSyncInfoFilter.java35
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/AutomergableFilter.java26
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/CompoundSyncInfoFilter.java19
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/DirectionFilterActionGroup.java97
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/ExpandAllAction.java65
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/MenuActionContributionItem.java21
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/OrSyncInfoFilter.java34
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/PseudoConflictFilter.java27
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java41
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/RemoveSynchronizeViewPageAction.java29
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SubscriberAction.java22
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SyncInfoChangeTypeFilter.java44
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SyncInfoDirectionFilter.java42
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SyncInfoFilter.java138
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SyncInfoSet.java48
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/package.html13
114 files changed, 1261 insertions, 3893 deletions
diff --git a/bundles/org.eclipse.team.core/.classpath b/bundles/org.eclipse.team.core/.classpath
index 02fe18230..c2a45fe37 100644
--- a/bundles/org.eclipse.team.core/.classpath
+++ b/bundles/org.eclipse.team.core/.classpath
@@ -3,7 +3,6 @@
<classpathentry kind="src" path="src/"/>
<classpathentry kind="src" path="/org.eclipse.core.resources"/>
<classpathentry kind="src" path="/org.eclipse.core.runtime"/>
- <classpathentry kind="src" path="/org.apache.xerces"/>
<classpathentry kind="src" path="/org.eclipse.core.boot"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
diff --git a/bundles/org.eclipse.team.core/.project b/bundles/org.eclipse.team.core/.project
index 2ed89860c..c3f50735a 100644
--- a/bundles/org.eclipse.team.core/.project
+++ b/bundles/org.eclipse.team.core/.project
@@ -3,7 +3,6 @@
<name>org.eclipse.team.core</name>
<comment></comment>
<projects>
- <project>org.apache.xerces</project>
<project>org.eclipse.core.boot</project>
<project>org.eclipse.core.resources</project>
<project>org.eclipse.core.runtime</project>
diff --git a/bundles/org.eclipse.team.core/plugin.xml b/bundles/org.eclipse.team.core/plugin.xml
index ed8b7129d..0e8fd5c76 100644
--- a/bundles/org.eclipse.team.core/plugin.xml
+++ b/bundles/org.eclipse.team.core/plugin.xml
@@ -15,7 +15,6 @@
<requires>
<import plugin="org.eclipse.core.resources"/>
<import plugin="org.eclipse.core.runtime"/>
- <import plugin="org.apache.xerces"/>
</requires>
@@ -23,7 +22,6 @@
<extension-point id="ignore" name="%GlobalIgnoreRegistry" schema="schema/ignore.exsd"/>
<extension-point id="projectSets" name="%TeamProjectSets" schema="schema/projectSets.exsd"/>
<extension-point id="repository" name="%Repository" schema="schema/repository.exsd"/>
- <extension-point id="targets" name="%Targets"/>
<extension-point id="subscriber" name="%Subscriber"/>
<!-- Define common known file types -->
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ContentComparisonCriteria.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ContentComparisonCriteria.java
index 989dbbbc8..b3aed9c6e 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ContentComparisonCriteria.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ContentComparisonCriteria.java
@@ -14,7 +14,7 @@ import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
-import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.TeamException;
@@ -150,8 +150,8 @@ public class ContentComparisonCriteria extends ComparisonCriteria {
private InputStream getContents(Object resource, IProgressMonitor monitor) throws TeamException {
try {
- if (resource instanceof IStorage) {
- return new BufferedInputStream(((IStorage) resource).getContents());
+ if (resource instanceof IFile) {
+ return new BufferedInputStream(((IFile) resource).getContents());
} else if(resource instanceof IRemoteResource) {
IRemoteResource remote = (IRemoteResource)resource;
if (!remote.isContainer()) {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteContentsCache.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteContentsCache.java
index 18710e0dd..67b985c0c 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteContentsCache.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteContentsCache.java
@@ -11,6 +11,7 @@
package org.eclipse.team.core.sync;
import java.io.BufferedOutputStream;
+import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -184,7 +185,8 @@ public class RemoteContentsCache {
// We will end up here if we couldn't read or delete the cache file
throw new TeamException(Policy.bind("RemoteContentsCache.fileError", ioFile.getAbsolutePath()), e); //$NON-NLS-1$
}
- return null;
+ // This can occur when there is no remote contents
+ return new ByteArrayInputStream(new byte[0]);
}
/**
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultFileModificationValidator.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultFileModificationValidator.java
index 09742418d..82bf0d998 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultFileModificationValidator.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultFileModificationValidator.java
@@ -12,6 +12,7 @@ package org.eclipse.team.internal.core;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFileModificationValidator;
+import org.eclipse.core.resources.IResourceStatus;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status;
@@ -22,7 +23,7 @@ public class DefaultFileModificationValidator implements IFileModificationValida
private IStatus getDefaultStatus(IFile file) {
return file.isReadOnly()
- ? new Status(Status.ERROR, TeamPlugin.ID, Status.ERROR, Policy.bind("FileModificationValidator.fileIsReadOnly", file.getFullPath().toString()), null) //$NON-NLS-1$
+ ? new Status(Status.ERROR, TeamPlugin.ID, IResourceStatus.READ_ONLY_LOCAL, Policy.bind("FileModificationValidator.fileIsReadOnly", file.getFullPath().toString()), null) //$NON-NLS-1$
: OK;
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLContentHandler.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLContentHandler.java
index 01f4d8a19..66f9785ec 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLContentHandler.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLContentHandler.java
@@ -38,9 +38,10 @@ public class SaveContextXMLContentHandler extends DefaultHandler {
/**
* @see ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
*/
- public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
+ public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
SaveContext ctx = (SaveContext)contextStack.peek();
- if (!localName.equals(ctx.getName())) {
+ String elementName = getElementName(namespaceURI, localName, qName);
+ if (!elementName.equals(ctx.getName())) {
// keep going
} else {
last = (SaveContext)contextStack.pop();
@@ -56,9 +57,10 @@ public class SaveContextXMLContentHandler extends DefaultHandler {
*/
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
SaveContext context = new SaveContext();
- context.setName(localName);
+ String elementName = getElementName(namespaceURI, localName, qName);
+ context.setName(elementName);
for (int i = 0; i < atts.getLength(); i++) {
- String attrName = atts.getLocalName(i);
+ String attrName = getAttributeName(atts, i);
String attrValue = atts.getValue(i);
context.putString(attrName, attrValue);
}
@@ -66,8 +68,33 @@ public class SaveContextXMLContentHandler extends DefaultHandler {
buffer = new StringBuffer();
contextStack.push(context);
}
-
+
public SaveContext getSaveContext() {
return last;
}
+
+ /*
+ * Couldn't figure out from the SAX API exactly when localName vs. qName is used.
+ * However, the XML for subscribers doesn't use namespaces so either of the two names
+ * is fine. Therefore, use whichever one is provided.
+ */
+ private String getElementName(String namespaceURI, String localName, String qName) {
+ if (localName != null && localName.length() > 0) {
+ return localName;
+ } else {
+ return qName;
+ }
+ }
+
+ /*
+ * See getElementName() reasoning for why this method is needed.
+ */
+ private String getAttributeName(Attributes atts, int i) {
+ String localName = atts.getLocalName(i);
+ if (localName != null && localName.length() > 0) {
+ return localName;
+ } else {
+ return atts.getQName(i);
+ }
+ }
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLWriter.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLWriter.java
index c4f76a8a0..039f42981 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLWriter.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLWriter.java
@@ -10,11 +10,27 @@
*******************************************************************************/
package org.eclipse.team.internal.core;
-import java.io.*;
-import java.util.*;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
-import org.apache.xerces.parsers.SAXParser;
-import org.eclipse.core.runtime.*;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
import org.eclipse.team.core.ISaveContext;
import org.eclipse.team.core.TeamException;
import org.xml.sax.InputSource;
@@ -187,10 +203,10 @@ public class SaveContextXMLWriter extends PrintWriter {
File file = pluginStateLocation.append(filename).toFile(); //$NON-NLS-1$
if (file.exists()) {
is = new BufferedInputStream(new FileInputStream(file));
- SAXParser parser = new SAXParser();
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ SAXParser parser = factory.newSAXParser();
SaveContextXMLContentHandler handler = new SaveContextXMLContentHandler();
- parser.setContentHandler(handler);
- parser.parse(new InputSource(is));
+ parser.parse(new InputSource(is), handler);
return handler.getSaveContext();
}
return null;
@@ -198,6 +214,8 @@ public class SaveContextXMLWriter extends PrintWriter {
throw new TeamException(Policy.bind("RepositoryManager.ioException"), ex); //$NON-NLS-1$
} catch (IOException e) {
throw new TeamException(Policy.bind("RepositoryManager.ioException"), e); //$NON-NLS-1$
+ } catch (ParserConfigurationException e) {
+ throw new TeamException(Policy.bind("RepositoryManager.ioException"), e); //$NON-NLS-1$
} finally {
if(is != null) {
try {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java
index c6de5c808..5b5d9140f 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java
@@ -17,7 +17,6 @@ import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.eclipse.team.core.Team;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.core.target.TargetManager;
/**
* <code>TeamPlugin</code> is the plug-in runtime class for the Team
@@ -46,8 +45,6 @@ final public class TeamPlugin extends Plugin {
public static final String PROJECT_SET_EXTENSION = "projectSets"; //$NON-NLS-1$
// The id of the targets extension point
public static final String REPOSITORY_EXTENSION = "repository"; //$NON-NLS-1$
- // The id of the targets extension point
- public static final String TARGETS_EXTENSION = "targets"; //$NON-NLS-1$
// The one and only plug-in instance
@@ -67,7 +64,6 @@ final public class TeamPlugin extends Plugin {
public void startup() throws CoreException {
Policy.localize("org.eclipse.team.internal.core.messages"); //$NON-NLS-1$
Team.startup();
- TargetManager.startup();
}
/**
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/AuthenticatedSite.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/AuthenticatedSite.java
deleted file mode 100644
index 3e1b5f8ea..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/AuthenticatedSite.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.target;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.core.TeamPlugin;
-
-/**
- * This is a layer that contains anything which a Target Site implementation that uses authentication would need to have.
- */
-public abstract class AuthenticatedSite extends Site {
-
- protected String username;
- protected String password;
-
- /**
- * @see org.eclipse.team.internal.core.target.Site#dispose()
- */
- public void dispose() throws TeamException {
- try {
- Platform.flushAuthorizationInfo(getURL(), "", ""); //$NON-NLS-1$ //$NON-NLS-2$
- } catch (CoreException e) {
- throw new TeamException(e.getStatus());
- }
- }
-
- /**
- * Gets the username.
- * @return Returns a String
- */
- public String getUsername() {
- return username;
- }
-
- /**
- * Gets the password.
- * @return Returns a String
- */
- public String getPassword() {
- return password;
- }
-
- public void setUsername(String name) throws TeamException {
- Map authInfo=Platform.getAuthorizationInfo(getURL(), "", ""); //$NON-NLS-1$ //$NON-NLS-2$
- if (authInfo==null) authInfo=new HashMap(2);
- authInfo.put("name", name); //$NON-NLS-1$
- try {
- Platform.flushAuthorizationInfo(getURL(), "", ""); //$NON-NLS-1$ //$NON-NLS-2$
- Platform.addAuthorizationInfo(getURL(), "", "", authInfo); //$NON-NLS-1$ //$NON-NLS-2$
- this.username=name;
- } catch (CoreException e) {
- throw TeamPlugin.wrapException(e);
- }
- }
-
- public void setPassword(String password) throws TeamException {
- Map authInfo=Platform.getAuthorizationInfo(getURL(), "", ""); //$NON-NLS-1$ //$NON-NLS-2$
- if (authInfo==null) authInfo=new HashMap(2);
- authInfo.put("password", password); //$NON-NLS-1$
- try {
- Platform.flushAuthorizationInfo(getURL(), "", ""); //$NON-NLS-1$ //$NON-NLS-2$
- Platform.addAuthorizationInfo(getURL(), "", "", authInfo); //$NON-NLS-1$ //$NON-NLS-2$
- this.password=password;
- } catch (CoreException e) {
- throw TeamPlugin.wrapException(e);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/BaseIdentifierNotInitializedException.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/BaseIdentifierNotInitializedException.java
deleted file mode 100644
index e592b65b5..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/BaseIdentifierNotInitializedException.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.target;
-
-public class BaseIdentifierNotInitializedException extends Exception {
- /**
- * Default constructor for a <code>TeamProviderException</code>.
- */
- public BaseIdentifierNotInitializedException() {
- super();
- }
-
- /**
- * Constructor for a <code>TeamProviderException</code> that takes
- * a string description of the cause of the exception.
- *
- * @param message a message describing the cause of the exception.
- */
- public BaseIdentifierNotInitializedException(String message) {
- super(message);
- }
-}
-
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/IRemoteTargetResource.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/IRemoteTargetResource.java
deleted file mode 100644
index 9395cc77d..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/IRemoteTargetResource.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.target;
-
-import java.net.URL;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteResource;
-
-/**
- * Interface for target resources that are not local. This is a handle to a
- * clients-side 'proxy' for the server resource. There are no guarantees that
- * the handle is not stale or invalid.
- * <p>
- * Use <code>exists()</code> to verify is the associated server resource
- * exists.</p>
- * <p>
- * Methods that take progress monitors are expected to be long running and
- * may contact the server. Progress and cancellation will be provided. Clients
- * can assume that methods that don't take progress monitors are responsive
- * and won't contact the server.
- * </p>
- *
- * @see IRemoteResource
- */
-public interface IRemoteTargetResource extends IRemoteResource {
- /**
- * Returns the URL of this remote resource.
- */
- public URL getURL();
-
- /**
- * Returns the size of the resource.
- */
- public int getSize(IProgressMonitor monitor) throws TeamException;
-
- /**
- * Returns the last modified time
- */
- public String getLastModified(IProgressMonitor monitor) throws TeamException;
-
- /**
- * Return a boolean value indicating whether or not this resource exists on the
- * remote server.
- */
- public boolean exists(IProgressMonitor monitor) throws TeamException;
-
- /**
- * Creates the directory named by this URL, including any necessary but non-existant
- * parent directories.
- */
- public void mkdirs(IProgressMonitor monitor) throws TeamException;
-
- /**
- * Returns a handle to the remote file identified by the given path in this
- * folder.
- * <p>
- * This is a remote resource handle operation; neither the resource nor
- * the result need exist on the server.</p>
- * <p>
- * The supplied path may be absolute or relative; in either case, it is
- * interpreted as relative to this resource and is appended
- * to this container's full path to form the full path of the resultant resource.
- * A trailing separator is ignored.
- * </p>
- *
- * @param name the path of the remote member file
- * @return the (handle of the) remote file
- * @see #getFolder
- */
- public IRemoteTargetResource getFile(String name);
-
- /**
- * Returns a handle to the remote folder identified by the given path in this
- * folder.
- * <p>
- * This is a remote resource handle operation; neither the resource nor
- * the result need exist on the server.</p>
- * <p>
- * The supplied path may be absolute or relative; in either case, it is
- * interpreted as relative to this resource and is appended
- * to this container's full path to form the full path of the resultant resource.
- * A trailing separator is ignored.
- * </p>
- *
- * @param path the path of the remote member file
- * @return the (handle of the) remote file
- * @see #getFolder
- */
- public IRemoteTargetResource getFolder(String name);
-
- /**
- * Return the site where this remote resource exists
- */
- public Site getSite();
-
- /**
- * Return true if this can be reached (in some fashion).
- * This method is not guaranteed to catch all connection failure cases but is used
- * to at least test the waters.
- * @param monitor
- * @return boolean
- */
- boolean canBeReached(IProgressMonitor monitor) throws TeamException;
-
- /**
- * Delete the remote resource.
- */
- public void delete(IProgressMonitor monitor) throws TeamException;
-
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ISiteFactory.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ISiteFactory.java
deleted file mode 100644
index 972c1592b..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ISiteFactory.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.target;
-
-import java.io.ObjectInputStream;
-import java.util.Properties;
-
-/**
- * The <code>ISiteFactory</code> interface must be implemented by any plug-in
- * that is providing target management. It provides mechanisms for creating
- * concrete <code>Site</code> instances for it's target type.
- *
- * @see Site
- */
-public interface ISiteFactory {
- /**
- * Responsible for reading from the stream and restoring the classes fields
- * then returning a new <code>Site</code> instance. The <code>Site</code>
- * instances are written using the <code>Site#writeObject</code> method.
- *
- * @param is the input stream that contains the output of Site#writeObject
- * @return a new target site
- */
- public Site newSite(ObjectInputStream is);
-
- /**
- * Returns a new target site for the given target specific properties. This
- * is mainly used for testing purposes.
- *
- * @param properties the target specific location encoded in properties
- * @return a new target site
- */
- public Site newSite(Properties properties);
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ISiteListener.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ISiteListener.java
deleted file mode 100644
index 39820348a..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ISiteListener.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.target;
-
-public interface ISiteListener {
- public void siteAdded(Site site);
- public void siteRemoved(Site site);
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ITargetRunnable.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ITargetRunnable.java
deleted file mode 100644
index e78f7b5ff..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ITargetRunnable.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.target;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.TeamException;
-
-public interface ITargetRunnable {
- public void run(IProgressMonitor monitor) throws TeamException;
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ITeamStatusConstants.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ITeamStatusConstants.java
deleted file mode 100644
index 97fde4d33..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ITeamStatusConstants.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.target;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.team.core.Team;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.core.Policy;
-import org.eclipse.team.internal.core.TeamPlugin;
-
-public interface ITeamStatusConstants {
-
- public static final IStatus OK_STATUS = Team.OK_STATUS;
-
- public static final IStatus NOT_CHECKED_OUT_STATUS =
- new Status(
- IStatus.ERROR,
- TeamPlugin.ID,
- TeamException.NOT_CHECKED_OUT,
- Policy.bind("teamStatus.notCheckedOut"), //$NON-NLS-1$
- null);
-
- public static final IStatus NOT_CHECKED_IN_STATUS =
- new Status(
- IStatus.ERROR,
- TeamPlugin.ID,
- TeamException.NOT_CHECKED_IN,
- Policy.bind("teamStatus.notCheckedIn"), //$NON-NLS-1$
- null);
-
- public static final IStatus NO_REMOTE_RESOURCE_STATUS =
- new Status(
- IStatus.ERROR,
- TeamPlugin.ID,
- TeamException.NO_REMOTE_RESOURCE,
- Policy.bind("teamStatus.noRemoteResource"), //$NON-NLS-1$
- null);
-
- public static final IStatus IO_FAILED_STATUS =
- new Status(
- IStatus.ERROR,
- TeamPlugin.ID,
- TeamException.IO_FAILED,
- Policy.bind("teamStatus.ioFailed"), //$NON-NLS-1$
- null);
-
- public static final IStatus CONFLICT_STATUS =
- new Status(
- IStatus.ERROR,
- TeamPlugin.ID,
- TeamException.CONFLICT,
- Policy.bind("teamStatus.conflict"), //$NON-NLS-1$
- null);
-
- public static final IStatus REQUIRED_CONFIGURATION_MISSING =
- new Status(
- IStatus.ERROR,
- TeamPlugin.ID,
- -100,
- Policy.bind("provider.configuration.missing"), //$NON-NLS-1$
- null);
-
- public static final IStatus INVALID_CONFIGURATION =
- new Status(
- IStatus.ERROR,
- TeamPlugin.ID,
- -101,
- Policy.bind("provider.configuration.invalid"), //$NON-NLS-1$
- null);
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/LocationMapping.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/LocationMapping.java
deleted file mode 100644
index 0aeb4f483..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/LocationMapping.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.target;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.net.URL;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-
-public class LocationMapping {
-
- private final long SERIAL_ID = 1;
-
- private String type;
- private URL url;
- private IPath path;
-
- public LocationMapping(Site site, IPath path) {
- this.type = site.getType();
- this.url = site.getURL();
- this.path = path;
- }
-
- public LocationMapping(String type, URL url, IPath path) {
- this.type = type;
- this.url = url;
- this.path = path;
- }
-
- public LocationMapping(byte[] bytes) throws IOException {
- ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
- DataInputStream is = new DataInputStream(bis);
- long id = is.readLong();
- this.type = is.readUTF();
- this.url = new URL(is.readUTF());
- this.path = new Path(is.readUTF());
- }
-
-
- /**
- * Gets the type.
- * @return Returns a String
- */
- public String getType() {
- return type;
- }
-
- /**
- * Gets the locationId.
- * @return Returns a String
- */
- public URL getURL() {
- return url;
- }
-
- /**
- * @see Object#equals(Object)
- */
- public boolean equals(Object other) {
- if(this == other) return true;
- if(! (other instanceof LocationMapping)) return false;
- LocationMapping location = (LocationMapping)other;
- return getType().equals(location.getType()) &&
- getURL().equals(location.getURL()) &&
- getPath().equals(location.getPath());
- }
- /**
- * Gets the path.
- * @return Returns a IPath
- */
- public IPath getPath() {
- return path;
- }
-
-
- public byte[] encode() throws IOException {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- DataOutputStream os = new DataOutputStream(bos);
- os.writeLong(SERIAL_ID);
- os.writeUTF(getType());
- os.writeUTF(getURL().toExternalForm());
- os.writeUTF(getPath().toString());
- return bos.toByteArray();
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/RemoteTargetSyncElement.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/RemoteTargetSyncElement.java
deleted file mode 100644
index 5ee713aa0..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/RemoteTargetSyncElement.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.target;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.ILocalSyncElement;
-import org.eclipse.team.core.sync.IRemoteResource;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.core.sync.RemoteSyncElement;
-import org.eclipse.team.internal.core.Policy;
-import org.eclipse.team.internal.core.TeamPlugin;
-
-/**
- * Is a synchronization element that can calculate three-way sync
- * states based on timestamps. This is useful for synchronizing between
- * repositories without revision history and thus the base contents is
- * not available (e.g. non-versioning DAV, FTP...)
- *
- * @see IRemoteSyncElement
- */
-public class RemoteTargetSyncElement extends RemoteSyncElement {
-
- private IRemoteTargetResource remote;
- private IResource local;
- private TargetProvider provider;
-
- public RemoteTargetSyncElement(TargetProvider provider, IResource local, IRemoteTargetResource remote) {
- this.local = local;
- this.remote = remote;
- this.provider = provider;
- }
-
- /**
- * @see RemoteSyncElement#create(boolean, IResource, IRemoteResource, IRemoteResource, Object)
- */
- public IRemoteSyncElement create(boolean isThreeWay, IResource local, IRemoteResource base, IRemoteResource remote, Object data) {
- return new RemoteTargetSyncElement(provider, local, (IRemoteTargetResource)remote);
- }
-
- /**
- * @see RemoteSyncElement#timestampEquals(IResource, IRemoteResource)
- */
- protected boolean timestampEquals(IResource e1, IRemoteResource e2) {
- return false;
- }
-
- /**
- * @see RemoteSyncElement#timestampEquals(IRemoteResource, IRemoteResource)
- */
- protected boolean timestampEquals(IRemoteResource e1, IRemoteResource e2) {
- return false;
- }
-
- /**
- * @see LocalSyncElement#create(IResource, IRemoteResource, Object)
- */
- public ILocalSyncElement create(IResource local, IRemoteResource base, Object data) {
- return new RemoteTargetSyncElement(provider, local, (IRemoteTargetResource)base);
- }
-
- /**
- * @see LocalSyncElement#getData()
- */
- protected Object getData() {
- return null;
- }
-
- /**
- * @see LocalSyncElement#isIgnored(IResource)
- */
- protected boolean isIgnored(IResource resource) {
- return false;
- }
-
- /**
- * @see IRemoteSyncElement#getRemote()
- */
- public IRemoteResource getRemote() {
- return remote;
- }
-
- /**
- * @see IRemoteSyncElement#isThreeWay()
- */
- public boolean isThreeWay() {
- return true;
- }
-
- /**
- * @see ILocalSyncElement#getLocal()
- */
- public IResource getLocal() {
- return local;
- }
-
- /**
- * @see ILocalSyncElement#getBase()
- */
- public IRemoteResource getBase() {
- return null;
- }
-
- /**
- * @see ILocalSyncElement#getSyncKind(int, IProgressMonitor)
- */
- public int getSyncKind(int granularity, IProgressMonitor progress) {
- progress.beginTask(null, 100);
- int description = IN_SYNC;
- IResource local = getLocal();
- boolean localExists = local.exists();
- boolean hasBase = provider.hasBase(local);
- boolean isOutgoing;
- boolean isIncoming;
- if (hasBase) {
- isOutgoing = provider.isDirty(local);
- isIncoming = isOutOfDate(Policy.subMonitorFor(progress, 10));
- } else {
- // if there's no base, use existance to determine direction
- isOutgoing = localExists;
- isIncoming = remote != null;
- }
-
- if (remote == null) {
- if (!localExists) {
- // this should never happen
- // Assert.isTrue(false);
- } else {
- // no remote but a local
- if (!isOutgoing && isIncoming) {
- description = INCOMING | DELETION;
- } else if (isOutgoing && isIncoming) {
- description = CONFLICTING | CHANGE;
- } else if (!isOutgoing && !isIncoming) {
- description = OUTGOING | ADDITION;
- } else if (isOutgoing && !isIncoming) {
- description = OUTGOING | ADDITION;
- }
- }
- } else {
- if (!localExists) {
- // a remote but no local
- if (!isOutgoing /* and both out of date and not out of date */) {
- description = INCOMING | ADDITION;
- } else if (isOutgoing && !isIncoming) {
- description = OUTGOING | DELETION;
- } else if (isOutgoing && isIncoming) {
- description = CONFLICTING | CHANGE;
- }
- } else {
- // have a local and a remote
- if (!isOutgoing && !isIncoming) {
- // ignore, there is no change;
- } else if (!isOutgoing && isIncoming) {
- description = INCOMING | CHANGE;
- } else if (isOutgoing && !isIncoming) {
- description = OUTGOING | CHANGE;
- } else {
- description = CONFLICTING | CHANGE;
- }
- // if contents are the same, then mark as pseudo change
- if (description != IN_SYNC && compare(granularity, false, local, remote, Policy.subMonitorFor(progress, 90)))
- description |= PSEUDO_CONFLICT;
- }
- }
- return description;
- }
- /**
- * Returns the provider.
- * @return TargetProvider
- */
- protected TargetProvider getProvider() {
- return provider;
- }
-
- /**
- * Return true if the resource associated with the receiver is out-of-date
- */
- protected boolean isOutOfDate(IProgressMonitor monitor) {
- IResource local = getLocal();
- if (provider.hasBase(local)) {
- try{
- return provider.isOutOfDate(local, monitor);
- } catch(TeamException e) {
- TeamPlugin.log(e);
- return true;
- }
- }
- return false;
- }
-
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ResourceState.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ResourceState.java
deleted file mode 100644
index e8033b1b2..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ResourceState.java
+++ /dev/null
@@ -1,826 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.target;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.core.Assert;
-import org.eclipse.team.internal.core.NullSubProgressMonitor;
-import org.eclipse.team.internal.core.Policy;
-import org.eclipse.team.internal.core.TeamPlugin;
-
-/**
- * This abstract class implements the state of a local and corresponding remote resource,
- * and behavior of those resources.
- * <p>
- * Common state for all 'managed' resources includes:
- * <ul>
- * <li>the local resource and corresponding remote resource objects</li>
- * <li>the timestamp of the local resource as it was last in synch with the provider</li>
- * <li>an identifier for the remote resource as it was last in synch with the provider</li>
- */
-public abstract class ResourceState {
-
- /*
- * Serialization format identifier.
- * see toBytes() and fromBytes()
- */
- private static final int BYTES_FORMAT = 0;
-
- /*
- * These constants are used to indicate uninitialized values for the local
- * base timestamp and remote base identifier.
- */
- protected static final long EMPTY_LOCALBASETS = -1L;
- protected static final String EMPTY_REMOTEBASEID = "Undefined:"; //$NON-NLS-1$
-
- /*
- * The base state of the resource. The 'base' is the state of the resource
- * state that was fetched from (or put in) the provider.
- */
- protected long localBaseTimestamp = EMPTY_LOCALBASETS;
- protected String remoteBaseIdentifier = EMPTY_REMOTEBASEID;
-
- protected boolean checkedOut = true;
-
- /*
- * This is the local resource that the receiver represents. It is initialized by
- * the constructor. (The remote resource is maintained by specific subclasses
- * as it is type-dependent.)
- */
- protected IResource localResource;
-
- protected QualifiedName stateKey = new QualifiedName("org.eclipse.team.target", "state_info"); //$NON-NLS-1$ //$NON-NLS-2$
-
- protected URL rootUrl;
-
- /**
- * Constructor for a resource state given a local resource.
- * Remember which local resource this state represents.
- *
- * @param localResource the local part of a synchronized pair of resources.
- */
- public ResourceState(IResource localResource, URL rootUrl) {
- super();
- this.rootUrl = rootUrl;
- SynchronizedTargetProvider.getSynchronizer().add(stateKey);
- this.localResource = localResource;
- }
-
- /**
- * Get the timestamp that represents the base state of the local resource, that is
- * the state that the local resource had when it was initially fetched from the repository.
- *
- * @return the timestamp of the local state of the resource (as reported by
- * java.io.File.getLastModified()) at the point the resource was downloaded to the
- * workspace.
- * @throws BaseIdentifierNotInitializedException if the resource has not yet been
- * downloaded.
- */
- public long getLocalBaseTimestamp()
- throws BaseIdentifierNotInitializedException {
- if (localBaseTimestamp == EMPTY_LOCALBASETS)
- throw new BaseIdentifierNotInitializedException();
- return localBaseTimestamp;
- }
-
-
- /**
- * Get the identifier that represents the base state of the remote resource, that is
- * the state of the remote resource when it was fetched as the base state of the
- * local resource.
- * <p>
- * In general, repositories have arbitrary ways to distinguish resource states.
- * The result should only be used for equality comparison, there should be no
- * ordering or other information implied from the value returned. For example,
- * the value may be a version identifier, timestamp, ETag, etc. To ensure
- * schemes do not inadvertantly test equal it is recommended that the identifier
- * be a URI where the scheme denotes the value type,
- * e.g., date-rfc1123:Fri, 16 Nov 2001 06:25:24 GMT</p>
- *
- * @return an opaque identifier to the base state of the resource in the provider.
- * @throws BaseIdentifierNotInitializedException if the resource has not yet been
- * downloaded.
- */
- public String getRemoteBaseIdentifier()
- throws BaseIdentifierNotInitializedException {
- if (remoteBaseIdentifier.equals(EMPTY_REMOTEBASEID))
- throw new BaseIdentifierNotInitializedException();
- return remoteBaseIdentifier;
- }
-
-
- /**
- * Get the identifier that represents the released state of the resource,
- * that is the state that it currently has in the repository.
- * <p>
- * In general, repositories have arbitrary ways to distinguish resource states.
- * The result should only be used for equality comparison, there should be no
- * ordering or other information implied from the value returned. For example,
- * the value may be a version identifier, timestamp, ETag, etc. To ensure
- * schemes do not inadvertantly test equal it is recommended that the identifier
- * be a URI where the scheme denotes the value type,
- * e.g., date-rfc1123:Fri, 16 Nov 2001 06:25:24 GMT</p>
- *
- * @param progress a progress monitor to indicate the duration of the operation, or
- * <code>null</code> if progress reporting is not required.
- * @return an opaque identifier to the current released state of the resource in
- * the provider.
- * @throws TeamException if there is a problem getting the released state
- * identifier from the provider. Valid exception status codes include:
- * <ul>
- * <li>IO_FAILED</li>
- * <li>NO_REMOTE_RESOURCE</li>
- * </ul></p>
- */
- public abstract String getReleasedIdentifier(IProgressMonitor monitor) throws TeamException;
-
- /**
- * Check out the receiver. Return a status if the receiver is in the wrong state for the operation to be performed.
- *
- * @throws TeamException if there is a error communicating with the resource from the server.
- */
- public void checkout(IProgressMonitor progress) throws TeamException {
- progress.beginTask(null, 100);
- try {
- // Not going to allow branching.
- if (isOutOfDate(Policy.subMonitorFor(progress, 50)))
- throw new TeamException(ITeamStatusConstants.CONFLICT_STATUS);
-
- // Sanity check.
- if (!hasRemote(Policy.subMonitorFor(progress, 50)))
- throw new TeamException(ITeamStatusConstants.NO_REMOTE_RESOURCE_STATUS);
-
- // Legally, the resource must be checked in before it can be checked out.
- if (isCheckedOut())
- throw new TeamException(ITeamStatusConstants.NOT_CHECKED_IN_STATUS);
-
- // Do the provider specific action for check-out.
- basicCheckout(progress);
- } finally {
- progress.done();
- }
- }
-
- /**
- * A basic checkout is provider specific.
- * Unless overridden, work in an optimistic mode.
- */
- protected void basicCheckout(IProgressMonitor progress) throws TeamException {
- checkedOut = true;
- }
-
-
- /**
- * Check in the receiver.
- *
- * @throws TeamException if there is a error communicating with the resource from the server.
- */
- public void checkin(IProgressMonitor progress) throws TeamException {
- progress = Policy.monitorFor(progress);
- progress.beginTask(null, 100);
- try {
- // The resource must be checked out before it can be checked in.
- if (!isCheckedOut())
- throw new TeamException(ITeamStatusConstants.NOT_CHECKED_OUT_STATUS);
-
- if (!hasLocal()) {
- if (hasRemote(Policy.subMonitorFor(progress, 10))) {
- delete(Policy.subMonitorFor(progress, 80));
- }
- } else {
- // Ensure the necessary remote direcotories exist
- mkRemoteDirs(Policy.subMonitorFor(progress, 10));
- // Copy from the local resource to the repository.
- if (getLocal().getType() == IResource.FILE) {
- upload(Policy.subMonitorFor(progress, 80));
- }
- }
- //if we got to here the upload succeeded (didn't throw)
- checkedOut = false;
- } finally {
- progress.done();
- }
- }
-
- /**
- * Uncheckout the receiver.
- */
- public void uncheckout(IProgressMonitor progress) throws TeamException {
- // Has to be checked-out before it can be reversed.
- if (!isCheckedOut())
- throw new TeamException(ITeamStatusConstants.NOT_CHECKED_OUT_STATUS);
-
- // Nothing interesting to do since the API spec. requires that we do not reverse
- // any local changes.
- checkedOut = false;
- }
-
- /**
- * Answer whether the receiver is checked out or not.
- * <p>
- * Note that this is a quick operation that will be called from the UI, so providers are required
- * to cache information that is expensive to compute. Where the cache may get stale users
- * have the opportunity to force a refresh using ITeamProvider.refreshState().
- *
- * @return <code>true</code> if the receiver is checked in, and <code>false</code>
- * if it is not.
- * @see ITeamProvider#isCheckedOut(IResource)
- * @see ITeamProvider#refreshState(IResource[], int, IProgressMonitor)
- */
- public boolean isCheckedOut() {
- return checkedOut;
- }
-
- /**
- * Answer if the local resource currently has a different timestamp to the
- * base timestamp for this resource.
- *
- * @return <code>true</code> if the resource has a different modification
- * timestamp, and <code>false</code> otherwise.
- * @see ITeamProvider#isDirty(IResource)
- */
- public boolean isDirty() {
- if (!hasPhantom()) return false;
- if (!hasLocal()) return true;
- if (localBaseTimestamp == EMPTY_LOCALBASETS)
- return localResource.getType() == IResource.FILE;
- return localBaseTimestamp != localResource.getModificationStamp();
- }
-
- /**
- * Answers true if the base identifier of the given resource is different to the
- * current released state of the resource.
- */
- public boolean isOutOfDate(IProgressMonitor monitor) throws TeamException {
- if (!hasPhantom()) return false;
- if (remoteBaseIdentifier.equals(EMPTY_REMOTEBASEID)) return false;
- String releasedIdentifier = getReleasedIdentifier(monitor);
- return !remoteBaseIdentifier.equals(releasedIdentifier);
- }
-
- /**
- * Download the remote resource represented by the receiver state to the location
- * represented by the local resource (i.e., resource.getLocation().toFile()).
- * This copies from the provider to the workspace, <em>and</em> sets the local
- * base timestamp and remote base identifier.
- * The provider may (and should wherever possible) optimize the case where it
- * knows the local resource is identical to the remote resource.
- */
- public abstract void download(IProgressMonitor progress) throws TeamException;
-
- /**
- * Upload the resource represented by the local resource to the remote
- * resource represented by the receiver. This copies from the workspace to
- * the provider <em>and</em> sets the local base timestamp and remote base
- * identifier.
- */
- public abstract void upload(IProgressMonitor progress) throws TeamException;
-
- /**
- * Delete the remote resource.
- */
- public abstract void delete(IProgressMonitor progress) throws TeamException;
-
- /**
- * Answer if the remote resource exists.
- */
- public abstract boolean hasRemote(IProgressMonitor monitor) throws TeamException;
-
- /**
- * Answer the type of the remote resource (if it exists).
- * The type should correspond to the IResource enumerated types.
- */
- public abstract int getRemoteType();
-
- /**
- * Answer the array of resource states for each member of the receiver.
- * If the receiver has no members (or is incapable of having members)
- * answer an empty array.
- */
- public abstract ResourceState[] getRemoteChildren(IProgressMonitor monitor) throws TeamException;
-
- /**
- * Create the necessary remote directories corresponding to the local resource.
- * That is, if the resource is a folder, create it and its parents if they don't
- * already exist. If the resource is a file, create its parents if they don't
- * already exist.
- */
- protected abstract void mkRemoteDirs(IProgressMonitor monitor) throws TeamException;
-
- /**
- */
- public IResource getLocal() {
- return localResource;
- }
-
- /**
- * Get the file underlying the local resource.
- */
- protected File getLocalFile() {
- return localResource.getLocation().toFile();
- }
-
- /**
- * Answer if the local resource exists.
- */
- protected boolean hasLocal() {
- return localResource.exists();
- }
-
- /**
- * Answer if the local resource has a phantom, which indicates that the respource had both a local
- * and remote version at one time.
- */
- protected boolean hasPhantom() {
- try {
- return SynchronizedTargetProvider.getSynchronizer().getSyncInfo(stateKey, localResource) != null;
- } catch (CoreException e) {
- TeamPlugin.log(e);
- return false;
- }
- }
-
- /**
- * Initializes the resource state instance from the given serialized state.
- * The format of the serialized state is that produced by <code>toBytes()</code>.
- *
- * @param bytes the serialized resource state.
- */
- public final void loadState() throws TeamException {
- try {
- byte[] storedState =
- SynchronizedTargetProvider.getSynchronizer().getSyncInfo(stateKey, localResource);
- if (storedState != null)
- fromBytes(storedState);
- } catch (CoreException e) {
- throw TeamPlugin.wrapException(e);
- }
- }
-
- /**
- * Initializes the resource state instance from the given serialized state.
- * The format of the serialized state is that produced by <code>toBytes()</code>.
- *
- * @param bytes the serialized resource state.
- */
- protected void fromBytes(byte[] bytes) throws TeamException{
- try {
- DataInputStream dataStream =
- new DataInputStream(new ByteArrayInputStream(bytes));
- if (BYTES_FORMAT != dataStream.readByte())
- return;
-
- // Restore common resource state values.
- remoteBaseIdentifier = dataStream.readUTF();
- localBaseTimestamp = dataStream.readLong();
-
- } catch (IOException e) {
- throw TeamPlugin.wrapException(e);
- }
- };
-
- public final void storeState() throws TeamException {
- try {
- SynchronizedTargetProvider.getSynchronizer().setSyncInfo(
- stateKey,
- localResource,
- toBytes());
- // Ensure that the parent has base info recorded (otherwise deleting the parent will cause the lose of sync info)
- if (localResource.getType() == IResource.PROJECT) return;
- IContainer parent = localResource.getParent();
- if (parent != null && parent.getType() != IResource.PROJECT &&
- SynchronizedTargetProvider.getSynchronizer().getSyncInfo(stateKey, parent) == null) {
- getParent().storeState();
- } else {
- ResourcesPlugin.getWorkspace().save(false, null);
- }
- } catch (CoreException e) {
- throw TeamPlugin.wrapException(e);
- }
- }
-
- /**
- * Answer the resource state as a sequence of bytes, in a format that can be used to
- * reconstruct an equivalent resource state using the <code>fromBytes(byte[])</code>
- * method.
- * <p>
- * Subclasses should implement <code>storeState(DataOutputStream)</code> to
- * store provider specific state information.</p>
- *
- * @return the resource state as a byte array.
- * @see #storeState(DataOutputStream)
- * @see fromBytes(byte[])
- */
- protected byte[] toBytes() throws TeamException {
- try {
- // Create a stream to store the byte representation of the receiver's state.
- ByteArrayOutputStream byteStream = new ByteArrayOutputStream(32);
- // Guess ~32 bytes
- DataOutputStream dataStream = new DataOutputStream(byteStream);
- dataStream.writeByte(BYTES_FORMAT);
-
- // Store data common to all resource states.
- dataStream.writeUTF(remoteBaseIdentifier);
- dataStream.writeLong(localBaseTimestamp);
-
- dataStream.close();
- return byteStream.toByteArray();
- } catch (IOException e) {
- throw TeamPlugin.wrapException(e);
- }
- }
-
- final public void removeState() throws TeamException {
- try {
- if (localResource.exists() || localResource.isPhantom()) {
- SynchronizedTargetProvider.getSynchronizer().flushSyncInfo(
- stateKey,
- localResource,
- IResource.DEPTH_INFINITE);
- }
- } catch (CoreException e) {
- throw TeamPlugin.wrapException(e);
- }
- }
-
- /**
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class)
- */
- public Object getAdapter(Class adapter) {
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
-
- /**
- * Method getRoot.
- * @return URL of this resource's parent
- */
- public URL getRoot() {
- return rootUrl;
- }
-
- private ResourceState getParent() throws TeamException {
- return getResourceStateFor(localResource.getParent());
- }
-
- private ResourceState getResourceStateFor(IResource resource) throws TeamException {
- TargetProvider provider = TargetManager.getProvider(resource.getProject());
- return ((SynchronizedTargetProvider)provider).getState(resource);
- }
-
- /**
- * Get the resource corresponding to the receiver to the specified depth.
- */
- protected final void get(int depth, IProgressMonitor progress) throws TeamException {
-
- progress = Policy.monitorFor(progress);
-
- // the no progress monitor is used to control the progress given to
- // other methods and ensures that the progress monitor is not overloaded
- // with subtask messages and work. The null monitor does propagate
- // cancellation.
- IProgressMonitor noProgress = new NullSubProgressMonitor(progress);
- try {
- progress.beginTask(null, 100);
- Policy.checkCanceled(progress);
-
- // If remote does not exist then simply ensure no local resource exists.
- if (!hasRemote(noProgress)) {
- if (hasLocal())
- deleteLocal(noProgress);
- return;
- }
-
- // Ensure that the required local folders exist
- if (!hasLocal()) {
- mkLocalDirs(noProgress);
- }
-
- // If the remote resource is a file, download the remote contents
- if (getRemoteType() == IResource.FILE) {
- download(Policy.subMonitorFor(progress, 100));
- return;
- }
-
- // The remote resource is a container.
-
- // If the local resource is a file, we must remove it first.
- if (getLocal().getType() == IResource.FILE) {
- if (hasLocal()) {
- deleteLocal(noProgress); // May not exist.
- }
- // change the local resource to a folder and create it
- localResource = localResource.getParent().getFolder(new Path(localResource.getName()));
- mkLocalDirs(noProgress);
- }
-
- // Finally, resolve the collection membership based upon the depth parameter.
- switch (depth) {
- case IResource.DEPTH_ZERO :
- // If we are not considering members of the collection then we are done.
- return;
- case IResource.DEPTH_ONE :
- // If we are considering only the immediate members of the collection
- getFolderShallow(Policy.subMonitorFor(progress, 100));
- return;
- case IResource.DEPTH_INFINITE :
- // We are going in deep.
- getFolderDeep(Policy.subMonitorFor(progress, 100));
- return;
- default :
- // We have covered all the legal cases.
- Assert.isLegal(false);
- return; // Never reached.
- } // end switch
- } finally {
- progress.done();
- }
- }
-
- /**
- * Get the folder resource represented by the receiver deeply.
- */
- protected final void getFolderDeep(IProgressMonitor progress) throws TeamException {
- progress = Policy.monitorFor(progress);
- try {
- progress.beginTask(null, 10);
- // Could throw if problem getting the folder at this level.
- ResourceState[] childFolders = getFolderShallow(Policy.subMonitorFor(progress, 7));
-
- // If there are no further children then we are done.
- if (childFolders.length == 0)
- return;
-
- IProgressMonitor subProgress = Policy.subMonitorFor(progress, 3);
- // Collect the responses in the multistatus.
- try {
- subProgress.beginTask(null, childFolders.length);
- for (int i = 0; i < childFolders.length; i++) {
- childFolders[i].get(IResource.DEPTH_INFINITE, Policy.subMonitorFor(subProgress, 1));
- }
- } finally {
- subProgress.done();
- }
-
- return;
- } finally {
- progress.done();
- }
- }
-
- /**
- * Synchronize from the remote provider to the workspace.
- * Assume that the 'remote' folder is correct, and change the local
- * folder to look like the remote folder.
- *
- * returns an array of children of the remote resource that are themselves
- * collections.
- */
- protected final ResourceState[] getFolderShallow(IProgressMonitor progress) throws TeamException {
- progress = Policy.monitorFor(progress);
- IProgressMonitor noProgress = new NullProgressMonitor();
- try {
- // We are assuming that the resource is a container.
- Assert.isLegal(getLocal() instanceof IContainer);
- IContainer localContainer = (IContainer)getLocal();
-
- // Get list of all _remote_ children.
- ResourceState[] remoteChildren = getRemoteChildren(noProgress);
-
- // This will be the list of remote children that are themselves containers.
- Set remoteChildFolders = new HashSet();
-
- // Make a list of _local_ children that have not yet been processed,
- IResource[] localChildren = getLocalChildren();
- Set surplusLocalChildren = new HashSet(localChildren.length);
- surplusLocalChildren.addAll(Arrays.asList(localChildren));
-
- progress.beginTask(null, remoteChildren.length * 100);
- // For each remote child that is a file, make the local file content equivalent.
- for (int i = 0; i < remoteChildren.length; i++) {
- Policy.checkCanceled(progress);
- ResourceState remoteChildState = remoteChildren[i];
- // If the remote child is a container add it to the list, and ensure that the local child
- // is a folder if it exists.
- if (remoteChildState.getRemoteType() == IResource.FILE) {
- // The remote resource is a file. Copy the content of the remote file
- // to the local file, overwriting any existing content that may exist, and
- // creating the file if it doesn't.
- remoteChildState.download(Policy.subMonitorFor(progress, 100));
- // Remember that we have processed this child.
- surplusLocalChildren.remove(remoteChildState.getLocal());
- } else {
- // The remote resource is a container.
- remoteChildFolders.add(remoteChildState);
- // If the local child is not a container then it must be deleted.
- IResource localChild = remoteChildState.getLocal();
- if (localChild.exists() && (!(localChild instanceof IContainer)))
- remoteChildState.deleteLocal(noProgress);
- } // end if
- } // end for
-
- // Remove each local child that does not have a corresponding remote resource.
- TargetProvider provider = TargetManager.getProvider(localContainer.getProject());
- Iterator childrenItr = surplusLocalChildren.iterator();
- while (childrenItr.hasNext()) {
- IResource unseenChild = (IResource) childrenItr.next();
- ((SynchronizedTargetProvider)provider).newState(unseenChild).deleteLocal(noProgress);
- } // end-while
-
- // Answer the array of children seen on the remote collection that are
- // themselves collections (to support depth operations).
- return (ResourceState[]) remoteChildFolders.toArray(
- new ResourceState[remoteChildFolders.size()]);
- } finally {
- progress.done();
- }
- }
-
- /**
- * Delete the local resource represented by the resource state. Do not complain if the resource does not exist.
- */
- protected final void deleteLocal(IProgressMonitor progress) throws TeamException {
- try {
- getLocal().delete(IResource.KEEP_HISTORY, progress);
- removeState();
- } catch (CoreException exception) {
- throw TeamPlugin.wrapException(exception);
- }
- }
-
- /**
- * Make the local directories matching the description of the local resource state.
- */
- protected final void mkLocalDirs(IProgressMonitor progress) throws TeamException {
- try {
- IResource resource = getLocal();
- if (resource.getType() == IResource.FILE) {
- resource = resource.getParent();
- }
- if (resource.getType() == IResource.FOLDER && ! resource.exists()) {
- if (!resource.getParent().exists()) {
- ResourceState parent=getResourceStateFor(resource.getParent());
- parent.mkLocalDirs(progress);
- }
- ((IFolder)resource).create(false /* force */, true /* make local */, progress);
- // Mark the folders as having a base
- storeState();
- }
- } catch (CoreException exception) {
- // The creation failed.
- throw TeamPlugin.wrapException(exception);
- }
- }
-
- /**
- * Get an array of local children of the given container, or an empty array if the
- * container does not exist or has no children.
- */
- protected final IResource[] getLocalChildren() throws TeamException {
- // We are assuming that the resource is a container.
- Assert.isLegal(getLocal() instanceof IContainer);
- IContainer container = (IContainer)getLocal();
- if (container.exists())
- try {
- return container.members();
- } catch (CoreException exception) {
- throw TeamPlugin.wrapException(exception);
- }
- return new IResource[0];
- }
-
- /**
- * Put the resource from the workspace to the remote provider.
- * Assume that the 'local' resource is correct, and change the remote
- * resource to look like the local resource. This includes removing any
- * child resources that exist remotely but do not exist locally.
- */
- protected final void put(IProgressMonitor progress) throws TeamException {
-
- progress = Policy.monitorFor(progress);
-
- // the no progress monitor is used to control the progress given to
- // other methods and ensures that the progress monitor is not overloaded
- // with subtask messages and work. The null monitor does propagate
- // cancellation.
- IProgressMonitor noProgress = new NullSubProgressMonitor(progress);
- try {
- // Check cancellation
- progress.beginTask(null, 100);
- Policy.checkCanceled(progress);
-
- // This operation is inefficient
-// // Ensure that the remote type matches the local type
-// boolean hasRemote = hasRemote(noProgress);
-// if ((getRemoteType() != localResource.getType() && localResource.getType() != IResource.PROJECT)) {
-// if (hasRemote) delete(noProgress);
-// hasRemote = false;
-// }
-
- // Upload the resource (this is a shallow operation for folders)
- checkin(Policy.subMonitorFor(progress, 75));
-
- // If we're putting a file, we're done
- if (localResource.getType() == IResource.FILE) return;
-
- // If the local doesn't exist then we just deleted the remote so we're done
- if (!hasLocal()) return;
-
- // Make a list of _remote_ children that have not yet been processed,
- Map surplusRemoteChildren = new HashMap();
- boolean hasRemote = hasRemote(noProgress); // XXX is this needed?
- if (hasRemote) {
- ResourceState[] remoteChildren = remoteChildren = getRemoteChildren(progress);
- for (int i = 0; i < remoteChildren.length; i++) {
- ResourceState resourceState = remoteChildren[i];
- surplusRemoteChildren.put(resourceState.getLocal(), resourceState);
- }
- }
-
- // For each local child that is a file, make the remote file content equivalent.
- IResource[] localChildren = getLocalChildren();
- IProgressMonitor subMonitor = Policy.subMonitorFor(progress, 25);
- try {
- subMonitor.beginTask(null, localChildren.length * 100);
- for (int i = 0; i < localChildren.length; i++) {
- IResource localChild = localChildren[i];
- // Get the resource state corresponding to the local resource
- ResourceState state = (ResourceState)surplusRemoteChildren.get(localChild);
- if (state == null) {
- // There is no remote corresponding to the local
- state = getResourceStateFor(localChild);
- } else {
- // There is a remote. Remember that we have processed this child.
- surplusRemoteChildren.remove(localChild);
- }
- // Put the child (this is a deep operation for folders)
- state.put(Policy.subMonitorFor(subMonitor, 100));
- }
- } finally {
- subMonitor.done();
- }
-
- // Remove each remote child that does not have a corresponding local resource.
- Iterator childrenItr = surplusRemoteChildren.values().iterator();
- while (childrenItr.hasNext()) {
- ResourceState unseenChild = (ResourceState) childrenItr.next();
- unseenChild.delete(noProgress);
- }
- } finally {
- progress.done();
-
- }
- }
-
- /**
- * Method to be used only by subclasses to set the remoteBaseIdentifier after
- * an upload or download.
- *
- * @param remoteBaseIdentifier The remoteBaseIdentifier to set
- */
- protected void setRemoteBaseIdentifier(String remoteBaseIdentifier) {
- this.remoteBaseIdentifier = remoteBaseIdentifier;
- }
-
- /**
- * Method to be used only by subclasses to set the localBaseTimestamp after
- * an upload or download.
- *
- * @param localBaseTimestamp The localBaseTimestamp to set
- */
- public void setLocalBaseTimestamp(long localBaseTimestamp) {
- this.localBaseTimestamp = localBaseTimestamp;
- }
-
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/Site.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/Site.java
deleted file mode 100644
index ff4c6ab2b..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/Site.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.target;
-
-import java.io.ObjectOutputStream;
-import java.net.URL;
-import java.util.Properties;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.team.core.TeamException;
-
-/**
- * A <code>Site</code> is a place where resources can be deployed and
- * retrieved via a target provider.
- *
- * @see ISiteFactory
- */
-public abstract class Site {
-
- //The location of the site's resources:
- private URL rootUrl;
-
- /**
- * Answers a <code>TargetProvider</code> instance for the given path at
- * this site.
- */
- public abstract TargetProvider newProvider(IPath intrasitePath)
- throws TeamException;
-
- /**
- * Answers the type identifier for this site. For example:
- * <blockquote><pre>
- * org.eclipse.team.target.webdav
- * </pre></blockquote>
- *
- * @return string identifier for this site
- */
- public abstract String getType();
-
- /**
- * Answers a string that can be displayed to the user that represents
- * this site. For example:
- * <blockquote><pre>
- * http://usename@www.mysite.com/dav (WebDav)
- * </pre></blockquote>
- */
- public String getDisplayName() {
- return getURL().toExternalForm();
- }
-
- /**
- * Writes the state of this site such that the corresponding concrete
- * <code>ISiteFactory</code> class can restore the site.
- *
- * @param os the object stream into which to write it's state
- */
- public abstract void writeObject(ObjectOutputStream os);
-
- /**
- * Returns a handle to the remote resource that represents this site
- * on the server.
- *
- * @return a remote handle to this site that may or may not exist
- */
- public IRemoteTargetResource getRemoteResource() throws TeamException {
- return newProvider(Path.EMPTY).getRemoteResource();
- }
-
- /**
- * Compares two Sites. The result is <code>true</code> if and only if
- * the argument is not <code>null</code> and is a Site object that
- * represents the same Site as this object. Two Site objects are equal
- * if they have the same types and URLs.
- *
- * @param other the Site to compare with
- *
- * @return <code>true</code> if the Sites are the same; <code>false</code>
- * otherwise
- *
- * @see Object#equals(Object)
- */
- public boolean equals(Object other) {
- if (this == other) return true;
- if (!(other instanceof Site)) return false;
- Site location = (Site)other;
- if (!getType().equals(location.getType())) return false;
- URL url = getURL();
- if (url == null) return super.equals(other);
- return url.equals(location.getURL());
- }
-
- public int hashCode() {
- URL url = getURL();
- if (url == null) return super.hashCode();
- return url.hashCode();
- }
-
- /**
- * Debugging helper
- *
- * @see Object#toString()
- */
- public String toString() {
- return getDisplayName();
- }
-
- /**
- * Should be called whenever a site is being deleted from the workspace.
- * This method removes the encrypted login info stored for the site.
- * @throws TeamException
- */
- public abstract void dispose() throws TeamException;
-
- /**
- * Answers the location of this site as a URL. For example:
- * <blockquote><pre>
- * http://www.mysite.com:14356/dav
- * </pre></blockquote>
- *
- * @return URL location of this site
- */
- public URL getURL() {
- return rootUrl;
- }
-
- /**
- * Sets the rootUrl.
- * @param rootUrl The rootUrl to set
- */
- protected void setURL(URL rootUrl) {
- this.rootUrl = rootUrl;
- }
-
- public abstract Properties getConfiguration();
-
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/SynchronizedTargetProvider.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/SynchronizedTargetProvider.java
deleted file mode 100644
index 8f5a7a137..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/SynchronizedTargetProvider.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.target;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ISynchronizer;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.core.Policy;
-import org.eclipse.team.internal.core.TeamPlugin;
-
-public abstract class SynchronizedTargetProvider extends TargetProvider {
-
- private static final int CONFIG_FORMAT_VERSION = 2;
-
- // The location where the target reads/writes against
- protected Site site;
- // The path relative to the site where the target reads/writes against
- protected IPath intrasitePath;
- // The URL which combines the site and relative path
- protected URL targetURL;
-
- /*
- * Answers the synchronizer.
- */
- final protected static ISynchronizer getSynchronizer() {
- return ResourcesPlugin.getWorkspace().getSynchronizer();
- }
-
- public SynchronizedTargetProvider(Site site, IPath intrasitePath) throws TeamException {
- this.intrasitePath = intrasitePath;
- this.site = site;
- // Create the combined URL here so we know it's good
- String root = getSite().getURL().toExternalForm();
- try {
- targetURL = UrlUtil.concat(root, intrasitePath);
- } catch (MalformedURLException e) {
- throw new TeamException(Policy.bind(Policy.bind("SynchronizedTargetProvider.invalidURLCombination"), root, intrasitePath.toString()), e); //$NON-NLS-1$
- }
- }
-
- /*
- * Answers a new state based on an existing local resource.
- */
- abstract public ResourceState newState(IResource resource);
-
- /*
- * Answers a new state based on an existing local resource and
- * an associated existing remote resource.
- */
- abstract public ResourceState newState(IResource resource, IRemoteTargetResource remote);
-
- /**
- * @see TargetProvider#getSite()
- */
- public Site getSite() {
- return site;
- }
-
- /**
- * @see TargetProvider#getURL()
- */
- public URL getURL() {
- return targetURL;
- }
-
- /*
- * Get the state descriptor for a given resource.
- */
- public ResourceState getState(IResource resource) throws TeamException {
- // Create a new resource state with default values.
- ResourceState state = newState(resource);
- state.loadState();
- return state;
- }
-
- /*
- * Get the state descriptor for a given resource.
- */
- public ResourceState getState(IResource resource, IRemoteTargetResource remote) throws TeamException {
- // Create a new resource state with default values.
- ResourceState state = newState(resource, remote);
- state.loadState();
- return state;
- }
-
- /**
- * Get the resource from the provider to the workspace, and remember the fetched
- * state as the base state of the resource.
- *
- * @see TargetProvider.get(IResource[], int, IProgressMonitor)
- */
- public void get(final IResource[] resources, IProgressMonitor progress) throws TeamException {
- run(new ITargetRunnable() {
- public void run(IProgressMonitor monitor) throws TeamException {
- monitor = Policy.monitorFor(monitor);
- try {
- monitor.beginTask(null, resources.length * 100);
- for (int i = 0; i < resources.length; i++) {
- getState(resources[i]).get(IResource.DEPTH_INFINITE, Policy.subMonitorFor(monitor, 100));
- }
- } finally {
- monitor.done();
- }
- }
- }, Policy.monitorFor(progress));
- }
-
- /**
- * Get the resource from the provider to the workspace, and remember the fetched
- * state as the base state of the resource.
- *
- * @see TargetProvider.get(IResource, IRemoteTargetResource, IProgressMonitor)
- */
- public void get(final IResource resource, final IRemoteTargetResource remote, IProgressMonitor progress) throws TeamException {
- run(new ITargetRunnable() {
- public void run(IProgressMonitor monitor) throws TeamException {
- getState(resource, remote).get(IResource.DEPTH_INFINITE, monitor);
- }
- }, Policy.monitorFor(progress));
- }
-
-
- /**
- * Put the resources to the remote.
- *
- * @see TargetProvider.put(IResource[], IProgressMonitor)
- */
- public void put(final IResource[] resources, IProgressMonitor progress) throws TeamException {
- run(new ITargetRunnable() {
- public void run(IProgressMonitor monitor) throws TeamException {
- monitor = Policy.monitorFor(monitor);
- try {
- monitor.beginTask(null, resources.length * 100);
- for (int i = 0; i < resources.length; i++) {
- getState(resources[i]).put(Policy.subMonitorFor(monitor, 100));
- }
- } finally {
- monitor.done();
- }
- }
- }, Policy.monitorFor(progress));
- }
-
- /**
- * Answer if the local resource currently has a different timestamp to the
- * base timestamp for this resource.
- *
- * @param resource the resource to test.
- * @return <code>true</code> if the resource has a different modification
- * timestamp, and <code>false</code> otherwise.
- *
- * @see TargetProvider#isDirty(IResource)
- */
- public boolean isDirty(IResource resource) {
- try {
- return getState(resource).isDirty();
- } catch (TeamException e) {
- TeamPlugin.log(e);
- return true;
- }
- }
-
- /**
- * Answers true if the base identifier of the given resource is different to the
- * current released state of the resource.
- *
- * @param resource the resource state to test.
- * @return <code>true</code> if the resource base identifier is different to the
- * current released state of the resource, and <code>false</code> otherwise.
- *
- * @see TargetProvider#isOutOfDate(IResource, IProgressMonitor)
- */
- public boolean isOutOfDate(IResource resource, IProgressMonitor monitor) throws TeamException {
- ResourceState state = getState(resource);
- return state.isOutOfDate(monitor);
- }
-
- /**
- * @see TargetProvider#deregister(IProject)
- */
- public void deregister(IProject project) {
- try {
- newState(project).removeState();
- } catch (TeamException e) {
- TeamPlugin.log(e);
- }
- }
-
- /**
- * @see TargetProvider#getRemoteSyncElement(IResource)
- */
- public IRemoteSyncElement getRemoteSyncElement(IResource resource) {
- return new RemoteTargetSyncElement(this, resource, getRemoteResourceFor(resource));
- }
-
-
- /**
- * @see TargetProvider#hasBase(IResource)
- */
- public boolean hasBase(IResource resource) {
- // the project always has a base
- if (resource.getType() == IResource.PROJECT) return true;
- try {
- return getState(resource).hasPhantom();
- } catch (TeamException e) {
- TeamPlugin.log(e);
- return true;
- }
- }
-
-
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/TargetManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/TargetManager.java
deleted file mode 100644
index 6b5902aba..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/TargetManager.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.target;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ISynchronizer;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.core.Policy;
-import org.eclipse.team.internal.core.TeamPlugin;
-
-public class TargetManager {
- private static final String TARGET_SITES_FILE = ".targetSites"; //$NON-NLS-1$
-
- private static final QualifiedName TARGET_MAPPINGS =
- new QualifiedName("org.eclipse.team.core.target", "mappings"); //$NON-NLS-1$ //$NON-NLS-2$
-
- private static Map factories = new Hashtable();
- private static List sites = new ArrayList();
- private static List listeners = new ArrayList();
-
- //Key for persistent property to denote the project as having target management
- private static final QualifiedName PROP_KEY =
- new QualifiedName("org.eclipse.team", "target"); //$NON-NLS-1$ //$NON-NLS-2$
-
- //Key to signify the kind of target. We only have one at the moment
- private static final String BASIC_TARGET_KEY = "basic"; //$NON-NLS-1$
-
- public static void startup() {
- ResourcesPlugin.getWorkspace().getSynchronizer().add(TARGET_MAPPINGS);
- readLocations();
- }
-
- public static Site[] getSites() {
- return (Site[]) sites.toArray(
- new Site[sites.size()]);
- }
-
- public static void addSite(Site site) {
- sites.add(site);
- save();
- for (Iterator it = listeners.iterator(); it.hasNext();) {
- ISiteListener element = (ISiteListener) it.next();
- element.siteAdded(site);
- }
- }
-
- public static void removeSite(Site site) {
- sites.remove(site);
- save();
- for (Iterator it = listeners.iterator(); it.hasNext();) {
- ISiteListener element = (ISiteListener) it.next();
- element.siteRemoved(site);
- }
- }
-
- /**
- * @see TargetProvider#map(IProject)
- */
- public static void map(IProject project, Site site, IPath path) throws TeamException {
- try {
- ISynchronizer s = ResourcesPlugin.getWorkspace().getSynchronizer();
- byte[] mappingBytes = s.getSyncInfo(TARGET_MAPPINGS, project);
- if (mappingBytes != null) {
- throw new TeamException(Policy.bind("TargetManager.Problems_mapping_project._Project_is_already_mapped._4")); //$NON-NLS-1$
- }
- LocationMapping mapping = new LocationMapping(site, path);
- s.setSyncInfo(
- TARGET_MAPPINGS,
- project,
- mapping.encode());
- project.setPersistentProperty(PROP_KEY, BASIC_TARGET_KEY);
- } catch (CoreException e) {
- throw new TeamException(Policy.bind("TargetManager.Problems_mapping_project", project.getName()), e); //$NON-NLS-1$
- } catch (IOException e) {
- throw new TeamException(Policy.bind("TargetManager.Problems_mapping_project", project.getName()), e); //$NON-NLS-1$
- }
- }
-
- /**
- * @see TargetProvider#unmap(IProject)
- */
- public static void unmap(IProject project) throws TeamException {
- try {
- ISynchronizer s = ResourcesPlugin.getWorkspace().getSynchronizer();
- byte[] mappingBytes = s.getSyncInfo(TARGET_MAPPINGS, project);
- if (mappingBytes == null) {
- throw new TeamException(Policy.bind("TargetManager.unableToUnmap", project.getName())); //$NON-NLS-1$
- } else {
- TargetProvider provider = getProvider(project);
- provider.deregister(project);
- s.flushSyncInfo(TARGET_MAPPINGS, project, IResource.DEPTH_ZERO);
- }
- project.setPersistentProperty(PROP_KEY, null); // null arg removes
- } catch (CoreException e) {
- throw new TeamException(Policy.bind("TargetManager.problemsUnmapping", project.getName()), e); //$NON-NLS-1$
- }
- }
-
- public static TargetProvider getProvider(IProject project) throws TeamException {
- try {
- ISynchronizer s = ResourcesPlugin.getWorkspace().getSynchronizer();
- byte[] mappingBytes = s.getSyncInfo(TARGET_MAPPINGS, project);
- if (mappingBytes == null) {
- return null;
- } else {
- LocationMapping mapping = new LocationMapping(mappingBytes);
- Site site =
- getSite(mapping.getType(), mapping.getURL());
- if (site != null) {
- return site.newProvider(mapping.getPath());
- }
- }
- return null;
- } catch (CoreException e) {
- throw new TeamException(Policy.bind("TargetManager.problemsGettingProvider", project.getName()), e); //$NON-NLS-1$
- } catch (IOException e) {
- throw new TeamException(Policy.bind("TargetManager.problemsGettingProvider", project.getName()), e); //$NON-NLS-1$
- }
- }
-
- public static Site getSite(String type, URL url) {
- return getSite(type, url.toExternalForm());
- }
-
- public static Site getSite(String type, String urlID) {
- for (Iterator it = sites.iterator(); it.hasNext();) {
- Site element = (Site) it.next();
- if (element.getType().equals(type)
- && element.getURL().toExternalForm().equals(urlID)) {
- return element;
- }
- }
- return null;
- }
-
- public static void addSiteListener(ISiteListener listener) {
- listeners.add(listener);
- }
-
- public static void removeSiteListener(ISiteListener listener) {
- listeners.remove(listener);
- }
-
- private static void readLocations() {
- // read saved locations list from disk, only if the file exists
- IPath pluginStateLocation =
- TeamPlugin.getPlugin().getStateLocation().append(
- TARGET_SITES_FILE);
- File f = pluginStateLocation.toFile();
- if (f.exists()) {
- try {
- DataInputStream dis =
- new DataInputStream(new FileInputStream(f));
- readLocations(dis);
- } catch (IOException e) {
- TeamPlugin.log(Status.ERROR, Policy.bind("Config.error"), e); //$NON-NLS-1$
- }
- }
- }
-
- private static void writeLocations() {
- // save repositories to disk
- IPath pluginStateLocation = TeamPlugin.getPlugin().getStateLocation();
- File tempFile = pluginStateLocation.append(TARGET_SITES_FILE + ".tmp").toFile(); //$NON-NLS-1$
- File stateFile =
- pluginStateLocation.append(TARGET_SITES_FILE).toFile();
- try {
- DataOutputStream dos =
- new DataOutputStream(new FileOutputStream(tempFile));
- writeLocations(dos);
- dos.close();
- if (stateFile.exists())
- stateFile.delete();
- boolean renamed = tempFile.renameTo(stateFile);
- if (!renamed) {
- //todo: log the error
- }
- } catch (IOException e) {
- TeamPlugin.log(Status.ERROR, Policy.bind("Config.error"), e); //$NON-NLS-1$
- }
- }
-
- private static void save() {
- writeLocations();
- }
-
- private static void readLocations(DataInputStream dis) throws IOException {
- int repoCount = dis.readInt();
- for (int i = 0; i < repoCount; i++) {
- String id = dis.readUTF();
- ISiteFactory factory =
- (ISiteFactory) getSiteFactory(id);
- if (factory == null) {
- //todo: log error
- return;
- }
- Site site = factory.newSite(new ObjectInputStream(dis));
- sites.add(site);
- }
- }
-
- private static void writeLocations(DataOutputStream dos)
- throws IOException {
- dos.writeInt(sites.size());
- Iterator iter = sites.iterator();
- while (iter.hasNext()) {
- Site site = (Site) iter.next();
- dos.writeUTF(site.getType());
- site.writeObject(new ObjectOutputStream(dos));
- }
- dos.flush();
- dos.close();
- }
-
- public static ISiteFactory getSiteFactory(String id) {
- TeamPlugin plugin = TeamPlugin.getPlugin();
- if (plugin != null) {
- IExtensionPoint extension =
- plugin.getDescriptor().getExtensionPoint(
- TeamPlugin.TARGETS_EXTENSION);
- if (extension != null) {
- IExtension[] extensions = extension.getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement[] configElements =
- extensions[i].getConfigurationElements();
- for (int j = 0; j < configElements.length; j++) {
- String extensionId = configElements[j].getAttribute("id"); //$NON-NLS-1$
- if (extensionId != null && extensionId.equals(id)) {
- try {
- return (ISiteFactory) configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
- } catch (CoreException e) {
- TeamPlugin.log(e);
- return null;
- }
- }
- }
- }
- }
- }
- return null;
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/TargetProvider.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/TargetProvider.java
deleted file mode 100644
index 4658623b3..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/TargetProvider.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.target;
-
-import java.net.URL;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-
-public abstract class TargetProvider {
- /**
- * Answers the site which this target is associated with
- * @return a printable string
- */
- public abstract Site getSite();
-
- /**
- * Answers the full path where the provider stores/retrieves to/from.
- * @return a printable string
- */
- public abstract URL getURL();
-
- /**
- * Updates the local resource to have the same content as the corresponding remote
- * resource. Where the local resource does not exist, this method will create it.
- * Where, the remote resource does not exist and the local does, this method will delete
- * the local resource.
- * <p>
- * If the remote resource is a container (e.g. folder or project) this operation is equivalent
- * to getting each member of the remote resource, thereby updating the
- * content of existing local members, creating local members to receive new remote resources,
- * and deleting local members that no longer have a corresponding remote resource.</p>
- * <p>
- * Interrupting the method (via the progress monitor) may lead to partial, but consistent, results.</p>
- *
- * @param resources an array of local resources to update from the corresponding remote
- * resources.
- * @param progress a progress monitor to indicate the duration of the operation, or
- * <code>null</code> if progress reporting is not required.
- * @throws TeamException if there is a problem getting one or more of the resources. The
- * exception will contain multiple statuses, one for each resource in the <code>resources</code>
- * array.
- */
- public abstract void get(IResource[] resources, IProgressMonitor progress) throws TeamException;
-
- /**
- * Updates the local resource to have the same content as the given remote
- * resource. Where the local resource does not exist, this method will create it.
- * <p>
- * If the remote resource is a container (e.g. folder or project) this operation is equivalent
- * to getting each non-container member of the remote resource, thereby updating the
- * content of existing local members, creating local members to receive new remote resources,
- * and deleting local members that no longer have a corresponding remote resource.</p>
- * <p>
- * Interrupting the method (via the progress monitor) may lead to partial, but consistent, results.</p>
- *
- * @param resources an array of local resources to update from the corresponding remote
- * resources.
- * @param progress a progress monitor to indicate the duration of the operation, or
- * <code>null</code> if progress reporting is not required.
- * @throws TeamException if there is a problem getting one or more of the resources. The
- * exception will contain multiple statuses, one for each resource in the <code>resources</code>
- * array.
- */
- public abstract void get(IResource resource, IRemoteTargetResource remote, IProgressMonitor progress) throws TeamException;
-
- /**
- * Transfers the content of the local resource to the corresponding remote resource.
- * <p>
- * If a remote resource does not exist this method creates a new remote resource with the same content
- * as the given local resource. The local resource is said to <i>correspond</i> to the new remote resource.
- * If the local resource doesn't exist and a remote does, the remote resource will be deleted.
- * </p>
- * <p>
- * If the local resource is a container (e.g. folder or project) this operation is equivalent
- * to putting each member of the local resource, thereby updating the
- * content of existing remote members, creating remote members to receive new local resources,
- * and deleting remote members that no longer have a corresponding local resource.</p>
- * <p>
- * @param resources an array of local resources to be put.
- * @param progress a progress monitor to indicate the duration of the operation, or
- * <code>null</code> if progress reporting is not required.
- * @throws TeamException if there is a problem put'ing one or more of the resources.
- * The exception will contain multiple status', one for each resource in the <code>resources</code>
- * array.
- */
- public abstract void put(IResource[] resources, IProgressMonitor progress) throws TeamException;
-
- /**
- * Returns a remote resource handle at the path of the given local resource.
- *
- * @param resource local resource path to be used to construct the remote handle's path
- * @return a handle to a remote resource that may or may not exist
- */
- public abstract IRemoteTargetResource getRemoteResourceFor(IResource resource);
-
- /**
- * Returns a remote resource handle at the path of this target provider's URL.
- * @return a handle to a remote resource that may or may not exist
- */
- public abstract IRemoteTargetResource getRemoteResource();
-
- /**
- * Replies true if its believed possible to get the given resource.
- * This intended to be a relatively quick operation, presumably based on local state of the provider
- * or it may be used to indicate that the provider only supports data transfer in one direction.
- * It is not intended to indicate the existance of a remote resource. Hence, this method may return true
- * even if there is no remote resource.
- */
- public boolean canGet(IResource resource) {
- return true;
- }
-
- /**
- * Replies true if its believed possible to put the given resource.
- * This intended to be a relatively quick operation, presumably based on local state of the provider
- * or it may be used to indicate that the provider only supports data transfer in one direction.
- */
- public boolean canPut(IResource resource) {
- return true;
- }
-
- /**
- * Answers true if the base identifier of the given resource is different to the
- * current released state of the resource. Answer false if there is no correspondence
- * between the local and remote resources (i.e. hasBase(resource) returns false).
- *
- * @param resource the resource to test
- * @param monitor a progress monitor
- *
- * @throws TeamException if there is a problem getting this information from the server.
- */
- public abstract boolean isOutOfDate(IResource resource, IProgressMonitor monitor) throws TeamException;
-
- /**
- * Answer true if the local resource currently has a different timestamp to the
- * base timestamp for this resource. Answer true for local resources that no longer exist
- * (i.e. the local resource did exist and corresponded to a remote resource) and false if the
- * local resource does not exist and was never mapped to a remote resource.
- *
- * @param resource the resource to test
- */
- public abstract boolean isDirty(IResource resource);
-
- /**
- * Answer true if the given resource at one time had a remote counterpart and still does
- * to the knowledge of the provider.
- *
- * @param resource the resource to test
- */
- public abstract boolean hasBase(IResource resource);
-
- public abstract void deregister(IProject project);
-
- /**
- * This method provides a mechanism for allowing a target provider to optimize connections
- * over a set of operations. The default behavior of the method is to run the provided runnable
- * and to supply it with the provided progress monitor. Specific target providers may override this
- * method in order to ensure that the number of connections made to a remote server is minimized.
- * Calls to this method are nestable and it is up to the target provider to ensure that this is
- * supported.
- */
- public void run(final ITargetRunnable runnable, IProgressMonitor monitor) throws TeamException {
- try {
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- try {
- runnable.run(monitor);
- } catch (TeamException e) {
- throw new CoreException(e.getStatus());
- }
- }
- }, monitor);
- } catch (CoreException e) {
- throw new TeamException(e.getStatus());
- }
- }
-
- /**
- * Return an IRemoteSyncElement for the given resource. This element is used to
- * compare the state of the local and remote resources.
- */
- public abstract IRemoteSyncElement getRemoteSyncElement(IResource resource);
-
- /**
- * @see java.lang.Object#equals(Object)
- */
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj.getClass().equals(this.getClass())) {
- return this.getURL().toExternalForm().equals(((TargetProvider)obj).getURL().toExternalForm());
- }
- return super.equals(obj);
- }
-
-
- /**
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return getURL().toExternalForm().hashCode();
- }
-
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/UrlUtil.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/UrlUtil.java
deleted file mode 100644
index 79dd18fa1..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/UrlUtil.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.target;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-
-public class UrlUtil {
-
- public static IPath getTrailingPath(URL fullURL, URL startingURL) {
- IPath fullPath = new Path(fullURL.getPath());
- IPath startingPath = new Path(startingURL.getPath());
- int matchingCount = fullPath.matchingFirstSegments(startingPath);
- return fullPath.removeFirstSegments(matchingCount);
- }
-
- public static URL concat(String root, IPath end) throws MalformedURLException {
- return new URL(concatString(root, end));
- }
-
- public static String concatString(String root, IPath end) {
- if(end.isEmpty())
- return root;
- if(root.length() == 0)
- return end.toString();
- boolean rootHasTrailing = root.charAt(root.length() - 1) == Path.SEPARATOR; //has trailing '/'
- boolean endHasLeading = end.isAbsolute(); // has leading '/'
-
- if(rootHasTrailing && endHasLeading) //http://mysite/ + /myFolder
- return root + end.toString().substring(1); // we have two seperators, drop one
-
- if(!rootHasTrailing && !endHasLeading) //http://mysite + myFolder
- return root + Path.SEPARATOR + end.toString();
-
- return root + end.toString(); //have one separator between the two, just concat end
- }
-
- /*
- * Return a string that is like url but guaranteed to end with a '/'
- */
- public static String makeAbsolute(String url) {
- boolean hasTrailing = url.charAt(url.length() - 1) == Path.SEPARATOR; //has trailing '/'
- if(hasTrailing)
- return url;
- return url + Path.SEPARATOR;
- }
-
- /*
- * @see toTruncatedPath(URL, int)
- */
- public static String toTruncatedPath(URL url, int split) {
- return toTruncatedPath(url.getPath(), split);
- }
-
- /*
- * If the number of segments in the url path is greater than <code>split</code> then
- * the returned path is truncated to <code>split</code> number of segments and '...'
- * is shown as the first segment of the path.
- */
- public static String toTruncatedPath(String url, int split) {
- IPath path = new Path(url);
- path = path.setDevice(null); // clear the device id, in this case the http:
- int segments = path.segmentCount();
- if(segments>split) {
- IPath last = path.removeFirstSegments(segments - split);
- return "..." + IPath.SEPARATOR + last.toString(); //$NON-NLS-1$
- }
- return path.toString();
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/messages.properties b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/messages.properties
deleted file mode 100644
index d398d21b5..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/messages.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-teamStatus.notCheckedOut=Not checked out.
-teamStatus.notCheckedIn=Not checked in.
-teamStatus.unmanagedResource=Unmanaged resource.
-teamStatus.noRemoteResource=Remote resource does not exist.
-teamStatus.ioFailed=An IO error occurred.
-teamStatus.conflict=A conflict occurred.
-provider.configuration.missing=Required configuration value missing.
-provider.configuration.invalid=Configuration value is invalid.
-filetransfer.monitor={0} ({1}K of {2}K bytes)
-multiStatus.errorsOccurred=Errors occurred \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/.classpath b/bundles/org.eclipse.team.cvs.core/.classpath
index 8eeac83f2..ca49cf8b2 100644
--- a/bundles/org.eclipse.team.cvs.core/.classpath
+++ b/bundles/org.eclipse.team.cvs.core/.classpath
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
+ <classpathentry kind="var" path="JRE_LIB" sourcepath="JRE_SRC"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="/org.eclipse.team.core"/>
- <classpathentry kind="src" path="/org.apache.xerces"/>
<classpathentry kind="src" path="/org.eclipse.core.resources"/>
<classpathentry kind="src" path="/org.eclipse.core.runtime"/>
<classpathentry kind="output" path="bin"/>
diff --git a/bundles/org.eclipse.team.cvs.core/.project b/bundles/org.eclipse.team.cvs.core/.project
index aef3007fd..a57858a9b 100644
--- a/bundles/org.eclipse.team.cvs.core/.project
+++ b/bundles/org.eclipse.team.cvs.core/.project
@@ -3,7 +3,6 @@
<name>org.eclipse.team.cvs.core</name>
<comment></comment>
<projects>
- <project>org.apache.xerces</project>
<project>org.eclipse.core.resources</project>
<project>org.eclipse.core.runtime</project>
<project>org.eclipse.team.core</project>
diff --git a/bundles/org.eclipse.team.cvs.core/plugin.xml b/bundles/org.eclipse.team.cvs.core/plugin.xml
index 61048381f..57def4e55 100644
--- a/bundles/org.eclipse.team.cvs.core/plugin.xml
+++ b/bundles/org.eclipse.team.cvs.core/plugin.xml
@@ -15,7 +15,6 @@
<requires>
<import plugin="org.eclipse.core.resources"/>
<import plugin="org.eclipse.team.core"/>
- <import plugin="org.apache.xerces"/>
</requires>
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java
index f4740a3cf..932b4e145 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java
@@ -58,7 +58,7 @@ import org.eclipse.team.internal.core.SaveContext;
*/
public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResourceChangeListener, ITeamResourceChangeListener {
- private final static String QUALIFIED_NAME = "org.eclipse.team.cvs.ui.cvsmerge-participant";
+ private final static String QUALIFIED_NAME = "org.eclipse.team.cvs.ui.cvsmerge-participant"; //$NON-NLS-1$
public static final String UNIQUE_ID_PREFIX = "merge-"; //$NON-NLS-1$
private CVSTag start, end;
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
index cc012897e..3f7757863 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
@@ -17,16 +17,11 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.Properties;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -53,6 +48,7 @@ import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.resources.FileModificationManager;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.util.BuildCleanupListener;
+import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
import org.eclipse.team.internal.ccvs.core.util.SyncFileChangeListener;
import org.eclipse.team.internal.ccvs.core.util.Util;
@@ -115,8 +111,6 @@ public class CVSProviderPlugin extends Plugin {
private static final String REPOSITORIES_STATE_FILE = ".cvsProviderState"; //$NON-NLS-1$
// version numbers for the state file (a positive number indicates version 1)
private static final int REPOSITORIES_STATE_FILE_VERSION_2 = -1;
- private Map repositories = new HashMap();
- private List repositoryListeners = new ArrayList();
private static List decoratorEnablementListeners = new ArrayList();
private CVSWorkspaceSubscriber cvsWorkspaceSubscriber;
@@ -131,6 +125,10 @@ public class CVSProviderPlugin extends Plugin {
*/
private static final String NATURE_ID = ID + ".cvsnature"; //$NON-NLS-1$
+ // File used to idicate if the workbench was shut down properly or not
+ private static final String CRASH_INDICATION_FILE = ".running"; //$NON-NLS-1$
+ private boolean crash;
+
public synchronized CVSWorkspaceSubscriber getCVSWorkspaceSubscriber() {
if (cvsWorkspaceSubscriber == null) {
cvsWorkspaceSubscriber = new CVSWorkspaceSubscriber(
@@ -311,6 +309,7 @@ public class CVSProviderPlugin extends Plugin {
// load the state which includes the known repositories
loadState();
+ crash = createCrashFile();
// Initialize CVS change listeners. Note tha the report type is important.
IWorkspace workspace = ResourcesPlugin.getWorkspace();
@@ -348,6 +347,8 @@ public class CVSProviderPlugin extends Plugin {
workspace.removeSaveParticipant(this);
RemoteContentsCache.disableCache(ID);
+
+ deleteCrashFile();
}
/**
@@ -446,101 +447,16 @@ public class CVSProviderPlugin extends Plugin {
promptOnFolderDelete = prompt;
}
- private static List listeners = new ArrayList();
-
- /*
- * @see ITeamManager#addResourceStateChangeListener(IResourceStateChangeListener)
- */
- public static void addResourceStateChangeListener(IResourceStateChangeListener listener) {
- listeners.add(listener);
- }
-
- /*
- * @see ITeamManager#removeResourceStateChangeListener(IResourceStateChangeListener)
- */
- public static void removeResourceStateChangeListener(IResourceStateChangeListener listener) {
- listeners.remove(listener);
- }
-
- public static void broadcastSyncInfoChanges(final IResource[] resources) {
- for(Iterator it=listeners.iterator(); it.hasNext();) {
- final IResourceStateChangeListener listener = (IResourceStateChangeListener)it.next();
- ISafeRunnable code = new ISafeRunnable() {
- public void run() throws Exception {
- listener.resourceSyncInfoChanged(resources);
- }
- public void handleException(Throwable e) {
- // don't log the exception....it is already being logged in Platform#run
- }
- };
- Platform.run(code);
- }
- }
-
- public static void broadcastExternalSyncInfoChanges(final IResource[] resources) {
- for(Iterator it=listeners.iterator(); it.hasNext();) {
- final IResourceStateChangeListener listener = (IResourceStateChangeListener)it.next();
- ISafeRunnable code = new ISafeRunnable() {
- public void run() throws Exception {
- listener.externalSyncInfoChange(resources);
- }
- public void handleException(Throwable e) {
- // don't log the exception....it is already being logged in Platform#run
- }
- };
- Platform.run(code);
- }
- }
-
public static void broadcastDecoratorEnablementChanged(final boolean enabled) {
- for(Iterator it=decoratorEnablementListeners.iterator(); it.hasNext();) {
- final ICVSDecoratorEnablementListener listener = (ICVSDecoratorEnablementListener)it.next();
- ISafeRunnable code = new ISafeRunnable() {
- public void run() throws Exception {
- listener.decoratorEnablementChanged(enabled);
- }
- public void handleException(Throwable e) {
- // don't log the exception....it is already being logged in Platform#run
- }
- };
- Platform.run(code);
- }
- }
-
- public static void broadcastModificationStateChanges(final IResource[] resources) {
- for(Iterator it=listeners.iterator(); it.hasNext();) {
- final IResourceStateChangeListener listener = (IResourceStateChangeListener)it.next();
- ISafeRunnable code = new ISafeRunnable() {
- public void run() throws Exception {
- listener.resourceModified(resources);
- }
- public void handleException(Throwable e) {
- // don't log the exception....it is already being logged in Platform#run
- }
- };
- Platform.run(code);
- }
- }
- protected static void broadcastProjectConfigured(final IProject project) {
- for(Iterator it=listeners.iterator(); it.hasNext();) {
- final IResourceStateChangeListener listener = (IResourceStateChangeListener)it.next();
- ISafeRunnable code = new ISafeRunnable() {
- public void run() throws Exception {
- listener.projectConfigured(project);
- }
- public void handleException(Throwable e) {
- // don't log the exception....it is already being logged in Platform#run
- }
- };
- Platform.run(code);
+ ICVSDecoratorEnablementListener[] listeners;
+ synchronized(decoratorEnablementListeners) {
+ listeners = (ICVSDecoratorEnablementListener[]) decoratorEnablementListeners.toArray(new ICVSDecoratorEnablementListener[decoratorEnablementListeners.size()]);
}
- }
- protected static void broadcastProjectDeconfigured(final IProject project) {
- for(Iterator it=listeners.iterator(); it.hasNext();) {
- final IResourceStateChangeListener listener = (IResourceStateChangeListener)it.next();
+ for (int i = 0; i < listeners.length; i++) {
+ final ICVSDecoratorEnablementListener listener = listeners[i];
ISafeRunnable code = new ISafeRunnable() {
public void run() throws Exception {
- listener.projectDeconfigured(project);
+ listener.decoratorEnablementChanged(enabled);
}
public void handleException(Throwable e) {
// don't log the exception....it is already being logged in Platform#run
@@ -565,34 +481,13 @@ public class CVSProviderPlugin extends Plugin {
public void setReplaceUnmanaged(boolean replaceUnmanaged) {
this.replaceUnmanaged = replaceUnmanaged;
}
-
- /*
- * Add the repository location to the cahced locations
- */
- private void addToRepositoriesCache(ICVSRepositoryLocation repository) {
- repositories.put(repository.getLocation(), repository);
- Iterator it = repositoryListeners.iterator();
- while (it.hasNext()) {
- ICVSListener listener = (ICVSListener)it.next();
- listener.repositoryAdded(repository);
- }
- }
-
- private void removeFromRepositoriesCache(ICVSRepositoryLocation repository) {
- if (repositories.remove(repository.getLocation()) != null) {
- Iterator it = repositoryListeners.iterator();
- while (it.hasNext()) {
- ICVSListener listener = (ICVSListener)it.next();
- listener.repositoryRemoved(repository);
- }
- }
- }
+
/**
* Register to receive notification of repository creation and disposal
*/
public void addRepositoryListener(ICVSListener listener) {
- repositoryListeners.add(listener);
+ KnownRepositories.getInstance().addRepositoryListener(listener);
}
/**
@@ -601,21 +496,25 @@ public class CVSProviderPlugin extends Plugin {
* resource with CVS information.
*/
public void addDecoratorEnablementListener(ICVSDecoratorEnablementListener listener) {
- decoratorEnablementListeners.add(listener);
+ synchronized(decoratorEnablementListeners) {
+ decoratorEnablementListeners.add(listener);
+ }
}
/**
* De-register a listener
*/
public void removeRepositoryListener(ICVSListener listener) {
- repositoryListeners.remove(listener);
+ KnownRepositories.getInstance().removeRepositoryListener(listener);
}
/**
* De-register the decorator enablement listener.
*/
public void removeDecoratorEnablementListener(ICVSDecoratorEnablementListener listener) {
- decoratorEnablementListeners.remove(listener);
+ synchronized(decoratorEnablementListeners) {
+ decoratorEnablementListeners.remove(listener);
+ }
}
/**
@@ -637,16 +536,7 @@ public class CVSProviderPlugin extends Plugin {
* exists.
*/
public ICVSRepositoryLocation createRepository(Properties configuration) throws CVSException {
- // Create a new repository location
- CVSRepositoryLocation location = CVSRepositoryLocation.fromProperties(configuration);
-
- // Check the cache for an equivalent instance and if there is one, throw an exception
- CVSRepositoryLocation existingLocation = (CVSRepositoryLocation)repositories.get(location.getLocation());
- if (existingLocation != null) {
- throw new CVSException(new CVSStatus(CVSStatus.ERROR, Policy.bind("CVSProvider.alreadyExists"))); //$NON-NLS-1$
- }
-
- return location;
+ return KnownRepositories.getInstance().createRepository(configuration);
}
/**
@@ -654,15 +544,7 @@ public class CVSProviderPlugin extends Plugin {
* password caching accross platform invokations.
*/
public void addRepository(ICVSRepositoryLocation repository) throws CVSException {
- // Check the cache for an equivalent instance and if there is one, just update the cache
- CVSRepositoryLocation existingLocation = (CVSRepositoryLocation)repositories.get(repository.getLocation());
- if (existingLocation != null) {
- ((CVSRepositoryLocation)repository).updateCache();
- } else {
- // Cache the password and register the repository location
- addToRepositoriesCache(repository);
- ((CVSRepositoryLocation)repository).updateCache();
- }
+ KnownRepositories.getInstance().addRepository(repository);
saveState();
}
@@ -672,8 +554,7 @@ public class CVSProviderPlugin extends Plugin {
* Removes any cached information about the repository such as a remembered password.
*/
public void disposeRepository(ICVSRepositoryLocation repository) throws CVSException {
- ((CVSRepositoryLocation)repository).dispose();
- removeFromRepositoriesCache(repository);
+ KnownRepositories.getInstance().disposeRepository(repository);
}
/**
@@ -681,14 +562,14 @@ public class CVSProviderPlugin extends Plugin {
* The location string corresponds to the Strin returned by ICVSRepositoryLocation#getLocation()
*/
public boolean isKnownRepository(String location) {
- return repositories.get(location) != null;
+ return KnownRepositories.getInstance().isKnownRepository(location);
}
/**
* Return a list of the know repository locations
*/
public ICVSRepositoryLocation[] getKnownRepositories() {
- return (ICVSRepositoryLocation[])repositories.values().toArray(new ICVSRepositoryLocation[repositories.size()]);
+ return KnownRepositories.getInstance().getKnownRepositories();
}
/**
@@ -715,12 +596,7 @@ public class CVSProviderPlugin extends Plugin {
* of the location permanently. This means that it cannot be modified by the authenticator.
*/
public ICVSRepositoryLocation getRepository(String location) throws CVSException {
- ICVSRepositoryLocation repository = (ICVSRepositoryLocation)repositories.get(location);
- if (repository == null) {
- repository = CVSRepositoryLocation.fromString(location);
- addToRepositoriesCache(repository);
- }
- return repository;
+ return KnownRepositories.getInstance().getRepository(location);
}
private void loadState() {
@@ -803,13 +679,12 @@ public class CVSProviderPlugin extends Plugin {
// Write the repositories
dos.writeInt(REPOSITORIES_STATE_FILE_VERSION_2);
// Write out the repos
- Collection repos = repositories.values();
- dos.writeInt(repos.size());
- Iterator it = repos.iterator();
- while (it.hasNext()) {
- CVSRepositoryLocation root = (CVSRepositoryLocation)it.next();
+ ICVSRepositoryLocation[] repos = KnownRepositories.getInstance().getKnownRepositories();
+ dos.writeInt(repos.length);
+ for (int i = 0; i < repos.length; i++) {
+ CVSRepositoryLocation root = (CVSRepositoryLocation)repos[i];
dos.writeUTF(root.getLocation());
- dos.writeUTF("unused"); // place holder for an additional configuration parameter //$NON-NLS-1$
+ dos.writeUTF("cvs"); // place holder for cureently unused remote program name //$NON-NLS-1$
}
}
@@ -859,4 +734,37 @@ public class CVSProviderPlugin extends Plugin {
public void setDebugProtocol(boolean value) {
Policy.DEBUG_CVS_PROTOCOL = value;
}
+
+ public boolean isDebugProtocol() {
+ return Policy.DEBUG_CVS_PROTOCOL;
+ }
+
+ /*
+ * Create the crash indicator file. This method returns true if the file
+ * already existed, indicating that a crash occurred on the last invokation of
+ * the platform.
+ */
+ private boolean createCrashFile() {
+ IPath pluginStateLocation = CVSProviderPlugin.getPlugin().getStateLocation();
+ File crashFile = pluginStateLocation.append(CRASH_INDICATION_FILE).toFile();
+ if (crashFile.exists()) {
+ return true;
+ }
+ try {
+ crashFile.createNewFile();
+ } catch (IOException e) {
+ CVSProviderPlugin.log(IStatus.ERROR, e.getMessage(), e);
+ }
+ return false;
+ }
+
+ private void deleteCrashFile() {
+ IPath pluginStateLocation = CVSProviderPlugin.getPlugin().getStateLocation();
+ File crashFile = pluginStateLocation.append(CRASH_INDICATION_FILE).toFile();
+ crashFile.delete();
+ }
+
+ public boolean crashOnLastRun() {
+ return crash;
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncInfo.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncInfo.java
index 7c038c972..8b2068e5a 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncInfo.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncInfo.java
@@ -113,35 +113,6 @@ public class CVSSyncInfo extends SyncInfo {
return kind;
}
-
- /**
- * Return true if the provided phantom folder conyains any outgoing file deletions.
- * We only need to detect if there are any files since a phantom folder can only
- * contain outgoing filre deletions and other folder.
- *
- * @param cvsFolder a phantom folder
- * @return boolean
- */
- private boolean containsOutgoingDeletions(ICVSFolder cvsFolder) {
- final boolean result[] = new boolean[] { false };
- try {
- cvsFolder.accept(new ICVSResourceVisitor() {
- public void visitFile(ICVSFile file) throws CVSException {
- // Do nothing. Files are handled below
- }
- public void visitFolder(ICVSFolder folder) throws CVSException {
- if (folder.members(ICVSFolder.FILE_MEMBERS).length > 0) {
- result[0] = true;
- } else {
- folder.acceptChildren(this);
- }
- }
- });
- } catch (CVSException e) {
- CVSProviderPlugin.log(e);
- }
- return result[0];
- }
/*
* If the resource has a delete/delete conflict then ensure that the local is unmanaged so that the
@@ -269,7 +240,7 @@ public class CVSSyncInfo extends SyncInfo {
boolean outgoing = (getKind() & DIRECTION_MASK) == OUTGOING;
if (outgoing) return;
- ICVSFolder local = (ICVSFolder)CVSWorkspaceRoot.getCVSFolderFor((IContainer)getLocal());
+ ICVSFolder local = CVSWorkspaceRoot.getCVSFolderFor((IContainer)getLocal());
RemoteFolder remote = (RemoteFolder)getRemote();
// The parent must be managed
@@ -283,6 +254,8 @@ public class CVSSyncInfo extends SyncInfo {
// If the folder already has CVS info, check that the remote and local match
if(local.isManaged() && local.isCVSFolder()) {
+ // If there's no remote, assume everything is OK
+ if (remote == null) return;
// Verify that the root and repository are the same
FolderSyncInfo remoteInfo = remote.getFolderSyncInfo();
FolderSyncInfo localInfo = local.getFolderSyncInfo();
@@ -305,7 +278,6 @@ public class CVSSyncInfo extends SyncInfo {
}
public String toString() {
- IResource local = getLocal();
IRemoteResource base = getBase();
IRemoteResource remote = getRemote();
StringBuffer result = new StringBuffer(super.toString());
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
index 4bebfc688..6bc313765 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
@@ -76,6 +76,7 @@ import org.eclipse.team.internal.ccvs.core.util.Assert;
import org.eclipse.team.internal.ccvs.core.util.MoveDeleteHook;
import org.eclipse.team.internal.ccvs.core.util.PrepareForReplaceVisitor;
import org.eclipse.team.internal.ccvs.core.util.ReplaceWithBaseVisitor;
+import org.eclipse.team.internal.ccvs.core.util.ResourceStateChangeListeners;
import org.eclipse.team.internal.ccvs.core.util.SyncFileWriter;
import org.eclipse.team.internal.core.streams.CRLFtoLFInputStream;
import org.eclipse.team.internal.core.streams.LFtoCRLFInputStream;
@@ -174,7 +175,7 @@ public class CVSTeamProvider extends RepositoryProvider {
}
public void deconfigured() {
- CVSProviderPlugin.broadcastProjectDeconfigured(getProject());
+ ResourceStateChangeListeners.getListener().projectDeconfigured(getProject());
}
/**
* @see IProjectNature#getProject()
@@ -648,7 +649,11 @@ public class CVSTeamProvider extends RepositoryProvider {
Session session = new Session(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true /* output to console */);
session.open(Policy.subMonitorFor(progress,10), false /* read-only */);
try {
- new PrepareForReplaceVisitor().visitResources(getProject(), resources, "CVSTeamProvider.scrubbingResource", depth, Policy.subMonitorFor(progress, 20)); //$NON-NLS-1$
+ ICVSResource[] cvsResources = new ICVSResource[resources.length];
+ for (int i = 0; i < cvsResources.length; i++) {
+ cvsResources[i] = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
+ }
+ new PrepareForReplaceVisitor().visitResources(getProject(), cvsResources, "CVSTeamProvider.scrubbingResource", depth, Policy.subMonitorFor(progress, 20)); //$NON-NLS-1$
List options = new ArrayList();
options.add(Update.IGNORE_LOCAL_CHANGES);
@@ -1030,7 +1035,7 @@ public class CVSTeamProvider extends RepositoryProvider {
}
public void configureProject() throws CoreException {
- CVSProviderPlugin.broadcastProjectConfigured(getProject());
+ ResourceStateChangeListeners.getListener().projectConfigured(getProject());
}
/**
* Sets the keyword substitution mode for the specified resources.
@@ -1360,13 +1365,13 @@ public class CVSTeamProvider extends RepositoryProvider {
monitor.beginTask(null, 100);
Session session = new Session(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true);
try {
- session.open(Policy.subMonitorFor(monitor, 10), true /* open for modification */);
- } catch (CVSException e1) {
- // If the connection cannot be opened, just exit normally.
- // The notifications will be sent when a connection can be made
- return;
- }
- try {
+ try {
+ session.open(Policy.subMonitorFor(monitor, 10), true /* open for modification */);
+ } catch (CVSException e1) {
+ // If the connection cannot be opened, just exit normally.
+ // The notifications will be sent when a connection can be made
+ return;
+ }
Command.NOOP.execute(
session,
Command.NO_GLOBAL_OPTIONS,
@@ -1377,6 +1382,7 @@ public class CVSTeamProvider extends RepositoryProvider {
} catch (CVSException e) {
exception[0] = e;
} finally {
+ session.close();
monitor.done();
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java
index 51767a0d7..f73c23bbf 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java
@@ -29,6 +29,7 @@ import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.core.subscribers.TeamDelta;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.OptimizedRemoteSynchronizer;
+import org.eclipse.team.internal.ccvs.core.util.ResourceStateChangeListeners;
/**
* CVSWorkspaceSubscriber
@@ -47,7 +48,7 @@ public class CVSWorkspaceSubscriber extends CVSSyncTreeSubscriber implements IRe
remoteSynchronizer = new OptimizedRemoteSynchronizer(REMOTE_RESOURCE_KEY);
// TODO: temporary proxy for CVS events
- CVSProviderPlugin.addResourceStateChangeListener(this);
+ ResourceStateChangeListeners.getListener().addResourceStateChangeListener(this);
}
/*
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java
index b4011085a..cb6310f9c 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java
@@ -104,6 +104,11 @@ abstract class AbstractStructureVisitor implements ICVSResourceVisitor {
// Do not send the same folder twice
if (isLastSent(mFolder)) return;
+
+ // Do not send virtual directories
+ if (isCVSFolder && mFolder.getFolderSyncInfo().isVirtualDirectory()) {
+ return;
+ }
String localPath = mFolder.getRelativePath(session.getLocalRoot());
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java
index f23cc3f59..afba8870a 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java
@@ -45,6 +45,7 @@ public abstract class Command extends Request {
public final static Checkout CHECKOUT = new CheckoutWithOverwrite();
public final static Commit COMMIT = new Commit();
public final static Diff DIFF = new Diff();
+ public final static RDiff RDIFF = new RDiff();
public final static Editors EDITORS = new Editors();
public final static Import IMPORT = new Import();
public final static Log LOG = new Log();
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java
index 14d43e601..dc32ec188 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java
@@ -27,6 +27,7 @@ public class Diff extends Command {
public static final LocalOption UNIFIED_FORMAT = new LocalOption("-u"); //$NON-NLS-1$
public static final LocalOption CONTEXT_FORMAT = new LocalOption("-c"); //$NON-NLS-1$
public static final LocalOption INCLUDE_NEWFILES = new LocalOption("-N"); //$NON-NLS-1$
+ public static final LocalOption BRIEF = new LocalOption("--brief"); //$NON-NLS-1$
protected Diff() { }
protected String getRequestId() {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RTag.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RTag.java
index a83cca00b..0baca4b3a 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RTag.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RTag.java
@@ -98,8 +98,7 @@ public class RTag extends RemoteCommand {
CVSTag sourceTag, CVSTag tag, ICVSRemoteResource[] arguments, IProgressMonitor monitor)
throws CVSException {
- ICVSResource[] resources = (ICVSResource[])Arrays.asList(arguments).toArray(new ICVSResource[arguments.length]);
- String[] stringArguments = convertArgumentsForOpenSession(arguments);
+ String[] stringArguments = convertArgumentsForOpenSession(arguments, session);
return execute(session, globalOptions, localOptions, sourceTag, tag, stringArguments, monitor);
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemoteCommand.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemoteCommand.java
index 3343962a7..bc99a257d 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemoteCommand.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemoteCommand.java
@@ -15,7 +15,6 @@ import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
/**
@@ -42,12 +41,20 @@ public abstract class RemoteCommand extends Command {
// do nothing
}
- protected String[] convertArgumentsForOpenSession(ICVSRemoteResource[] arguments) throws CVSException {
- // Convert arguments
- List stringArguments = new ArrayList(arguments.length);
- for (int i = 0; i < arguments.length; i++) {
- stringArguments.add(arguments[i].getRepositoryRelativePath());
- }
- return (String[]) stringArguments.toArray(new String[stringArguments.size()]);
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.core.client.Command#convertArgumentsForOpenSession(org.eclipse.team.internal.ccvs.core.ICVSResource[], org.eclipse.team.internal.ccvs.core.client.Session)
+ */
+ protected String[] convertArgumentsForOpenSession(
+ ICVSResource[] arguments,
+ Session openSession)
+ throws CVSException {
+
+ // Convert arguments
+ List stringArguments = new ArrayList(arguments.length);
+ for (int i = 0; i < arguments.length; i++) {
+ stringArguments.add(arguments[i].getRepositoryRelativePath());
+ }
+ return (String[]) stringArguments.toArray(new String[stringArguments.size()]);
}
+
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
index 6bca062ff..6d0e4caf1 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
@@ -687,7 +687,7 @@ public class CVSRepositoryLocation extends PlatformObject implements ICVSReposit
partId = "CVSRepositoryLocation.parsingUser";//$NON-NLS-1$
end = location.indexOf(HOST_SEPARATOR, start);
- String user = null;;
+ String user = null;
String password = null;
// if end is -1 then there is no host separator meaning that the username is not present
if (end != -1) {
@@ -954,8 +954,35 @@ public class CVSRepositoryLocation extends PlatformObject implements ICVSReposit
if(firstSpace != -1) {
// remove the program name and the space
message = message.substring(firstSpace + 1);
- if (message.startsWith(prefix)) {
- message = message.substring(prefix.length());
+ // Quick fix to handle changes in server message format (see Bug 45138)
+ if (prefix.startsWith("[")) {
+ // This is the server aborted message
+ // Remove the pattern "[command_name aborted]: "
+ int closingBracket = message.indexOf("]: ");
+ if (closingBracket == -1) return null;
+ // get what is inside the brackets
+ String realPrefix = message.substring(1, closingBracket);
+ // check that there is two words and the second word is "aborted"
+ int space = realPrefix.indexOf(' ');
+ if (space == -1) return null;
+ if (realPrefix.indexOf(' ', space +1) != -1) return null;
+ if (!realPrefix.substring(space +1).equals("aborted")) return null;
+ // It's a match, return the rest of the line
+ message = message.substring(closingBracket + 2);
+ if (message.charAt(0) == ' ') {
+ message = message.substring(1);
+ }
+ return message;
+ } else {
+ // This is the server command message
+ // Remove the pattern "command_name: "
+ int colon = message.indexOf(": ");
+ if (colon == -1) return null;
+ // get what is before the colon
+ String realPrefix = message.substring(0, colon);
+ // ensure that it is a single word
+ if (realPrefix.indexOf(' ') != -1) return null;
+ message = message.substring(colon + 1);
if (message.charAt(0) == ' ') {
message = message.substring(1);
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties
index 3298d9cbc..aa23fa7fb 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties
@@ -147,16 +147,20 @@ Command.serverError=The server reported an error while performing the "cvs {0}"
Command.noMoreInfoAvailable=The server did not provide any additional information.
Command.add=add
Command.admin=admin
+Command.annotate=annotate
Command.co=checkout
Command.ci=commit
Command.diff=diff
+Command.editors=editors
Command.import=import
Command.log=log
Command.remove=remove
Command.status=status
Command.tag=tag
+Command.rtag=rtag
Command.update=update
Command.version=version
+Command.rdiff=rdiff
Command.valid-requests=valid-requests
Command.expand-modules=expand-modules
Command.unsupportedResponse=Unknown response received from cvs server: {0} {1}
@@ -326,3 +330,6 @@ DeferredResourceChangeHandler.0=Reconciling CVS state changes
DeferredResourceChangeHandler.1=Errors occured handling ignore file (.cvsignore) changes. Some resources may not be decorated properly.
CVSWorkspaceRoot.11=The parent folder of managed file {0} does not have sync info associated with it.
RemoveEntryHandler.2=Remove-entry received and ignored from CVS server for existing file {0}.
+ServerMessageLineMatcher.5=Variable in template is not of the correct format: {0}
+ServerMessageLineMatcher.6=There are additional groups above those defining variables in template: {0}
+ServerMessageLineMatcher.7=Expected variable {0} in {1} but it is not present.
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java
index 8d962a619..ccdfe5297 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java
@@ -45,7 +45,6 @@ import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
import org.eclipse.team.internal.ccvs.core.Policy;
import org.eclipse.team.internal.ccvs.core.client.Checkout;
import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Import;
import org.eclipse.team.internal.ccvs.core.client.Request;
import org.eclipse.team.internal.ccvs.core.client.Session;
import org.eclipse.team.internal.ccvs.core.client.Update;
@@ -237,22 +236,22 @@ public class CVSWorkspaceRoot {
final ICVSFolder folder = (ICVSFolder)CVSWorkspaceRoot.getCVSResourceFor(project);
try {
- // Get the import properties
- String message = Policy.bind("CVSProvider.initialImport"); //$NON-NLS-1$
- String vendor = "vendor"; //$NON-NLS-1$
- String tag = "start"; //$NON-NLS-1$
String projectName = project.getName();
if (moduleName == null)
moduleName = projectName;
// Perform the import using a dummy root so the local project is not traversed
- Session s = new Session(location, new RemoteFolderTree(null, location, Path.EMPTY.toString(), null));
+ RemoteFolderTree root = new RemoteFolderTree(null, location, Path.EMPTY.toString(), null);
+ root.setChildren(new ICVSRemoteResource[] {
+ new RemoteFolder(root, moduleName, null, null, null, false)
+ });
+ Session s = new Session(location, root);
s.open(monitor, true /* open for modification */);
try {
- IStatus status = Command.IMPORT.execute(s,
+ IStatus status = Command.ADD.execute(s,
Command.NO_GLOBAL_OPTIONS,
- new LocalOption[] {Import.makeArgumentOption(Command.MESSAGE_OPTION, message)},
- new String[] { moduleName, vendor, tag },
+ Command.NO_LOCAL_OPTIONS,
+ new String[] { moduleName },
null,
monitor);
// If we get a warning, the operation most likely failed so check that the status is OK
@@ -702,4 +701,21 @@ public class CVSWorkspaceRoot {
if (cvsResource.isIgnored()) return false;
return cvsResource.getParent().isCVSFolder();
}
+
+ /**
+ * Return whether the given container is an orphaned subtree. An orphaned subtree
+ * is folder (i.e. non-project) that is a CVS folder but is not managed and is not
+ * a linked resource. To know if the resource is a descendant of an orphaned subtree,
+ * the client must invoked this method for each ancestor of a resource.
+ * @param container the container being tested
+ * @return whether the container is an orphaned CVS folder
+ * @throws CVSException
+ */
+ public static boolean isOrphanedSubtree(IContainer container) throws CVSException {
+ ICVSFolder mFolder = CVSWorkspaceRoot.getCVSFolderFor(container);
+ return (mFolder.isCVSFolder()
+ && ! mFolder.isManaged()
+ && mFolder.getIResource().getType() == IResource.FOLDER
+ && !isLinkedResource(container));
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java
index 333ad5273..17be9e028 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java
@@ -322,10 +322,11 @@ class EclipseFolder extends EclipseResource implements ICVSFolder {
*/
public void delete() throws CVSException {
if (!exists()) return;
- if (isCVSFolder()) {
- EclipseSynchronizer.getInstance().prepareForDeletion(getIResource());
+ try {
+ resource.delete(false /*force*/, null);
+ } catch(CoreException e) {
+ throw new CVSException(e.getStatus());
}
- super.delete();
}
/**
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java
index 451856f5c..9a0bee1ce 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java
@@ -13,7 +13,6 @@ package org.eclipse.team.internal.ccvs.core.resources;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.Team;
import org.eclipse.team.internal.ccvs.core.CVSException;
@@ -73,17 +72,6 @@ abstract class EclipseResource implements ICVSResource, Comparable {
}
/*
- * @see ICVSResource#delete()
- */
- public void delete() throws CVSException {
- try {
- resource.delete(false /*force*/, null);
- } catch(CoreException e) {
- throw new CVSException(e.getStatus());
- }
- }
-
- /*
* @see ICVSResource#exists()
*/
public boolean exists() {
@@ -144,7 +132,7 @@ abstract class EclipseResource implements ICVSResource, Comparable {
if (parent.isIgnored()) return true;
FolderSyncInfo info = parent.getFolderSyncInfo();
if (info == null) return false;
- return info.getRepository().equals(FolderSyncInfo.VIRTUAL_DIRECTORY);
+ return info.isVirtualDirectory();
}
/*
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
index 4c5e9cd87..4156ee46d 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
@@ -53,6 +53,7 @@ import org.eclipse.team.internal.ccvs.core.syncinfo.ReentrantLock.IFlushOperatio
import org.eclipse.team.internal.ccvs.core.syncinfo.ReentrantLock.ThreadInfo;
import org.eclipse.team.internal.ccvs.core.util.Assert;
import org.eclipse.team.internal.ccvs.core.util.FileNameMatcher;
+import org.eclipse.team.internal.ccvs.core.util.ResourceStateChangeListeners;
import org.eclipse.team.internal.ccvs.core.util.SyncFileWriter;
/**
@@ -283,7 +284,7 @@ public class EclipseSynchronizer implements IFlushOperation {
try {
cacheResourceSyncForChildren(parent, false /* cannot modify workspace */);
} catch (CVSException e) {
- if (isCannotModifySynchronizer(e)) {
+ if (isCannotModifySynchronizer(e) || isResourceNotFound(e)) {
// We will resort to loading the sync info for the requested resource from disk
byte[] bytes = getSyncBytesFromDisk(resource);
if (!resource.exists() && bytes != null && !ResourceSyncInfo.isDeletion(bytes)) {
@@ -426,7 +427,7 @@ public class EclipseSynchronizer implements IFlushOperation {
// broadcast changes to unmanaged children - they are the only candidates for being ignored
List possibleIgnores = new ArrayList();
accumulateNonManagedChildren(folder, possibleIgnores);
- CVSProviderPlugin.broadcastSyncInfoChanges((IResource[])possibleIgnores.toArray(new IResource[possibleIgnores.size()]));
+ ResourceStateChangeListeners.getListener().resourceSyncInfoChanged((IResource[])possibleIgnores.toArray(new IResource[possibleIgnores.size()]));
} finally {
endOperation();
}
@@ -451,7 +452,7 @@ public class EclipseSynchronizer implements IFlushOperation {
cacheResourceSyncForChildren(folder, false);
}
} catch (CVSException e) {
- if (!isCannotModifySynchronizer(e)) {
+ if (!isCannotModifySynchronizer(e) && !isResourceNotFound(e)) {
throw e;
}
} finally {
@@ -473,6 +474,10 @@ public class EclipseSynchronizer implements IFlushOperation {
|| e.getStatus().getCode() == CVSStatus.FAILED_TO_CACHE_SYNC_INFO);
}
+ private boolean isResourceNotFound(CVSException e) {
+ return e.getStatus().getCode() == IResourceStatus.RESOURCE_NOT_FOUND;
+ }
+
/**
* Begins a batch of operations in order to optimize sync file writing.
* The provided scheduling rule indicates the resources
@@ -596,13 +601,6 @@ public class EclipseSynchronizer implements IFlushOperation {
monitor.done();
}
}
-
- private void purgeCache(IResource resource, boolean deep) throws CVSException {
- sessionPropertyCache.purgeResourceSyncCache(resource);
- if (resource.getType() != IResource.FILE) {
- sessionPropertyCache.purgeCache((IContainer)resource, deep);
- }
- }
/**
* Called to notify the synchronizer that meta files have changed on disk, outside
@@ -625,7 +623,7 @@ public class EclipseSynchronizer implements IFlushOperation {
endOperation();
}
if (!changed.isEmpty()) {
- CVSProviderPlugin.broadcastSyncInfoChanges(
+ ResourceStateChangeListeners.getListener().resourceSyncInfoChanged(
(IResource[]) changed.toArray(new IResource[changed.size()]));
}
} finally {
@@ -650,16 +648,25 @@ public class EclipseSynchronizer implements IFlushOperation {
changed.add(file);
}
}
- CVSProviderPlugin.broadcastExternalSyncInfoChanges(
+ ResourceStateChangeListeners.getListener().externalSyncInfoChange(
(IResource[]) changed.toArray(new IResource[changed.size()]));
}
- /**
- * The folder is about to be deleted (including its CVS subfolder).
- * Take any appropriate action to remember the CVS information.
+ /*
+ * The resource is about to be deleted by the move delete hook.
+ * In all cases (except when the resource doesn't exist), this method
+ * will indicate that the dirty state of the parent needs to be recomputed.
+ * For managed resources, it will move the cached sync info from the session
+ * property cache into the sycnrhonizer cache, purging the session cache.
+ * @param resource the resource about to be deleted.
+ * <p>
+ * Note taht this method is not recursive. Hence, for managed resources
+ *
+ * @returns whether children need to be prepared
+ * @throws CVSException
*/
- public void prepareForDeletion(IResource resource) throws CVSException {
- if (!resource.exists()) return;
+ /* private */ boolean prepareForDeletion(IResource resource) throws CVSException {
+ if (!resource.exists()) return false;
ISchedulingRule rule = null;
try {
rule = beginBatching(resource, null);
@@ -678,21 +685,27 @@ public class EclipseSynchronizer implements IFlushOperation {
syncBytes = convertToDeletion(syncBytes);
synchronizerCache.setCachedSyncBytes(resource, syncBytes, true);
}
+ sessionPropertyCache.purgeResourceSyncCache(resource);
resourceChanged(resource);
}
+ return false;
} else {
IContainer container = (IContainer)resource;
if (container.getType() == IResource.PROJECT) {
synchronizerCache.flush((IProject)container);
+ return false;
} else {
// Move the folder sync info into phantom space
FolderSyncInfo info = getFolderSync(container);
- if (info == null) return;
+ if (info == null) return false;
synchronizerCache.setCachedFolderSync(container, info, true);
folderChanged(container);
// move the resource sync as well
byte[] syncBytes = getSyncBytes(resource);
synchronizerCache.setCachedSyncBytes(resource, syncBytes, true);
+ sessionPropertyCache.purgeResourceSyncCache(container);
+ sessionPropertyCache.purgeCache(container, false);
+ return true;
}
}
} finally {
@@ -722,37 +735,41 @@ public class EclipseSynchronizer implements IFlushOperation {
}
/**
- * Prepare for a move or delete within the move/delete hook by moving the
- * sync info into phantom space and flushing the session properties cache.
- * This will allow sync info for deletions to be maintained in the source
- * location and sync info at the destination to be preserved as well.
+ * Prepare for the deletion of the target resource from within
+ * the move/delete hook. The method is invoked by both the
+ * deleteFile/Folder methods and for the source resource
+ * of moveFile/Folder. This method will move the cached sync info
+ * into the phantom (ISynchronizer) cache so that outgoing deletions
+ * and known remote folders are preserved.
*
* @param resource
* @param monitor
* @throws CVSException
*/
- public void prepareForMoveDelete(IResource resource, IProgressMonitor monitor) throws CVSException {
+ public void prepareForDeletion(IResource resource, IProgressMonitor monitor) throws CVSException {
// Move sync info to phantom space for the resource and all it's children
+ monitor = Policy.monitorFor(monitor);
try {
+ beginOperation();
monitor.beginTask(null, 100);
- resource.accept(new IResourceVisitor() {
- public boolean visit(IResource innerResource) throws CoreException {
- try {
- prepareForDeletion(innerResource);
- } catch (CVSException e) {
- CVSProviderPlugin.log(e);
- throw new CoreException(e.getStatus());
+ try {
+ resource.accept(new IResourceVisitor() {
+ public boolean visit(IResource innerResource) throws CoreException {
+ try {
+ return prepareForDeletion(innerResource);
+ } catch (CVSException e) {
+ CVSProviderPlugin.log(e);
+ throw new CoreException(e.getStatus());
+ }
}
- return true;
- }
- });
- } catch (CoreException e) {
- throw CVSException.wrapException(e);
+ });
+ } catch (CoreException e) {
+ throw CVSException.wrapException(e);
+ }
} finally {
+ endOperation();
monitor.done();
}
- // purge the sync info to clear the session properties
- purgeCache(resource, true);
}
/**
@@ -969,7 +986,7 @@ public class EclipseSynchronizer implements IFlushOperation {
*/
void broadcastResourceStateChanges(IResource[] resources) {
if (resources.length > 0) {
- CVSProviderPlugin.broadcastSyncInfoChanges(resources);
+ ResourceStateChangeListeners.getListener().resourceSyncInfoChanged(resources);
}
}
@@ -1540,5 +1557,71 @@ public class EclipseSynchronizer implements IFlushOperation {
if (rule != null) endBatching(rule, null);
}
}
+
+ /**
+ * React to a resource that was just moved by the move/delete hook.
+ * @param resource the resource that was moved (at its new location)
+ */
+ public void postMove(IResource resource) throws CVSException {
+ try {
+ beginOperation();
+ if (resource.getType() == IResource.FILE) {
+ // Purge any copied sync info so true sync info will
+ // be obtained from the synchronizer cache
+ sessionPropertyCache.purgeResourceSyncCache(resource);
+ } else {
+ IContainer container = (IContainer)resource;
+ // Purge any copied sync info
+ sessionPropertyCache.purgeCache(container, true /* deep */);
+ // Dirty all resources so old sync info will be rewritten to disk
+ try {
+ container.accept(new IResourceVisitor() {
+ public boolean visit(IResource resource) throws CoreException {
+ if (getSyncBytes(resource) != null) {
+ resourceChanged(resource);
+ }
+ if (resource.getType() != IResource.FILE) {
+ if (getFolderSync((IContainer)resource) != null) {
+ folderChanged((IContainer)resource);
+ return true;
+ }
+ }
+ return false;
+ }
+ });
+ } catch (CoreException e) {
+ throw CVSException.wrapException(e);
+ }
+ // Flush the sync info to disk
+ flush(container, true /* deep */, null);
+ }
+ } finally {
+ endOperation();
+ }
+ }
+ /**
+ * This method is to be invoked only from the move/delete hook. It's purpose
+ * is to obtain the sync look in order to prevent other threads from accessing
+ * sync info while the move/delete is taking place.
+ * @param runnable
+ * @param monitor
+ * @throws CVSException
+ */
+ public void performMoveDelete(ICVSRunnable runnable, IProgressMonitor monitor) throws CVSException {
+ ISchedulingRule rule = null;
+ try {
+ monitor.beginTask(null, 100);
+ rule = beginBatching(null, null);
+ try {
+ beginOperation();
+ runnable.run(Policy.subMonitorFor(monitor, 95));
+ } finally {
+ endOperation();
+ }
+ } finally {
+ if (rule != null) endBatching(rule, Policy.subMonitorFor(monitor, 5));
+ monitor.done();
+ }
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/FileContentCachingService.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/FileContentCachingService.java
index c2735c91d..e7b9146e4 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/FileContentCachingService.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/FileContentCachingService.java
@@ -16,6 +16,7 @@ import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.team.internal.ccvs.core.CVSException;
+import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.ICVSFile;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
@@ -49,6 +50,18 @@ public class FileContentCachingService {
}
}
+ /**
+ * Fetch and cache the file contents for the specified files.
+ * @param root the root folder for the files being fetched
+ * @param filePaths the root relative file paths
+ * @param monitor
+ * @throws CVSException
+ */
+ public static void fetchFileContents(RemoteFolderTree root, String[] filePaths, IProgressMonitor monitor) throws CVSException {
+ FileContentCachingService service = new FileContentCachingService((CVSRepositoryLocation)root.getRepository(), root, filePaths);
+ service.cacheFileContents(monitor);
+ }
+
public static RemoteFile buildRemoteTree(CVSRepositoryLocation repository, ICVSFile file, CVSTag tag, IProgressMonitor monitor) throws CVSException {
monitor.beginTask(null, 100);
try {
@@ -86,6 +99,10 @@ public class FileContentCachingService {
files,
null,
Policy.subMonitorFor(monitor, files.length * 100));
+ if (!status.isOK()) {
+ // No big deal but log the problem anyway
+ CVSProviderPlugin.log (new CVSException(status));
+ }
} finally {
session.close();
monitor.done();
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/FileModificationManager.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/FileModificationManager.java
index 1250c5b25..ad71ba405 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/FileModificationManager.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/FileModificationManager.java
@@ -31,6 +31,7 @@ import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.core.ICVSFile;
+import org.eclipse.team.internal.ccvs.core.util.ResourceStateChangeListeners;
/**
* This class performs several functions related to determining the modified
@@ -98,7 +99,7 @@ public class FileModificationManager implements IResourceChangeListener, ISavePa
}
});
if (!modifiedResources.isEmpty()) {
- CVSProviderPlugin.broadcastModificationStateChanges(
+ ResourceStateChangeListeners.getListener().resourceModified(
(IResource[])modifiedResources.toArray(new IResource[modifiedResources.size()]));
modifiedResources.clear();
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java
index 3643ecee4..8d04eb5dc 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java
@@ -20,6 +20,7 @@ import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -43,10 +44,10 @@ import org.eclipse.team.internal.ccvs.core.ICVSResourceVisitor;
import org.eclipse.team.internal.ccvs.core.ILogEntry;
import org.eclipse.team.internal.ccvs.core.Policy;
import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
import org.eclipse.team.internal.ccvs.core.client.Log;
import org.eclipse.team.internal.ccvs.core.client.Session;
import org.eclipse.team.internal.ccvs.core.client.Update;
+import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
import org.eclipse.team.internal.ccvs.core.client.Command.QuietOption;
import org.eclipse.team.internal.ccvs.core.client.listeners.LogListener;
@@ -60,12 +61,10 @@ import org.eclipse.team.internal.ccvs.core.util.Assert;
* This class provides the implementation of ICVSRemoteFile and IManagedFile for
* use by the repository and sync view.
*/
-public class RemoteFile extends RemoteResource implements ICVSRemoteFile, IStorage {
+public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
// sync info in byte form
private byte[] syncBytes;
- // buffer for file contents received from the server
- private byte[] contents;
// cache the log entry for the remote file
private ILogEntry entry;
@@ -164,33 +163,30 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile, IStora
* @see ICVSRemoteFile#getContents()
*/
public InputStream getContents(IProgressMonitor monitor) throws CVSException {
- if (contents == null) {
- // First, check to see if there's a cached contents for the file
- InputStream cached = getCachedContents();
- if (cached != null) {
- return cached;
- }
-
- // No contents cached so fetch contents from the server.
+ // Ensure that the contents are cached from the server
+ if (!isContentsCached()) {
fetchContents(monitor);
-
- // If the update succeeded but no contents were retreived from the server
- // than we can assume that the remote file has no contents.
- if (contents == null) {
- // The above is true unless there is a cache file
- cached = getCachedContents();
- if (cached != null) {
- return cached;
- } else {
- contents = new byte[0];
- }
- }
}
- return new ByteArrayInputStream(contents);
+ // If the fetch succeeded but no contents were cached from the server
+ // than we can assume that the remote file has no contents.
+ if (!isContentsCached()) {
+ setContents(new ByteArrayInputStream(new byte[0]), UPDATED, false /* keep history */, monitor);
+ }
+ // Return the cached contents
+ InputStream cached = getCachedContents();
+ Assert.isNotNull(cached, "Caching error for file " + getRepositoryRelativePath()); //$NON-NLS-1$
+ return cached;
}
/* package*/ void fetchContents(IProgressMonitor monitor) throws CVSException {
monitor.beginTask(Policy.bind("RemoteFile.getContents"), 100);//$NON-NLS-1$
+ if (getRevision().equals(ResourceSyncInfo.ADDED_REVISION)) {
+ // The revision of the remote file is not known so we need to use the tag to get the status of the file
+ CVSTag tag = getSyncInfo().getTag();
+ if (tag == null) tag = CVSTag.DEFAULT;
+ RemoteFolderMemberFetcher fetcher = new RemoteFolderMemberFetcher((RemoteFolder)getParent(), tag);
+ fetcher.updateFileRevisions(new ICVSFile[] { this }, Policy.subMonitorFor(monitor, 10));
+ }
Session session = new Session(getRepository(), parent, false /* create backups */);
session.open(Policy.subMonitorFor(monitor, 10), false /* read-only */);
try {
@@ -202,7 +198,7 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile, IStora
Update.IGNORE_LOCAL_CHANGES },
new ICVSResource[] { this },
null,
- Policy.subMonitorFor(monitor, 90));
+ Policy.subMonitorFor(monitor, 80));
if (status.getCode() == CVSStatus.SERVER_ERROR) {
throw new CVSServerException(status);
}
@@ -317,13 +313,11 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile, IStora
* @see ICVSFile#getSize()
*/
public long getSize() {
- if (contents == null) {
- File ioFile = getRemoteContentsCache().getFile(getCacheRelativePath());
- if (ioFile.exists()) {
- return ioFile.length();
- }
+ File ioFile = getRemoteContentsCache().getFile(getCacheRelativePath());
+ if (ioFile.exists()) {
+ return ioFile.length();
}
- return contents == null ? 0 : contents.length;
+ return 0;
}
/**
@@ -377,14 +371,15 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile, IStora
}
public InputStream getContents() throws CVSException {
- if (contents == null) {
- // Check for cached contents for the file
- InputStream cached = getCachedContents();
- if (cached != null) {
- return cached;
- }
+ // Return the cached contents
+ InputStream cached = getCachedContents();
+ if (cached != null) {
+ return cached;
}
- return new ByteArrayInputStream(contents == null ? new byte[0] : contents);
+ // There was nothing cached so return an empty stream.
+ // This is done to allow the contents to be fetched
+ // (i.e. update sends empty contents and real contents are sent back)
+ return new ByteArrayInputStream(new byte[0]);
}
private InputStream getCachedContents() throws CVSException {
@@ -424,13 +419,15 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile, IStora
* Return whether there are already contents cached for the given handle
*/
public boolean isContentsCached() {
+ if (getRevision().equals(ResourceSyncInfo.ADDED_REVISION)) return false;
return getRemoteContentsCache().hasContents(getCacheRelativePath());
}
/*
* @see ICVSFile#setReadOnly(boolean)
*/
- public void setReadOnly(boolean readOnly) throws CVSException {
+ public void setReadOnly(boolean readOnly) {
+ // RemoteFiles are always read only
}
/*
@@ -450,20 +447,21 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile, IStora
/*
* @see ICVSFile#setTimeStamp(Date)
*/
- public void setTimeStamp(Date date) throws CVSException {
+ public void setTimeStamp(Date date) {
+ // RemoteFiles are not muttable so do not support timestamp changes
}
/**
* @see ICVSFile#moveTo(String)
*/
- public void copyTo(String mFile) throws CVSException {
+ public void copyTo(String mFile) {
// Do nothing
}
/*
* @see IRemoteResource#members(IProgressMonitor)
*/
- public IRemoteResource[] members(IProgressMonitor progress) throws TeamException {
+ public IRemoteResource[] members(IProgressMonitor progress) {
return new IRemoteResource[0];
}
@@ -517,14 +515,14 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile, IStora
/**
* @see org.eclipse.team.internal.ccvs.core.ICVSFile#checkout(int)
*/
- public void edit(int notifications, IProgressMonitor monitor) throws CVSException {
+ public void edit(int notifications, IProgressMonitor monitor) {
// do nothing
}
/**
* @see org.eclipse.team.internal.ccvs.core.ICVSFile#uncheckout()
*/
- public void unedit(IProgressMonitor monitor) throws CVSException {
+ public void unedit(IProgressMonitor monitor) {
// do nothing
}
@@ -538,7 +536,7 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile, IStora
/**
* @see org.eclipse.team.internal.ccvs.core.ICVSFile#getPendingNotification()
*/
- public NotifyInfo getPendingNotification() throws CVSException {
+ public NotifyInfo getPendingNotification() {
return null;
}
@@ -563,13 +561,13 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile, IStora
/**
* @see org.eclipse.team.internal.ccvs.core.ICVSFile#committed(org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo)
*/
- public void checkedIn(String info) throws CVSException {
+ public void checkedIn(String info) {
// do nothing
}
/**
* @see org.eclipse.team.internal.ccvs.core.ICVSFile#isEdited()
*/
- public boolean isEdited() throws CVSException {
+ public boolean isEdited() {
return false;
}
/**
@@ -600,7 +598,7 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile, IStora
/* (non-Javadoc)
* @see org.eclipse.team.core.sync.IRemoteResource#getContentIdentifier()
*/
- public String getContentIdentifier() throws CVSException {
+ public String getContentIdentifier() {
return getRevision();
}
@@ -618,13 +616,22 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile, IStora
public IStorage getBufferedStorage(IProgressMonitor monitor) throws TeamException {
// Invoke getContents which ensures that contents are cached
getContents(monitor);
- return this;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.IStorage#getFullPath()
- */
- public IPath getFullPath() {
- return new Path(getRepositoryRelativePath());
+ return new IStorage() {
+ public InputStream getContents() throws CoreException {
+ return RemoteFile.this.getContents();
+ }
+ public IPath getFullPath() {
+ return new Path(getRepositoryRelativePath());
+ }
+ public String getName() {
+ return RemoteFile.this.getName();
+ }
+ public boolean isReadOnly() {
+ return true;
+ }
+ public Object getAdapter(Class adapter) {
+ return RemoteFile.this.getAdapter(adapter);
+ }
+ };
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java
index 8aaa53010..8916a12e3 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java
@@ -89,7 +89,9 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
public RemoteFolder(RemoteFolder parent, String name, ICVSRepositoryLocation repository, String repositoryRelativePath, CVSTag tag, boolean isStatic) {
super(parent, name);
- this.folderInfo = new FolderSyncInfo(repositoryRelativePath.toString(), repository.getLocation(), tag, isStatic);
+ if (repository != null) {
+ this.folderInfo = new FolderSyncInfo(repositoryRelativePath.toString(), repository.getLocation(), tag, isStatic);
+ }
this.repository = repository;
}
@@ -396,6 +398,9 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
* @see ICVSResource#getRemoteLocation(ICVSFolder)
*/
public String getRemoteLocation(ICVSFolder stopSearching) throws CVSException {
+ if (folderInfo == null) {
+ return Util.appendPath(parent.getRemoteLocation(stopSearching), getName());
+ }
return folderInfo.getRemoteLocation();
}
@@ -403,7 +408,7 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
* @see ICVSFolder#isCVSFolder()
*/
public boolean isCVSFolder() {
- return true;
+ return folderInfo != null;
}
/**
@@ -465,8 +470,6 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
*/
public void setFolderSyncInfo(FolderSyncInfo folderInfo) throws CVSException {
this.folderInfo = folderInfo;
- // Currently not supported
- throw new CVSException(Policy.bind("RemoteResource.invalidOperation"));//$NON-NLS-1$
}
/*
@@ -615,4 +618,12 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
public IStorage getBufferedStorage(IProgressMonitor monitor) throws TeamException {
return null;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.core.ICVSResource#isManaged()
+ */
+ public boolean isManaged() {
+ return super.isManaged() && isCVSFolder();
+ }
+
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SessionPropertySyncInfoCache.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SessionPropertySyncInfoCache.java
index 15bca6e99..96672c101 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SessionPropertySyncInfoCache.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SessionPropertySyncInfoCache.java
@@ -249,7 +249,7 @@ import org.eclipse.team.internal.ccvs.core.util.SyncFileWriter;
// a delta.
if(di == null) {
byte [] diBytes = ResourcesPlugin.getWorkspace().getSynchronizer().getSyncInfo(FOLDER_DIRTY_STATE_KEY, container);
- if(diBytes != null) {
+ if(diBytes != null && !CVSProviderPlugin.getPlugin().crashOnLastRun()) {
di = new String(diBytes);
if(di.equals(NOT_DIRTY_INDICATOR)) {
di = NOT_DIRTY_INDICATOR;
@@ -372,29 +372,15 @@ import org.eclipse.team.internal.ccvs.core.util.SyncFileWriter;
* @see org.eclipse.team.internal.ccvs.core.resources.SyncInfoCache#setCachedSyncBytes(org.eclipse.core.resources.IResource, byte[])
*/
void setCachedSyncBytes(IResource resource, byte[] syncBytes, boolean canModifyWorkspace) throws CVSException {
+ // Ensure that the sync bytes do not indicate a deletion
if (syncBytes != null && ResourceSyncInfo.isDeletion(syncBytes)) {
- // Ensue that the sync bytes do not indicate a deletion
syncBytes = ResourceSyncInfo.convertFromDeletion(syncBytes);
}
+ // Put the sync bytes into the cache
safeSetSessionProperty(resource, RESOURCE_SYNC_KEY, syncBytes);
- if (resource.exists()) {
- // Ensure the synchronizer is clear for exiting resources
- if (canModifyWorkspace) {
- byte[] oldBytes = synchronizerCache.getCachedSyncBytes(resource);
- if (oldBytes != null && canModifyWorkspace) {
- synchronizerCache.setCachedSyncBytes(resource, null, canModifyWorkspace);
- if (ResourceSyncInfo.isFolder(syncBytes)) {
- // Handle gender changes
- IContainer container;
- if (resource.getType() == IResource.FILE) {
- container = resource.getParent().getFolder(new Path(resource.getName()));
- } else {
- container = (IContainer)resource;
- }
- synchronizerCache.setCachedFolderSync(container, null, canModifyWorkspace);
- }
- }
- }
+ // Ensure the synchronizer is clear
+ if (canModifyWorkspace && synchronizerCache.getCachedSyncBytes(resource) != null) {
+ synchronizerCache.setCachedSyncBytes(resource, null, canModifyWorkspace);
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/BaserevInfo.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/BaserevInfo.java
index 3166344a3..41ebfb14a 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/BaserevInfo.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/BaserevInfo.java
@@ -41,6 +41,7 @@ public class BaserevInfo {
result.append(name);
result.append(ResourceSyncInfo.SEPARATOR);
result.append(revision);
+ result.append(ResourceSyncInfo.SEPARATOR);
return result.toString();
}
private void setEntryLine(String entryLine) throws CVSException {
@@ -48,7 +49,9 @@ public class BaserevInfo {
entryLine = entryLine.substring(1);
}
String[] strings = Util.parseIntoSubstrings(entryLine, ResourceSyncInfo.SEPARATOR);
- if(strings.length != 2) {
+ // Accept either a length of 2 or 3. If the length is 3, we ignore the last
+ // string as per the CVS spec.
+ if(strings.length != 2 && strings.length != 3) {
throw new CVSException(Policy.bind("BaseRevInfo.malformedEntryLine", entryLine)); //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/FolderSyncInfo.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/FolderSyncInfo.java
index 544ee08b0..31ac7d209 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/FolderSyncInfo.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/FolderSyncInfo.java
@@ -301,4 +301,15 @@ public class FolderSyncInfo {
}
return new FolderSyncInfo(repository, root, tag, isStatic);
}
+
+ /**
+ * Return whether the local directory is mapped to an existing remote
+ * directory or is just a local placeholder for child folders. a return type
+ * of <code>true</code> indicates that the local folder is not mapped to a
+ * remote folder.
+ * @return whether the directory is a local placeholder
+ */
+ public boolean isVirtualDirectory() {
+ return getRepository().equals(VIRTUAL_DIRECTORY);
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/BuildCleanupListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/BuildCleanupListener.java
index 7841f4a59..16d82a15b 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/BuildCleanupListener.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/BuildCleanupListener.java
@@ -27,7 +27,6 @@ import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
import org.eclipse.team.internal.ccvs.core.Policy;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
@@ -80,10 +79,8 @@ public class BuildCleanupListener implements IResourceDeltaVisitor, IResourceCha
*/
private boolean handleOrphanedSubtree(IContainer container) {
try {
- ICVSFolder mFolder = CVSWorkspaceRoot.getCVSFolderFor(container);
- if (mFolder.isCVSFolder() && ! mFolder.isManaged() && mFolder.getIResource().getParent().getType() != IResource.ROOT) {
- // linked resources are not considered orphans even if they have CVS folders in them
- if (isLinkedResource(mFolder)) return false;
+ if (CVSWorkspaceRoot.isOrphanedSubtree(container)) {
+ ICVSFolder mFolder = CVSWorkspaceRoot.getCVSFolderFor(container);
mFolder.unmanage(null);
return true;
}
@@ -93,13 +90,6 @@ public class BuildCleanupListener implements IResourceDeltaVisitor, IResourceCha
return false;
}
- private boolean isLinkedResource(ICVSResource cvsResource) throws CVSException {
- IResource iResource = cvsResource.getIResource();
- if (iResource != null)
- return CVSWorkspaceRoot.isLinkedResource(iResource);
- return false;
- }
-
public void resourceChanged(IResourceChangeEvent event) {
try {
IResourceDelta root = event.getDelta();
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/MoveDeleteHook.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/MoveDeleteHook.java
index fc697ae70..8dad4e254 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/MoveDeleteHook.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/MoveDeleteHook.java
@@ -33,7 +33,6 @@ import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
import org.eclipse.team.internal.ccvs.core.ICVSFile;
import org.eclipse.team.internal.ccvs.core.ICVSFileModificationValidator;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
import org.eclipse.team.internal.ccvs.core.Policy;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
@@ -55,28 +54,39 @@ public class MoveDeleteHook implements IMoveDeleteHook {
IProgressMonitor monitor) {
try {
+ monitor.beginTask(null, 100);
+
// No special handling required for team-private members
if (file.isTeamPrivateMember()) return false;
+
// If the file is ignored by CVS then we can just delete it.
ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor(file);
if (cvsFile.isIgnored()) return false;
+
+ // If we can't check out the files, return.
+ if (!checkOutFiles(tree, new IFile[] {file}, Policy.subMonitorFor(monitor, 30))) {
+ // Return that the delete was handled because the checkout
+ // will have reported the error to the IResourceTree
+ return true;
+ }
+
// Otherwise, we need to prepare properly for the delete
- EclipseSynchronizer.getInstance().run(new ICVSRunnable() {
+ EclipseSynchronizer.getInstance().performMoveDelete(new ICVSRunnable() {
public void run(IProgressMonitor monitor) throws CVSException {
try {
- monitor.beginTask(null, 100);
- if (checkOutFiles(tree, new IFile[] {file}, Policy.subMonitorFor(monitor, 35))) {
- EclipseSynchronizer.getInstance().prepareForMoveDelete(file, Policy.subMonitorFor(monitor, 30));
- tree.standardDeleteFile(file, updateFlags, Policy.subMonitorFor(monitor, 35));
- }
+ monitor.beginTask(null, 100);
+ EclipseSynchronizer.getInstance().prepareForDeletion(file, Policy.subMonitorFor(monitor, 40));
+ tree.standardDeleteFile(file, updateFlags, Policy.subMonitorFor(monitor, 60));
} finally {
monitor.done();
}
}
- }, monitor);
+ }, Policy.subMonitorFor(monitor, 70));
} catch (CVSException e) {
tree.failed(e.getStatus());
- }
+ } finally {
+ monitor.done();
+ }
return true;
}
@@ -94,12 +104,12 @@ public class MoveDeleteHook implements IMoveDeleteHook {
monitor.beginTask(null, 100);
try {
final ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor(folder);
- if (cvsFolder.isManaged() && ensureCheckedOut(new IFolder[] {folder}, tree, Policy.subMonitorFor(monitor, 30))) {
- EclipseSynchronizer.getInstance().run(new ICVSRunnable() {
+ if (cvsFolder.isCVSFolder() && ensureCheckedOut(new IFolder[] {folder}, tree, Policy.subMonitorFor(monitor, 30))) {
+ EclipseSynchronizer.getInstance().performMoveDelete(new ICVSRunnable() {
public void run(IProgressMonitor monitor) throws CVSException {
try {
monitor.beginTask(null, 100);
- EclipseSynchronizer.getInstance().prepareForMoveDelete(folder, Policy.subMonitorFor(monitor, 50));
+ EclipseSynchronizer.getInstance().prepareForDeletion(folder, Policy.subMonitorFor(monitor, 20));
tree.standardDeleteFolder(folder, updateFlags, Policy.subMonitorFor(monitor, 50));
} finally {
monitor.done();
@@ -108,7 +118,7 @@ public class MoveDeleteHook implements IMoveDeleteHook {
}, Policy.subMonitorFor(monitor, 70));
return true;
} else if (!cvsFolder.isIgnored()) {
- prepareToDelete(cvsFolder);
+ EclipseSynchronizer.getInstance().prepareForDeletion(cvsFolder.getIResource(), Policy.subMonitorFor(monitor, 70));
}
} catch (CVSException e) {
tree.failed(e.getStatus());
@@ -131,7 +141,7 @@ public class MoveDeleteHook implements IMoveDeleteHook {
// All other sync info is stored in session and persistant properties, which
// are deleted when the associated resources are deleted
try {
- EclipseSynchronizer.getInstance().prepareForDeletion(project);
+ EclipseSynchronizer.getInstance().prepareForDeletion(project, monitor);
} catch (CVSException e) {
CVSProviderPlugin.log(e);
}
@@ -150,31 +160,41 @@ public class MoveDeleteHook implements IMoveDeleteHook {
IProgressMonitor monitor) {
try {
- EclipseSynchronizer.getInstance().run(new ICVSRunnable() {
+ monitor.beginTask(null, 100);
+
+ // ensure we can write to both the source and the destination
+ IFile[] filesToCheckOut;
+ if (destination.exists()) {
+ filesToCheckOut = new IFile[] {source, destination};
+ } else {
+ filesToCheckOut = new IFile[] {source};
+ }
+ if (!checkOutFiles(tree, filesToCheckOut, Policy.subMonitorFor(monitor, 30))) {
+ // Return that the move was handled because the checkout
+ // will have reported the error to the IResourceTree
+ return true;
+ }
+
+ // Perform the move
+ EclipseSynchronizer.getInstance().performMoveDelete(new ICVSRunnable() {
public void run(IProgressMonitor monitor) throws CVSException {
try {
monitor.beginTask(null, 100);
- // ensure we can write to both the source and the destination
- IFile[] filesToCheckOut;
+ EclipseSynchronizer.getInstance().prepareForDeletion(source, Policy.subMonitorFor(monitor, 40));
if (destination.exists()) {
- filesToCheckOut = new IFile[] {source, destination};
- } else {
- filesToCheckOut = new IFile[] {source};
- }
- if (checkOutFiles(tree, filesToCheckOut, Policy.subMonitorFor(monitor, 30))) {
- EclipseSynchronizer.getInstance().prepareForMoveDelete(source, Policy.subMonitorFor(monitor, 20));
- if (destination.exists()) {
- EclipseSynchronizer.getInstance().prepareForMoveDelete(destination, Policy.subMonitorFor(monitor, 20));
- }
- tree.standardMoveFile(source, destination, updateFlags, Policy.subMonitorFor(monitor, 30));
+ EclipseSynchronizer.getInstance().prepareForDeletion(destination, Policy.subMonitorFor(monitor, 20));
}
+ tree.standardMoveFile(source, destination, updateFlags, Policy.subMonitorFor(monitor, 40));
+ EclipseSynchronizer.getInstance().postMove(destination);
} finally {
monitor.done();
}
}
- }, monitor);
+ }, Policy.subMonitorFor(monitor, 70));
} catch (CVSException e) {
tree.failed(e.getStatus());
+ } finally {
+ monitor.done();
}
return true;
}
@@ -194,14 +214,15 @@ public class MoveDeleteHook implements IMoveDeleteHook {
final ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor(source);
if (cvsFolder.isManaged()) {
if (!ensureCheckedOut(new IFolder[] {source, destination}, tree, Policy.subMonitorFor(monitor, 20))) return true;
- EclipseSynchronizer.getInstance().run(new ICVSRunnable() {
+ EclipseSynchronizer.getInstance().performMoveDelete(new ICVSRunnable() {
public void run(IProgressMonitor monitor) throws CVSException {
- EclipseSynchronizer.getInstance().prepareForMoveDelete(source, Policy.subMonitorFor(monitor, 20));
+ EclipseSynchronizer.getInstance().prepareForDeletion(source, Policy.subMonitorFor(monitor, 20));
if (destination.exists()) {
- EclipseSynchronizer.getInstance().prepareForMoveDelete(destination, Policy.subMonitorFor(monitor, 20));
+ EclipseSynchronizer.getInstance().prepareForDeletion(destination, Policy.subMonitorFor(monitor, 20));
}
tree.standardMoveFolder(source, destination, updateFlags, Policy.subMonitorFor(monitor, 30));
purgeCVSFolders(destination, Policy.subMonitorFor(monitor, 20));
+ EclipseSynchronizer.getInstance().postMove(destination);
}
private void purgeCVSFolders(IFolder destination, final IProgressMonitor monitor) throws CVSException {
// Delete any CVS folders
@@ -222,8 +243,7 @@ public class MoveDeleteHook implements IMoveDeleteHook {
}, Policy.subMonitorFor(monitor, 60));
return true;
} else if (!cvsFolder.isIgnored()) {
- // XXX Should be inside cvs runnable
- prepareToDelete(cvsFolder);
+ EclipseSynchronizer.getInstance().prepareForDeletion(cvsFolder.getIResource(), Policy.subMonitorFor(monitor, 60));
}
} catch (CVSException e) {
tree.failed(e.getStatus());
@@ -250,7 +270,7 @@ public class MoveDeleteHook implements IMoveDeleteHook {
// project will mean that the file deletions will be lost. It also means that phantom
// folders are lost.
try {
- EclipseSynchronizer.getInstance().prepareForDeletion(source);
+ EclipseSynchronizer.getInstance().prepareForDeletion(source, monitor);
} catch (CVSException e) {
CVSProviderPlugin.log(e);
}
@@ -265,7 +285,7 @@ public class MoveDeleteHook implements IMoveDeleteHook {
* @param file
* @return boolean
*/
- private boolean checkOutFiles(IResourceTree tree, IFile[] files, IProgressMonitor monitor) {
+ /* private */ boolean checkOutFiles(IResourceTree tree, IFile[] files, IProgressMonitor monitor) {
// Ensure that the file is "checked out" (i.e. not read-only
IFileModificationValidator validator = getFileModificationValidator(files);
if (validator instanceof ICVSFileModificationValidator) {
@@ -317,12 +337,4 @@ public class MoveDeleteHook implements IMoveDeleteHook {
CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(files[0].getProject(), CVSProviderPlugin.getTypeId());
return provider;
}
-
- /*
- * Signal that the unmanaged resource is about to be deleted so that the
- * dirty count of it's parent can be reduced if appropriate.
- */
- private void prepareToDelete(ICVSResource resource) throws CVSException {
- EclipseSynchronizer.getInstance().prepareForDeletion(resource.getIResource());
- }
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PrepareForReplaceVisitor.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PrepareForReplaceVisitor.java
index 4fef8987f..8963c8d83 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PrepareForReplaceVisitor.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PrepareForReplaceVisitor.java
@@ -91,7 +91,7 @@ public class PrepareForReplaceVisitor implements ICVSResourceVisitor {
monitor.worked(1);
}
- public void visitResources(IProject project, final IResource[] resources, final String key, int depth, IProgressMonitor pm) throws CVSException {
+ public void visitResources(IProject project, final ICVSResource[] resources, final String key, int depth, IProgressMonitor pm) throws CVSException {
this.depth = depth;
CVSWorkspaceRoot.getCVSFolderFor(project).run(new ICVSRunnable() {
public void run(IProgressMonitor pm) throws CVSException {
@@ -99,10 +99,9 @@ public class PrepareForReplaceVisitor implements ICVSResourceVisitor {
monitor.beginTask(null, 512);
for (int i = 0; i < resources.length; i++) {
if (key != null) {
- monitor.subTask(Policy.bind(key, resources[i].getFullPath().toString())); //$NON-NLS-1$
+ monitor.subTask(Policy.bind(key, resources[i].getIResource().getFullPath().toString())); //$NON-NLS-1$
}
- IResource resource = resources[i];
- CVSWorkspaceRoot.getCVSResourceFor(resource).accept(PrepareForReplaceVisitor.this);
+ resources[i].accept(PrepareForReplaceVisitor.this);
}
monitor.done();
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java
index 1b9977154..d5f3c7c08 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java
@@ -540,4 +540,8 @@ public class Util {
}
return resource.getName();
}
+
+ public static String getVariablePattern(String pattern, String variableName) {
+ return "(" + variableName + ":" + pattern + ":" + variableName + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
}
diff --git a/bundles/org.eclipse.team.ui/.classpath b/bundles/org.eclipse.team.ui/.classpath
index bd0325657..28f06a050 100644
--- a/bundles/org.eclipse.team.ui/.classpath
+++ b/bundles/org.eclipse.team.ui/.classpath
@@ -5,7 +5,6 @@
<classpathentry kind="src" path="/org.eclipse.team.core"/>
<classpathentry kind="src" path="/org.eclipse.ui"/>
<classpathentry kind="src" path="/org.eclipse.compare"/>
- <classpathentry kind="src" path="/org.apache.xerces"/>
<classpathentry kind="src" path="/org.eclipse.core.boot"/>
<classpathentry kind="src" path="/org.eclipse.core.runtime"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
diff --git a/bundles/org.eclipse.team.ui/.project b/bundles/org.eclipse.team.ui/.project
index f64f798e5..98a3aebac 100644
--- a/bundles/org.eclipse.team.ui/.project
+++ b/bundles/org.eclipse.team.ui/.project
@@ -3,7 +3,6 @@
<name>org.eclipse.team.ui</name>
<comment></comment>
<projects>
- <project>org.apache.xerces</project>
<project>org.eclipse.compare</project>
<project>org.eclipse.core.boot</project>
<project>org.eclipse.core.resources</project>
diff --git a/bundles/org.eclipse.team.ui/plugin.properties b/bundles/org.eclipse.team.ui/plugin.properties
index c0cfd111c..9a167c3f7 100644
--- a/bundles/org.eclipse.team.ui/plugin.properties
+++ b/bundles/org.eclipse.team.ui/plugin.properties
@@ -36,22 +36,6 @@ ProjectSetImportWizard.name=Team Project Set
ProjectSetImportWizard.description=A wizard that imports a Team Project Set
ProjectSetExportWizard.name=Team Project Set
ProjectSetExportWizard.description=A wizard that exports a Team Project Set
-TargetSiteImportWizard.name=Target Site
-TargetSiteImportWizard.description=A wizard that imports a Target site
-TargetSiteExportWizard.name=Target Site
-TargetSiteExportWizard.description=A wizard that exports a Target site
-
-Deployment.group=Depl&oy
-Deployment.getAction=&Target
-Deployment.uploadAction=Upl&oad
-Deployment.synchronize=Synchroni&ze with Target...
-
-SiteExplorerGetAs.label=Download &As...
-SiteExplorerGetAs.tooltip=Download the selected remote folder with a user specified project type and name.
-SiteExplorerGetAsProject.label=&Download As Project
-SiteExplorerGetAsProject.tooltip=Download the selected remote folder and create a project with the same name.
-SiteExplorerDiscardSite.label=D&iscard Site
-SiteExplorerDiscardSite.tooltip=Discard the site
Command.category.name=Team
Command.category.description=Actions that apply when working with a Team
diff --git a/bundles/org.eclipse.team.ui/plugin.xml b/bundles/org.eclipse.team.ui/plugin.xml
index 8747b5da4..47ca2048f 100644
--- a/bundles/org.eclipse.team.ui/plugin.xml
+++ b/bundles/org.eclipse.team.ui/plugin.xml
@@ -17,12 +17,10 @@
<import plugin="org.eclipse.team.core"/>
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.compare"/>
- <import plugin="org.apache.xerces"/>
</requires>
<extension-point id="configurationWizards" name="%configurationWizards" schema="schema/configurationWizards.exsd"/>
- <extension-point id="targetConfigWizards" name="%targetWizards"/>
<extension-point id="synchronizeParticipants" name="%synchronizeParticipants"/>
<!-- **************** PREFERENCES ******************* -->
@@ -46,26 +44,6 @@
id="org.eclipse.team.ui.IgnorePreferences">
</page>
</extension>
-<!-- ************** Property Pages *************** -->
- <extension
- point="org.eclipse.ui.propertyPages">
- <page
- objectClass="org.eclipse.team.internal.ui.target.SiteElement"
- name="%loginDetails"
- class="org.eclipse.team.internal.ui.target.AuthenticatedTargetSitePropertiesPage"
- id="org.eclipse.team.target.ui.propertyPages.AuthenticatedTargetSitePropertiesPage">
- </page>
- <page
- objectClass="org.eclipse.core.resources.IProject"
- name="%targetSite"
- class="org.eclipse.team.internal.ui.target.ProjectTargetMappingPropertiesPage"
- id="org.eclipse.team.internal.ui.target.ProjectTargetMappingPropertiesPage">
- <filter
- name="projectPersistentProperty"
- value="org.eclipse.team.target=basic">
- </filter>
- </page>
- </extension>
<!-- ****************** POPUP ACTIONS *************** -->
<extension
point="org.eclipse.ui.popupMenus">
@@ -128,66 +106,6 @@
id="org.eclipse.team.ui.ConfigureProject">
</action>
</objectContribution>
-<!-- ****************** Target Management Popup Actions *************** -->
- <objectContribution
- objectClass="org.eclipse.core.resources.IResource"
- adaptable="true"
- id="org.eclipse.team.ui.targetResourceContributionsActions">
- <filter
- name="projectPersistentProperty"
- value="org.eclipse.team.target=basic">
- </filter>
- <action
- label="%Deployment.getAction"
- helpContextId="org.eclipse.team.ui.target_get_action_context"
- class="org.eclipse.team.internal.ui.target.GetAction"
- menubarPath="replaceWithMenu/replaceWithGroup"
- id="org.eclipse.team.target.getAction">
- </action>
- <action
- label="%Deployment.uploadAction"
- helpContextId="org.eclipse.team.ui.target_put_action_context"
- class="org.eclipse.team.internal.ui.target.UploadAction"
- menubarPath="team.main/targetGroup"
- id="org.eclipse.team.target.uploadAction">
- </action>
- <action
- label="%Deployment.synchronize"
- helpContextId="org.eclipse.team.ui.target_synchronize_action_context"
- class="org.eclipse.team.internal.ui.target.SyncAction"
- menubarPath="team.main/targetGroup"
- id="org.eclipse.team.target.SyncAction">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.team.internal.ui.target.RemoteResourceElement"
- id="org.eclipse.team.internal.ui.target.RemoteResourceElement">
- <action
- label="%SiteExplorerGetAs.label"
- helpContextId="org.eclipse.team.ui.target_getas_action_context"
- tooltip="%SiteExplorerGetAs.tooltip"
- class="org.eclipse.team.internal.ui.target.GetAsAction"
- id="org.eclipse.team.internal.ui.target.GetAsAction">
- </action>
- <action
- label="%SiteExplorerGetAsProject.label"
- helpContextId="org.eclipse.team.ui.target_getasproject_action_context"
- tooltip="%SiteExplorerGetAsProject.tooltip"
- class="org.eclipse.team.internal.ui.target.GetAsProjectAction"
- id="org.eclipse.team.internal.ui.target.GetAsProjectAction">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.team.internal.ui.target.SiteElement"
- id="org.eclipse.team.internal.ui.target.SiteElement">
- <action
- label="%SiteExplorerDiscardSite.label"
- helpContextId="org.eclipse.team.ui.target_disconnect_action_context"
- tooltip="%SiteExplorerDiscardSite.tooltip"
- class="org.eclipse.team.internal.ui.target.DiscardSiteAction"
- id="org.eclipse.team.internal.ui.target.DiscardSiteAction">
- </action>
- </objectContribution>
</extension>
<!-- ************** Views ********************** -->
<extension
@@ -205,7 +123,7 @@
id="org.eclipse.team.ui.sync.SyncView">
</view>
<view
- name="Synchronize View"
+ name="%SyncView.name"
icon="icons/full/cview16/synch_synch.gif"
fastViewWidthRatio="0.25"
category="org.eclipse.team.ui"
@@ -279,12 +197,6 @@
relationship="stack"
id="org.eclipse.team.ui.sync.SyncView">
</view>
- <view
- relative="org.eclipse.ui.views.ResourceNavigator"
- visible="false"
- relationship="stack"
- id="org.eclipse.team.ui.target.SiteExplorerView">
- </view>
</perspectiveExtension>
<perspectiveExtension
targetID="org.eclipse.team.internal.ui.sync.views.TeamSynchronizingPerspective">
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java
index a89a0862d..36611f963 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java
@@ -193,4 +193,8 @@ public class Policy {
return "..." + stringPath.substring(index); //$NON-NLS-1$
}
}
+
+ public static ResourceBundle getBundle() {
+ return bundle;
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.java
index f3f05277f..1d58bdff1 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.java
@@ -32,7 +32,8 @@ public class ProjectSetContentHandler extends DefaultHandler {
* @see ContentHandler#startElement(String, String, String, Attributes)
*/
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
- if (localName.equals("psf")) { //$NON-NLS-1$
+ String elementName = getElementName(namespaceURI, localName, qName);
+ if (elementName.equals("psf")) { //$NON-NLS-1$ //$NON-NLS-2$
map = new HashMap();
inPsf = true;
String version = atts.getValue("version"); //$NON-NLS-1$
@@ -40,14 +41,14 @@ public class ProjectSetContentHandler extends DefaultHandler {
return;
}
if (isVersionOne) return;
- if (localName.equals("provider")) { //$NON-NLS-1$
+ if (elementName.equals("provider")) { //$NON-NLS-1$ //$NON-NLS-2$
if (!inPsf) throw new SAXException(Policy.bind("ProjectSetContentHandler.Element_provider_must_be_contained_in_element_psf_4")); //$NON-NLS-1$
inProvider = true;
id = atts.getValue("id"); //$NON-NLS-1$
references = new ArrayList();
return;
}
- if (localName.equals("project")) { //$NON-NLS-1$
+ if (elementName.equals("project")) { //$NON-NLS-1$ //$NON-NLS-2$
if (!inProvider) throw new SAXException(Policy.bind("ProjectSetContentHandler.Element_project_must_be_contained_in_element_provider_7")); //$NON-NLS-1$
inProject = true;
String reference = atts.getValue("reference"); //$NON-NLS-1$
@@ -60,18 +61,19 @@ public class ProjectSetContentHandler extends DefaultHandler {
* @see ContentHandler#endElement(String, String, String)
*/
public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
- if (localName.equals("psf")) { //$NON-NLS-1$
+ String elementName = getElementName(namespaceURI, localName, qName);
+ if (elementName.equals("psf")) { //$NON-NLS-1$ //$NON-NLS-2$
inPsf = false;
return;
}
if (isVersionOne) return;
- if (localName.equals("provider")) { //$NON-NLS-1$
+ if (elementName.equals("provider")) { //$NON-NLS-1$ //$NON-NLS-2$
map.put(id, references);
references = null;
inProvider = false;
return;
}
- if (localName.equals("project")) { //$NON-NLS-1$
+ if (elementName.equals("project")) { //$NON-NLS-1$ //$NON-NLS-2$
inProject = false;
return;
}
@@ -84,4 +86,17 @@ public class ProjectSetContentHandler extends DefaultHandler {
public boolean isVersionOne() {
return isVersionOne;
}
+
+ /*
+ * Couldn't figure out from the SAX API exactly when localName vs. qName is used.
+ * However, the XML for project sets doesn't use namespaces so either of the two names
+ * is fine. Therefore, use whichever one is provided.
+ */
+ private String getElementName(String namespaceURI, String localName, String qName) {
+ if (localName != null && localName.length() > 0) {
+ return localName;
+ } else {
+ return qName;
+ }
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java
index c393e35f7..c07f46123 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java
@@ -64,7 +64,7 @@ public class TeamUIPlugin extends AbstractUIPlugin implements IPropertyChangeLis
private static List propertyChangeListeners = new ArrayList(5);
- private static Hashtable imageDescriptors = new Hashtable(20);
+ private Hashtable imageDescriptors = new Hashtable(20);
private static List disposeOnShutdownImages= new ArrayList();
private RefreshSubscriberInputJob refreshJob;
@@ -141,6 +141,16 @@ public class TeamUIPlugin extends AbstractUIPlugin implements IPropertyChangeLis
* @return the singleton plugin instance
*/
public static TeamUIPlugin getPlugin() {
+ // If the instance has not been initialized, we will wait.
+ // This can occur if multiple threads try to load the plugin at the same
+ // time (see bug 33825: http://bugs.eclipse.org/bugs/show_bug.cgi?id=33825)
+ while (instance == null) {
+ try {
+ Thread.sleep(50);
+ } catch (InterruptedException e) {
+ // ignore and keep trying
+ }
+ }
return instance;
}
/**
@@ -254,6 +264,10 @@ public class TeamUIPlugin extends AbstractUIPlugin implements IPropertyChangeLis
* @param baseURL the base URL for the image
*/
protected static void createImageDescriptor(String id, URL baseURL) {
+ // Delegate to the plugin instance to avoid concurrent class loading problems
+ getPlugin().privateCreateImageDescriptor(id, baseURL);
+ }
+ private void privateCreateImageDescriptor(String id, URL baseURL) {
URL url = null;
try {
url = new URL(baseURL, ICON_PATH + id);
@@ -270,6 +284,10 @@ public class TeamUIPlugin extends AbstractUIPlugin implements IPropertyChangeLis
* @return the image associated with the given ID
*/
public static ImageDescriptor getImageDescriptor(String id) {
+ // Delegate to the plugin instance to avoid concurrent class loading problems
+ return getPlugin().privateGetImageDescriptor(id);
+ }
+ private ImageDescriptor privateGetImageDescriptor(String id) {
if(! imageDescriptors.containsKey(id)) {
URL baseURL = TeamUIPlugin.getPlugin().getDescriptor().getInstallURL();
createImageDescriptor(id, baseURL);
@@ -365,6 +383,10 @@ public class TeamUIPlugin extends AbstractUIPlugin implements IPropertyChangeLis
* Dispose of images
*/
public static void disposeImages() {
+ // Delegate to the plugin instance to avoid concurrent class loading problems
+ getPlugin().privateDisposeImages();
+ }
+ private void privateDisposeImages() {
if (disposeOnShutdownImages != null) {
Iterator i= disposeOnShutdownImages.iterator();
while (i.hasNext()) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java
index 5178ca73f..af26e305c 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java
@@ -34,8 +34,6 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.core.TeamPlugin;
-import org.eclipse.team.internal.core.target.TargetManager;
-import org.eclipse.team.internal.core.target.TargetProvider;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.ui.IObjectActionDelegate;
@@ -46,6 +44,7 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionDelegate;
/**
@@ -68,6 +67,7 @@ public abstract class TeamAction extends ActionDelegate implements IObjectAction
// pass one of these values to the run method.
public final static int PROGRESS_DIALOG = 1;
public final static int PROGRESS_BUSYCURSOR = 2;
+ public final static int PROGRESS_WORKBENCH_WINDOW = 3;
private IWorkbenchPart targetPart;
@@ -186,6 +186,16 @@ public abstract class TeamAction extends ActionDelegate implements IObjectAction
final protected void run(final IRunnableWithProgress runnable, final String problemMessage, int progressKind) {
final Exception[] exceptions = new Exception[] {null};
switch (progressKind) {
+ case PROGRESS_WORKBENCH_WINDOW :
+ try {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().run(true, true, runnable);
+ } catch (InterruptedException e1) {
+ exceptions[0] = null;
+ e1.printStackTrace();
+ } catch (InvocationTargetException e) {
+ exceptions[0] = e;
+ }
+ break;
case PROGRESS_BUSYCURSOR :
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
public void run() {
@@ -311,37 +321,6 @@ public abstract class TeamAction extends ActionDelegate implements IObjectAction
}
/**
- * Convenience method that maps the selected resources to their target providers.
- * The returned Hashtable has keys which are TargetProviders, and values
- * which are Lists of IResources that are shared with that provider.
- *
- * @return a hashtable mapping providers to their selected resources
- */
- protected Hashtable getTargetProviderMapping() throws TeamException {
- return getTargetProviderMapping(getSelectedResources());
- }
- /**
- * Convenience method that maps the given resources to their target providers.
- * The returned Hashtable has keys which are TargetProviders, and values
- * which are Lists of IResources that are shared with that provider.
- *
- * @return a hashtable mapping providers to their resources
- */
- protected Hashtable getTargetProviderMapping(IResource[] resources) throws TeamException {
- Hashtable result = new Hashtable();
- for (int i = 0; i < resources.length; i++) {
- TargetProvider provider = TargetManager.getProvider(resources[i].getProject());
- List list = (List)result.get(provider);
- if (list == null) {
- list = new ArrayList();
- result.put(provider, list);
- }
- list.add(resources[i]);
- }
- return result;
- }
-
- /**
* @return IWorkbenchPart
*/
protected IWorkbenchPart getTargetPart() {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialog.java
index d5fe9f945..44ab6a890 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialog.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialog.java
@@ -143,7 +143,6 @@ abstract public class DetailsDialog extends Dialog {
layout.numColumns = 2;
top.setLayout(layout);
top.setLayoutData(new GridData(GridData.FILL_BOTH));
- top.setFont(parent.getFont());
// add the image to the left of the composite
Label label = new Label(top, 0);
@@ -162,7 +161,6 @@ abstract public class DetailsDialog extends Dialog {
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
right.setLayout(layout);
right.setLayoutData(new GridData(GridData.FILL_BOTH));
- right.setFont(parent.getFont());
createMainDialogArea(right);
} else {
createMainDialogArea(composite);
@@ -172,9 +170,9 @@ abstract public class DetailsDialog extends Dialog {
errorMessageLabel.setLayoutData(new GridData(
GridData.GRAB_HORIZONTAL |
GridData.HORIZONTAL_ALIGN_FILL));
- errorMessageLabel.setFont(parent.getFont());
errorMessageLabel.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_RED));
+ Dialog.applyDialogFont(parent);
return composite;
}
@@ -210,7 +208,7 @@ abstract public class DetailsDialog extends Dialog {
detailsCreated = true;
detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL);
}
-
+ Dialog.applyDialogFont(getContents());
Point newSize = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT);
getShell().setSize(new Point(windowSize.x, windowSize.y + (newSize.y - oldSize.y)));
@@ -283,7 +281,6 @@ abstract public class DetailsDialog extends Dialog {
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- composite.setFont(parent.getFont());
return composite;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialogWithProjects.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialogWithProjects.java
index b1db66d2a..8993d5299 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialogWithProjects.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialogWithProjects.java
@@ -61,7 +61,6 @@ public class DetailsDialogWithProjects extends DetailsDialog {
GridData.VERTICAL_ALIGN_CENTER);
data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
label.setLayoutData(data);
- label.setFont(composite.getFont());
updateEnablements();
}
@@ -78,7 +77,6 @@ public class DetailsDialogWithProjects extends DetailsDialog {
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- composite.setFont(parent.getFont());
detailsList = new org.eclipse.swt.widgets.List(composite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
GridData data = new GridData ();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PreferencePageContainerDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PreferencePageContainerDialog.java
index 9ea7871ba..b67505869 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PreferencePageContainerDialog.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PreferencePageContainerDialog.java
@@ -149,12 +149,9 @@ public class PreferencePageContainerDialog extends Dialog implements IPreference
/**
* @see Dialog#createDialogArea(Composite)
*/
- protected Control createDialogArea(Composite parent) {
- Font font = parent.getFont();
-
+ protected Control createDialogArea(Composite parent) {
Composite composite = (Composite)super.createDialogArea(parent);
((GridLayout) composite.getLayout()).numColumns = 1;
- composite.setFont(font);
// Build the title area and separator line
Composite titleComposite = new Composite(composite, SWT.NONE);
@@ -165,7 +162,6 @@ public class PreferencePageContainerDialog extends Dialog implements IPreference
layout.horizontalSpacing = 0;
titleComposite.setLayout(layout);
titleComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- titleComposite.setFont(font);
createTitleArea(titleComposite);
@@ -187,7 +183,7 @@ public class PreferencePageContainerDialog extends Dialog implements IPreference
gd.horizontalSpan = 2;
separator.setLayoutData(gd);
- applyDialogFont(composite);
+ applyDialogFont(parent);
return composite;
}
@@ -218,7 +214,6 @@ public class PreferencePageContainerDialog extends Dialog implements IPreference
GridData layoutData = new GridData(GridData.FILL_BOTH);
fTitleArea.setLayout(layout);
fTitleArea.setLayoutData(layoutData);
- fTitleArea.setFont(font);
fTitleArea.setBackground(bg);
// Message label
@@ -265,7 +260,6 @@ public class PreferencePageContainerDialog extends Dialog implements IPreference
private Composite createPageContainer(Composite parent) {
Composite result = new Composite(parent, SWT.NULL);
result.setLayout(new PageLayout());
- result.setFont(parent.getFont());
return result;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TeamSubscriberParticipantPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TeamSubscriberParticipantPage.java
index c3d0c7273..160f0f7b0 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TeamSubscriberParticipantPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TeamSubscriberParticipantPage.java
@@ -43,11 +43,19 @@ import org.eclipse.team.internal.ui.IPreferenceIds;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.actions.TeamAction;
import org.eclipse.team.internal.ui.jobs.JobBusyCursor;
+import org.eclipse.team.internal.ui.synchronize.actions.ComparisonCriteriaActionGroup;
+import org.eclipse.team.internal.ui.synchronize.actions.INavigableControl;
+import org.eclipse.team.internal.ui.synchronize.actions.NavigateAction;
+import org.eclipse.team.internal.ui.synchronize.actions.OpenWithActionGroup;
+import org.eclipse.team.internal.ui.synchronize.actions.RefactorActionGroup;
+import org.eclipse.team.internal.ui.synchronize.actions.RefreshAction;
import org.eclipse.team.internal.ui.synchronize.actions.StatusLineContributionGroup;
+import org.eclipse.team.internal.ui.synchronize.actions.SyncViewerShowPreferencesAction;
+import org.eclipse.team.internal.ui.synchronize.actions.ToggleViewLayoutAction;
import org.eclipse.team.internal.ui.synchronize.actions.WorkingSetFilterActionGroup;
import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInput;
+import org.eclipse.team.internal.ui.synchronize.views.SyncSetContentProvider;
import org.eclipse.team.internal.ui.synchronize.views.SyncSetTableContentProvider;
import org.eclipse.team.internal.ui.synchronize.views.SyncTableViewer;
import org.eclipse.team.internal.ui.synchronize.views.SyncTreeViewer;
@@ -56,21 +64,10 @@ import org.eclipse.team.internal.ui.synchronize.views.SyncViewerSorter;
import org.eclipse.team.internal.ui.synchronize.views.SyncViewerTableSorter;
import org.eclipse.team.ui.synchronize.ISynchronizeView;
import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant;
-import org.eclipse.team.ui.synchronize.actions.AndSyncInfoFilter;
-import org.eclipse.team.ui.synchronize.actions.ComparisonCriteriaActionGroup;
-import org.eclipse.team.ui.synchronize.actions.INavigableControl;
-import org.eclipse.team.ui.synchronize.actions.NavigateAction;
-import org.eclipse.team.ui.synchronize.actions.OpenWithActionGroup;
-import org.eclipse.team.ui.synchronize.actions.PseudoConflictFilter;
-import org.eclipse.team.ui.synchronize.actions.RefactorActionGroup;
-import org.eclipse.team.ui.synchronize.actions.RefreshAction;
import org.eclipse.team.ui.synchronize.actions.SubscriberAction;
-import org.eclipse.team.ui.synchronize.actions.SyncInfoChangeTypeFilter;
-import org.eclipse.team.ui.synchronize.actions.SyncInfoDirectionFilter;
import org.eclipse.team.ui.synchronize.actions.SyncInfoFilter;
-import org.eclipse.team.ui.synchronize.actions.SyncViewerShowPreferencesAction;
-import org.eclipse.team.ui.synchronize.actions.ToggleViewLayoutAction;
import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.IPageBookViewPage;
@@ -220,6 +217,7 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper
refactorActions.fillContextMenu(manager);
manager.add(new Separator());
manager.add(expandAll);
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
/**
@@ -465,12 +463,8 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper
return ""; //$NON-NLS-1$
}
- /**
- * @param object
- * @return
- */
private IResource getResource(Object object) {
- return (IResource)TeamAction.getAdapter(object, IResource.class);
+ return SyncSetContentProvider.getResource(object);
}
public void selectAll() {
@@ -576,11 +570,11 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper
}
try {
input.setFilter(
- new AndSyncInfoFilter(
+ new SyncInfoFilter.AndSyncInfoFilter(
new SyncInfoFilter[] {
- new SyncInfoDirectionFilter(modeFilter),
- new SyncInfoChangeTypeFilter(new int[] {SyncInfo.ADDITION, SyncInfo.DELETION, SyncInfo.CHANGE}),
- new PseudoConflictFilter()
+ new SyncInfoFilter.SyncInfoDirectionFilter(modeFilter),
+ new SyncInfoFilter.SyncInfoChangeTypeFilter(new int[] {SyncInfo.ADDITION, SyncInfo.DELETION, SyncInfo.CHANGE}),
+ new SyncInfoFilter.PseudoConflictFilter()
}), new NullProgressMonitor());
} catch (TeamException e) {
Utils.handleError(getSite().getShell(), e, Policy.bind("SynchronizeView.16"), e.getMessage()); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/ComparisonCriteriaActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ComparisonCriteriaActionGroup.java
index 212a966d4..c56de08d7 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/ComparisonCriteriaActionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ComparisonCriteriaActionGroup.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.ui.synchronize.actions;
+package org.eclipse.team.internal.ui.synchronize.actions;
import java.lang.reflect.InvocationTargetException;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/INavigableControl.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/INavigableControl.java
index 0ea1df8e7..14e19b114 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/INavigableControl.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/INavigableControl.java
@@ -8,12 +8,12 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.ui.synchronize.actions;
+package org.eclipse.team.internal.ui.synchronize.actions;
public interface INavigableControl {
/**
- * Direction to naviate
+ * Direction to navigate
*/
final public static int NEXT = 1;
final public static int PREVIOUS = 2;
@@ -22,18 +22,4 @@ public interface INavigableControl {
* Returns true if at end or beginning.
*/
boolean gotoDifference(int direction);
-
- /**
- * Preserve the selection for the given direction
- * filter.
- * @param the direction to preserve
- */
- void preserveState(int direction);
-
- /**
- * Restore the selection and expansion for the
- * given direction.
- * @param direction the direction to restore
- */
- void restoreState(int direction);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/NavigateAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java
index 3eea9eaa3..c2a9c896b 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/NavigateAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.ui.synchronize.actions;
+package org.eclipse.team.internal.ui.synchronize.actions;
import org.eclipse.compare.CompareEditorInput;
import org.eclipse.compare.ICompareNavigator;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenFileInSystemEditorAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenFileInSystemEditorAction.java
new file mode 100644
index 000000000..f5f90cc77
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenFileInSystemEditorAction.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.synchronize.actions;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.team.internal.ui.synchronize.views.SyncSetContentProvider;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.actions.OpenFileAction;
+
+public class OpenFileInSystemEditorAction extends OpenFileAction {
+
+ public OpenFileInSystemEditorAction(IWorkbenchPage page) {
+ super(page);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.actions.SelectionListenerAction#getSelectedResources()
+ */
+ protected List getSelectedResources() {
+ List resources = new ArrayList();
+ IStructuredSelection selection = getStructuredSelection();
+ for (Iterator e = selection.iterator(); e.hasNext();) {
+ Object next = e.next();
+ IResource resource = SyncSetContentProvider.getResource(next);
+ if(resource != null) {
+ resources.add(resource);
+ }
+ }
+ return resources;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.actions.SelectionListenerAction#getSelectedNonResources()
+ */
+ protected List getSelectedNonResources() {
+ return Collections.EMPTY_LIST;
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/OpenInCompareAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
index c9765b0a1..b1cd30fa1 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/OpenInCompareAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.ui.synchronize.actions;
+package org.eclipse.team.internal.ui.synchronize.actions;
import java.lang.reflect.InvocationTargetException;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/OpenWithActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java
index 0a9e97c0d..2a5716659 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/OpenWithActionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java
@@ -8,26 +8,26 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.ui.synchronize.actions;
+package org.eclipse.team.internal.ui.synchronize.actions;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.internal.ui.actions.TeamAction;
+import org.eclipse.team.internal.ui.synchronize.views.SyncSetContentProvider;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.actions.ActionGroup;
-import org.eclipse.ui.actions.OpenFileAction;
import org.eclipse.ui.actions.OpenWithMenu;
import org.eclipse.ui.views.navigator.ResourceNavigatorMessages;
/**
- * This is the action group for the open actions.
+ * This is the action group for the open actions. It contains open
+ * actions for
*/
public class OpenWithActionGroup extends ActionGroup {
- private OpenFileAction openFileAction;
+ private OpenFileInSystemEditorAction openFileAction;
private OpenInCompareAction openInCompareAction;
private IViewPart part;
@@ -37,7 +37,7 @@ public class OpenWithActionGroup extends ActionGroup {
}
protected void makeActions() {
- openFileAction = new OpenFileAction(part.getSite().getPage());
+ openFileAction = new OpenFileInSystemEditorAction(part.getSite().getPage());
openInCompareAction = new OpenInCompareAction(part);
}
@@ -89,7 +89,7 @@ public class OpenWithActionGroup extends ActionGroup {
}
private IResource getResource(Object obj) {
- return (IResource)TeamAction.getAdapter(obj, IResource.class);
+ return SyncSetContentProvider.getResource(obj);
}
public void openInCompareEditor() {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/RefactorActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java
index 7119ca42a..13930ea8c 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/RefactorActionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java
@@ -8,17 +8,21 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.ui.synchronize.actions;
+package org.eclipse.team.internal.ui.synchronize.actions;
+import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.internal.ui.Policy;
+import org.eclipse.team.internal.ui.synchronize.views.SyncSetContentProvider;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IKeyBindingService;
import org.eclipse.ui.ISharedImages;
@@ -59,18 +63,31 @@ public class RefactorActionGroup extends ActionGroup {
IResource.PROJECT | IResource.FOLDER | IResource.FILE);
MenuManager menu = new MenuManager(Policy.bind("RefactorActionGroup.0")); //$NON-NLS-1$
-
+ IStructuredSelection convertedSelection = convertSelection(selection);
+
if (anyResourceSelected) {
- deleteAction.selectionChanged(selection);
+ deleteAction.selectionChanged(convertedSelection);
menu.add(deleteAction);
- moveAction.selectionChanged(selection);
+ moveAction.selectionChanged(convertedSelection);
menu.add(moveAction);
- renameAction.selectionChanged(selection);
+ renameAction.selectionChanged(convertedSelection);
menu.add(renameAction);
}
parentMenu.add(menu);
}
+ private IStructuredSelection convertSelection(IStructuredSelection selection) {
+ List resources = new ArrayList();
+ Iterator it = selection.iterator();
+ while(it.hasNext()) {
+ IResource resource = SyncSetContentProvider.getResource(it.next());
+ if(resource != null) {
+ resources.add(resource);
+ }
+ }
+ return new StructuredSelection(resources);
+ }
+
public void fillActionBars(IActionBars actionBars) {
textActionHandler = new TextActionHandler(actionBars); // hooks handlers
textActionHandler.setDeleteAction(deleteAction);
@@ -122,6 +139,9 @@ public class RefactorActionGroup extends ActionGroup {
IAdaptable adaptable = (IAdaptable)next;
resource = (IResource)adaptable.getAdapter(IResource.class);
}
+ if(resource == null) {
+ resource = SyncSetContentProvider.getResource(next);
+ }
if (resource == null || (resource.getType() & resourceMask) == 0) {
return false;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/RefreshAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefreshAction.java
index c98468640..bd8f4bc53 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/RefreshAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefreshAction.java
@@ -8,9 +8,12 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.ui.synchronize.actions;
+package org.eclipse.team.internal.ui.synchronize.actions;
import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -21,11 +24,15 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.TeamSubscriber;
-import org.eclipse.team.internal.ui.*;
-import org.eclipse.team.internal.ui.actions.TeamAction;
+import org.eclipse.team.internal.ui.IPreferenceIds;
+import org.eclipse.team.internal.ui.Policy;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.jobs.JobStatusHandler;
import org.eclipse.team.internal.ui.jobs.RefreshSubscriberJob;
import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInput;
+import org.eclipse.team.internal.ui.synchronize.views.SyncSetContentProvider;
+import org.eclipse.team.ui.synchronize.actions.SubscriberAction;
import org.eclipse.ui.IWorkbenchPage;
public class RefreshAction extends Action {
@@ -52,11 +59,19 @@ public class RefreshAction extends Action {
}
}
- private IResource[] getResources(ISelection selection) {
+ private IResource[] getResources(IStructuredSelection selection) {
if(selection == null) {
return new IResource[0];
}
- return (IResource[])TeamAction.getSelectedAdaptables(selection, IResource.class);
+ List resources = new ArrayList();
+ Iterator it = selection.iterator();
+ while(it.hasNext()) {
+ IResource resource = SyncSetContentProvider.getResource(it.next());
+ if(resource != null) {
+ resources.add(resource);
+ }
+ }
+ return (IResource[]) resources.toArray(new IResource[resources.size()]);
}
public static void run(IResource[] resources, TeamSubscriber subscriber) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineCLabelContribution.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineCLabelContribution.java
index a038c805e..1fe202a2b 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineCLabelContribution.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineCLabelContribution.java
@@ -26,7 +26,7 @@ public class StatusLineCLabelContribution extends ContributionItem {
private int charWidth;
private CLabel label;
private Image image;
- private String text = "";
+ private String text = ""; //$NON-NLS-1$
private int widthHint = -1;
public StatusLineCLabelContribution(String id) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java
index 00a53781e..636f7c2a2 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java
@@ -25,9 +25,9 @@ import org.eclipse.ui.actions.ActionGroup;
public class StatusLineContributionGroup extends ActionGroup implements ISyncSetChangedListener {
- private static final String INCOMING_ID = "org.eclipse.team.iu.statusline.incoming";
- private static final String OUTGOING_ID = "org.eclipse.team.iu.statusline.outgoing";
- private static final String CONFLICTING_ID = "org.eclipse.team.iu.statusline.conflicting";
+ private static final String INCOMING_ID = "org.eclipse.team.iu.statusline.incoming"; //$NON-NLS-1$
+ private static final String OUTGOING_ID = "org.eclipse.team.iu.statusline.outgoing"; //$NON-NLS-1$
+ private static final String CONFLICTING_ID = "org.eclipse.team.iu.statusline.conflicting"; //$NON-NLS-1$
private StatusLineCLabelContribution incoming;
private StatusLineCLabelContribution outgoing;
@@ -36,16 +36,16 @@ public class StatusLineContributionGroup extends ActionGroup implements ISyncSet
public StatusLineContributionGroup(SubscriberInput input) {
super();
- this.incoming = createStatusLineContribution(INCOMING_ID, "0", TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_INCOMING).createImage());
- this.outgoing = createStatusLineContribution(OUTGOING_ID, "0", TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_OUTGOING).createImage());
- this.conflicting = createStatusLineContribution(CONFLICTING_ID, "0", TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_CONFLICTING).createImage());
+ this.incoming = createStatusLineContribution(INCOMING_ID, "0", TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_INCOMING).createImage()); //$NON-NLS-1$
+ this.outgoing = createStatusLineContribution(OUTGOING_ID, "0", TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_OUTGOING).createImage()); //$NON-NLS-1$
+ this.conflicting = createStatusLineContribution(CONFLICTING_ID, "0", TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_CONFLICTING).createImage()); //$NON-NLS-1$
this.input = input;
input.registerListeners(this);
}
private StatusLineCLabelContribution createStatusLineContribution(String id, String label, Image image) {
StatusLineCLabelContribution item = new StatusLineCLabelContribution(id, 15);
- item.setText(Policy.bind("StatisticsPanel.outgoing"));
+ item.setText(Policy.bind("StatisticsPanel.outgoing")); //$NON-NLS-1$
if(image != null) {
item.setImage(image);
TeamUIPlugin.disposeOnShutdown(image);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SyncViewerShowPreferencesAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SyncViewerShowPreferencesAction.java
index e487f78fd..ca6abf4a0 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SyncViewerShowPreferencesAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SyncViewerShowPreferencesAction.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.ui.synchronize.actions;
+package org.eclipse.team.internal.ui.synchronize.actions;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.Dialog;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/ToggleViewLayoutAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ToggleViewLayoutAction.java
index 09da2f7c2..55c4296c6 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/ToggleViewLayoutAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ToggleViewLayoutAction.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.ui.synchronize.actions;
+package org.eclipse.team.internal.ui.synchronize.actions;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.util.IPropertyChangeListener;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetFilterActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetFilterActionGroup.java
index 8bfdd4007..9a1bc681b 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetFilterActionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetFilterActionGroup.java
@@ -39,8 +39,6 @@ import org.eclipse.ui.internal.WorkingSetComparator;
public class WorkingSetFilterActionGroup extends ActionGroup {
public static final String CHANGE_WORKING_SET = "changeWorkingSet"; //$NON-NLS-1$
- private static final String SEPARATOR_ID = "workingSetGroupSeparator"; //$NON-NLS-1$
-
private IWorkingSet workingSet = null;
private ClearWorkingSetAction clearWorkingSetAction;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncInfoWorkingSetFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncInfoWorkingSetFilter.java
index 8160b163e..12d9a48c5 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncInfoWorkingSetFilter.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncInfoWorkingSetFilter.java
@@ -124,5 +124,4 @@ public class SyncInfoWorkingSetFilter extends SyncInfoFilter {
public void setWorkingSet(IWorkingSet workingSet) {
this.workingSet = workingSet;
}
-
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncSetContentProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncSetContentProvider.java
index 14c54fe07..fe664b304 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncSetContentProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncSetContentProvider.java
@@ -20,7 +20,6 @@ import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Control;
import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.internal.ui.actions.TeamAction;
import org.eclipse.team.internal.ui.synchronize.sets.ISyncSetChangedListener;
import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInput;
import org.eclipse.team.internal.ui.synchronize.sets.SyncSet;
@@ -30,7 +29,7 @@ import org.eclipse.team.internal.ui.synchronize.sets.SyncSetChangedEvent;
* This class provides the contents for a StructuredViewer using a SyncSet as the model
*/
public abstract class SyncSetContentProvider implements IStructuredContentProvider, ISyncSetChangedListener {
-
+
protected Viewer viewer;
protected SyncSet getSyncSet() {
@@ -52,7 +51,7 @@ public abstract class SyncSetContentProvider implements IStructuredContentProvid
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public void inputChanged(Viewer v, Object oldInput, Object newInput) {
-
+
this.viewer = v;
SubscriberInput oldSubscriberInput = null;
SubscriberInput newSubscriberInput = null;
@@ -72,7 +71,7 @@ public abstract class SyncSetContentProvider implements IStructuredContentProvid
}
}
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
*/
@@ -87,7 +86,7 @@ public abstract class SyncSetContentProvider implements IStructuredContentProvid
input.getFilteredSyncSet().removeSyncSetChangedListener(this);
}
}
-
+
/* (non-Javadoc)
* @see org.eclipse.team.ccvs.syncviews.views.ISyncSetChangedListener#syncSetChanged(org.eclipse.team.ccvs.syncviews.views.SyncSetChangedEvent)
*/
@@ -102,7 +101,7 @@ public abstract class SyncSetContentProvider implements IStructuredContentProvid
});
}
}
-
+
/**
* Update the viewer with the sync-set changes, aditions and removals
* in the given event. This method is invoked from within the UI thread.
@@ -120,7 +119,7 @@ public abstract class SyncSetContentProvider implements IStructuredContentProvid
}
viewer.getControl().setRedraw(true);
}
-
+
/**
* Update the viewer for the sync set changes in the provided event.
* This method is invoked by <code>handleSyncSetChanges</code>.
@@ -137,7 +136,7 @@ public abstract class SyncSetContentProvider implements IStructuredContentProvid
updateParentLabels(local);
}
}
-
+
/**
* Update the viewer for the sync set removals in the provided event.
* This method is invoked by <code>handleSyncSetChanges</code>.
@@ -153,7 +152,7 @@ public abstract class SyncSetContentProvider implements IStructuredContentProvid
updateParentLabels(resource);
}
}
-
+
/**
* Update the viewer for the sync set additions in the provided event.
* This method is invoked by <code>handleSyncSetChanges</code>.
@@ -169,40 +168,12 @@ public abstract class SyncSetContentProvider implements IStructuredContentProvid
updateParentLabels(resource);
}
}
-
+
public StructuredViewer getViewer() {
return (StructuredViewer)viewer;
}
/**
- * Return the IResource for the given model object that was returned by
- * SyncSet#members(IResource). Return <code>null</code> if the given
- * object does not have a corresponding IResource.
- *
- * @param element
- * @return
- */
- public IResource getResource(Object obj) {
- return (IResource)TeamAction.getAdapter(obj, IResource.class);
- }
-
- /**
- * Return the sync kind for the given model object that was returned by
- * SyncSet#members(IResource). If syncSet is null, then the
- * sync kind for SyncContainers will always be 0.
- *
- * @param element
- * @return
- */
- public int getSyncKind(SyncSet syncSet, Object element) {
- SyncInfo info = getSyncInfo(element);
- if (info != null) {
- return info.getKind();
- }
- return 0;
- }
-
- /**
* Return the children of the given container who are either out-of-sync or contain
* out-of-sync resources.
*/
@@ -224,17 +195,50 @@ public abstract class SyncSetContentProvider implements IStructuredContentProvid
* @param element
* @return
*/
- public SyncInfo getSyncInfo(Object element) {
+ public static SyncInfo getSyncInfo(Object element) {
if (element instanceof SyncInfo) {
return ((SyncInfo) element);
} else if (element instanceof SynchronizeViewNode) {
SynchronizeViewNode syncResource = (SynchronizeViewNode)element;
return syncResource.getSyncInfo();
}
+ throw new NullPointerException();
+ }
+
+ /**
+ * Return the IResource for the given model object that was returned by
+ * SyncSet#members(IResource). Return <code>null</code> if the given
+ * object does not have a corresponding IResource.
+ *
+ * @param element
+ * @return
+ */
+ public static IResource getResource(Object obj) {
+ if (obj instanceof SyncInfo) {
+ return ((SyncInfo) obj).getLocal();
+ } else if (obj instanceof SynchronizeViewNode) {
+ return ((SynchronizeViewNode)obj).getResource();
+ }
return null;
}
/**
+ * Return the sync kind for the given model object that was returned by
+ * SyncSet#members(IResource). If syncSet is null, then the
+ * sync kind for SyncContainers will always be 0.
+ *
+ * @param element
+ * @return
+ */
+ public static int getSyncKind(Object element) {
+ SyncInfo info = getSyncInfo(element);
+ if (info != null) {
+ return info.getKind();
+ }
+ return SyncInfo.IN_SYNC;
+ }
+
+ /**
* Get the model object (SyncSet, SyncInfo or SyncContainer) that is the
* parent of the given model object.
*
@@ -248,7 +252,7 @@ public abstract class SyncSetContentProvider implements IStructuredContentProvid
IContainer parent = resource.getParent();
return getModelObject(parent);
}
-
+
/**
* Return the model object for the given IResource.
* @param resource
@@ -282,8 +286,8 @@ public abstract class SyncSetContentProvider implements IStructuredContentProvid
parent = parent.getParent();
}
getViewer().update(
- (SynchronizeViewNode[])parents.toArray(new SynchronizeViewNode[parents.size()]),
- null
- );
+ (SynchronizeViewNode[])parents.toArray(new SynchronizeViewNode[parents.size()]),
+ null
+ );
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncTableViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncTableViewer.java
index bc8add706..08baea02e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncTableViewer.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncTableViewer.java
@@ -13,7 +13,7 @@ package org.eclipse.team.internal.ui.synchronize.views;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Table;
-import org.eclipse.team.ui.synchronize.actions.INavigableControl;
+import org.eclipse.team.internal.ui.synchronize.actions.INavigableControl;
public class SyncTableViewer extends TableViewer implements INavigableControl {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncTreeViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncTreeViewer.java
index 47f225d21..00d829e73 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncTreeViewer.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncTreeViewer.java
@@ -24,7 +24,7 @@ import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.team.internal.ui.IPreferenceIds;
import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.ui.synchronize.actions.INavigableControl;
+import org.eclipse.team.internal.ui.synchronize.actions.INavigableControl;
/**
* Subclass of TreeViewer which handles decorator events properly. We should not need to create
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncViewerLabelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncViewerLabelProvider.java
index 19cb3a5ef..582855d4a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncViewerLabelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncViewerLabelProvider.java
@@ -7,8 +7,6 @@ import java.util.Map;
import org.eclipse.compare.CompareConfiguration;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.DecoratingLabelProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
@@ -17,12 +15,10 @@ import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.core.sync.IRemoteSyncElement;
import org.eclipse.team.internal.ui.OverlayIcon;
import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.actions.TeamAction;
import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInput;
import org.eclipse.team.internal.ui.synchronize.sets.SyncInfoStatistics;
import org.eclipse.team.internal.ui.synchronize.sets.SyncSet;
import org.eclipse.team.ui.ISharedImages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
import org.eclipse.ui.model.WorkbenchLabelProvider;
/**
@@ -51,29 +47,12 @@ public class SyncViewerLabelProvider extends LabelProvider implements ITableLabe
return compressedFolderImage;
}
- /**
- * Returns a sync view label provider that is hooked up to the decorator
- * mechanism.
- *
- * @return a new <code>DecoratingLabelProvider</code> which wraps a <code>
- * new <code>WorkbenchLabelProvider</code>
- */
- public static ILabelProvider getDecoratingLabelProvider() {
- return new DecoratingLabelProvider(
- new SyncViewerLabelProvider(),
- WorkbenchPlugin
- .getDefault()
- .getWorkbench()
- .getDecoratorManager()
- .getLabelDecorator());
- }
-
public SyncViewerLabelProvider() {
}
public String getText(Object element) {
String name;
- IResource resource = getResource(element);
+ IResource resource = SyncSetContentProvider.getResource(element);
if (element instanceof CompressedFolder) {
name = resource.getProjectRelativePath().toString();
} else {
@@ -90,12 +69,12 @@ public class SyncViewerLabelProvider extends LabelProvider implements ITableLabe
*/
public Image getImage(Object element) {
Image decoratedImage = null;
- IResource resource = getResource(element);
+ IResource resource = SyncSetContentProvider.getResource(element);
if (element instanceof CompressedFolder) {
decoratedImage = compareConfig.getImage(getCompressedFolderImage(), IRemoteSyncElement.IN_SYNC);
} else {
- int kind = getSyncKind(element);
+ int kind = SyncSetContentProvider.getSyncKind(element);
switch (kind & IRemoteSyncElement.DIRECTION_MASK) {
case IRemoteSyncElement.OUTGOING:
kind = (kind &~ IRemoteSyncElement.OUTGOING) | IRemoteSyncElement.INCOMING;
@@ -114,7 +93,8 @@ public class SyncViewerLabelProvider extends LabelProvider implements ITableLabe
private Image propagateConflicts(Image base, Object element, IResource resource) {
if(element instanceof SynchronizeViewNode && resource.getType() != IResource.FILE) {
// if the folder is already conflicting then don't bother propagating the conflict
- if((getSyncKind(element) & SyncInfo.DIRECTION_MASK) != SyncInfo.CONFLICTING) {
+ int kind = SyncSetContentProvider.getSyncKind(element);
+ if((kind & SyncInfo.DIRECTION_MASK) != SyncInfo.CONFLICTING) {
SubscriberInput input = ((SynchronizeViewNode)element).getSubscriberInput();
SyncSet set = new SyncSet();
SyncInfo[] infos = input.getWorkingSetSyncSet().getOutOfSyncDescendants(resource);
@@ -171,7 +151,7 @@ public class SyncViewerLabelProvider extends LabelProvider implements ITableLabe
if (columnIndex == COL_RESOURCE) {
return getImage(element);
} else if (columnIndex == COL_PARENT) {
- IResource resource = getResource(element);
+ IResource resource = SyncSetContentProvider.getResource(element);
return null;
}
return null;
@@ -184,28 +164,9 @@ public class SyncViewerLabelProvider extends LabelProvider implements ITableLabe
if (columnIndex == COL_RESOURCE) {
return getText(element);
} else if (columnIndex == COL_PARENT) {
- IResource resource = getResource(element);
+ IResource resource = SyncSetContentProvider.getResource(element);
return resource.getParent().getFullPath().toString();
}
return null;
}
-
- private IResource getResource(Object element) {
- if(element instanceof SynchronizeViewNode) {
- return ((SynchronizeViewNode)element).getResource();
- }
- return null;
- }
-
- private SyncInfo getSyncInfo(Object obj) {
- return (SyncInfo)TeamAction.getAdapter(obj, SyncInfo.class);
- }
-
- private int getSyncKind(Object element) {
- SyncInfo info = getSyncInfo(element);
- if (info != null) {
- return info.getKind();
- }
- return 0;
- }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncViewerSorter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncViewerSorter.java
index 4e232ecc1..4a517183a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncViewerSorter.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncViewerSorter.java
@@ -12,7 +12,6 @@ package org.eclipse.team.internal.ui.synchronize.views;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.team.internal.ui.actions.TeamAction;
import org.eclipse.ui.views.navigator.ResourceSorter;
/**
@@ -50,6 +49,6 @@ public class SyncViewerSorter extends ResourceSorter {
}
protected IResource getResource(Object obj) {
- return (IResource)TeamAction.getAdapter(obj, IResource.class);
+ return SyncSetContentProvider.getResource(obj);
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SynchronizeViewNode.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SynchronizeViewNode.java
index 659ecd13a..9ac04d469 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SynchronizeViewNode.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SynchronizeViewNode.java
@@ -26,7 +26,7 @@ import org.eclipse.ui.IActionFilter;
* <p>
* @see org.eclipse.team.ui.sync.ISynchronizeViewNode
*/
-public class SynchronizeViewNode implements IAdaptable, IActionFilter, ISynchronizeViewNode {
+public class SynchronizeViewNode implements IAdaptable, IActionFilter, ITeamSubscriberParticipantNode {
private IResource resource;
private SubscriberInput input;
@@ -60,9 +60,6 @@ public class SynchronizeViewNode implements IAdaptable, IActionFilter, ISynchron
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
public Object getAdapter(Class adapter) {
- if(adapter == IResource.class) {
- return getResource();
- }
if (adapter == SyncInfo.class) {
return getSyncInfo();
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java
index 8f34c0308..7974af079 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java
@@ -13,6 +13,7 @@ package org.eclipse.team.internal.ui.wizards;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
@@ -150,6 +151,7 @@ public class ConfigureProjectWizardMainPage extends WizardPage {
}
});
viewer.setInput(wizards);
+ Dialog.applyDialogFont(parent);
}
/**
* The <code>WizardSelectionPage</code> implementation of
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetMainPage.java
index 6382e6ddd..693f6fd3a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetMainPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetMainPage.java
@@ -17,6 +17,7 @@ import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
@@ -137,6 +138,7 @@ public class ExportProjectSetMainPage extends TeamWizardPage {
initializeProjects();
setControl(composite);
updateEnablement();
+ Dialog.applyDialogFont(parent);
}
private void initializeProjects() {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java
index 8de9fcc41..e1a5b9133 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java
@@ -12,6 +12,7 @@ package org.eclipse.team.internal.ui.wizards;
import java.io.File;
+import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
@@ -104,6 +105,7 @@ public class ImportProjectSetMainPage extends TeamWizardPage {
createWorkinSetCreationArea(inner, 3);
setControl(composite);
updateEnablement();
+ Dialog.applyDialogFont(parent);
}
/**
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java
index 86807bb76..f29f19f97 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java
@@ -20,7 +20,10 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import org.apache.xerces.parsers.SAXParser;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.ErrorDialog;
@@ -77,11 +80,11 @@ public class ProjectSetImportWizard extends Wizard implements IImportWizard {
lastFile = filename;
reader = new InputStreamReader(new FileInputStream(filename), "UTF-8"); //$NON-NLS-1$
- SAXParser parser = new SAXParser();
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ SAXParser parser = factory.newSAXParser();
ProjectSetContentHandler handler = new ProjectSetContentHandler();
- parser.setContentHandler(handler);
InputSource source = new InputSource(reader);
- parser.parse(source);
+ parser.parse(source, handler);
Map map = handler.getReferences();
List newProjects = new ArrayList();
@@ -114,6 +117,8 @@ public class ProjectSetImportWizard extends Wizard implements IImportWizard {
throw new InvocationTargetException(e);
} catch (TeamException e) {
throw new InvocationTargetException(e);
+ } catch (ParserConfigurationException e) {
+ throw new InvocationTargetException(e);
} finally {
if (reader != null) {
try {
@@ -143,7 +148,7 @@ public class ProjectSetImportWizard extends Wizard implements IImportWizard {
return result[0];
}
- private void createWorkingSet(String workingSetName, IProject[] projects) {
+ /* private */ void createWorkingSet(String workingSetName, IProject[] projects) {
IWorkingSetManager manager = TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager();
IWorkingSet oldSet = manager.getWorkingSet(workingSetName);
if (oldSet == null) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java
index 39dc4f5a9..2b8b7e728 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java
@@ -23,8 +23,16 @@ import org.eclipse.jface.viewers.IBasicPropertyConstants;
import org.eclipse.team.ui.TeamImages;
import org.eclipse.team.ui.TeamUI;
-public abstract class AbstractSynchronizeParticipant implements ISynchronizeParticipant {
+/**
+ * AbstractSynchronizeParticipant is the abstract base class for all
+ * synchronize view participants. It provides default lifecycle support
+ * for participants.
+ *
+ * @see ISynchronizeParticipant
+ * @since 3.0
+ */
+public abstract class AbstractSynchronizeParticipant implements ISynchronizeParticipant {
// property listeners
private ListenerList fListeners;
@@ -130,19 +138,6 @@ public abstract class AbstractSynchronizeParticipant implements ISynchronizePart
return fName;
}
- /**
- * Sets the name of this console to the specified value and notifies
- * property listeners of the change.
- *
- * @param name
- * the new name
- */
- protected void setName(String name) {
- String old = fName;
- fName = name;
- firePropertyChange(this, IBasicPropertyConstants.P_TEXT, old, name);
- }
-
/*
* (non-Javadoc)
*
@@ -152,19 +147,6 @@ public abstract class AbstractSynchronizeParticipant implements ISynchronizePart
return fImageDescriptor;
}
- /**
- * Sets the image descriptor for this console to the specified value and
- * notifies property listeners of the change.
- *
- * @param imageDescriptor
- * the new image descriptor
- */
- protected void setImageDescriptor(ImageDescriptor imageDescriptor) {
- ImageDescriptor old = fImageDescriptor;
- fImageDescriptor = imageDescriptor;
- firePropertyChange(this, IBasicPropertyConstants.P_IMAGE, old, imageDescriptor);
- }
-
/*
* (non-Javadoc)
*
@@ -174,10 +156,6 @@ public abstract class AbstractSynchronizeParticipant implements ISynchronizePart
return fId;
}
- protected void setId(QualifiedName id) {
- this.fId = id;
- }
-
/*
* (non-Javadoc)
*
@@ -221,20 +199,6 @@ public abstract class AbstractSynchronizeParticipant implements ISynchronizePart
notifier.notify(new PropertyChangeEvent(source, property, oldValue, newValue));
}
- /**
- * Called when this console is added to the console manager. Default
- * implementation does nothing. Subclasses may override.
- */
- protected void init() {
- }
-
- /**
- * Called when this console is removed from the console manager. Default
- * implementation does nothing. Subclasses may override.
- */
- protected void dispose() {
- }
-
/*
* (non-Javadoc)
*
@@ -260,4 +224,48 @@ public abstract class AbstractSynchronizeParticipant implements ISynchronizePart
fImageDescriptor = TeamImages.getImageDescriptorFromExtension(configElement.getDeclaringExtension(), strIcon);
}
}
+
+ /**
+ * Sets the name of this console to the specified value and notifies
+ * property listeners of the change.
+ *
+ * @param name
+ * the new name
+ */
+ protected void setName(String name) {
+ String old = fName;
+ fName = name;
+ firePropertyChange(this, IBasicPropertyConstants.P_TEXT, old, name);
+ }
+
+ /**
+ * Called when this console is added to the console manager. Default
+ * implementation does nothing. Subclasses may override.
+ */
+ protected void init() {
+ }
+
+ /**
+ * Called when this console is removed from the console manager. Default
+ * implementation does nothing. Subclasses may override.
+ */
+ protected void dispose() {
+ }
+
+ protected void setId(QualifiedName id) {
+ this.fId = id;
+ }
+
+ /**
+ * Sets the image descriptor for this console to the specified value and
+ * notifies property listeners of the change.
+ *
+ * @param imageDescriptor
+ * the new image descriptor
+ */
+ protected void setImageDescriptor(ImageDescriptor imageDescriptor) {
+ ImageDescriptor old = fImageDescriptor;
+ fImageDescriptor = imageDescriptor;
+ firePropertyChange(this, IBasicPropertyConstants.P_IMAGE, old, imageDescriptor);
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java
index 77c547e69..38611a75c 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java
@@ -14,10 +14,13 @@ import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.ui.IWorkbenchPage;
/**
- * Manages synchronization view participants.
+ * Manages synchronization view participants. Clients can programatically add
+ * or remove participants via this manager. Whereas static participants
+ * defined in a plugin.xml file are added automatically by the manager.
* <p>
* Clients are not intended to implement this interface.
* </p>
+ * @see ISynchronizeParticipant
* @since 3.0
*/
public interface ISynchronizeManager {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java
index 4a7d8aa8e..a51493e60 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java
@@ -18,10 +18,12 @@ import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.IPageBookViewPage;
/**
- * A synchronize participant provides a logical connection between local resources
- * and a remote location that is used to share those resources. The Synchronize View
- * displays synchronize participants.
- *
+ * A synchronize participant provides a logical connection between local
+ * resources and a remote location that is used to share those resources. The
+ * Synchronize View displays synchronize participants.
+ * <p>
+ * Clients may implement this interface.
+ * </p>
* @see ISynchronizeView
* @see ISynchronizeManager
*
@@ -29,82 +31,94 @@ import org.eclipse.ui.part.IPageBookViewPage;
*/
public interface ISynchronizeParticipant extends IExecutableExtension {
/**
- * Returns the unique id that identified the <i>type<i> of this synchronize participant.
+ * Returns the unique id that identified the <i>type <i>of this
+ * synchronize participant.
*
- * @return the unique id that identified the <i>type<i> of this synchronize participant.
+ * @return the unique id that identified the <i>type <i>of this
+ * synchronize participant.
*/
public QualifiedName getId();
-
+
/**
* Returns the name of this synchronize participant.
*
* @return the name of this synchronize participant
*/
public String getName();
-
+
/**
* Returns an image descriptor for this synchronize participant, or <code>null</code>
* if none.
*
* @return an image descriptor for this synchronize participant, or <code>null</code>
- * if none
+ * if none
*/
public ImageDescriptor getImageDescriptor();
-
+
/**
- * Creates and returns a new page for this synchronize participant. The page is displayed
- * for this synchronize participant in the given synchronize view.
+ * Creates and returns a new page for this synchronize participant. The
+ * page is displayed for this synchronize participant in the given
+ * synchronize view.
*
- * @param view the view in which the page is to be created
- * @return a page book view page representation of this synchronize participant
+ * @param view
+ * the view in which the page is to be created
+ * @return a page book view page representation of this synchronize
+ * participant
*/
public IPageBookViewPage createPage(ISynchronizeView view);
-
+
/**
- * Initializes this participant with the given synchronize view. The instance id is
- * passed to the participant.
+ * Initializes this participant with the given synchronize view. The
+ * instance id is passed to the participant.
* <p>
- * This method is automatically called by the team plugin shortly after synchronize
- * view construction. It marks the start of the views's lifecycle. Clients must
- * not call this method.
+ * This method is automatically called by the team plugin shortly after
+ * synchronize view construction. It marks the start of the views's
+ * lifecycle. Clients must not call this method.
* </p>
- *
- * @param view the synchronize view reconstructing this participant
- * @param saveContext the ISynchronizeParticipant state or null if there is no previous saved state
- * @exception PartInitException if this participant was not initialized successfully
+ *
+ * @param view
+ * the synchronize view reconstructing this participant
+ * @param saveContext
+ * the ISynchronizeParticipant state or null if there is no
+ * previous saved state
+ * @exception PartInitException
+ * if this participant was not initialized successfully
*/
public void init(QualifiedName id) throws PartInitException;
-
+
/**
* Saves the participants object state.
*/
public void saveState();
-
+
/**
- * Adds a listener for changes to properties of this synchronize participant.
- * Has no effect if an identical listener is already registered.
+ * Adds a listener for changes to properties of this synchronize
+ * participant. Has no effect if an identical listener is already
+ * registered.
* <p>
* The changes supported by the synchronize view are as follows:
* <ul>
- * <li><code>IBasicPropertyConstants.P_TEXT</code> - indicates the name
- * of a synchronize participant has changed</li>
- * <li><code>IBasicPropertyConstants.P_IMAGE</code> - indicates the image
- * of a synchronize participant has changed</li>
+ * <li><code>IBasicPropertyConstants.P_TEXT</code>- indicates the name
+ * of a synchronize participant has changed</li>
+ * <li><code>IBasicPropertyConstants.P_IMAGE</code>- indicates the
+ * image of a synchronize participant has changed</li>
* </ul>
* </p>
* <p>
* Clients may define additional properties as required.
* </p>
- *
- * @param listener a property change listener
+ *
+ * @param listener
+ * a property change listener
*/
public void addPropertyChangeListener(IPropertyChangeListener listener);
-
+
/**
* Removes the given property listener from this synchronize participant.
* Has no effect if an identical listener is not alread registered.
*
- * @param listener a property listener
+ * @param listener
+ * a property listener
*/
- public void removePropertyChangeListener(IPropertyChangeListener listener);
+ public void removePropertyChangeListener(IPropertyChangeListener listener);
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeView.java
index 3a2663c1c..9cb1e2a71 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeView.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeView.java
@@ -14,11 +14,18 @@ import org.eclipse.ui.IViewPart;
/**
* A view that displays synchronization participants that are registered with the
- * synchronize manager.
+ * synchronize manager. This is essentially a generic container that allows
+ * multiple {@link ISynchronizeParticipant} implementations to share the same
+ * view. The only behavior provided by the view is a mechanism for switching
+ * between participants.
+ * <p>
+ * Clients should not add viewActions to this view because they will be global
+ * to all participants. Instead, add participant specific actions.
+ * </p>
* <p>
* Clients are not intended to implement this interface.
* </p>
- *
+ * @see ISynchronizeManager
* @since 3.0
*/
public interface ISynchronizeView extends IViewPart {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeViewNode.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeViewNode.java
deleted file mode 100644
index fb976e549..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeViewNode.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.ui.synchronize;
-
-import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.core.subscribers.TeamSubscriber;
-
-/**
- * An <code>ISynchronizeViewNode</code> is used in the <code>ISynchronizeView</code>
- * to display the kind of change detected as the result of a two-way or three-way
- * synchronize.
- * <p>
- * Clients can contribute objectContribution actions to the Synchronize View that are
- * scoped by <code>TeamSubscriber</code> ids.
- * <br>
- * Example objectContribution:
- *
- * <extension
- * point="org.eclipse.ui.popupMenus">
- * <objectContribution
- * objectClass="org.eclipse.team.ui.sync.ISynchronizeViewNode"
- * id="yourObjectContributionID"
- * adaptable="true">
- *
- * <filter name="equals" value="org.eclipse.team.cvs.subscribers:workspace-subscriber" />
- * <action
- * label="Your Action Label"
- * menubarPath="SubscriberActions"
- * class="org.eclipse.team.internal.ccvs.ui.subscriber.SubscriberCommitAction"
- * overrideActionId="org.eclipse.team.ccvs.ui.commit"
- * id="yourActionID">
- * </action>
- * </objectContribution>
- * </extension>
- *
- * The above example makes use of the standard UI mechanisms for contributing ObjectContribution
- * Actions in Eclipse. See the UI documentation for additional elements that can be declared.
- * The interesting elements for scoping the contribution to a TeamSubscriber type are:
- *
- * <filter> element in the object contribution. This will remove all the actions and their
- * overridesActionIds unless the filter is matched. The name can be "equals"
- * or "startsWith" and the value is the ID of the subscriber.
- *
- * menuparPath is either SubscriberActions to place actions in their own group above other
- * objectContributions or Additions to place the actions at the bottom of the menu with other
- * objectContributions
- *
- * overrideActionId is optional but if present, is the ID of an existing objectContribution that
- * this action should replace.
- *
- * </p>
- * @see org.eclipse.team.ui.sync.ISynchronizeView
- * @see org.eclipse.team.core.subscribers.TeamSubscriber
- * @since 3.0
- */
-public interface ISynchronizeViewNode {
- /**
- * Answer the receiver's Subscriber
- * @return the node's TeamSubscriber
- */
- public abstract TeamSubscriber getTeamSubscriber();
- /**
- * Returns the SyncInfo for this node. Note that the SynchronizeView only creates nodes
- * for resources that are out-of-sync.
- * @return SyncInfo the sync info for this node
- */
- public abstract SyncInfo getSyncInfo();
- /**
- * Return an array that contains all children (including the receiver) that have SyncInfos
- * that are out-of-sync. Returns an empty array if this node does not have children.
- * @return SyncInfo[] all out-of-sync child resources.
- */
- public abstract SyncInfo[] getChildSyncInfos();
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ITeamSubscriberParticipantNode.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ITeamSubscriberParticipantNode.java
new file mode 100644
index 000000000..155fb0661
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ITeamSubscriberParticipantNode.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.ui.synchronize;
+
+import org.eclipse.team.core.subscribers.SyncInfo;
+import org.eclipse.team.core.subscribers.TeamSubscriber;
+
+/**
+ * ITeamSubscriberParticipantNode is used in the page created by the
+ * <code>TeamSubscriberParticipant<code> to display the kind of change
+ * detected in a two or three-way synchronize operation. They are the
+ * nodes shown in the Synchronize View.
+ * <p>
+ * Actions contributed to the TeamSubscriberParticipant will operate
+ * on these nodes. A common super class {@link SubscriberAction} exists
+ * to help create actions that are contributed to the TeamSubscriberParticipant.
+ * It contains helpers for accessing and filtering these nodes.
+ * </p>
+ * @see TeamSubscriberParticipantPage
+ * @see SubscriberAction
+ * @since 3.0
+ */
+public interface ITeamSubscriberParticipantNode {
+ /**
+ * Answer the receiver's Subscriber
+ *
+ * @return the node's TeamSubscriber
+ */
+ public abstract TeamSubscriber getTeamSubscriber();
+ /**
+ * Returns the SyncInfo for this node. Note that the SynchronizeView only
+ * creates nodes for resources that are out-of-sync.
+ *
+ * @return SyncInfo the sync info for this node
+ */
+ public abstract SyncInfo getSyncInfo();
+ /**
+ * Return an array that contains all children (including the receiver) that
+ * have SyncInfos that are out-of-sync. Returns an empty array if this node
+ * does not have children.
+ *
+ * @return SyncInfo[] all out-of-sync child resources.
+ */
+ public abstract SyncInfo[] getChildSyncInfos();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipant.java
index 0638607f1..db3ad6f6f 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipant.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipant.java
@@ -7,13 +7,19 @@ import org.eclipse.team.core.subscribers.TeamSubscriber;
import org.eclipse.team.internal.ui.IPreferenceIds;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.jobs.RefreshSubscriberInputJob;
+import org.eclipse.team.internal.ui.synchronize.actions.RefreshAction;
import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInput;
import org.eclipse.team.internal.ui.synchronize.TeamSubscriberParticipantPage;
-import org.eclipse.team.ui.synchronize.actions.RefreshAction;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.part.IPageBookViewPage;
+/**
+ * A synchronize participant that displays synchronization information for local
+ * resources that is managed via a {@link TeamSubscriber}.
+ *
+ * @since 3.0
+ */
public abstract class TeamSubscriberParticipant extends AbstractSynchronizeParticipant {
private SubscriberInput input;
@@ -56,17 +62,10 @@ public abstract class TeamSubscriberParticipant extends AbstractSynchronizeParti
*/
public static final int TABLE_LAYOUT = 1;
- public static final String MB_MODESGROUP = TeamUIPlugin.ID + ".modes";
-
public TeamSubscriberParticipant() {
super();
}
- protected void setSubscriber(TeamSubscriber subscriber) {
- this.input = new SubscriberInput(subscriber);
- this.currentMode = BOTH_MODE;
- }
-
/* (non-Javadoc)
* @see org.eclipse.team.ui.sync.ISynchronizeViewPage#createPage(org.eclipse.team.ui.sync.ISynchronizeView)
*/
@@ -79,10 +78,6 @@ public abstract class TeamSubscriberParticipant extends AbstractSynchronizeParti
return page;
}
- public SubscriberInput getInput() {
- return input;
- }
-
public void setMode(int mode) {
int oldMode = getMode();
currentMode = mode;
@@ -144,4 +139,13 @@ public abstract class TeamSubscriberParticipant extends AbstractSynchronizeParti
refreshJob.schedule(20000 /* 20 seconds */);
}
}
+
+ protected SubscriberInput getInput() {
+ return input;
+ }
+
+ protected void setSubscriber(TeamSubscriber subscriber) {
+ this.input = new SubscriberInput(subscriber);
+ this.currentMode = BOTH_MODE;
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/AndSyncInfoFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/AndSyncInfoFilter.java
deleted file mode 100644
index 7b1ccac4b..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/AndSyncInfoFilter.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.ui.synchronize.actions;
-
-import org.eclipse.team.core.subscribers.SyncInfo;
-
-/**
- * Selects SyncInfo which match all child filters
- */
-public class AndSyncInfoFilter extends CompoundSyncInfoFilter {
- public AndSyncInfoFilter(SyncInfoFilter[] filters) {
- super(filters);
- }
- /* (non-Javadoc)
- * @see org.eclipse.team.ccvs.syncviews.views.SyncSetFilter#select(org.eclipse.team.core.sync.SyncInfo)
- */
- public boolean select(SyncInfo info) {
- for (int i = 0; i < filters.length; i++) {
- SyncInfoFilter filter = filters[i];
- if (!filter.select(info)) {
- return false;
- }
- }
- return true;
- }
-
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/AutomergableFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/AutomergableFilter.java
deleted file mode 100644
index cfefc6298..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/AutomergableFilter.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.ui.synchronize.actions;
-
-import org.eclipse.team.core.subscribers.SyncInfo;
-
-/**
- * Selects SyncInfo that are automergable
- */
-public class AutomergableFilter extends SyncInfoFilter {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ccvs.syncviews.views.SyncSetFilter#select(org.eclipse.team.core.sync.SyncInfo)
- */
- public boolean select(SyncInfo info) {
- return (info.getKind() & SyncInfo.AUTOMERGE_CONFLICT) != 0;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/CompoundSyncInfoFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/CompoundSyncInfoFilter.java
deleted file mode 100644
index d25dea526..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/CompoundSyncInfoFilter.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.ui.synchronize.actions;
-
-
-public abstract class CompoundSyncInfoFilter extends SyncInfoFilter {
- protected SyncInfoFilter[] filters;
- public CompoundSyncInfoFilter(SyncInfoFilter[] filters) {
- this.filters = filters;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/DirectionFilterActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/DirectionFilterActionGroup.java
index 96f5ace8d..b2e108c6c 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/DirectionFilterActionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/DirectionFilterActionGroup.java
@@ -10,17 +10,16 @@
*******************************************************************************/
package org.eclipse.team.ui.synchronize.actions;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.synchronize.actions.TextToolbarManager;
-import org.eclipse.team.internal.ui.synchronize.sets.*;
+import org.eclipse.team.ui.Utilities;
import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.actions.ActionGroup;
@@ -28,9 +27,15 @@ import org.eclipse.ui.actions.ActionGroup;
/**
* This ActionGroup provides filtering of a sync set by change direction.
* The actions are presented to the user as toolbar buttons where only one
- * button is active at a time
+ * button is active at a time.
+ * <p>
+ * When a modes changes a property change event is fired from the participant
+ * with a value of <code>TeamSubscriberParticipant.P_SYNCVIEWPAGE_MODE</code>.
+ *
+ * @see TeamSubscriberParticipant
+ * @since 3.0
*/
-public class DirectionFilterActionGroup extends ActionGroup implements IPropertyChangeListener, ISyncSetChangedListener {
+public class DirectionFilterActionGroup extends ActionGroup implements IPropertyChangeListener {
// An array of the selection actions for the modes (indexed by mode constant)
private List actions = new ArrayList(3);
@@ -49,14 +54,12 @@ public class DirectionFilterActionGroup extends ActionGroup implements IProperty
public DirectionFilterAction(String prefix,String commandId, int modeId) {
super("", AS_RADIO_BUTTON); //$NON-NLS-1$
this.modeId = modeId;
- Utils.initAction(this, prefix);
+ Utilities.initAction(this, prefix, Policy.getBundle());
Action a = new Action() {
public void run() {
DirectionFilterAction.this.run();
}
};
- //IKeyBindingService kbs = site.getKeyBindingService();
- //Utils.registerAction(kbs, a, commandId); //$NON-NLS-1$
}
public void run() {
// checkMode() is called because programatic checking of radio buttons doesn't
@@ -70,14 +73,26 @@ public class DirectionFilterActionGroup extends ActionGroup implements IProperty
}
}
- public DirectionFilterActionGroup(TeamSubscriberParticipant page, int supportedModes) {
+ /**
+ * Creates a direction filter group with the given supported modes. The
+ * possible values for modes are defined by the {@link TeamSubscriberParticipant}
+ * class.
+ *
+ * @see TeamSubscriberParticipant#BOTH_MODE
+ * @see TeamSubscriberParticipant#OUTGOING_MODE
+ * @see TeamSubscriberParticipant#INCOMING_MODE
+ * @see TeamSubscriberParticipant#CONFLICTING_MODE
+ * @see TeamSubscriberParticipant#ALL_MODES
+ *
+ * @param participant the participant showing this group
+ * @param supportedModes the modes to be shown
+ */
+ public DirectionFilterActionGroup(TeamSubscriberParticipant participant, int supportedModes) {
this.supportedModes = supportedModes;
- this.page = page;
+ this.page = participant;
createActions();
- page.addPropertyChangeListener(this);
- page.getInput().registerListeners(this);
- checkMode(page.getMode());
- //updateStats();
+ participant.addPropertyChangeListener(this);
+ checkMode(participant.getMode());
}
/**
@@ -126,17 +141,9 @@ public class DirectionFilterActionGroup extends ActionGroup implements IProperty
* @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars)
*/
public void fillToolBar(IToolBarManager toolBar) {
- boolean custom = false;
- if(toolBar instanceof TextToolbarManager) {
- custom = true;
- }
for (Iterator it = actions.iterator(); it.hasNext();) {
DirectionFilterAction action = (DirectionFilterAction) it.next();
- if(custom) {
- ((TextToolbarManager)toolBar).add(action, 150);
- } else {
toolBar.add(action);
- }
}
}
@@ -168,46 +175,4 @@ public class DirectionFilterActionGroup extends ActionGroup implements IProperty
// TODO Auto-generated method stub
super.dispose();
}
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.sync.sets.ISyncSetChangedListener#syncSetChanged(org.eclipse.team.internal.ui.sync.sets.SyncSetChangedEvent)
- */
- public void syncSetChanged(SyncSetChangedEvent event) {
- //updateStats();
- }
-
- private void updateStats() {
- SubscriberInput input = page.getInput();
- SyncInfoStatistics workspaceSetStats = input.getSubscriberSyncSet().getStatistics();
- SyncInfoStatistics workingSetSetStats = input.getWorkingSetSyncSet().getStatistics();
-
- int workspaceConflicting = (int)workspaceSetStats.countFor(SyncInfo.CONFLICTING, SyncInfo.DIRECTION_MASK);
- int workspaceOutgoing = (int)workspaceSetStats.countFor(SyncInfo.OUTGOING, SyncInfo.DIRECTION_MASK);
- int workspaceIncoming = (int)workspaceSetStats.countFor(SyncInfo.INCOMING, SyncInfo.DIRECTION_MASK);
- int workingSetConflicting = (int)workingSetSetStats.countFor(SyncInfo.CONFLICTING, SyncInfo.DIRECTION_MASK);
- int workingSetOutgoing = (int)workingSetSetStats.countFor(SyncInfo.OUTGOING, SyncInfo.DIRECTION_MASK);
- int workingSetIncoming = (int)workingSetSetStats.countFor(SyncInfo.INCOMING, SyncInfo.DIRECTION_MASK);
-
- if(bothMode != null)
- bothMode.setText(new Integer(input.getWorkingSetSyncSet().size()).toString());
- if(input.getWorkingSet() != null) {
- if(conflictsMode != null)
- conflictsMode.setText(padString(Policy.bind("StatisticsPanel.changeNumbers", new Integer(workingSetConflicting).toString(), new Integer(workspaceConflicting).toString()))); //$NON-NLS-1$
- if(incomingMode != null)
- incomingMode.setText(padString(Policy.bind("StatisticsPanel.changeNumbers", new Integer(workingSetIncoming).toString(), new Integer(workspaceIncoming).toString()))); //$NON-NLS-1$
- if(outgoingMode != null)
- outgoingMode.setText(padString(Policy.bind("StatisticsPanel.changeNumbers", new Integer(workingSetOutgoing).toString(), new Integer(workspaceOutgoing).toString()))); //$NON-NLS-1$
- } else {
- if(conflictsMode != null)
- conflictsMode.setText(padString(new Integer(workspaceConflicting).toString())); //$NON-NLS-1$
- if(incomingMode != null)
- incomingMode.setText(padString(new Integer(workspaceIncoming).toString())); //$NON-NLS-1$
- if(outgoingMode != null)
- outgoingMode.setText(padString(new Integer(workspaceOutgoing).toString())); //$NON-NLS-1$
- }
- }
-
- private String padString(String s) {
- return s;
- }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/ExpandAllAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/ExpandAllAction.java
deleted file mode 100644
index f7b6d8db5..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/ExpandAllAction.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.ui.synchronize.actions;
-
-import java.util.Iterator;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.ui.IViewPart;
-
-
-public class ExpandAllAction extends Action {
- private IViewPart part;
- private AbstractTreeViewer viewer;
-
- public ExpandAllAction(IViewPart part) {
- this.part = part;
- Utils.initAction(this, "action.expandAll."); //$NON-NLS-1$
- }
-
- public void run() {
- expandSelection();
- }
-
- public void setTreeViewer(AbstractTreeViewer viewer) {
- this.viewer = viewer;
- }
-
- public void update() {
- setEnabled(viewer != null && hasSelection());
- }
-
- protected void expandSelection() {
- if (viewer != null) {
- ISelection selection = getSelection();
- if (selection instanceof IStructuredSelection) {
- Iterator elements = ((IStructuredSelection)selection).iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- viewer.expandToLevel(next, AbstractTreeViewer.ALL_LEVELS);
- }
- }
- }
- }
-
- private ISelection getSelection() {
- return part.getSite().getPage().getSelection();
- }
-
- private boolean hasSelection() {
- ISelection selection = getSelection();
- return (selection != null && !selection.isEmpty());
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/MenuActionContributionItem.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/MenuActionContributionItem.java
deleted file mode 100644
index 9f78a4ccb..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/MenuActionContributionItem.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.ui.synchronize.actions;
-
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-
-public class MenuActionContributionItem extends ActionContributionItem {
-
- public MenuActionContributionItem(IAction action) {
- super(action);
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/OrSyncInfoFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/OrSyncInfoFilter.java
deleted file mode 100644
index 7bad3b3ae..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/OrSyncInfoFilter.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.ui.synchronize.actions;
-
-import org.eclipse.team.core.subscribers.SyncInfo;
-
-/**
- * Selects SyncInfo that match any of the child filters.
- */
-public class OrSyncInfoFilter extends CompoundSyncInfoFilter {
- public OrSyncInfoFilter(SyncInfoFilter[] filters) {
- super(filters);
- }
- /* (non-Javadoc)
- * @see org.eclipse.team.ccvs.syncviews.views.SyncSetFilter#select(org.eclipse.team.core.sync.SyncInfo)
- */
- public boolean select(SyncInfo info) {
- for (int i = 0; i < filters.length; i++) {
- SyncInfoFilter filter = filters[i];
- if (filter.select(info)) {
- return true;
- }
- }
- return false;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/PseudoConflictFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/PseudoConflictFilter.java
deleted file mode 100644
index 5272f2cb3..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/PseudoConflictFilter.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.ui.synchronize.actions;
-
-import org.eclipse.team.core.subscribers.SyncInfo;
-
-/**
- * This filter selects only those SyncInfo that are not Pseudo-conflicts
- */
-public class PseudoConflictFilter extends SyncInfoFilter {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.SyncInfoFilter#select(org.eclipse.team.core.subscribers.SyncInfo)
- */
- public boolean select(SyncInfo info) {
- return info.getKind() != 0 && (info.getKind() & SyncInfo.PSEUDO_CONFLICT) == 0;
- }
-
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java
new file mode 100644
index 000000000..ba1aa9275
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.ui.synchronize.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.team.internal.ui.Policy;
+import org.eclipse.team.ui.TeamUI;
+import org.eclipse.team.ui.Utilities;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
+
+/**
+ * Action to remove the given participant from the synchronize manager.
+ * @since 3.0
+ */
+public class RemoveSynchronizeParticipantAction extends Action {
+ private ISynchronizeParticipant participant;
+
+ /**
+ * Creates the action to remove the participant from the synchronize
+ * manager.
+ * @param participant the participant to remove from the synchronize
+ * manager.
+ */
+ public RemoveSynchronizeParticipantAction(ISynchronizeParticipant participant) {
+ this.participant = participant;
+ Utilities.initAction(this, "action.removePage.", Policy.getBundle()); //$NON-NLS-1$
+ }
+
+ public void run() {
+ TeamUI.getSynchronizeManager().removeSynchronizeParticipants(
+ new ISynchronizeParticipant[] {participant});
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/RemoveSynchronizeViewPageAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/RemoveSynchronizeViewPageAction.java
deleted file mode 100644
index 3238d13e7..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/RemoveSynchronizeViewPageAction.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.ui.synchronize.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
-
-public class RemoveSynchronizeViewPageAction extends Action {
- private ISynchronizeParticipant page;
-
- public RemoveSynchronizeViewPageAction(ISynchronizeParticipant page) {
- this.page = page;
- Utils.initAction(this, "action.removePage."); //$NON-NLS-1$
- }
-
- public void run() {
- TeamUI.getSynchronizeManager().removeSynchronizeParticipants(new ISynchronizeParticipant[] {page});
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SubscriberAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SubscriberAction.java
index 4d8a656e8..25dd8a495 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SubscriberAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SubscriberAction.java
@@ -23,12 +23,18 @@ import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.actions.TeamAction;
import org.eclipse.team.internal.ui.jobs.JobStatusHandler;
-import org.eclipse.team.ui.synchronize.ISynchronizeViewNode;
+import org.eclipse.team.ui.synchronize.ITeamSubscriberParticipantNode;
import org.eclipse.ui.IViewActionDelegate;
/**
- * This is the abstract superclass for actions associated with a subscriber.
- * It is not necessary that subscriber actions be subclasses of this class.
+ * This is an abstract superclass for actions associated with a
+ * {@link TeamSubscriberParticipant}. It provides helper methods to
+ * access and filter selections that contain {@link ITeamSubscriberParticipantNode}
+ * instances.
+ * <p>
+ * It is optional for TeamSubscriberParticipant actions to subclass.
+ * </p>
+ * @since 3.0
*/
public abstract class SubscriberAction extends TeamAction implements IViewActionDelegate {
@@ -60,8 +66,8 @@ public abstract class SubscriberAction extends TeamAction implements IViewAction
Set result = new HashSet();
for (int i = 0; i < selected.length; i++) {
Object object = selected[i];
- if (object instanceof ISynchronizeViewNode) {
- ISynchronizeViewNode syncResource = (ISynchronizeViewNode) object;
+ if (object instanceof ITeamSubscriberParticipantNode) {
+ ITeamSubscriberParticipantNode syncResource = (ITeamSubscriberParticipantNode) object;
SyncInfo[] infos = syncResource.getChildSyncInfos();
result.addAll(Arrays.asList(infos));
}
@@ -92,9 +98,6 @@ public abstract class SubscriberAction extends TeamAction implements IViewAction
return info != null && getSyncInfoFilter().select(info);
}
- /**
- * @return
- */
protected SyncInfoFilter getSyncInfoFilter() {
return new SyncInfoFilter();
}
@@ -108,9 +111,6 @@ public abstract class SubscriberAction extends TeamAction implements IViewAction
List filtered = new ArrayList();
for (int i = 0; i < infos.length; i++) {
SyncInfo info = infos[i];
-// if(subscriber == null) {
-// subscriber = info.getSubscriber();
-//}
if (select(info))
filtered.add(info);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SyncInfoChangeTypeFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SyncInfoChangeTypeFilter.java
deleted file mode 100644
index 50ccd2f59..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SyncInfoChangeTypeFilter.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.ui.synchronize.actions;
-
-import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-
-/**
- * Thsi class filters the SyncInfo by change type (addition, deletion, change)
- */
-public class SyncInfoChangeTypeFilter extends SyncInfoFilter {
-
- private int[] changeFilters = new int[] {IRemoteSyncElement.ADDITION, IRemoteSyncElement.DELETION, IRemoteSyncElement.CHANGE};
-
- public SyncInfoChangeTypeFilter(int[] changeFilters) {
- this.changeFilters = changeFilters;
- }
-
- public SyncInfoChangeTypeFilter(int change) {
- this(new int[] { change });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ccvs.syncviews.views.SyncSetFilter#select(org.eclipse.team.core.sync.SyncInfo)
- */
- public boolean select(SyncInfo info) {
- int syncKind = info.getKind();
- for (int i = 0; i < changeFilters.length; i++) {
- int filter = changeFilters[i];
- if ((syncKind & SyncInfo.CHANGE_MASK) == filter)
- return true;
- }
- return false;
- }
-
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SyncInfoDirectionFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SyncInfoDirectionFilter.java
deleted file mode 100644
index 92fe21b9e..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SyncInfoDirectionFilter.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.ui.synchronize.actions;
-
-import org.eclipse.team.core.subscribers.SyncInfo;
-
-/**
- * Filter the SyncInfo by a set of directions (incoming, outgoing, conflict)
- */
-public class SyncInfoDirectionFilter extends SyncInfoFilter {
-
- int[] directionFilters = new int[] {SyncInfo.OUTGOING, SyncInfo.INCOMING, SyncInfo.CONFLICTING};
-
- public SyncInfoDirectionFilter(int[] directionFilters) {
- this.directionFilters = directionFilters;
- }
-
- public SyncInfoDirectionFilter(int direction) {
- this(new int[] { direction });
- }
-
- /* (non-Javadoc)
- * @see SyncSetFilter#select(org.eclipse.team.core.sync.SyncInfo)
- */
- public boolean select(SyncInfo info) {
- int syncKind = info.getKind();
- for (int i = 0; i < directionFilters.length; i++) {
- int filter = directionFilters[i];
- if ((syncKind & SyncInfo.DIRECTION_MASK) == filter)
- return true;
- }
- return false;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SyncInfoFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SyncInfoFilter.java
index bc2bca314..4f60d06d6 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SyncInfoFilter.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SyncInfoFilter.java
@@ -13,22 +13,138 @@ package org.eclipse.team.ui.synchronize.actions;
import org.eclipse.team.core.subscribers.SyncInfo;
/**
- * A SyncInfoFilter is used by a SyncSetInput to detemine which resources
- * should be part of the sync set.
+ * A SyncInfoFilter can be used to control, at a fine grain, {@link SyncInfo}
+ * instances in a SyncInfoSet.
+ *
+ * @see SyncInfoSet
+ * @since 3.0
*/
public class SyncInfoFilter {
-
+
public static SyncInfoFilter getDirectionAndChangeFilter(int direction, int change) {
- return new AndSyncInfoFilter(new SyncInfoFilter[] {
- new SyncInfoDirectionFilter(direction),
- new SyncInfoChangeTypeFilter(change)
- });
+ return new AndSyncInfoFilter(new SyncInfoFilter[]{new SyncInfoDirectionFilter(direction), new SyncInfoChangeTypeFilter(change)});
+ }
+
+ public static abstract class CompoundSyncInfoFilter extends SyncInfoFilter {
+ protected SyncInfoFilter[] filters;
+ public CompoundSyncInfoFilter(SyncInfoFilter[] filters) {
+ this.filters = filters;
+ }
+ }
+
+ /**
+ * Selects SyncInfo which match all child filters
+ */
+ public static class AndSyncInfoFilter extends CompoundSyncInfoFilter {
+ public AndSyncInfoFilter(SyncInfoFilter[] filters) {
+ super(filters);
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ccvs.syncviews.views.SyncSetFilter#select(org.eclipse.team.core.sync.SyncInfo)
+ */
+ public boolean select(SyncInfo info) {
+ for (int i = 0; i < filters.length; i++) {
+ SyncInfoFilter filter = filters[i];
+ if (!filter.select(info)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ }
+
+ public static class AutomergableFilter extends SyncInfoFilter {
+ public boolean select(SyncInfo info) {
+ return (info.getKind() & SyncInfo.AUTOMERGE_CONFLICT) != 0;
+ }
}
+ public static class PseudoConflictFilter extends SyncInfoFilter {
+ public boolean select(SyncInfo info) {
+ return info.getKind() != 0 && (info.getKind() & SyncInfo.PSEUDO_CONFLICT) == 0;
+ }
+ }
+
+ /**
+ * Selects SyncInfo that match any of the child filters.
+ */
+ public static class OrSyncInfoFilter extends CompoundSyncInfoFilter {
+ public OrSyncInfoFilter(SyncInfoFilter[] filters) {
+ super(filters);
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ccvs.syncviews.views.SyncSetFilter#select(org.eclipse.team.core.sync.SyncInfo)
+ */
+ public boolean select(SyncInfo info) {
+ for (int i = 0; i < filters.length; i++) {
+ SyncInfoFilter filter = filters[i];
+ if (filter.select(info)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
+ public static class SyncInfoChangeTypeFilter extends SyncInfoFilter {
+
+ private int[] changeFilters = new int[]{SyncInfo.ADDITION, SyncInfo.DELETION, SyncInfo.CHANGE};
+
+ public SyncInfoChangeTypeFilter(int[] changeFilters) {
+ this.changeFilters = changeFilters;
+ }
+
+ public SyncInfoChangeTypeFilter(int change) {
+ this(new int[]{change});
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.team.ccvs.syncviews.views.SyncSetFilter#select(org.eclipse.team.core.sync.SyncInfo)
+ */
+ public boolean select(SyncInfo info) {
+ int syncKind = info.getKind();
+ for (int i = 0; i < changeFilters.length; i++) {
+ int filter = changeFilters[i];
+ if ((syncKind & SyncInfo.CHANGE_MASK) == filter)
+ return true;
+ }
+ return false;
+ }
+
+ }
+
+ public static class SyncInfoDirectionFilter extends SyncInfoFilter {
+
+ int[] directionFilters = new int[] {SyncInfo.OUTGOING, SyncInfo.INCOMING, SyncInfo.CONFLICTING};
+
+ public SyncInfoDirectionFilter(int[] directionFilters) {
+ this.directionFilters = directionFilters;
+ }
+
+ public SyncInfoDirectionFilter(int direction) {
+ this(new int[] { direction });
+ }
+
+ /* (non-Javadoc)
+ * @see SyncSetFilter#select(org.eclipse.team.core.sync.SyncInfo)
+ */
+ public boolean select(SyncInfo info) {
+ int syncKind = info.getKind();
+ for (int i = 0; i < directionFilters.length; i++) {
+ int filter = directionFilters[i];
+ if ((syncKind & SyncInfo.DIRECTION_MASK) == filter)
+ return true;
+ }
+ return false;
+ }
+ }
+
/**
- * Return true if the provided SyncInfo matches the filter.
- * The default behavior it to include resources whose syncKind
- * is non-zero.
+ * Return true if the provided SyncInfo matches the filter. The default
+ * behavior it to include resources whose syncKind is non-zero.
*
* @param info
* @return
@@ -36,4 +152,4 @@ public class SyncInfoFilter {
public boolean select(SyncInfo info) {
return info.getKind() != 0;
}
-}
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SyncInfoSet.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SyncInfoSet.java
index cc7968c3d..ab75b7e91 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SyncInfoSet.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SyncInfoSet.java
@@ -19,20 +19,28 @@ import java.util.Set;
import org.eclipse.core.resources.IResource;
import org.eclipse.team.core.subscribers.SyncInfo;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoFilter.SyncInfoDirectionFilter;
+/**
+ * Convenience class for manipulating and searching sets of {@link SyncInfo}
+ * instances.
+ *
+ * @see SyncInfoFilter
+ * @since 3.0
+ */
public class SyncInfoSet {
-
+
Set set = new HashSet();
- public SyncInfoSet(SyncInfo[] resources) {
- set.addAll(Arrays.asList(resources));
+ public SyncInfoSet(SyncInfo[] infos) {
+ set.addAll(Arrays.asList(infos));
}
/**
* Returns true if there are any conflicting nodes in the set, and
* false otherwise.
*/
public boolean hasConflicts() {
- return hasNodes(new SyncInfoDirectionFilter(SyncInfo.CONFLICTING));
+ return hasNodes(new SyncInfoFilter.SyncInfoDirectionFilter(SyncInfo.CONFLICTING));
}
/**
@@ -42,7 +50,7 @@ public class SyncInfoSet {
public boolean hasIncomingChanges() {
return hasNodes(new SyncInfoDirectionFilter(SyncInfo.INCOMING));
}
-
+
/**
* Returns true if this sync set has outgoing changes.
* Note that conflicts are not considered to be outgoing changes.
@@ -55,7 +63,7 @@ public class SyncInfoSet {
* Returns true if this sync set has auto-mergeable conflicts.
*/
public boolean hasAutoMergeableConflicts() {
- return hasNodes(new AutomergableFilter());
+ return hasNodes(new SyncInfoFilter.AutomergableFilter());
}
/**
@@ -90,7 +98,7 @@ public class SyncInfoSet {
}
}
}
-
+
/**
* Indicate whether the set has nodes matching the given filter
*/
@@ -168,22 +176,11 @@ public class SyncInfoSet {
removeResource(resource);
}
}
-
- private void removeResource(IResource resource) {
- for (Iterator it = set.iterator(); it.hasNext();) {
- SyncInfo node = (SyncInfo)it.next();
- if (node.getLocal().equals(resource)) {
- it.remove();
- // short-circuit the operation once a match is found
- return;
- }
- }
- }
-
+
public int size() {
return set.size();
}
-
+
public SyncInfo getNodeFor(IResource resource) {
for (Iterator it = set.iterator(); it.hasNext();) {
SyncInfo node = (SyncInfo)it.next();
@@ -202,5 +199,16 @@ public class SyncInfoSet {
}
}
+
+ private void removeResource(IResource resource) {
+ for (Iterator it = set.iterator(); it.hasNext();) {
+ SyncInfo node = (SyncInfo)it.next();
+ if (node.getLocal().equals(resource)) {
+ it.remove();
+ // short-circuit the operation once a match is found
+ return;
+ }
+ }
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/package.html b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/package.html
new file mode 100644
index 000000000..da75e925f
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/package.html
@@ -0,0 +1,13 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="Author" content="IBM">
+ <title>Package-level Javadoc</title>
+</head>
+<body>
+<p>Actions for use with with the Eclipse Synchronize View.</p>
+<h2>Package Specification</h2>
+<p>This package contains actions that are used by subclasses of the <b>TeamSubscriberParticipant</b>.</p>
+</body>
+</html> \ No newline at end of file

Back to the top