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" <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
06/06/2008 04:23 AM
Please respond to
[EMAIL PROTECTED]; Please respond to
"Eclipse platform general developers list."     <[email protected]>


To
<[email protected]>
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
[email protected]
https://dev.eclipse.org/mailman/listinfo/platform-dev

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

Reply via email to