Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Problem with moving toolbars after switch from mars to neon(Cannot move toolbars in application window from side trimbars to top toolbar)
Problem with moving toolbars after switch from mars to neon [message #1751254] Fri, 06 January 2017 10:55 Go to next message
Vladimir Dobos is currently offline Vladimir DobosFriend
Messages: 2
Registered: January 2017
Junior Member
I have several RCP 3 applications running through compatibility layer and I'm currently changing their base from Mars to Neon. Before update, I could not move toolbars (due to me not using CSS). This has been changed in Neon - due to fix of https://bugs.eclipse.org/bugs/show_bug.cgi?id=472761

After changing to Neon, toolbars are now movable and if they are all moved to side trim bars from default location on top, then the top toolbar disappears (I have no search text field to kep it up).
Now the problem - while side empty trim bars appear after moving dragged toolbar near sides of window, top coolbar doesn't and I cannot move toolbars back to the top (only way I found is to clear model data).

Is there a way for me to disable toolbar moving, make top toolbar appear on drag simmilar to side trim bars, make top coolbar not hide after all toolbars are moved from it or disable moving to side trimbars ?
Toolbar is defined in 3.x way in plugin.xml.

Hope i made clear what is the problem, unfortunatelly forums don't allow me to link screencap (just made the account) to illustrate the problem better.
Re: Problem with moving toolbars after switch from mars to neon [message #1751552 is a reply to message #1751254] Wed, 11 January 2017 12:08 Go to previous messageGo to next message
Michael Haug is currently offline Michael HaugFriend
Messages: 1
Registered: January 2017
Junior Member
I had exactly the same problem! Since our main toolbar is also created in the old 3.x way (ActionBarAdvisor), I have added the tag IPresentationEngine.NO_MOVE to the toolbar model using the following model processor:

   <extension
         id="id1"
         point="org.eclipse.e4.workbench.model">
      <processor
            apply="initial"
            beforefragment="true"
            class="xxx.xxx.xxx.xxx.ToolBarProcessor">
      </processor>

import javax.inject.Inject;

import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.services.events.IEventBroker;
import org.eclipse.e4.ui.model.application.ui.MElementContainer;
import org.eclipse.e4.ui.model.application.ui.menu.MToolBar;
import org.eclipse.e4.ui.workbench.IPresentationEngine;
import org.eclipse.e4.ui.workbench.UIEvents;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventHandler;

public class ToolBarProcessor
{
	@Inject
	private IEventBroker broker;

	@Execute
	public void init()
	{
		broker.subscribe(UIEvents.ElementContainer.TOPIC_ALL, new EventHandler()
		{
			public void handleEvent(Event event)
			{
				Object object = event.getProperty(UIEvents.EventTags.ELEMENT);
				if (object instanceof MToolBar)
				{
					MToolBar toolBar = (MToolBar) object;
					MElementContainer<?> container = toolBar.getParent();
					if (container != null && container.getElementId().equals("org.eclipse.ui.main.toolbar"))
					{
						toolBar.getTags().add(IPresentationEngine.NO_MOVE);
						broker.unsubscribe(this);
					}
				}
			}
		});
	}
}
Re: Problem with moving toolbars after switch from mars to neon [message #1751996 is a reply to message #1751552] Tue, 17 January 2017 15:27 Go to previous message
Vladimir Dobos is currently offline Vladimir DobosFriend
Messages: 2
Registered: January 2017
Junior Member
Thanks for reply. Already found the same solution (IPresentationEngine.NO_MOVE) while this question was waiting for approval Smile and just checked if someone replied with something different. From what I was able to read from source code in platform, there isn't any other feasible solution besides this or having quicksearch in toolbar to keep top toolbar accessible. For now this solution is enough. Hopefully none of my users will demand moving toolbars Rolling Eyes
Previous Topic:Native eclipse core net
Next Topic:NPE when switching Perspective
Goto Forum:
  


Current Time: Sat Nov 18 10:34:18 GMT 2017

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

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