|
From: <caw...@us...> - 2007-04-06 15:54:55
|
Revision: 2295
http://svn.sourceforge.net/rubyeclipse/?rev=2295&view=rev
Author: cawilliams
Date: 2007-04-06 08:54:53 -0700 (Fri, 06 Apr 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/SearchDocument.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/indexing/IndexManager.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/indexing/InternalSearchDocument.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/SearchDocument.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/SearchDocument.java 2007-04-06 15:42:21 UTC (rev 2294)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/SearchDocument.java 2007-04-06 15:54:53 UTC (rev 2295)
@@ -5,7 +5,6 @@
import java.util.List;
import java.util.Set;
-import org.eclipse.core.runtime.IPath;
import org.rubypeople.rdt.core.IParent;
import org.rubypeople.rdt.core.IRubyElement;
import org.rubypeople.rdt.core.IRubyScript;
@@ -13,18 +12,35 @@
import org.rubypeople.rdt.core.RubyModelException;
import org.rubypeople.rdt.internal.core.Openable;
import org.rubypeople.rdt.internal.core.search.HandleFactory;
+import org.rubypeople.rdt.internal.core.search.indexing.InternalSearchDocument;
-public class SearchDocument {
+public class SearchDocument extends InternalSearchDocument {
private static HandleFactory factory = new HandleFactory();
+ private IRubyScript script;
+
private static final String SEPARATOR = "/";
+
private List<String> indices = new ArrayList<String>();
- private IPath path;
- private IRubyScript script;
+
+ private String documentPath;
- public SearchDocument(IPath path) {
- this.path = path;
+ public SearchDocument(String documentPath) {
+ this.documentPath = documentPath;
}
+
+ public void addIndexEntry(char[] category, char[] key) {
+ super.addIndexEntry(category, key);
+ }
+
+ /**
+ * Removes all index entries from the index for the given document.
+ * This method must be called from
+ * {@link SearchParticipant#indexDocument(SearchDocument document, org.eclipse.core.runtime.IPath indexPath)}.
+ */
+ public void removeAllIndexEntries() {
+ super.removeAllIndexEntries();
+ }
public Set<String> getElementNamesOfType(int type) {
Set<String> names = new HashSet<String>();
@@ -42,7 +58,7 @@
private IRubyScript getScript() {
if (this.script == null) {
- Openable openable = factory.createOpenable(path.toString());
+ Openable openable = factory.createOpenable(documentPath);
this.script = (IRubyScript) openable;
}
return this.script;
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/indexing/IndexManager.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/indexing/IndexManager.java 2007-04-06 15:42:21 UTC (rev 2294)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/indexing/IndexManager.java 2007-04-06 15:54:53 UTC (rev 2295)
@@ -65,7 +65,7 @@
(element.isType(IRubyElement.SOURCE_FOLDER))) return;
SearchDocument doc = documents.get(element.getPath());
if (doc == null) {
- doc = new SearchDocument(element.getPath());
+ doc = new SearchDocument(element.getPath().toString());
documents.put(element.getPath(), doc);
}
doc.addElement(element);
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/indexing/InternalSearchDocument.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/indexing/InternalSearchDocument.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/indexing/InternalSearchDocument.java 2007-04-06 15:54:53 UTC (rev 2295)
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.internal.core.search.indexing;
+
+import org.rubypeople.rdt.internal.core.index.Index;
+
+/**
+ * Internal search document implementation
+ */
+public class InternalSearchDocument {
+ Index index;
+ private String containerRelativePath;
+// SourceElementParser parser;
+ /*
+ * Hidden by API SearchDocument subclass
+ */
+ public void addIndexEntry(char[] category, char[] key) {
+ if (this.index != null) {
+ index.addIndexEntry(category, key, getContainerRelativePath());
+// if (category == IIndexConstants.TYPE_DECL && key != null) {
+// int length = key.length;
+// if (length > 1 && key[length-2] == IIndexConstants.SEPARATOR && key[length-1] == IIndexConstants.SECONDARY_SUFFIX ) {
+// // This is a key of a secondary type => reset ruby model manager secondary types cache for document path project
+// RubyModelManager manager = RubyModelManager.getRubyModelManager();
+// manager.secondaryTypeAdding(getPath(), key);
+// }
+// }
+ }
+ }
+ private String getContainerRelativePath() {
+ if (this.containerRelativePath == null)
+ this.containerRelativePath = this.index.containerRelativePath(getPath());
+ return this.containerRelativePath;
+ }
+ /*
+ * Hidden by API SearchDocument subclass
+ */
+ public void removeAllIndexEntries() {
+ if (this.index != null)
+ index.remove(getContainerRelativePath());
+ }
+ /*
+ * Hidden by API SearchDocument subclass
+ */
+ public String getPath() {
+ return null; // implemented by subclass
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|