Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 330106

Summary: [Compatibility] WorkbenchWindowControlContributions through toolbar:org.eclipse.ui.trim.status do not appear
Product: [Eclipse Project] Platform Reporter: Michael Valenta <Michael.Valenta>
Component: UIAssignee: Eric Moffatt <emoffatt>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: bhunt, emoffatt, john.camelon, Mike_Wilson, Olivier_Thomann, pwebster, remy.suen, thatnitind, vasili.gulevich
Version: 4.1   
Target Milestone: 4.2 M4   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
plugin.xml
none
Make the bottom trim into model elements
none
Part 2: Handle the deprecated (but used) extensions
none
HACK ALERT !! This is an *interim* hack until JFace is fixed. none

Description Michael Valenta CLA 2010-11-12 11:26:00 EST
I installed the latest RTC into Eclipse 4.1 M3. When I started Eclipse, I noticed that our work item trim component is missing. There were no errors in the log. Eric indicated that he knew what the issue probably is.
Comment 1 Michael Valenta CLA 2010-11-12 11:46:19 EST
Here is the xml

   <extension
         point="org.eclipse.ui.menus">
      <group
            id="com.ibm.team.workitem.rcp.ui.SearchBarGroup"
            separatorsVisible="true">
         <location>
            <bar type="trim"/>
            <order position="before" relativeTo="status"/>
         </location>
      </group>
      <widget class="com.ibm.team.workitem.rcp.ui.internal.quicksearch.SearchBarTrim" id="com.ibm.team.workitem.rcp.ui.SearchBar">
         <location>
            <bar path="com.ibm.team.workitem.rcp.ui.SearchBarGroup" type="trim"/>
         </location>
         <layout fillMajor="false" fillMinor="false"/>
      </widget>
      <group
            id="com.ibm.team.workitem.rcp.ui.WorkitemActivationGroup"
            separatorsVisible="true">
         <location>
            <order
                  position="after"
                  relativeTo="status">
            </order>
            <bar
                  type="trim">
            </bar>
         </location>
      </group>
      <widget
            class="com.ibm.team.workitem.rcp.ui.internal.activation.ActiveWorkItemWorkbenchTrim"
            id="com.ibm.team.workitem.rcp.ui.WorkitemActivationTrim">
         <location>
            <bar
                  path="com.ibm.team.workitem.rcp.ui.WorkitemActivationGroup"
                  type="trim">
            </bar>
         </location>
         <layout
               fillMajor="false"
               fillMinor="true">
         </layout>
      </widget>
   </extension>
Comment 2 Paul Webster CLA 2010-11-15 16:08:02 EST
(In reply to comment #1)
> Here is the xml
> 
>    <extension
>          point="org.eclipse.ui.menus">
>       <group
>             id="com.ibm.team.workitem.rcp.ui.SearchBarGroup"
>             separatorsVisible="true">

Michael, is there any reason that you don't use the normal org.eclipse.ui.menus syntax?  There was never released a working version of this old syntax that wasn't backed by the o.e.ui.menus we released in 3.3

PW
Comment 3 Michael Valenta CLA 2010-11-15 16:13:28 EST
This isn't my code. It belongs to another component of RTC (Work Items). I don't know they history of it.
Comment 4 Michael Valenta CLA 2011-01-06 16:37:04 EST
Paul, are you saying that the XML code in question was never API and hence will not be supported in 4.x? I just ask because the lack of this trim widget is enough to keep me from using 4.1 on a daily basis.
Comment 5 Paul Webster CLA 2011-01-07 07:28:21 EST
Created attachment 186264 [details]
plugin.xml

I had a full look back.  This was released in 3.2 as experimental API and then deprecated in 3.3 (as a bad idea) and replaced with org.eclipse.ui.menus/menuContribution

Could you open a work item with the Jazz guys to get them to fix this?  It should work from 3.3 on (although it should probably be tested if the claim is to still support RTC on 3.3).

As a workaround while we decide what to do (one of the benefits of moving to 4.x was the ability to walk away from useless deprecated API :-) could you try the org.eclipse.ui.menus extension from the attached plugin.xml in your setup (from a plugin that can see the 2 classes specified)? Then at least something should show up on your status bar.

PW
Comment 6 Eric Moffatt CLA 2011-01-10 14:29:07 EST
Created attachment 186414 [details]
Make the bottom trim into model elements


This is Step 0: Turn the current hacked trim code into real model code. This means that we now populate the model with the bottom trim elements (giving me something to place extensions relative 'to'.

This also cleans up a bit by having a far simpler code for the TrimBarLayout as well as moving the LayoutModifierToolControl into the same package as the layout itself.
Comment 7 Remy Suen CLA 2011-01-11 16:34:17 EST
An NPE is now thrown if you try to restart Eclipse with an editor open.

ERROR: Unable to create class 'org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor' from bundle '2025'
org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:59)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:828)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:808)
	at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:108)
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:310)
	at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:237)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:153)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:90)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:64)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:53)
	at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:117)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:699)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:497)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:574)
	at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.showTab(StackRenderer.java:512)
	at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.postProcess(LazyStackRenderer.java:106)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:513)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:574)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:59)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:509)
	at org.eclipse.e4.ui.workbench.renderers.swt.ElementReferenceRenderer.createWidget(ElementReferenceRenderer.java:69)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:699)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:497)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:574)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:59)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:509)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:574)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:59)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:509)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:574)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:59)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:509)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:574)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:59)
	at org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveRenderer.processContents(PerspectiveRenderer.java:59)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:509)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:574)
	at org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveStackRenderer.showTab(PerspectiveStackRenderer.java:103)
	at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.postProcess(LazyStackRenderer.java:106)
	at org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveStackRenderer.postProcess(PerspectiveStackRenderer.java:77)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:513)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:574)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:59)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:509)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:574)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:59)
	at org.eclipse.e4.ui.workbench.renderers.swt.WBWRenderer.processContents(WBWRenderer.java:471)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:509)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:574)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$6.run(PartRenderingEngine.java:771)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:726)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:89)
	at org.eclipse.ui.internal.Workbench$3.run(Workbench.java:540)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:522)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:600)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Caused by: java.lang.NullPointerException
	at org.eclipse.jface.action.StatusLineManager$1.done(StatusLineManager.java:165)
	at org.eclipse.ui.internal.WorkbenchWindow$8.run(WorkbenchWindow.java:1578)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:1568)
	at org.eclipse.ui.texteditor.AbstractTextEditor.internalInit(AbstractTextEditor.java:3217)
	at org.eclipse.ui.texteditor.AbstractTextEditor.init(AbstractTextEditor.java:3244)
	at org.eclipse.ui.internal.EditorReference.initialize(EditorReference.java:332)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:169)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:600)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:52)
	... 70 more
Comment 8 Remy Suen CLA 2011-01-12 08:37:17 EST
(In reply to comment #7)
> An NPE is now thrown if you try to restart Eclipse with an editor open.

This seems to be a generic problem with the status line given that it's used as a progress monitor even if it hasn't been constructed. See bug 334093.
Comment 9 Eric Moffatt CLA 2011-01-12 15:40:57 EST
Created attachment 186674 [details]
Part 2: Handle the deprecated (but used) extensions


This patch add the code to create model elements for the IWindowTrim based extensions from org.eclipse.ui.menus.

I still need to implement the 'proper' extensions (i.e. the ones that use a locationURI like "trim:org.eclipse.ui.status?after=status...).

Now on to remy's issue...
Comment 10 Eric Moffatt CLA 2011-01-12 16:12:48 EST
Committed in >20110112. Applied the patch.
Comment 11 Eric Moffatt CLA 2011-01-13 10:37:57 EST
Created attachment 186734 [details]
HACK ALERT !! This is an *interim* hack until JFace is fixed.


This code should be removed once the fix for bug 334093 is in...
Comment 12 Eric Moffatt CLA 2011-01-13 10:38:50 EST
Committed in >20110113. Applied the patch.
Comment 13 Remy Suen CLA 2011-01-13 10:43:53 EST
(In reply to comment #11)
> Created attachment 186734 [details]
> HACK ALERT !! This is an *interim* hack until JFace is fixed.
> 
> 
> This code should be removed once the fix for bug 334093 is in...

I gave Eric an incorrect fix. I have rewritten his interim fix (above) with a less ugly one and have delivered it to HEAD.
Comment 14 Michael Valenta CLA 2011-01-28 15:07:14 EST
I wasn't sure what the state of this was so I tried it again on the latest I build (eclipse-SDK-I20110127-2200-win32-x86_64). The trim widget is still missing. I also tried the snipet Paul provided in comment 5 (against an Eclipse 3.5 target) and it didn't work.
Comment 15 Remy Suen CLA 2011-05-12 10:54:36 EDT
(In reply to comment #14)
> The trim widget is still
> missing. I also tried the snipet Paul provided in comment 5 (against an Eclipse
> 3.5 target) and it didn't work.

The reason the snippet doesn't work is because it assumes the trim widgets from RTC extends WorkbenchWindowControlContribution (which is not the case).
Comment 16 Remy Suen CLA 2011-08-25 09:15:52 EDT
(In reply to comment #9)
> I still need to implement the 'proper' extensions (i.e. the ones that use a
> locationURI like "trim:org.eclipse.ui.status?after=status...).

RTC has changed their code to use the "toolbar:org.eclipse.ui.trim.status" location defined in MenuUtil.TRIM_STATUS now. We will need to support this sort of extension to get those trim widgets to appear.
Comment 17 Eric Moffatt CLA 2011-11-15 10:43:40 EST
Pushed in >20111115.

commit ea62329cce61835e868f858e3031d3d4b83af26e

This works for my test cases (using Michael's contribution format with a Label and a Text field, let me know if there are any remaining issues...
Comment 18 Remy Suen CLA 2011-11-17 07:54:33 EST
*** Bug 363942 has been marked as a duplicate of this bug. ***
Comment 19 Remy Suen CLA 2011-11-18 10:06:35 EST
Looks good to me with I20111116-0810 on Windows 7. I'll verify again during M4's milestone week.
Comment 20 Eric Moffatt CLA 2011-12-08 15:10:14 EST
Verified in I20111205-2330.

NOTE: There is still a defect regarding the height of toolbars that contain only controls but this is apparently an SWT issue, not an artifact of this defect...
Comment 21 Vasili Gulevich CLA 2016-09-22 06:22:38 EDT
Related comments are still left in org.eclipse.ui.internal.WorkbenchWindow.run(boolean, boolean, IRunnableWithProgress)

// Temporary Hack for bug 330106, remove when bug 334093 is fixed
boolean progressHack = manager.getControl() == null;
if (manager == null || progressHack) {
	runnable.run(new NullProgressMonitor());
} else {
  ...
Comment 22 Paul Webster CLA 2016-09-22 11:18:26 EDT
Please open a new bug to re-examine the comments and code that are still there.

PW