Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 324663 - [ActivityMgmt] Enabling activity through core expression overrides pattern binding, causing exception
Summary: [ActivityMgmt] Enabling activity through core expression overrides pattern bi...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7 M5   Edit
Assignee: Paul Webster CLA
QA Contact: Paul Webster CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-07 11:10 EDT by Christian Sell CLA
Modified: 2011-01-25 09:16 EST (History)
0 users

See Also:


Attachments
null guard v01 (1002 bytes, patch)
2011-01-06 15:05 EST, Paul Webster CLA
no flags Details | Diff
null guard v02 (4.02 KB, patch)
2011-01-07 13:34 EST, Paul Webster CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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