Bug 180308 - [UX] Remove Print toolbar tool by default
Summary: [UX] Remove Print toolbar tool by default
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 4.5 M6   Edit
Assignee: Andrey Loskutov CLA
QA Contact:
URL:
Whiteboard:
Keywords: greatfix, noteworthy
: 181009 (view as bug list)
Depends on: 393391
Blocks:
  Show dependency tree
 
Reported: 2007-03-30 17:41 EDT by Kevin McGuire CLA
Modified: 2015-03-16 19:58 EDT (History)
7 users (show)

See Also:


Attachments
Screenshot of the problem (14.68 KB, image/png)
2014-04-07 08:41 EDT, Dani Megert CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin McGuire CLA 2007-03-30 17:41:46 EDT
The Print tool takes up space but is likely seldom used.  In the interest of providing more toolbar space to other plugins, we should consider removing it.
Comment 1 Kevin McGuire CLA 2007-04-04 13:54:46 EDT
*** Bug 181009 has been marked as a duplicate of this bug. ***
Comment 2 Kevin McGuire CLA 2007-04-12 11:46:59 EDT
Was there a conclusion on this one?  

I've been seeing a trend where the Print tool is no longer included in toolbars (Firefox being one).  People just don't print much in general and likely even more rarely from Eclipse based apps.  For example in WID our print support was always the last to get attention and the task was more around report production rather than straight printing.  The only expection might be an RCP app but presumably the could just add it in.
Comment 3 Susan McCourt CLA 2009-11-30 16:41:15 EST
I think e4 is the right timeframe to do stuff like this.
Comment 4 Lars Vogel CLA 2013-04-29 10:22:08 EDT
Would be nice to remove the "Print" button for Eclipse 4.3 as default. @Paul, is that something which would be possible?
Comment 5 Paul Webster CLA 2013-04-29 10:24:52 EDT
(In reply to comment #4)
> Would be nice to remove the "Print" button for Eclipse 4.3 as default.
> @Paul, is that something which would be possible?

Not in 4.3.  It would have to be done early in Luna.

PW
Comment 6 Lars Vogel CLA 2013-04-29 11:12:19 EDT
If we remote this, I suggest also to remove the default shortcut, CTRL+P.
Comment 7 Dani Megert CLA 2013-06-05 10:43:06 EDT
Removing outdated target milestone.
Comment 8 Lars Vogel CLA 2013-10-21 05:29:17 EDT
(In reply to Lars Vogel from comment #6)
> If we remote this, I suggest also to remove the default shortcut, CTRL+P.

I revert that statement Ctrl+P is very common for printing. I think only the toolbar button should be removed.
Comment 9 Lars Vogel CLA 2013-11-18 07:05:21 EST
Simple fix would be to remove the following two lines from WorkbenchActionBuilder

   fileToolBar.add(getPrintItem());
    fileToolBar
                    .add(new GroupMarker(IWorkbenchActionConstants.PRINT_EXT));

But this would prevent that users can add it again with Window -> Customize Perspective. 

Any tip where the defaults for the visible toolbar entries are set?
Comment 10 Paul Webster CLA 2013-11-18 09:27:11 EST
(In reply to Lars Vogel from comment #9)
> Simple fix would be to remove the following two lines from
> WorkbenchActionBuilder
> 
>    fileToolBar.add(getPrintItem());

Why not getPrintItem() and then use setVisible(false) before you add it to the toolbar manager?

PW
Comment 11 Lars Vogel CLA 2013-11-18 10:34:52 EST
> Why not getPrintItem() and then use setVisible(false) before you add it to
> the toolbar manager?
> 

If I do this I get the following error message if I try to activate it:
----
"Print (Ctrl+P)" cannot be made visible because it is in the unavailable "null" command group.

Would you like to switch to the Command Group Availability tab?
-------

To test this is created the following Gerrit review:

https://git.eclipse.org/r/18503
Comment 12 Paul Webster CLA 2013-11-18 10:38:47 EST
That error message is part of Bug 378849

PW
Comment 14 Dani Megert CLA 2013-11-18 11:38:32 EST
(In reply to Lars Vogel from comment #13)
> Sorry accidently pushed with
> https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/
> ?id=d0feb8b5efe20dc21de5c45e4b369e903eef4976
> 
> Reverted with
> https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/
> ?id=2b32ff06f55839f5f109e11ffbbf1e76bd581c48
> 
> I try to be more careful in the future with direct pushes.

Normally, you should revert it via the change (press the 'Revert Change' button).
Comment 15 Lars Vogel CLA 2013-11-18 14:09:57 EST
> Normally, you should revert it via the change (press the 'Revert Change'
> button).

Thanks. I used the "Revert" button in EGit. In which tool is the button you mean?
Comment 16 Dani Megert CLA 2013-11-19 03:43:59 EST
(In reply to Lars Vogel from comment #15)
> > Normally, you should revert it via the change (press the 'Revert Change'
> > button).
> 
> Thanks. I used the "Revert" button in EGit. In which tool is the button you
> mean?

The tool you used to push the change in the first place: Gerrit ;-).
Comment 17 Lars Vogel CLA 2014-02-26 04:35:43 EST
Paul, could you do a review of the change and give me a hint why my change does not work? I think you +1 it, but it unfortunately does not hide the button.
Comment 18 Paul Webster CLA 2014-02-28 10:16:03 EST
It's being switched for a MHandledToolItem in org.eclipse.ui.internal.CoolBarToTrimManager.fill(MToolBar, IContributionManager) but that's not respecting the visible flag.

PW
Comment 19 Paul Webster CLA 2014-02-28 10:16:48 EST
Should be fixed in the org.eclipse.ui.internal.menus.MenuHelper.create*(*) methods.

PW
Comment 20 Dmitry Spiridenok CLA 2014-03-14 19:12:46 EDT
What about the following solution:
    https://git.eclipse.org/r/#/c/23420

I've tested it on my Windows PC:
1. Print icon is gone from the main tool bar
2. CTRL+P and File->Print still work fine
3. No exceptions

Would this be an appropriate solution for this bug?
Comment 21 Lars Vogel CLA 2014-03-15 05:22:36 EDT
(In reply to Dmitry Spiridenok from comment #20)
> Would this be an appropriate solution for this bug?

No, we want allow users to add it again, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=180308#c19 for a hint for the correct solution together with my patch.
Comment 22 Dmitry Spiridenok CLA 2014-03-15 08:35:38 EDT
(In reply to Lars Vogel from comment #21)
> No, we want allow users to add it again, see
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=180308#c19 for a hint for the
> correct solution together with my patch.

So you want users to be able to bring it back via "Customize Perspective" menu? I was missing this part of requirements.

I've seen the hint for MenuHelper create*() methods. However they looked too generic to me to disable some specific button there.

I'll try some other solutions suggested in this thread.
Comment 24 Lars Vogel CLA 2014-04-07 05:56:22 EDT
Verified in Build id: I20140402-0100
Comment 25 Dani Megert CLA 2014-04-07 08:41:14 EDT
I can no longer bring back the icon into my toolbar. Either the underlying problem ('null' command group) needs to be fixed or this change needs to be reverted for M7.
Comment 26 Dani Megert CLA 2014-04-07 08:41:34 EDT
Created attachment 241673 [details]
Screenshot of the problem
Comment 27 Lars Vogel CLA 2014-04-09 02:56:16 EDT
Paul, what are the plans for the CustomizePerspectiveDialog? It feels to me that the deep embedded assumption that ActionGroup/ Command Groups are present makes it very, very hard to fix it. Maybe if we remove this from the dialog, we can work on the model?
Comment 28 Paul Webster CLA 2014-04-09 08:52:16 EDT
(In reply to Lars Vogel from comment #27)
> Paul, what are the plans for the CustomizePerspectiveDialog? It feels to me
> that the deep embedded assumption that ActionGroup/ Command Groups are
> present makes it very, very hard to fix it. Maybe if we remove this from the
> dialog, we can work on the model?

The first thing to do is fix the validation.  If the object in question (in this case, contributed through the WorkbenchActionBuilder) is not part of a group, why is the validation tripping it up?

PW
Comment 29 Dani Megert CLA 2014-04-25 08:27:59 EDT
This needs to be pulled as I don't think bug 393391 will make it into Luna.

Lars, can you please do this (or fix the other bug ;-).
Comment 30 Lars Vogel CLA 2014-04-25 08:44:20 EDT
(In reply to Dani Megert from comment #29)
> This needs to be pulled as I don't think bug 393391 will make it into Luna.
> 
> Lars, can you please do this (or fix the other bug ;-).

Will do. After 18:00 CET
Comment 31 Lars Vogel CLA 2014-04-25 11:38:35 EDT
(In reply to Lars Vogel from comment #30)
> (In reply to Dani Megert from comment #29)
> > This needs to be pulled as I don't think bug 393391 will make it into Luna.
> > 
> > Lars, can you please do this (or fix the other bug ;-).

I removed the part which sets the print button to invisible but left the fix in which allows to handle visible. 

https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=8d6cb1423760b1f2c150d959e3eb9eb6d1357da2
Comment 32 Dani Megert CLA 2014-04-25 11:46:02 EDT
(In reply to Lars Vogel from comment #31)
> (In reply to Lars Vogel from comment #30)
> > (In reply to Dani Megert from comment #29)
> > > This needs to be pulled as I don't think bug 393391 will make it into Luna.
> > > 
> > > Lars, can you please do this (or fix the other bug ;-).
> 
> I removed the part which sets the print button to invisible but left the fix
> in which allows to handle visible. 
> 
> https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/
> ?id=8d6cb1423760b1f2c150d959e3eb9eb6d1357da2

Thanks.
Comment 33 Lars Vogel CLA 2015-01-26 09:18:16 EST
https://git.eclipse.org/r/40354
Comment 34 Lars Vogel CLA 2015-01-26 09:32:30 EST
(In reply to Lars Vogel from comment #33)
> https://git.eclipse.org/r/40354

Unfortunately this is still blocked by the CPD as such a disabled action cannot be enabled in CPD.
Comment 35 Andrey Loskutov CLA 2015-01-26 10:32:12 EST
(In reply to Lars Vogel from comment #34)
> (In reply to Lars Vogel from comment #33)
> > https://git.eclipse.org/r/40354
> 
> Unfortunately this is still blocked by the CPD as such a disabled action
> cannot be enabled in CPD.

This is most likely not CPD issue, but the problem of the WorkbenchActionBuilder contributions which are still living in "pre e4" world. They work well as long as they are visible by default, but don't if they are hidden.

Try to enable "Pin editor" action - same issue on latest nightly BUT once you set the General->Editors->Close automatically and restart Eclipse, the toolbar button enablement/disablement starts to work.

The common issue is that ContributionItem.setVisible() is the "legacy" API AFAIK, e4 & CPD expect that the "hidden" toolbar buttons are added via WorkbenchPage.addHiddenItems() and WorkbenchPage.removeHiddenItems().
Comment 36 Andrey Loskutov CLA 2015-02-21 13:39:25 EST
While debugging bug 445538 and bug 402429 patches I'm stumbled on a pretty simple way to fix this bug.

The solution is *much* easier as expected: if we just use our own extension points we can simply disable the "print" button, see how JDT does it eclipse.jdt.ui/org.eclipse.jdt.ui/plugin.xml:

   <extension
         point="org.eclipse.ui.perspectiveExtensions">
      <perspectiveExtension
            targetID="*">
         <hiddenToolBarItem
               id="org.eclipse.jdt.ui.actions.OpenProjectWizard">
         </hiddenToolBarItem>
      </perspectiveExtension>
   </extension>

This way it just works (with all the fixes for bug 420956 on HEAD it can be disabled/enabled in CPD without any issues). 
Patch follows.
Comment 37 Eclipse Genie CLA 2015-02-21 13:39:54 EST
New Gerrit change created: https://git.eclipse.org/r/42365
Comment 38 Eclipse Genie CLA 2015-02-23 16:52:32 EST
New Gerrit change created: https://git.eclipse.org/r/42474
Comment 40 Dani Megert CLA 2015-02-24 04:18:51 EST
.
Comment 41 Lars Vogel CLA 2015-02-24 05:42:53 EST
Andrey thanks for the fix. Please also provide a N&N entry.
Comment 42 Dani Megert CLA 2015-02-24 06:19:01 EST
(In reply to Lars Vogel from comment #41)
> Andrey thanks for the fix. Please also provide a N&N entry.

The important part of the entry is to describe how to get it back.
Comment 43 Andrey Loskutov CLA 2015-03-01 09:56:25 EST
(In reply to Dani Megert from comment #42)
> (In reply to Lars Vogel from comment #41)
> > Andrey thanks for the fix. Please also provide a N&N entry.
> 
> The important part of the entry is to describe how to get it back.

Please review N&N notes:
https://git.eclipse.org/r/42965
Comment 44 Dani Megert CLA 2015-03-02 09:07:36 EST
(In reply to Andrey Loskutov from comment #43)
> (In reply to Dani Megert from comment #42)
> > (In reply to Lars Vogel from comment #41)
> > > Andrey thanks for the fix. Please also provide a N&N entry.
> > 
> > The important part of the entry is to describe how to get it back.
> 
> Please review N&N notes:
> https://git.eclipse.org/r/42965

Submitted with http://git.eclipse.org/c/www.eclipse.org/eclipse/news.git/commit/?id=69d120bc05da10825db66d6ea3d6d7c174efb60a
Comment 45 Lars Vogel CLA 2015-03-16 19:58:11 EDT
This requires a reset of the perspective for me in4.5.0.N20150315-1630. I think that is fine.