Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-dev] How can an object determine which plugin it was instantiated?


Hi,

This email list is for developers working on Eclipse itself.  Please direct how-to type questions to the newsgroup, which is quite lively.


Kevin



"Zsuffa Zsolt" <zsolt@xxxxxxx>
Sent by: platform-dev-bounces@xxxxxxxxxxx

06/06/2008 04:23 AM

Please respond to
zsolt@xxxxxxx; Please respond to
"Eclipse platform general developers list."        <platform-dev@xxxxxxxxxxx>

To
<platform-dev@xxxxxxxxxxx>
cc
Subject
[platform-dev] How can an object determine which plugin it was        instantiated?





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



__________ Information from ESET NOD32 Antivirus, version of virus signature database 2985 (20080330) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com_______________________________________________
platform-dev mailing list
platform-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-dev


Back to the top