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

Bug 324663

Summary: [ActivityMgmt] Enabling activity through core expression overrides pattern binding, causing exception
Product: [Eclipse Project] Platform Reporter: Christian Sell <c.sell>
Component: UIAssignee: Paul Webster <pwebster>
Status: VERIFIED FIXED QA Contact: Paul Webster <pwebster>
Severity: normal    
Priority: P3    
Version: 4.0   
Target Milestone: 3.7 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
null guard v01
none
null guard v02 none

Description Christian Sell CLA 2010-09-07 11:10:55 EDT
Build Identifier: 20100218-1602

If a plugin defines a view perspectiveExtension targeted at a perspective from another plugin, and the view is disabled by means of an activityPatternBinding with a core expression, the UI will try to create the view event though it is disabled, resulting in an exception. The exception only appears in the log.

Heres my analysis:
- PageLayout#createView(String partID) calls ViewRegistry#find(String id). 
- That method returns null because WorkbenchActivityHelper#restrictUseOf(desc)is true.
- PageLayout#createView passes the null result to WorkbenchActivityHelper#filterItem, which returns false!
- therefore LayoutHelper#createView is called, resulting in an exception

Reproducible: Always

Steps to Reproduce:
1. define a perspectiveExtension that adds a view to another plugins's perspective
2. add an activity with a regex expression, e.g. "com\.mycompany\.demo/..*
3. disable the activity
4. reset the perspective
Comment 1 Christian Sell CLA 2010-09-07 11:39:33 EDT
I have to correct myself:

the problem appears when the activity is enabled/disabled through an <enabledWhen> subelement in plugin.xml. Only in that case, the WorkbenchActivityHelper#restrictUseOf mtethod returns true, leading to the described phenomenon
Comment 2 Christian Sell CLA 2010-09-07 12:03:06 EDT
the essence of the problem seems to be that enablement of activities through core expressions (i.e., in plugin.xml) does not work well
Comment 3 Paul Webster CLA 2011-01-06 15:05:15 EST
Created attachment 186220 [details]
null guard v01

Suggested fix: If a view descriptor is not returned, that view doesn't exist.  We can count it as filtered.

PW
Comment 4 Paul Webster CLA 2011-01-07 13:34:00 EST
Created attachment 186296 [details]
null guard v02

Provides more accurate behaviour.  if the view is restricted, it returns.  If the view is null because it is not defined, it still writes out the error.

PW
Comment 5 Paul Webster CLA 2011-01-07 13:34:56 EST
Released to HEAD
PW
Comment 6 Paul Webster CLA 2011-01-25 09:16:58 EST
In I20110124-1800
PW