Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Schorn2006-07-04 11:39:07 +0000
committerMarkus Schorn2006-07-04 11:39:07 +0000
commit7aecc5731fd8317feb57db52f824d256570e369d (patch)
treec6ae5f5e47dd08f10399c1ba7a7f3d1ed29cf82d /core/org.eclipse.cdt.core
parenta4e51489253abd621b195baf90c2b9a481967d87 (diff)
downloadorg.eclipse.cdt-7aecc5731fd8317feb57db52f824d256570e369d.tar.gz
org.eclipse.cdt-7aecc5731fd8317feb57db52f824d256570e369d.tar.xz
org.eclipse.cdt-7aecc5731fd8317feb57db52f824d256570e369d.zip
Add position trackers for workspace external files.
Diffstat (limited to 'core/org.eclipse.cdt.core')
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IPositionTrackerManager.java19
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PositionTrackerManager.java14
2 files changed, 30 insertions, 3 deletions
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IPositionTrackerManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IPositionTrackerManager.java
index 04ae6f6de2f..d186416a437 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IPositionTrackerManager.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IPositionTrackerManager.java
@@ -12,9 +12,10 @@
package org.eclipse.cdt.core;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
/**
- * An interface to manage the position tracking that allows for mapping character
+ * An interface to manage the position tracking. It allows for mapping character
* offsets from a file previously stored on disk to the current offset.
*/
public interface IPositionTrackerManager {
@@ -24,7 +25,19 @@ public interface IPositionTrackerManager {
*
* @param file a file for which the position adapter is requested.
* @param timestamp identifies the version of the file stored on disk.
- * @return the requested position adapter or <code>null</code>.
+ * @return the requested position converter or <code>null</code>.
*/
- IPositionConverter findPositionConverter(IFile file, long timestamp);
+ public IPositionConverter findPositionConverter(IFile file, long timestamp);
+
+ /**
+ * Returns the position tracker suitable for mapping character offsets of the
+ * given external file/timestamp to the current version of it. <p>
+ * The method can be used for resources by supplying the <b>full path</b>. However,
+ * it does not work if you supply the location of a resource.
+ *
+ * @param externalLocationOrFullPath an external location for which the position adapter is requested.
+ * @param timestamp identifies the version of the file stored on disk.
+ * @return the requested position converter or <code>null</code>.
+ */
+ public IPositionConverter findPositionConverter(IPath fullPathOrExternalLocation, long timestamp);
}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PositionTrackerManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PositionTrackerManager.java
index 4fea088824f..3c14691fe54 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PositionTrackerManager.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PositionTrackerManager.java
@@ -168,6 +168,9 @@ public class PositionTrackerManager implements IPositionTrackerManager, IFileBuf
}
}
+ /**
+ * {@inheritDoc}
+ */
public synchronized IPositionConverter findPositionConverter(IFile file, long timestamp) {
PositionTrackerChain chain= (PositionTrackerChain) fPositionTrackerMap.get(file.getFullPath());
if (chain != null) {
@@ -175,4 +178,15 @@ public class PositionTrackerManager implements IPositionTrackerManager, IFileBuf
}
return null;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public synchronized IPositionConverter findPositionConverter(IPath externalLocation, long timestamp) {
+ PositionTrackerChain chain= (PositionTrackerChain) fPositionTrackerMap.get(externalLocation);
+ if (chain != null) {
+ return chain.findTrackerAt(timestamp);
+ }
+ return null;
+ }
}

Back to the top