This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 414741 - ToolbarControl in own ToolBar throws NPE
Summary: ToolbarControl in own ToolBar throws NPE
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.3   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 4.4 M2   Edit
Assignee: Paul Webster CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-09 04:04 EDT by Dennis Melzer CLA
Modified: 2013-09-17 13:56 EDT (History)
1 user (show)

See Also:


Attachments
NPE Fix (1.06 KB, application/octet-stream)
2013-08-09 04:04 EDT, Dennis Melzer CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Melzer CLA 2013-08-09 04:04:03 EDT
Created attachment 234247 [details]
NPE Fix

If i use a own ToolBarControl in my own Toolbar, i get a NPE.

Extension Point
   <menuContribution
         allPopups="false"
         locationURI="toolbar:mytoolbar">
      <control
            class="MyControl"
            id="myControl">
      </control>
   </menuContribution>

Problem is the CompatibilityWorkbenchWindowControlContribution provides only Controls in a MTrimBar, i don't understand why.

while (!(parent instanceof MTrimBar)) {
parent = parent.getParent();
}
I patch it
Comment 1 Lars Vogel CLA 2013-08-09 04:35:32 EDT
Thank you for the patch. Any chance that you can provide it as a Gerrit review? 

See: http://www.vogella.com/articles/Gerrit/article.html and http://wiki.eclipse.org/Gerrit for information on Gerrit.
Comment 2 Dennis Melzer CLA 2013-08-09 08:14:46 EDT
Hi Lars,

i get always a  https://git.eclipse.org/gitroot/platform/eclipse.platform.ui.git: not authorized exception
Comment 3 Lars Vogel CLA 2013-08-09 08:17:52 EDT
You need to fillout the CLA and push to the correct URL. Also ensure to include you Sign-off and the Change-Id in the commit you are trying to push. See the links for a detailed the description.
Comment 4 Dennis Melzer CLA 2013-08-09 09:35:25 EDT
Okay works, i forgot the CLA ;)
Comment 5 Paul Webster CLA 2013-08-12 15:17:25 EDT
The control element and WorkbenchWindowControlContribution only apply to trim (what sense does "side" make if you add it to your own toolbar).

However, I don't see a way to add a control element to a user-defined toolbar.  Does it make sense to simple have a default curSide of TOP?  Could that be added to https://git.eclipse.org/r/#/c/15287/3

PW
Comment 6 Dennis Melzer CLA 2013-08-13 05:32:32 EDT
I have a Editor and on the top is a own toolbar (via Extension Point) with commands and custom controls. 
With the patch you can add own custom controld to your own toolbar.
I set the default contribution curSide to SWT.TOP
Comment 7 Paul Webster CLA 2013-08-13 07:52:33 EDT
I've updated the change on https://git.eclipse.org/r/#/c/15287

2 comments in the review. To update this fix:

1) check out patch set 4 (I used EGit's "Fetch From Gerrit...")
2) make the changes necessary for the review 
3) amend the commit to include your changes 
4) push again to the Gerrit review system

It will create a patch set 5.
Comment 8 Paul Webster CLA 2013-08-13 10:21:41 EDT
Released as http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=5ef642c5cdbd19e171252be4a977bfa31dea0027  Thanks.

BTW.  When dealing with Gerrit (and pushing from master) you have to remember to reset your master branch after every Gerrit push. ex, on the command line it would be:

git reset --hard origin/master

PW
Comment 9 Paul Webster CLA 2013-08-13 10:21:50 EDT
.
Comment 10 Dennis Melzer CLA 2013-08-13 10:26:20 EDT
Thanks for the tip, iam new in git and gerrit :)
Comment 11 Paul Webster CLA 2013-09-17 13:56:49 EDT
In 4.4.0.I20130916-2330

Could you test it out on your app, to make sure the fix works for your scenario?

PW