Showing Part toolbar in full span in Eclipse e4 - eclipse

I have implemented Eclipse RCP product in 4.5 (Mars) version. There is a part with toolbar. I want to show the part toolbar always in full span (covering the entire width of the part) and not on the part stack (on right side of the part tab).
I tried to add Part-Toolbar-FullSpan tag to the Part and also to the part toolbar but it is not helping.
I also tried to create a custom toolbar but that approach did not work out.
Do you know how I can show the part toolbar in full span?
Thank you.

Part-Toolbar-FullSpan appears to be for the e(fx)clipse JavaFX stack renderer only so it won't work with SWT.
The SWT stack renderer org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer uses the setTopRight method of CTabFolder to manage the toolbar. This will only push the toolbar on to a separate row when there not enough space for it on the tab row.
So it looks like the only way to do this would be to define a custom renderer factory and override the stack renderer. Unfortunately for what you want this would be a substantial change to the renderer.

Related

Eclipse RCP4: Display HandledToolItem with both image and label

I'm working on an Eclipse RCP 4 application and trying to add a HandledToolItem that displays both a label and an image to its left. Problem is whenever i add the image it only displays the image and hides the label. Is there any other way of getting this implemented other than creating a new ToolControl with a Button or a custom Toolbar that can handle this?
It would be nice to have the HandledToolItem because of the simpler management through Commands and Handlers.
Add FORCE_TEXT to the Tags (on the Supplementary tab) for the HandledToolItem in the e4xmi file.

How can I customize partstack header in rcp application

I am trying to customize PartStack header of a view in rcp application. My goal is to customize the coloring of the header and to add date and time to it and hide minimize and maximize buttons. Buttons can be hidden using css but other goals give me hard time. At the moment I am looking to use a custom renderer by overriding some methods in StackRenderer class. Is that a right approach or is there another renderer that I shoud use?
If you don't want the min/max buttons then do not include MinMaxAddon in the Add On list in the Application.e4xmi.
Using a custom renderer for StackRenderer is useful for changing the text of the part tabs items. If you want to put text elsewhere on the part stack line you will probably need to look at the MinMaxAddon to see how it does that.

JavaFX 2 custom popup pane

The JavaFX 2 colour picker has a button that pops up a colour chooser pane like so:
I'd like to do something similar, in that I'd like a custom pane to pop up when the button is clicked on and disappear when something else is clicked (in my case, a few image thumbnails). What would be the best way of achieving this? Should I use a ContextMenu and add a pane to a MenuItem somehow, or is there something else I should look at?
It's kind of difficult to do well with the current JavaFX 2.2 API.
Here are some options.
Use a MenuButton with a graphic set in it's MenuItem
This is the approach taken in Button with popup showed below's executable sample code.
Use a PopupControl
Take a look at how the ColorPicker does this in it's code.
ColorPicker extends PopupControl. You could do this, but not all of the API required to build your own PopupControl is currently public. So, for JavaFX 2.2, you would have to rely on internal com.sun classes which are deprecated and will be replaced by public javafx.scene.control classes in JDK8.
Use a ContextMenu
So, I think your idea to "use a ContextMenu and add a pane to a MenuItem" is probably the best approach for now. You should be able to do this by using a CustomMenuItem or setting a graphic on a normal MenuItem. The ContextMenu has nice relative positioning logic. A ContextMenu can also be triggered by a MenuButton.
Use a Custom Dialog
To do this, display a transparent stage at a location relative to the node.
There is some sample code to get you started which I have temporarily linked here.
The sample code does relative positioning to the sides of the main window, but you could update it to perform positioning relative to the sides of a given node (like the ContextMenu's show method).
Use a Glass Pane
To do this, create a StackPane as your root of your main window. Place your main content pane as the first node in the StackPane and then create a Group as the second node in the stackpane, so that it will layer over the top of the main content. Normally, the top group contains nothing, but when you want to show your popup, place it in the top group and translate it to a location relative to the appropriate node in your main content.
You could look at how the anchor nodes in this demo are used to see how this might be adaptable to your context.
Is there a relevant update for this for JavaFX8?
There is not much difference of relevance for Java 8, in general the options are as outlined in this post based on Java 2.2 functionality. Java 8 does add Dialog and Alert functionality, but those are more targeted at use of dialogs with borders, titles and buttons rather than the kind of functionality desired in the question. Perhaps you might be able to start from the Dialog class and heavily customize it to get something close to what is needed, but you are probably better off starting from a blank stage or PopupControl instead.

Change content of a Label depending on panel size

once again I've got a question. Since I am using Google Web Toolkit (GWT) at work (along with Java Servlets), I am currently building some user interface with GWT (in Java).
I've got some trouble though. I am using a SplitLayoutPanel which contains a ScrollPanel on the left and another one on the right.
In the left ScrollPanel there's a VerticalPanel with several Labels, which differ in their width. What I want to accomplish, is: if the Label's text doesn't fit in one line, it should display as many characters as possible and have a "..." in the end, if it's not fully displayed.
I am about to add a CustomEvent EventHandler for the Label, which can be fired whenever the Label needs to change its content. Now the problem however is, that I'd need to fire the event whenever the ScrollPanel or its inner VerticalPanel is resized (by dragging the SplitLayoutPanel-Splitter).
Now the question: is it possible to override some sort of "onResize"-Event or at least "onMouseMove"-Event inside the VerticalPanel, so that I could fire the "changeLabelSize()"-method for each Label inside of this VerticalPanel?
How would I go about it? Thank you all for your time in advance! Please ask for anything unclear, so I can clarify it.
Best regards,
Igor.
This can be done easily with the CSS property text-overflow: ellipsis;.
Supported by IE7-, Safari and Konqueror.
And it can be emulated in Firefox.

SWT "slim look" buttons and scrollbars

Eclipse 3.5 (on the Mac, at least) now has a slimmer look to its buttons and scroll bars, whereas previous versions' buttons and scroll bars used the larger, "puffier" look. I would like to adopt this same look in my RCP app, but I can't find in the SWT or JFace APIs anywhere how to force the widgets to use this slimmer look. How is this done?
This is because you're now using native Cocoa versus the previous Carbon implementation. There is no API for it.