Author: pwang
Date: 2012-01-11 13:49:37 -0800 (Wed, 11 Jan 2012)
New Revision: 27983
Modified:
core3/impl/trunk/search-impl/src/main/java/org/cytoscape/search/internal/EnhancedSearchIndex.java
core3/impl/trunk/search-impl/src/main/java/org/cytoscape/search/internal/IndexAndSearchTask.java
core3/impl/trunk/search-impl/src/main/java/org/cytoscape/search/internal/ReindexTask.java
Log:
Update taskMonitor when do indexing
Modified:
core3/impl/trunk/search-impl/src/main/java/org/cytoscape/search/internal/EnhancedSearchIndex.java
===================================================================
---
core3/impl/trunk/search-impl/src/main/java/org/cytoscape/search/internal/EnhancedSearchIndex.java
2012-01-11 20:01:48 UTC (rev 27982)
+++
core3/impl/trunk/search-impl/src/main/java/org/cytoscape/search/internal/EnhancedSearchIndex.java
2012-01-11 21:49:37 UTC (rev 27983)
@@ -47,16 +47,17 @@
import org.cytoscape.model.CyTableEntry;
import org.cytoscape.model.CyTableUtil;
import org.cytoscape.search.internal.util.EnhancedSearchUtils;
+import org.cytoscape.work.TaskMonitor;
public class EnhancedSearchIndex {
RAMDirectory idx;
-
+ final TaskMonitor taskMonitor;
// Index the given network
- public EnhancedSearchIndex(final CyNetwork network) {
+ public EnhancedSearchIndex(final CyNetwork network, final TaskMonitor
taskMonitor) {
if(network == null)
throw new NullPointerException("Network is null.");
-
+ this.taskMonitor = taskMonitor;
// Construct a RAMDirectory to hold the in-memory
representation of the index.
idx = new RAMDirectory();
BuildIndex(idx, network);
@@ -72,9 +73,11 @@
// Add a document for each graph object - node and edge
List<CyNode> nodeList = network.getNodeList();
+ this.taskMonitor.setProgress(0.1);
for (CyNode cyNode : nodeList) {
writer.addDocument(createDocument(network,
cyNode, EnhancedSearch.NODE_TYPE, cyNode.getIndex()));
}
+ this.taskMonitor.setProgress(0.6);
List<CyEdge> edgeList = network.getEdgeList();
for (CyEdge cyEdge : edgeList) {
@@ -88,6 +91,7 @@
} catch (IOException ioe) {
ioe.printStackTrace();
}
+ this.taskMonitor.setProgress(0.95);
}
Modified:
core3/impl/trunk/search-impl/src/main/java/org/cytoscape/search/internal/IndexAndSearchTask.java
===================================================================
---
core3/impl/trunk/search-impl/src/main/java/org/cytoscape/search/internal/IndexAndSearchTask.java
2012-01-11 20:01:48 UTC (rev 27982)
+++
core3/impl/trunk/search-impl/src/main/java/org/cytoscape/search/internal/IndexAndSearchTask.java
2012-01-11 21:49:37 UTC (rev 27983)
@@ -93,7 +93,7 @@
}
else {
taskMonitor.setStatusMessage("Indexing network");
- final EnhancedSearchIndex indexHandler = new
EnhancedSearchIndex(network);
+ final EnhancedSearchIndex indexHandler = new
EnhancedSearchIndex(network, taskMonitor);
idx = indexHandler.getIndex();
enhancedSearch.setNetworkIndex(network, idx);
EnhancedSearchPlugin.attributeChanged = false;
Modified:
core3/impl/trunk/search-impl/src/main/java/org/cytoscape/search/internal/ReindexTask.java
===================================================================
---
core3/impl/trunk/search-impl/src/main/java/org/cytoscape/search/internal/ReindexTask.java
2012-01-11 20:01:48 UTC (rev 27982)
+++
core3/impl/trunk/search-impl/src/main/java/org/cytoscape/search/internal/ReindexTask.java
2012-01-11 21:49:37 UTC (rev 27983)
@@ -61,7 +61,7 @@
RAMDirectory idx = null;
taskMonitor.setStatusMessage("Re-indexing network");
- EnhancedSearchIndex indexHandler = new
EnhancedSearchIndex(network);
+ EnhancedSearchIndex indexHandler = new
EnhancedSearchIndex(network, taskMonitor);
idx = indexHandler.getIndex();
enhancedSearch.setNetworkIndex(network, idx);
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.