Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Image on Tool Bar
Image on Tool Bar [message #153977] Thu, 14 October 2004 03:47 Go to next message
Eclipse UserFriend
Originally posted by: svenkat.asu.edu

Currently I have the following code that specifies the contents of my
toolbar:

public void contributeToToolBar(IToolBarManager toolBarManager)
{
toolBarManager.add(getAction(IWorkbenchActionConstants.DELET E));
toolBarManager.add(getAction(IWorkbenchActionConstants.UNDO) );
toolBarManager.add(getAction(IWorkbenchActionConstants.REDO) );

toolBarManager.add (a); // my action
toolBarManager.add (b); // another action
toolBarManager.add (c); // another action

}

However, I wanted to add an icon to the tool bar that represents the 3
actions...currently, a plain button is displayed on my tool bar with the
string that I passed to the action constructor. How can I make an image
appear instead? I would also like a separator between the 1st three and
the last three items.

Any help is appreciated.

Thanks,

Swami.
Re: Image on Tool Bar [message #154011 is a reply to message #153977] Thu, 14 October 2004 13:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

I would have to know what getAction() is doing to answer this question. Is
it getting the GEF versions of those actions?

"Swami" <svenkat@asu.edu> wrote in message news:ckksrl$sbo$1@eclipse.org...
> Currently I have the following code that specifies the contents of my
> toolbar:
>
> public void contributeToToolBar(IToolBarManager toolBarManager)
> {
> toolBarManager.add(getAction(IWorkbenchActionConstants.DELET E));
> toolBarManager.add(getAction(IWorkbenchActionConstants.UNDO) );
> toolBarManager.add(getAction(IWorkbenchActionConstants.REDO) );
>
> toolBarManager.add (a); // my action
> toolBarManager.add (b); // another action
> toolBarManager.add (c); // another action
>
> }
>
> However, I wanted to add an icon to the tool bar that represents the 3
> actions...currently, a plain button is displayed on my tool bar with the
> string that I passed to the action constructor. How can I make an image
> appear instead? I would also like a separator between the 1st three and
> the last three items.
>
> Any help is appreciated.
>
> Thanks,
>
> Swami.
>
Re: Image on Tool Bar [message #154082 is a reply to message #154011] Thu, 14 October 2004 17:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: svenkat.asu.edu

My action, for instance "a" is defined like this:

GenerateAction a = new GenerateAction ("Run");

GenerateAction is defined like this:

public class GenerateAction extends Action
{
public GenerateAction()
{
...
}

public GenerateAction (String choice)
{
...
}

public void run()
{
My Code...
}
}

Currently, a plain button with the text "Run" appears on the toolbar...I
wanted to substitute this with an icon.

Thanks!

Swami.


Randy Hudson wrote:

> I would have to know what getAction() is doing to answer this question. Is
> it getting the GEF versions of those actions?

> "Swami" <svenkat@asu.edu> wrote in message news:ckksrl$sbo$1@eclipse.org...
> > Currently I have the following code that specifies the contents of my
> > toolbar:
> >
> > public void contributeToToolBar(IToolBarManager toolBarManager)
> > {
> > toolBarManager.add(getAction(IWorkbenchActionConstants.DELET E));
> > toolBarManager.add(getAction(IWorkbenchActionConstants.UNDO) );
> > toolBarManager.add(getAction(IWorkbenchActionConstants.REDO) );
> >
> > toolBarManager.add (a); // my action
> > toolBarManager.add (b); // another action
> > toolBarManager.add (c); // another action
> >
> > }
> >
> > However, I wanted to add an icon to the tool bar that represents the 3
> > actions...currently, a plain button is displayed on my tool bar with the
> > string that I passed to the action constructor. How can I make an image
> > appear instead? I would also like a separator between the 1st three and
> > the last three items.
> >
> > Any help is appreciated.
> >
> > Thanks,
> >
> > Swami.
> >
Re: Image on Tool Bar [message #154090 is a reply to message #154082] Thu, 14 October 2004 17:42 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Try asking on the platform newsgroup. You could also try actually setting
the Image that you want to appear, unless that is implied by "...".

"Swami" <svenkat@asu.edu> wrote in message news:ckmblr$o6s$1@eclipse.org...
> My action, for instance "a" is defined like this:
>
> GenerateAction a = new GenerateAction ("Run");
>
> GenerateAction is defined like this:
>
> public class GenerateAction extends Action
> {
> public GenerateAction()
> {
> ...
> }
>
> public GenerateAction (String choice)
> {
> ...
> }
>
> public void run()
> {
> My Code...
> }
> }
>
> Currently, a plain button with the text "Run" appears on the toolbar...I
> wanted to substitute this with an icon.
>
> Thanks!
>
> Swami.
>
>
> Randy Hudson wrote:
>
> > I would have to know what getAction() is doing to answer this question.
Is
> > it getting the GEF versions of those actions?
>
> > "Swami" <svenkat@asu.edu> wrote in message
news:ckksrl$sbo$1@eclipse.org...
> > > Currently I have the following code that specifies the contents of my
> > > toolbar:
> > >
> > > public void contributeToToolBar(IToolBarManager toolBarManager)
> > > {
> > >
toolBarManager.add(getAction(IWorkbenchActionConstants.DELET E));
> > > toolBarManager.add(getAction(IWorkbenchActionConstants.UNDO) );
> > > toolBarManager.add(getAction(IWorkbenchActionConstants.REDO) );
> > >
> > > toolBarManager.add (a); // my action
> > > toolBarManager.add (b); // another action
> > > toolBarManager.add (c); // another action
> > >
> > > }
> > >
> > > However, I wanted to add an icon to the tool bar that represents the 3
> > > actions...currently, a plain button is displayed on my tool bar with
the
> > > string that I passed to the action constructor. How can I make an
image
> > > appear instead? I would also like a separator between the 1st three
and
> > > the last three items.
> > >
> > > Any help is appreciated.
> > >
> > > Thanks,
> > >
> > > Swami.
> > >
>
>
Previous Topic:Using property Sheet
Next Topic:Scaling of a DirectEditRequestLocation
Goto Forum:
  


Current Time: Sat Apr 27 02:00:21 GMT 2024

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

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

Back to the top