Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » ViewPart with Toolbar
ViewPart with Toolbar [message #1065544] Wed, 26 June 2013 12:46 Go to next message
Sascha Smoo is currently offline Sascha Smoo
Messages: 55
Registered: November 2012
Member
Hello,

I've got a custom ViewPart in my RAP Application and I'm trying to add a Button to the Toolbar of this view by using the following code:

	@Override
	public void createPartControl(Composite parent) {
		IToolBarManager toolBarManager = getViewSite().getActionBars()
				.getToolBarManager();
		toolBarManager.add(new Action("ModeSwitch") {
			private static final long serialVersionUID = 7203102815117067524L;

			@Override
			public void run() {
				// TODO mach etwas
			}
		});
         }


But the toolbar does not appear at all. Am I missing something here?

Greetings,
Sascha

[Updated on: Wed, 26 June 2013 12:46]

Report message to a moderator

Re: ViewPart with Toolbar [message #1065554 is a reply to message #1065544] Wed, 26 June 2013 13:26 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan Furnadjiev
Messages: 1839
Registered: July 2009
Senior Member
Hi Sascha,
just tried your snippet in our Workbench Demo and it's working fine for
me. See attached screenshot.
Best,
Ivan

On 6/26/2013 3:46 PM, Sascha Smoo wrote:
> Hello,
>
> I've got a custom ViewPart in my RAP Application and I'm trying to add
> a Button to the Toolbar of this with with the following code:
>
>
> @Override
> public void createPartControl(Composite parent) {
> IToolBarManager toolBarManager = getViewSite().getActionBars()
> .getToolBarManager();
> toolBarManager.add(new Action("ModeSwitch") {
> private static final long serialVersionUID =
> 7203102815117067524L;
>
> @Override
> public void run() {
> // TODO mach etwas
> }
> });
> }
>
>
> But the toolbar does not appear at all. Am I missing something here?
>
> Greetings,
> Sascha

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
  • Attachment: demo.png
    (Size: 35.11KB, Downloaded 40 times)
Re: ViewPart with Toolbar [message #1065556 is a reply to message #1065554] Wed, 26 June 2013 13:40 Go to previous messageGo to next message
Sascha Smoo is currently offline Sascha Smoo
Messages: 55
Registered: November 2012
Member
Hello Ivan,

strange.... very strange. Smile Maybe I'm missing something else in my viewpart.

Greetings,
Sascha

[Updated on: Wed, 26 June 2013 13:42]

Report message to a moderator

Re: ViewPart with Toolbar [message #1065561 is a reply to message #1065556] Wed, 26 June 2013 14:00 Go to previous messageGo to next message
Sascha Smoo is currently offline Sascha Smoo
Messages: 55
Registered: November 2012
Member
Maybe it has something to do with my theme? Cause I'm not having any close buttons in my view tabs too.

Greetings,
Sascha
  • Attachment: screen.png
    (Size: 98.96KB, Downloaded 31 times)
Re: ViewPart with Toolbar [message #1065690 is a reply to message #1065561] Thu, 27 June 2013 07:39 Go to previous messageGo to next message
Sascha Smoo is currently offline Sascha Smoo
Messages: 55
Registered: November 2012
Member
Ok, the problem is indeed the theme. When deactivating the theme the button shows up. But I don't know why, I just copied the fancy example rap theme to my own project and manipulated it to my needs. Any ideas on this?
One problem I can see is that my PresentationFactory has Warnings cause there are access restrictions for IToolBarManager2 Interfaces.

Greetings,
Sascha

[Updated on: Thu, 27 June 2013 08:07]

Report message to a moderator

Re: ViewPart with Toolbar [message #1065706 is a reply to message #1065690] Thu, 27 June 2013 08:27 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan Furnadjiev
Messages: 1839
Registered: July 2009
Senior Member
Hi Sascha,
you are not using only the theme (fancy.css + images), but the complete
design bundle (probably a copy of org.eclipse.rap.design.example). This
bundle defines a custom workbench layout and stack presentation ( see
org.eclipse.rap.design.example\META-INF\MANIFEST.MF). It seems that you
removed the
"org.eclipse.rap.internal.design.example.stacks.ConfigAction" specified
in "org.eclipse.rap.ui.stackPresentations" extension. This class enable
the configuration button in the top-right view corner (see attached
screenshot). The visibility of your actions is controlled from there.
HTH,
Ivan

On 6/27/2013 10:39 AM, Sascha Smoo wrote:
> Ok, the problem is indeed the theme. When deactivating the theme the
> button shows up. But I don't know why, I just copied the fancy example
> rap theme to my own project and manipulated it to my needs. Any ideas
> on this?
>
> Greetings,
> Sascha

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: ViewPart with Toolbar [message #1065719 is a reply to message #1065706] Thu, 27 June 2013 09:09 Go to previous message
Sascha Smoo is currently offline Sascha Smoo
Messages: 55
Registered: November 2012
Member
Hi Ivan,

thanks for the hint. It's working now as it should work.

Greetings,
Sascha
Previous Topic:I have a white screen when I wait for the response of the server
Next Topic:[ANN] RAP 2.1 is released
Goto Forum:
  


Current Time: Sat Oct 25 00:55:09 GMT 2014

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

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