Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Weinand2004-11-07 17:08:01 -0500
committerAndre Weinand2004-11-07 17:08:01 -0500
commit69fb14ec1b90a84205fec49ea06425525e8745ab (patch)
treeedf226fa3bdaed7ca457b14a53437674b6bdfdb3 /bundles/org.eclipse.compare/compare
parent7c61db807f1131486e667402713fcd980884036f (diff)
downloadeclipse.platform.team-69fb14ec1b90a84205fec49ea06425525e8745ab.tar.gz
eclipse.platform.team-69fb14ec1b90a84205fec49ea06425525e8745ab.tar.xz
eclipse.platform.team-69fb14ec1b90a84205fec49ea06425525e8745ab.zip
first half of fix for #77599
Diffstat (limited to 'bundles/org.eclipse.compare/compare')
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/HistoryItem.java14
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java3
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IResourceProvider.java23
3 files changed, 36 insertions, 4 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/HistoryItem.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/HistoryItem.java
index 9e1b4bddf..3c9dff749 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/HistoryItem.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/HistoryItem.java
@@ -15,6 +15,7 @@ import java.io.BufferedInputStream;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.compare.internal.IResourceProvider;
import org.eclipse.core.resources.IEncodedStorage;
import org.eclipse.core.resources.IFileState;
import org.eclipse.core.resources.IResource;
@@ -31,7 +32,7 @@ import org.eclipse.core.runtime.IPath;
* Clients may instantiate this class; it is not intended to be subclassed.
* </p>
*/
-public class HistoryItem implements IEncodedStreamContentAccessor, ITypedElement, IModificationDate {
+public class HistoryItem implements IEncodedStreamContentAccessor, ITypedElement, IModificationDate, IResourceProvider {
private ITypedElement fBase;
private IFileState fFileState;
@@ -90,12 +91,19 @@ public class HistoryItem implements IEncodedStreamContentAccessor, ITypedElement
public String getCharset() throws CoreException {
String charset= fFileState.getCharset();
if (charset == null) {
- IPath fullPath = fFileState.getFullPath();
- IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(fullPath);
+ IResource resource= getResource();
if (resource instanceof IEncodedStorage)
charset= ((IEncodedStorage)resource).getCharset();
}
return charset;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.internal.IResourceProvider#getResource()
+ */
+ public IResource getResource() {
+ IPath fullPath= fFileState.getFullPath();
+ return ResourcesPlugin.getWorkspace().getRoot().findMember(fullPath);
+ }
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java
index 39a88a93a..ad07219e3 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java
@@ -20,6 +20,7 @@ import org.eclipse.jface.util.Assert;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.compare.internal.IResourceProvider;
import org.eclipse.compare.internal.Utilities;
import org.eclipse.compare.structuremergeviewer.IStructureComparator;
@@ -35,7 +36,7 @@ import org.eclipse.compare.structuremergeviewer.IStructureComparator;
*/
public class ResourceNode extends BufferedContent
implements IEncodedStreamContentAccessor, IStructureComparator, ITypedElement,
- IEditableContent, IModificationDate {
+ IEditableContent, IModificationDate, IResourceProvider {
private IResource fResource;
private ArrayList fChildren;
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IResourceProvider.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IResourceProvider.java
new file mode 100644
index 000000000..359d6a293
--- /dev/null
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IResourceProvider.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.compare.internal;
+
+import org.eclipse.core.resources.IResource;
+
+public interface IResourceProvider {
+
+ /**
+ * Returns the corresponding resource for this object or <code>null</code>.
+ *
+ * @return the corresponding resource or <code>null</code>
+ */
+ IResource getResource();
+}

Back to the top