Author: pwang
Date: 2011-04-05 14:11:11 -0700 (Tue, 05 Apr 2011)
New Revision: 24681
Modified:
core3/search-impl/trunk/src/main/java/org/cytoscape/search/internal/EnhancedSearchPlugin.java
Log:
Reclaim memory if the index is no longer needed
Modified:
core3/search-impl/trunk/src/main/java/org/cytoscape/search/internal/EnhancedSearchPlugin.java
===================================================================
---
core3/search-impl/trunk/src/main/java/org/cytoscape/search/internal/EnhancedSearchPlugin.java
2011-04-05 21:06:37 UTC (rev 24680)
+++
core3/search-impl/trunk/src/main/java/org/cytoscape/search/internal/EnhancedSearchPlugin.java
2011-04-05 21:11:11 UTC (rev 24681)
@@ -47,6 +47,7 @@
import org.cytoscape.application.swing.CySwingApplication;
import org.cytoscape.search.internal.ui.EnhancedSearchPanel;
import org.cytoscape.work.swing.GUITaskManager;
+import org.cytoscape.model.CyNetwork;
public class EnhancedSearchPlugin implements SetCurrentNetworkViewListener,
NetworkAboutToBeDestroyedListener,
SessionLoadedListener
@@ -55,7 +56,7 @@
private CyApplicationManager netmgr;
private CyTableManager tableMgr;
private GUITaskManager taskMgr;
- private EnhancedSearchManager searchMgr;
+ private EnhancedSearchManager searchMgr = null;
private static boolean initialized = false;
public EnhancedSearchPlugin(CySwingApplication desktopApp,
CyApplicationManager netmgr,
@@ -79,7 +80,7 @@
@Override
public void handleEvent(SetCurrentNetworkViewEvent e) {
- // Show the Enhanced Search text-field only when a network view
is presented in screen
+ // Show the Enhanced Search text-field only when after network
view is presented on screen
if (!initialized){
init();
}
@@ -87,12 +88,18 @@
@Override
public void handleEvent(SessionLoadedEvent e) {
- //System.out.println("\n\tEnhanceSearch: Got event ---
SessionLoadedEvent");
+ // reset the state of the search-manager
+ if (searchMgr != null){
+ searchMgr.clear();
+ }
}
@Override
public void handleEvent(NetworkAboutToBeDestroyedEvent e) {
- //CyNetwork network = e.getNetwork();
- //System.out.println("\n\tEnhanceSearch: Got event ---
NetworkAboutToBeDestroyedEvent");
+ // remove the index of network to be destroyed
+ if (searchMgr != null){
+ CyNetwork network = e.getNetwork();
+ searchMgr.removeNetworkIndex(network);
+ }
}
}
--
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.