Revision: 16762
          http://sourceforge.net/p/gate/code/16762
Author:   markagreenwood
Date:     2013-08-01 17:37:35 +0000 (Thu, 01 Aug 2013)
Log Message:
-----------
switched to working from the NameBearerHandle instead of the Resource as this 
allows us to update status messages etc. and as this is a GUI based item it 
makes more sense -- I told you this was experimental :)

Modified Paths:
--------------
    gate/trunk/src/gate/gui/NameBearerHandle.java
    gate/trunk/src/gate/gui/ResourceHelper.java

Modified: gate/trunk/src/gate/gui/NameBearerHandle.java
===================================================================
--- gate/trunk/src/gate/gui/NameBearerHandle.java       2013-08-01 12:01:06 UTC 
(rev 16761)
+++ gate/trunk/src/gate/gui/NameBearerHandle.java       2013-08-01 17:37:35 UTC 
(rev 16762)
@@ -243,7 +243,7 @@
                     .get(type).getInstantiations();
         for(Resource res : instances) {
           if(res instanceof ResourceHelper) {
-            Iterator<Action> actionIter = 
((ResourceHelper)res).getActions((Resource)target).iterator();
+            Iterator<Action> actionIter = 
((ResourceHelper)res).getActions(NameBearerHandle.this).iterator();
             while(actionIter.hasNext()) {
               Action anAction = (Action)actionIter.next();
               if(anAction == null)

Modified: gate/trunk/src/gate/gui/ResourceHelper.java
===================================================================
--- gate/trunk/src/gate/gui/ResourceHelper.java 2013-08-01 12:01:06 UTC (rev 
16761)
+++ gate/trunk/src/gate/gui/ResourceHelper.java 2013-08-01 17:37:35 UTC (rev 
16762)
@@ -34,7 +34,7 @@
   // We cache the actions so we don't keep recreating them every time. If you
   // don't want this behaviour (i.e. you want completely dynamic menus) then
   // you'll need to override the getActions method
-  Map<Resource, List<Action>> actions = new HashMap<Resource, List<Action>>();
+  Map<Object, List<Action>> actions = new HashMap<Object, List<Action>>();
 
   @Override
   public Resource init() {
@@ -51,35 +51,35 @@
    * resource. Note that this implementation uses a cache so that the same 
items
    * will be returned each time the menu is displayed. For a fully dynamic
    * approach a subclass should override this method to simply call @{link
-   * {@link #buildActions(Resource)}.
+   * {@link #buildActions(NameBearerHandle)}.
    * 
-   * @param resource
-   *          the {@link gate.Resource} instance we are wanting to add new menu
+   * @param handle
+   *          the {@link gate.gui.NameBearerHandle} instance we are wanting to 
add new menu
    *          items to
    * @return a list of {@link javax.swing.Action} instances which will be added
-   *         to the right click menu of the resource
+   *         to the right click menu of the specified handle
    */
-  public List<Action> getActions(Resource resource) {
+  public List<Action> getActions(NameBearerHandle handle) {
 
-    if(!actions.containsKey(resource)) {
+    if(!actions.containsKey(handle.getTarget())) {
       // if we haven't seen this resource before then build the actions
-      actions.put(resource, buildActions(resource));
+      actions.put(handle.getTarget(), buildActions(handle));
     }
 
     // return the actions from the cache
-    return actions.get(resource);
+    return actions.get(handle.getTarget());
   }
 
   /**
    * Build the {@link javax.swing.Action} instances that should be used to
-   * enhance the right-click menu of the specified {@link gate.Resource}.
+   * enhance the right-click menu of the specified {@link 
gate.gui.NameBearerHandle}.
    * 
    * @param resource
-   *          the {@link gate.Resource} instance we are adding to
+   *          the {@link gate.gui.NameBearerHandle} instance we are adding to
    * @return a list of {@link javax.swing.Action} instances that will be added
    *         to the right-click menu of the resource.
    */
-  protected abstract List<Action> buildActions(Resource resource);
+  protected abstract List<Action> buildActions(NameBearerHandle handle);
 
   @Override
   public void cleanup() {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to