I would think we need some central repository of context actions that
a module can register its actions to and then have our internal
components query that to build extra actions for context menus.

Better still the module registers some factory class that can generate
those actions when they're needed (or just return null if the action
isn't relevant in context)

For example a module provides classes that fit the following interface
public interface ContextActionFactory {
    Action createAction(Object modelElement);
}

An example being

public class GetterSetterActionFactory {
    public class GetterSetterActionFactory() {
    }

    public Action createAction(Object modelElement) {
        if (Model.getFacade().isAClass(modelElement) ||
Model.getFacade().isAInterface(modelElement)) {
            // This is creating an instance of your own Action class
            return new GetterSetterAction(modelElement);
        } else {
            // The action is required in the context so return null
            return null;
        }
    }
}


It registers those through some means like this

ContextMenuManager.getInstance().addActionFactory(new
GetterSetterActionFactory());

When ArgoUML creates a context menu on the explorer or on a diagram
Fig it calls each of these factories in turn by querying the
ContextMenuManager. If the factory decides that the menu item is
needed from the context passed to it (the model element) then it adds
that action to the menu before displaying it to the user.

So we need some internal changes to allow for this in a clean way but
I think that is better than having module writers tie themselves
directly to our diagram and explorer implementations that may change
in future.

Bob.


2009/10/20 Andreas Rueckert <[email protected]>:
> Hi!
>
> -------- Original-Nachricht --------
>> Datum: Tue, 20 Oct 2009 13:47:16 +0200
>> Von: Enrico DR <[email protected]>
>> An: [email protected]
>> Betreff: Re: [argouml-dev] Integrating modules and context menus
>
>> Hi Andreas!
>
> --<snip>--
>
>> Yup, as far as i've seen on the mailing list, there was a time when
>> these
>> methods where allowed.. Actually i've not seen any evidence of them :(
>
> I think the scheme plugin used them and the sources of this plugin
> are available.
>
> --<snip>--
>
>> > I think someone even managed to use some scripting framework in
>> > Argo, so that various scripting languages could be used for such
>> > simple tasks?
>>
>> Basically as i told before i've seen the evidence of a scripting
>> framework
>> plugin for ArgoUML but it's quite old, no source (as far as i've seen),
>> and most
>> important it's pretty old (the argouml jars inside the installation
>> dates
>> from
>> 2006, so may be version 0.22) but seems that someone mantain it, since
>> there is some files from 2008
>
> Yeah, I think most of this stuff was done in 2006, or so.
> Don't think anyone used it since then...
>
>> But i resist fighting against the source :P
>
> You don't have to fight. Just use it! :-)
>
> Ciao,
> Andreas
>
> --
> Neu: GMX DSL bis 50.000 kBit/s und 200,- Euro Startguthaben!
> http://portal.gmx.net/de/go/dsl02
>
> ------------------------------------------------------
> http://argouml.tigris.org/ds/viewMessage.do?dsForumId=450&dsMessageId=2409378
>
> To unsubscribe from this discussion, e-mail: 
> [[email protected]].
> To be allowed to post to the list contact the mailing list moderator, email: 
> [[email protected]]
>

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=450&dsMessageId=2409535

To unsubscribe from this discussion, e-mail: 
[[email protected]].
To be allowed to post to the list contact the mailing list moderator, email: 
[[email protected]]

Reply via email to