Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Can plugin1 call a method on a class that is part of plugin2?
Can plugin1 call a method on a class that is part of plugin2? [message #156966] Fri, 14 November 2003 17:26 Go to next message
David Whitehurst is currently offline David WhitehurstFriend
Messages: 76
Registered: July 2009
Member
Can Plugin1 call a method on a class that is part of plugin2? If so, how?

David

--
David L. Whitehurst
aka. PiratePete
http://www.piratepetesoftware.com
dlwhitehurst@comcast.net
Re: Can plugin1 call a method on a class that is part of plugin2? [message #156983 is a reply to message #156966] Fri, 14 November 2003 18:05 Go to previous messageGo to next message
Del Myers is currently offline Del MyersFriend
Messages: 69
Registered: July 2009
Member
If I understand you correctly, then yes, it is possible. In the PDE editor
for Plugin1's plugin.xml, go to the "Dependencies" page and add plugin2.
Java files in Plugin1's project should now be able to import any public
class from plugin2, and call any of its public methods.

"David" <dlwhitehurst@comcast.net> wrote in message
news:bp3342$bno$1@eclipse.org...
> Can Plugin1 call a method on a class that is part of plugin2? If so, how?
>
> David
>
> --
> David L. Whitehurst
> aka. PiratePete
> http://www.piratepetesoftware.com
> dlwhitehurst@comcast.net
>
>
Re: Can plugin1 call a method on a class that is part of plugin2? [message #156988 is a reply to message #156983] Fri, 14 November 2003 18:04 Go to previous messageGo to next message
David Whitehurst is currently offline David WhitehurstFriend
Messages: 76
Registered: July 2009
Member
Ok, we're almost there ... (must have been the way I asked, lol) ... my
editor action wants to call writeln(String s) in my console view. So, how
do I get the "running" instance of the class ConsoleView and not the Plugin?
I can't create a console in my action because the one I want to call the
writeln method on is already running?

Thank you, thank you, ...

David

--
David L. Whitehurst
aka. PiratePete
http://www.piratepetesoftware.com
dlwhitehurst@comcast.net
"Del" <delmyers@cs.uvic.ca> wrote in message
news:bp34mf$dep$1@eclipse.org...
> If I understand you correctly, then yes, it is possible. In the PDE editor
> for Plugin1's plugin.xml, go to the "Dependencies" page and add plugin2.
> Java files in Plugin1's project should now be able to import any public
> class from plugin2, and call any of its public methods.
>
> "David" <dlwhitehurst@comcast.net> wrote in message
> news:bp3342$bno$1@eclipse.org...
> > Can Plugin1 call a method on a class that is part of plugin2? If so,
how?
> >
> > David
> >
> > --
> > David L. Whitehurst
> > aka. PiratePete
> > http://www.piratepetesoftware.com
> > dlwhitehurst@comcast.net
> >
> >
>
>
Re: Can plugin1 call a method on a class that is part of plugin2? [message #156996 is a reply to message #156988] Fri, 14 November 2003 18:15 Go to previous messageGo to next message
David Whitehurst is currently offline David WhitehurstFriend
Messages: 76
Registered: July 2009
Member
Del:

The guy in the post below had the same issue that I am having. I don't care
whether I use a listener/proxy/callback method or a direct method call way
of talking between plugins, but I have been unsuccessful doing either. Just
like the guy in next post down, I tried using the IListener, ext-point,
extension way of using a host plugin and the console would be the listener.
When my editor action run method called Platform.getPlugin, it returned
null. I can't get a running instance of the host plugin. Since, it had no
GUI, I assume I was missing something. A view gets created when you use
Eclipse to show it. I don't know what you do to get a dumb plugin to run.

David

--
David L. Whitehurst
aka. PiratePete
http://www.piratepetesoftware.com
dlwhitehurst@comcast.net
"David" <dlwhitehurst@comcast.net> wrote in message
news:bp35ci$eam$1@eclipse.org...
> Ok, we're almost there ... (must have been the way I asked, lol) ... my
> editor action wants to call writeln(String s) in my console view. So, how
> do I get the "running" instance of the class ConsoleView and not the
Plugin?
> I can't create a console in my action because the one I want to call the
> writeln method on is already running?
>
> Thank you, thank you, ...
>
> David
>
> --
> David L. Whitehurst
> aka. PiratePete
> http://www.piratepetesoftware.com
> dlwhitehurst@comcast.net
> "Del" <delmyers@cs.uvic.ca> wrote in message
> news:bp34mf$dep$1@eclipse.org...
> > If I understand you correctly, then yes, it is possible. In the PDE
editor
> > for Plugin1's plugin.xml, go to the "Dependencies" page and add plugin2.
> > Java files in Plugin1's project should now be able to import any public
> > class from plugin2, and call any of its public methods.
> >
> > "David" <dlwhitehurst@comcast.net> wrote in message
> > news:bp3342$bno$1@eclipse.org...
> > > Can Plugin1 call a method on a class that is part of plugin2? If so,
> how?
> > >
> > > David
> > >
> > > --
> > > David L. Whitehurst
> > > aka. PiratePete
> > > http://www.piratepetesoftware.com
> > > dlwhitehurst@comcast.net
> > >
> > >
> >
> >
>
>
Re: Can plugin1 call a method on a class that is part of plugin2? [message #157045 is a reply to message #156996] Fri, 14 November 2003 20:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: luis_benitez.nospam.us.ibm.com

Hi David,

Have you tried adding the <exports> line to the plugin 2's plugin.xml ? If
plugin 2 doesn't export its classes, then plugin 1 won't be able to call
methods on classes that belong to plugin 2.

-Luis

"David" <dlwhitehurst@comcast.net> wrote in message
news:bp360c$f37$1@eclipse.org...
> Del:
>
> The guy in the post below had the same issue that I am having. I don't
care
> whether I use a listener/proxy/callback method or a direct method call way
> of talking between plugins, but I have been unsuccessful doing either.
Just
> like the guy in next post down, I tried using the IListener, ext-point,
> extension way of using a host plugin and the console would be the
listener.
> When my editor action run method called Platform.getPlugin, it returned
> null. I can't get a running instance of the host plugin. Since, it had
no
> GUI, I assume I was missing something. A view gets created when you use
> Eclipse to show it. I don't know what you do to get a dumb plugin to run.
>
> David
>
> --
> David L. Whitehurst
> aka. PiratePete
> http://www.piratepetesoftware.com
> dlwhitehurst@comcast.net
> "David" <dlwhitehurst@comcast.net> wrote in message
> news:bp35ci$eam$1@eclipse.org...
> > Ok, we're almost there ... (must have been the way I asked, lol) ...
my
> > editor action wants to call writeln(String s) in my console view. So,
how
> > do I get the "running" instance of the class ConsoleView and not the
> Plugin?
> > I can't create a console in my action because the one I want to call the
> > writeln method on is already running?
> >
> > Thank you, thank you, ...
> >
> > David
> >
> > --
> > David L. Whitehurst
> > aka. PiratePete
> > http://www.piratepetesoftware.com
> > dlwhitehurst@comcast.net
> > "Del" <delmyers@cs.uvic.ca> wrote in message
> > news:bp34mf$dep$1@eclipse.org...
> > > If I understand you correctly, then yes, it is possible. In the PDE
> editor
> > > for Plugin1's plugin.xml, go to the "Dependencies" page and add
plugin2.
> > > Java files in Plugin1's project should now be able to import any
public
> > > class from plugin2, and call any of its public methods.
> > >
> > > "David" <dlwhitehurst@comcast.net> wrote in message
> > > news:bp3342$bno$1@eclipse.org...
> > > > Can Plugin1 call a method on a class that is part of plugin2? If
so,
> > how?
> > > >
> > > > David
> > > >
> > > > --
> > > > David L. Whitehurst
> > > > aka. PiratePete
> > > > http://www.piratepetesoftware.com
> > > > dlwhitehurst@comcast.net
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Re: Can plugin1 call a method on a class that is part of plugin2? [message #157146 is a reply to message #156996] Fri, 14 November 2003 21:33 Go to previous message
Del Myers is currently offline Del MyersFriend
Messages: 69
Registered: July 2009
Member
I answered this problem a while back, but since I can't remember what post
it was in, I'll answer again :-).

You don't have to worry about the classes as they are associated with
plugins. You are only worried about views that are visible on the workbench
(if I read you correctly). That is, you have a view on the workbench that is
visible and you want to force it to do something.

A workbench page will only ever have one instance of a view openned at a
time, so you can ask it for the view that you want:

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().findVie
w(myView.id);

This will return an instance of IViewPart, or null if your view couldn't be
found. You can then cast what was returned to whatever class it is that your
view is an instance of, and call the method that you want.

Del.



"David" <dlwhitehurst@comcast.net> wrote in message
news:bp360c$f37$1@eclipse.org...
> Del:
>
> The guy in the post below had the same issue that I am having. I don't
care
> whether I use a listener/proxy/callback method or a direct method call way
> of talking between plugins, but I have been unsuccessful doing either.
Just
> like the guy in next post down, I tried using the IListener, ext-point,
> extension way of using a host plugin and the console would be the
listener.
> When my editor action run method called Platform.getPlugin, it returned
> null. I can't get a running instance of the host plugin. Since, it had
no
> GUI, I assume I was missing something. A view gets created when you use
> Eclipse to show it. I don't know what you do to get a dumb plugin to run.
>
> David
>
> --
> David L. Whitehurst
> aka. PiratePete
> http://www.piratepetesoftware.com
> dlwhitehurst@comcast.net
> "David" <dlwhitehurst@comcast.net> wrote in message
> news:bp35ci$eam$1@eclipse.org...
> > Ok, we're almost there ... (must have been the way I asked, lol) ...
my
> > editor action wants to call writeln(String s) in my console view. So,
how
> > do I get the "running" instance of the class ConsoleView and not the
> Plugin?
> > I can't create a console in my action because the one I want to call the
> > writeln method on is already running?
> >
> > Thank you, thank you, ...
> >
> > David
> >
> > --
> > David L. Whitehurst
> > aka. PiratePete
> > http://www.piratepetesoftware.com
> > dlwhitehurst@comcast.net
> > "Del" <delmyers@cs.uvic.ca> wrote in message
> > news:bp34mf$dep$1@eclipse.org...
> > > If I understand you correctly, then yes, it is possible. In the PDE
> editor
> > > for Plugin1's plugin.xml, go to the "Dependencies" page and add
plugin2.
> > > Java files in Plugin1's project should now be able to import any
public
> > > class from plugin2, and call any of its public methods.
> > >
> > > "David" <dlwhitehurst@comcast.net> wrote in message
> > > news:bp3342$bno$1@eclipse.org...
> > > > Can Plugin1 call a method on a class that is part of plugin2? If
so,
> > how?
> > > >
> > > > David
> > > >
> > > > --
> > > > David L. Whitehurst
> > > > aka. PiratePete
> > > > http://www.piratepetesoftware.com
> > > > dlwhitehurst@comcast.net
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Previous Topic:Runtime diagnostic/debugging strategies.
Next Topic:IPluginContentWizard help
Goto Forum:
  


Current Time: Thu Jul 25 13:46:54 GMT 2024

Powered by FUDForum. Page generated in 0.04066 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top