Re: [RomaFramework-dev] R: Plugin-based development in ROMA?
Brought to you by:
lvca
|
From: ted s. <emo...@ya...> - 2006-09-22 11:30:04
|
ted stockwell wrote:
> I will try to implement my proposed extension to the menu example
> myself. That will be a good way for me to learn more about ROMA.
>
Hi All,
I have completed a simple extension to the ROMA menu demo that
dynamically extends a menu by adding actions to the menu class at run time.
This demonstrates that ROMA can indeed be extended by plugins.
It turned out that what I wanted to do is in fact amazingly easy. I
just created a new 'aspect' that added the new action to the menu.
The entire code for dynamically adding a menu item at runtime is shown
below.
The code adds a "help" menu item to the main menu of the menu demo.
I'm very impressed by ROMA.
For my next prototype I will attempt to create an Eclipse RCP view
aspect that is capable of running the BLOG demo.
Best Regards,
Ted Stockwell
---------------------------------------------------------
public class HelpUIAspect extends SelfRegistrantConfigurableAspect<String> {
public static final String ASPECT_NAME = "helpui";
public String aspectName() {
return ASPECT_NAME;
}
@Override
public void configClass(SchemaClassDefinition iClass, Annotation
iAnnotation, XmlConfigClassType iNode) {
try {
if (iClass.getSchemaClass().getName().contains("MainMenu")) {
SchemaAction helpAction= new SchemaAction(iClass);
Method helpMethod= this.getClass().getMethod("help", null);
helpAction.configure(helpMethod);
iClass.setAction("this-name-is-ignored", helpAction);
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void help() {
}
}
|