Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » set max item count for PartStack
set max item count for PartStack [message #1265633] Thu, 06 March 2014 10:38 Go to next message
Jan Weidauer is currently offline Jan WeidauerFriend
Messages: 49
Registered: July 2009
Member
Hi,

in the IDE there is the handy list of all tab items that appeares after
the last tab when a certain amount of items is opened. How can I achieve
this in my RCP? At the moment the behaviour is that the title gets
smaller and smaller the more items are opened.

Regards,

Jan
Re: set max item count for PartStack [message #1265988 is a reply to message #1265633] Thu, 06 March 2014 21:00 Go to previous messageGo to next message
Eric Moffatt is currently offline Eric MoffattFriend
Messages: 118
Registered: July 2009
Senior Member

When we create a stack using the StackRenderer it calls 'setMinimumCharacters' based on whether it's an editor or a view stack. For view stacks we set it to '1', meaning that it'll shrink the tab rather than dropping them of onto the end with the '>>' dropdown.

I'm not positive but you may well be able to fix this by over riding our default using CSS...let me know if this doesn't work (it should).
Re: set max item count for PartStack [message #1266314 is a reply to message #1265988] Fri, 07 March 2014 09:04 Go to previous messageGo to next message
Jan Weidauer is currently offline Jan WeidauerFriend
Messages: 49
Registered: July 2009
Member
Thanks for the answer.

I wondered what the difference between a view stack and an editor stack
might be for this is a point of view I thought e4 hasn't anymore. So I
took a deeper look into the StackRenderer (I am working with 4.3). It
seems the renderer decides if the Stack is placed in an MArea or not.
I changed my model and placed the Stack inside an Area but nothing
changed. So I debugged that and found that the model service ignores the
fact that the parent of the Stack is an Area.

After that I was searching for possible CSS properties but didn't find a
proper thing. Could you give me a hint in this direction please?

If that turns out to be no usable way too I see only the option to try
to retrieve the CTabFolder of the Stack and set the minimum characters
programmatically. But this seems to be a more dirty way.

Jan




Am 06.03.2014 22:00, schrieb Eric Moffatt:
>
> When we create a stack using the StackRenderer it calls 'setMinimumCharacters' based on whether it's an editor or a view stack. For view stacks we set it to '1', meaning that it'll shrink the tab rather than dropping them of onto the end with the '>>' dropdown.
>
> I'm not positive but you may well be able to fix this by over riding our default using CSS...let me know if this doesn't work (it should).
>
Re: set max item count for PartStack [message #1266602 is a reply to message #1266314] Fri, 07 March 2014 18:03 Go to previous messageGo to next message
Eric Moffatt is currently offline Eric MoffattFriend
Messages: 118
Registered: July 2009
Senior Member

Here's the current state of the SWT CSS capabilities (thanks to Paul Webster for finding this...)

http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/bundles/org.eclipse.e4.ui.css.swt/plugin.xml

If it's not able to be set through CSS here's a hack that listens for new stacks being rendered and sets the char limit:

@Inject
@Optional
private void handleNewStacks(@UIEventTopic(UIEvents.UIElement.TOPIC_WIDGET) Event event) {
final MUIElement changedElement = (MUIElement) event.getProperty(EventTags.ELEMENT);
if (!(changedElement instanceof MPartStack) || !(changedElement.getWidget() instanceof CTabFolder))
return;

CTabFolder ctf = (CTabFolder) changedElement.getWidget();
ctf.setMinimumCharacters(<whatever you want>);
}
Re: set max item count for PartStack [message #1268423 is a reply to message #1266602] Mon, 10 March 2014 13:33 Go to previous message
Jan Weidauer is currently offline Jan WeidauerFriend
Messages: 49
Registered: July 2009
Member
Thanks alot Eric!

Am 07.03.2014 19:03, schrieb Eric Moffatt:
>
> Here's the current state of the SWT CSS capabilities (thanks to Paul Webster for finding this...)
>
> http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/bundles/org.eclipse.e4.ui.css.swt/plugin.xml
>
> If it's not able to be set through CSS here's a hack that listens for new stacks being rendered and sets the char limit:
>
> @Inject
> @Optional
> private void handleNewStacks(@UIEventTopic(UIEvents.UIElement.TOPIC_WIDGET) Event event) {
> final MUIElement changedElement = (MUIElement) event.getProperty(EventTags.ELEMENT);
> if (!(changedElement instanceof MPartStack) || !(changedElement.getWidget() instanceof CTabFolder))
> return;
>
> CTabFolder ctf = (CTabFolder) changedElement.getWidget();
> ctf.setMinimumCharacters(<whatever you want>);
> }
>
Previous Topic:key binding in e4 RCP application
Next Topic:workbench.xmi not updated?
Goto Forum:
  


Current Time: Fri Dec 19 08:49:57 GMT 2014

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

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