Hi.

 

I've created a generic plugin with a couple of abstract classes. Specialized
plugins are using this generic plugin's functionality. Sometimes the classes
in generic plugin have to know in which specialized pligin they were
instantiated. Let me clarify the concrete problem:

 

public abstract class GenericPlugin extends AbstractUIPlugin {

                private CommandMapping commandMapping;

 

                public void start( BundleContext context ) {

                               commandMapping = instantiateCommandMapping();

                }

 

                public CommandMapping getCommandMapping() { return
commandMapping; }

 

                publc static GenericPlugin getInstance( String pluginName )
{ return PlguinRegistry.get( pluginName ); }

                

                protected CommandMapping instantiateCommandMapping();

}

 

public class SpecificPlugin extends GenericPlugin {

                protected CommandMapping instantiateCommandMapping() {

                               return new SpecificCommandMapping();

                }

}

 

public abstract class ActionDelegate implements
IWorkbenchWindowActionDelegate {

                private CommandMapping commandMapping;

 

                public void init( IWorkbenchWindow window ) {

                               commandMapping = GenericPlugin.getInstance(
pluginName ).getCommandMapping();

                }

}

 

public class SpecificActionDelegate extends GenericActionDelegate {

                public void init(IWorkbenchWindow window ) {

                               super( window );

                }

}

 

The line: GenericPlugin.getInstance( pluginName ) is crucial because I don't
know how can I determine the plugin's name within which the object
SpecificActionDelegate was instantiated. 

 

Do you have any idea?

 

Zsolt

_______________________________________________
platform-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/platform-dev

Reply via email to