Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » RCP issues (view titles, toolbar, quick access)
RCP issues (view titles, toolbar, quick access) [message #893532] Wed, 04 July 2012 09:17 Go to next message
Oleg Danilov is currently offline Oleg Danilov
Messages: 21
Registered: July 2012
Junior Member
I just installed 4.2 and found 3 issues (see attached pic) with my simple RCP application:

index.php/fa/10566/0/

1. toolbar is right aligned
2. viewpart titles are missed
3. new 'quick access' field which is useless for me

On #3 seems like it is hard-coded somewhere and can't be removed, correct?

Any ideas about #1 & #2?

Thanks.
Re: RCP issues (view titles, toolbar, quick access) [message #893582 is a reply to message #893532] Wed, 04 July 2012 13:11 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de Alwis
Messages: 242
Registered: July 2009
Senior Member
#1 and #3 are known and we'll deal with them for 4.3.

#2 is bizarre: I've never seen anything like it. Are there any errors in your log? Are you using the old themes support? Can you reproduce with the RCP Mail example? If not, please file a bug report against Eclipse Platform UI and attach your .metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi.

Brian,
Re: RCP issues (view titles, toolbar, quick access) [message #893666 is a reply to message #893582] Thu, 05 July 2012 03:59 Go to previous messageGo to next message
Oleg Danilov is currently offline Oleg Danilov
Messages: 21
Registered: July 2012
Junior Member
Brian de Alwis wrote on Wed, 04 July 2012 13:11
Are there any errors in your log? Are you using the old themes support?


There are no error in the log. I didn't change anything in my app developed using 3.7, and frankly say, I have no ideas about themes support.

Quote:
Can you reproduce with the RCP Mail example?


No, but mail example has another issue:

index.php/fa/10572/0/
Re: RCP issues (view titles, toolbar, quick access) [message #893692 is a reply to message #893582] Thu, 05 July 2012 05:47 Go to previous messageGo to next message
Oleg Danilov is currently offline Oleg Danilov
Messages: 21
Registered: July 2012
Junior Member
Brian de Alwis wrote on Wed, 04 July 2012 13:11

#2 is bizarre: I've never seen anything like it.


I just found the reason. These views are configured as standalone in the org.eclipse.ui.perspectiveExtensions. 3.7 shows titles for standalone views, 4.2 - doesn't.
Re: RCP issues (view titles, toolbar, quick access) [message #893705 is a reply to message #893692] Thu, 05 July 2012 06:22 Go to previous messageGo to next message
Sopot Cela is currently offline Sopot Cela
Messages: 597
Registered: December 2010
Senior Member

It would be great if you could file a bug related to that here https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform&component=UI so it can be fixed.
Thanks.
Re: RCP issues (view titles, toolbar, quick access) [message #893743 is a reply to message #893705] Thu, 05 July 2012 08:42 Go to previous messageGo to next message
Sopot Cela is currently offline Sopot Cela
Messages: 597
Registered: December 2010
Senior Member

I noticed you filed them. For reference to others: https://bugs.eclipse.org/bugs/show_bug.cgi?id=384344 and https://bugs.eclipse.org/bugs/show_bug.cgi?id=384345
Re: RCP issues (view titles, toolbar, quick access) [message #1007090 is a reply to message #893743] Mon, 04 February 2013 07:12 Go to previous messageGo to next message
govind Mising name is currently offline govind Mising name
Messages: 92
Registered: July 2009
Member
Hello All,



1. toolbar is right aligned facing the same issue.

This occurs when we try to add tool bar actions using plugin.xml
<extension
point="org.eclipse.ui.menus">
<menuContribution
allPopups="false"
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
<command
commandId="SampleMail.category"
icon="icons/sample2.gif"
label="Test"
style="push">
</command>
</menuContribution>
</extension>

But doesn't occur when add in ..ActionBar advisor.
protected void fillCoolBar(ICoolBarManager coolBar) {
IToolBarManager toolbar = new ToolBarManager(SWT.FLAT | SWT.LEFT);
coolBar.add(new ToolBarContributionItem(toolbar, "main"));
toolbar.add(openViewAction);
toolbar.add(messagePopupAction);
}

Just WorkAround.


Just override ActionBaradvisor

protected void fillCoolBar(ICoolBarManager coolBar) {
IToolBarManager toolbar = new ToolBarManager(SWT.FLAT | SWT.LEFT);
coolBar.add(new ToolBarContributionItem(toolbar, "main")); <-- is id the
}

Then add the actions

<extension
point="org.eclipse.ui.menus">
<menuContribution
allPopups="false"
locationURI="toolbar:main?after=additions"> <!-- main id-->
<command
commandId="SampleMail.category"
icon="icons/sample2.gif"
label="Test"
style="push">
</command>
</menuContribution>
</extension>

This fixes the issues..
Re: RCP issues (view titles, toolbar, quick access) [message #1116324 is a reply to message #893532] Wed, 25 September 2013 04:48 Go to previous messageGo to next message
Cedric Moonen is currently offline Cedric Moonen
Messages: 270
Registered: August 2009
Senior Member
Hi, I'm bumping this since I have similar problems when upgrading my RCP application from Indigo to Kepler.

Problems 2 and 3 were fixed but problem 1 remains (toolbar which is aligned to the right). I tried the solution provided above (creating a toolbar in the fillCoolBar method of the ActionBarAdvisor class) but this doesn't solve the problem: my toolbar is simply not visible anymore (I used the same Id in the ActionBarAdvisor and in my plugin.xml).

Did anybody fixed this problem ?
Re: RCP issues (view titles, toolbar, quick access) [message #1139416 is a reply to message #1116324] Tue, 15 October 2013 15:10 Go to previous messageGo to next message
Eric Moffatt is currently offline Eric Moffatt
Messages: 118
Registered: July 2009
Senior Member

The 'right alignment' issue stems from the initial UI model containing / adding the
'Search Field'; part of its construction is to add a 'spacer' element to force the right adjustment.

If you can gain access to the ui Model you could simply remove those two elements from the top trim
and it should revert to being left adjusted.
Re: RCP issues (view titles, toolbar, quick access) [message #1149759 is a reply to message #1139416] Tue, 22 October 2013 05:32 Go to previous messageGo to next message
Cedric Moonen is currently offline Cedric Moonen
Messages: 270
Registered: August 2009
Senior Member
Thanks for the reply. However, I have an old RCP application with 3.X plugins. So, it is using the compatibility layer. I don't think I'll be able to gain access to the UI model. Or is it possible ?
I have edited the stylesheet to remove the search field already.

The strange thing is that the toolbar is properly aligned the first time I start my application (when there's no .metadata folder). However, after that the toolbar is not aligned properly anymore.
Re: RCP issues (view titles, toolbar, quick access) [message #1175456 is a reply to message #893532] Thu, 07 November 2013 14:28 Go to previous messageGo to next message
Fredrik Attebrant is currently offline Fredrik Attebrant
Messages: 24
Registered: June 2012
Junior Member
>The strange thing is that the toolbar is properly aligned the first time I start my application (when
> there's no .metadata folder). However, after that the toolbar is not aligned properly anymore.

I got the same thing and it turns out that the problem is caused by the entries written to <workspace>/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi when the application exits after the first launch.

In the workbench.xmi the entries for "SearchField" and "Search-PS Glue" appears and at the subsequent launch the toolbar entries are right aligned.

Launching with the argument "-clearPersistedState" ensures that the workbench.xmi is deleted when launching and then I get the "good" behavior with correct alignment of the actions to the left.

Still just a workaround, but it helps while waiting for the real solution...
Re: RCP issues (view titles, toolbar, quick access) [message #1176798 is a reply to message #1175456] Fri, 08 November 2013 10:08 Go to previous messageGo to next message
Cedric Moonen is currently offline Cedric Moonen
Messages: 270
Registered: August 2009
Senior Member
Frederik, thanks for your reply. Your suggestion indeed works but this also has the consequence to always "reset" the application state to its default: which views are open, size of the views, perspective, ... all that information is lost. IMO, this is more annoying than having the toolbar not aligned properly.

Re: RCP issues (view titles, toolbar, quick access) [message #1178529 is a reply to message #1176798] Sat, 09 November 2013 13:26 Go to previous messageGo to next message
Fredrik Attebrant is currently offline Fredrik Attebrant
Messages: 7
Registered: October 2010
Junior Member
Yes that's not really acceptable.
I also tried the approach of copying the LegacyIDE.e4xmi from org.eclipse.platform plugin into my product plugin as in the https://github.com/fredrikattebrant/Simple-4x-RCP-app
But now the app will not render at all which is even worse...
Re: RCP issues (view titles, toolbar, quick access) [message #1208939 is a reply to message #1178529] Mon, 25 November 2013 03:54 Go to previous messageGo to next message
Cedric Moonen is currently offline Cedric Moonen
Messages: 270
Registered: August 2009
Senior Member
I'm bumping this up: the issue with the wrong alignment of the toolbar is a big issue for us. Having the toolbar aligned on the right is extremely confusing for our users.
I was able to remove the "Search Field" via the application CSS but is there also a way to remove the spacer element ?
Re: RCP issues (view titles, toolbar, quick access) [message #1210032 is a reply to message #1208939] Mon, 25 November 2013 15:42 Go to previous messageGo to next message
Eric Moffatt is currently offline Eric Moffatt
Messages: 118
Registered: July 2009
Senior Member

If someone could open a defect specific to this scenario and attach a sample RCP app that demonstrates the problem we'll be in a much better position to look for a fix...
Re: RCP issues (view titles, toolbar, quick access) [message #1213574 is a reply to message #1210032] Wed, 27 November 2013 04:48 Go to previous messageGo to next message
Cedric Moonen is currently offline Cedric Moonen
Messages: 270
Registered: August 2009
Senior Member
Ok, I adapted the mail template example so that it shows the problem. I opened a bug to submit the issue: https://bugs.eclipse.org/bugs/show_bug.cgi?id=422651
Re: RCP issues (view titles, toolbar, quick access) [message #1214659 is a reply to message #1213574] Wed, 27 November 2013 15:03 Go to previous messageGo to next message
Eric Moffatt is currently offline Eric Moffatt
Messages: 118
Registered: July 2009
Senior Member

Thanks Cedric, I can reproduce the issue now...track the defect for updates.
Re: RCP issues (view titles, toolbar, quick access) [message #1230926 is a reply to message #893532] Mon, 13 January 2014 06:37 Go to previous messageGo to next message
Phillipus B is currently offline Phillipus B
Messages: 18
Registered: October 2012
Junior Member
Seeing the right-aligned toolbar problem in my 3.8 RCP app using the compatibility layer running in Eclipse 4.4 N20140112-2000.

In my RCP app, a GEF-based editor adds contributions to the toolbar with a ActionBarContributor. The contributed toolbar always gets added to the right. I notice that the following lines are added to file (workspace).metadata.plugins\org.eclipse.e4.workbench\workbench.xmi

<children xsi:type="menu:ToolControl" xmi:id="_frzPUHw5EeODTpTvuym4Ow" elementId="PerspectiveSpacer" contributionURI="bundleclass://org.eclipse.e4.ui.workbench.renderers.swt/org.eclipse.e4.ui.workbench.renderers.swt.LayoutModifierToolControl">
<tags>stretch</tags>
</children>
<children xsi:type="menu:ToolControl" xmi:id="_frzPUXw5EeODTpTvuym4Ow" elementId="PerspectiveSwitcher" toBeRendered="false" contributionURI="bundleclass://org.eclipse.ui.workbench/org.eclipse.e4.ui.workbench.addons.perspectiveswitcher.PerspectiveSwitcher">
<tags>Draggable</tags>
</children>

If I manually remove these it works OK.
Re: RCP issues (view titles, toolbar, quick access) [message #1251420 is a reply to message #893532] Thu, 20 February 2014 02:38 Go to previous messageGo to next message
Sanghyun Choi is currently offline Sanghyun Choi
Messages: 1
Registered: February 2014
Junior Member
Hi Oleg,

I'm desperately searching for a solution to this toolbar problem but I just can't find any valid solution on google. Did you find any workaround for this? Your reply would be greatly appreciated!

Best,
Daniel
Re: RCP issues (view titles, toolbar, quick access) [message #1273065 is a reply to message #1251420] Wed, 19 March 2014 08:39 Go to previous message
Sergey Kuznetsov is currently offline Sergey Kuznetsov
Messages: 29
Registered: July 2009
Junior Member
Since solution is not available (even in latest Luna developer release) I wrote small code to patch workbench.xmi during RCP product start to get toolbar left-aligned. I put it in Activator.start method of my plugin, here is the code, hope it helps:


final String workBenchXMI = "org.eclipse.e4.workbench" + //$NON-NLS-1$
File.separator + "workbench.xmi"; //$NON-NLS-1$
private void patchWorkbenchXmi () {
try {
final IPath thisBundleStatePath = Platform.getStateLocation(Platform.getBundle(PLUGIN_ID));
final String thisBundleStateFilePath = thisBundleStatePath.toFile().getCanonicalPath();
final File workbenchXmiFile = new File(thisBundleStateFilePath.replace(PLUGIN_ID, workBenchXMI));

final Document workbenchXmiXmlDoc = new SAXReader().read(workbenchXmiFile);
if (workbenchXmiXmlDoc != null) {
final Element trimBarsEl = (Element)workbenchXmiXmlDoc.getRootElement().selectSingleNode("children/trimBars"); //$NON-NLS-1$
if (trimBarsEl != null) {
@SuppressWarnings("rawtypes")
final List childrenList = trimBarsEl.selectNodes("children"); //$NON-NLS-1$
for (Object childObj : childrenList) {
trimBarsEl.remove((Element)childObj);
logger.info(((Element)childObj).asXML() + " has been removed."); //$NON-NLS-1$
}
}
}

final OutputStream outStream = new FileOutputStream(workbenchXmiFile);
final Writer outWriter = new OutputStreamWriter(outStream, "ASCII"); //$NON-NLS-1$
outWriter.write(toASCII(workbenchXmiXmlDoc.asXML()));
outWriter.close();
outStream.close();
} catch (Exception e) {
logger.severe(e.toString());
logStackTrace(e);
}
}

private String toASCII (String unicodeString) {
final StringBuffer asciiStringBuffer = new StringBuffer();
final char[] charArray = unicodeString.toCharArray();

for (char c : charArray) {
if ((int) c > 255)
asciiStringBuffer.append("&#x" + //$NON-NLS-1$
Integer.toHexString((int)c) + ";"); //$NON-NLS-1$
else
asciiStringBuffer.append(c);
}

return asciiStringBuffer.toString();
}
Previous Topic:PreDestroy not called
Next Topic:Product run differs from development run
Goto Forum:
  


Current Time: Fri Aug 29 18:29:56 EDT 2014

Powered by FUDForum. Page generated in 0.12486 seconds