Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 354769 - "New" wizard shortcut does not check with activity manager
Summary: "New" wizard shortcut does not check with activity manager
Status: RESOLVED INVALID
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-15 15:45 EDT by Vivian Kong CLA
Modified: 2011-08-17 10:04 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vivian Kong CLA 2011-08-15 15:45:47 EDT
The "New" wizard shortcut from org.eclipse.ui.perspectiveExtensions (newWizardShortcut) should check with activity manager to see if a wizard should be visible or not.
Comment 1 Vivian Kong CLA 2011-08-15 17:22:51 EDT
Actually I think the "New" wizard shortcut does check with the activity manager since once I switched between views (or launched the 
NewWizardSelectionPage), my wizard is now hidden.


My wizard is being hidden on condition (with the click of a button).  I'm seeing that WorkbenchActivityHelper.filterItem(object) is not returning the expected result.  If I switched between views then I get the correct result.  Maybe the activity calculation is not being updated somehow?  And the calculation is triggered when I switched between views?
Comment 2 Remy Suen CLA 2011-08-15 17:40:30 EDT
(In reply to comment #1)
> Actually I think the "New" wizard shortcut does check with the activity manager
> since once I switched between views (or launched the 
> NewWizardSelectionPage), my wizard is now hidden.

Yes, the filtering should be happening.

See org.eclipse.ui.actions.BaseNewWizardMenu.addShortcuts(List).

> If I switched between views then I get the correct result. 
> Maybe the activity calculation is not being updated somehow?  And the
> calculation is triggered when I switched between views?

What do you mean by "switched between views"? If your view is already up and activated on workbench startup, does your wizard show up?
Comment 3 Paul Webster CLA 2011-08-15 19:10:34 EDT
What kind of condition are you using?  You mean an activity with an enabledWhen?  If so, what does it look like?

PW
Comment 4 Vivian Kong CLA 2011-08-16 10:09:06 EDT
(In reply to comment #2)
 
> What do you mean by "switched between views"? If your view is already up and
> activated on workbench startup, does your wizard show up?

I had the project explorer view and the RSE remote systems view beside each other. After I clicked my button, I brought up the context menu in the project explorer view and I expected my wizard to not show up from the "New" sub-menu.  However it was still there and it wasn't until I switched to the remote systems view and back to project explorer view that the wizard is finally hidden (the activity calculation was triggered somehow by this I guess?)

(In reply to comment #3)
> What kind of condition are you using?  You mean an activity with an
> enabledWhen?  If so, what does it look like?

This is my perspective extension & activity:

<extension point="org.eclipse.ui.perspectiveExtensions">
	<perspectiveExtension targetID="org.eclipse.ptp.rdt.ui.remoteCPerspective">
		<newWizardShortcut id="a.b.c.newProjectWizard" />		


<activity
	id="a.b.c.newWizardsActivity"
	name="ABC Wizards Activity">
	<enabledWhen>
		<not>
             		<test property="a.b.c.isWorkspaceOffline" value=""/>
             	</not>
	</enabledWhen>
</activity>
<activityPatternBinding
	activityId="a.b.c.newWizardsActivity"
	pattern="a\.b\.c/a.b.c.newProjectWizard">
</activityPatternBinding>
Comment 5 Paul Webster CLA 2011-08-16 21:14:35 EDT
(In reply to comment #4)

>     <enabledWhen>
>         <not>
>                      <test property="a.b.c.isWorkspaceOffline" value=""/>
>                  </not>
>     </enabledWhen>

Property testers don't deal in events like ISourceProviders, which means they won't notify core expressions when they changed.

If you change something that changes the results of a property tester, you need to use org.eclipse.ui.services.IEvaluationService.requestEvaluation(String) to request all expressions with that property be re-evaluated.

PW
Comment 6 Vivian Kong CLA 2011-08-17 10:04:25 EDT
(In reply to comment #5)
> Property testers don't deal in events like ISourceProviders, which means they
> won't notify core expressions when they changed.
> 
> If you change something that changes the results of a property tester, you need
> to use org.eclipse.ui.services.IEvaluationService.requestEvaluation(String) to
> request all expressions with that property be re-evaluated.
> 
> PW

Ah OK.  It works for me now.  I'll close this as invalid.  Thanks Remy and Paul.