Bug 173302 - [PropertiesDialog] allow Project References property page to be disabled
Summary: [PropertiesDialog] allow Project References property page to be disabled
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: All All
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard: hasPatch
Keywords: api
Depends on:
Blocks:
 
Reported: 2007-02-07 12:16 EST by Andrew Ferguson CLA
Modified: 2019-09-06 15:32 EDT (History)
3 users (show)

See Also:


Attachments
proposed patch (2.17 KB, patch)
2007-02-07 12:26 EST, Andrew Ferguson CLA
no flags Details | Diff
IEnablementVetoHolder property tester (5.63 KB, patch)
2007-02-12 17:58 EST, Andrew Ferguson CLA
no flags Details | Diff
CDT usage as IEnablementVetoHolder implementor (4.44 KB, patch)
2007-02-12 18:11 EST, Andrew Ferguson CLA
no flags Details | Diff
CDT usage as IEnablementVetoHolder implementor (2.38 KB, patch)
2007-02-12 18:22 EST, Andrew Ferguson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Ferguson CLA 2007-02-07 12:16:05 EST
hi,

 In the next release of CDT (4.0) the new project model has the idea of a project configuration.

The new project model is discussed under
   https://bugs.eclipse.org/bugs/show_bug.cgi?id=115935 

A single project can have many configurations (e.g. release,debug, or varying by toolchain), and we will allow the user to create dependencies between configurations rather than projects.

In this view of the world, IProject references are something CDT will manage for the user based on the references they create at the configuration level (in a UI supplied by us). This also means the current UI page may confuse the user as they will see two referencing mechanisms, and not necessarily know that one is managed for them.

With this in mind, it would be great if we could tell the project reference page not to display itself for certain projects. The way I see making most sense is to have a published project persistant property, that projects can set in order that the project reference page will not appear.

I'm not sure, but maybe PDE would also benefit from disabling the project references page, as (I believe) the build order is managed for you based on plugin dependencies.

I've tried this out and will attach the patch that works for me (this is against 3.3 HEAD)

thanks,
Andrew
Comment 1 Andrew Ferguson CLA 2007-02-07 12:26:44 EST
Created attachment 58457 [details]
proposed patch

I'm not sure the IDE class is the appropriate place to publish the QualifiedName of the property that needs setting to disable the project 
references page, but otherwise I've confirmed this works in the way desired.

The page in question is: org.eclipse.ui.internal.ide.dialogs.ProjectReferencePage

In order to disable the page, you invoke code such as

IProject project = ...;
project.setPersistentProperty(IDE.DISABLE_PROJECT_PREFERENCES_PAGE, "true");

This is backwards compatible as existing projects will not have this persistant property.
Comment 2 Andrew Ferguson CLA 2007-02-08 06:35:50 EST
Our use-case for this might not be valid, discussion is still ongoing in bug 115935
Comment 3 Andrew Ferguson CLA 2007-02-12 17:58:37 EST
Created attachment 58807 [details]
IEnablementVetoHolder property tester

Mikhail has pointed out that the previous patch is unsuitable, as it relies on persitent properties on the project, and these are not preserved as part of the project when shared via source control.

This second patch introduces a new PropertyTester acting on any type (java.lang.Object) testing a property "org.eclipse.core.expressions.notVetoed"

If the object being tested can be Adapted to an IEnablementVetoHolder, then it is queried to see if it vetoes the enablement of the host object, otherwise it has no effect.

This would allow us to have the Project References enablement check to see if the object its acting upon vetoes its enablement:

...
<enabledWhen>
    <and>
        <test
           args="org.eclipse.ui.propertypages.project.reference"
           property="org.eclipse.core.expressions.notVetoed">
        </test>
        <adapt
           type="org.eclipse.core.resources.IProject">
        </adapt>
    </and>
</enabledWhen>
...

The argument to the IEnablementVetoHolder is a String id (the id of the host of the enablement element) which is public for dependent plug-ins to test for.

As the test operates on the object before it is adapted to an IProject - this would allow CDT a say over what pages are displayed in its ICProject properties pages, without taking control over what is displayed for IProject objects. This seems a good fit for the common navigator.
Comment 4 Andrew Ferguson CLA 2007-02-12 18:11:50 EST
Created attachment 58808 [details]
CDT usage as IEnablementVetoHolder implementor

This patch shows how CDT would be a client of the previous patch

Applied against current CDT HEAD, and running with the previous patch itself applied against 3.3 HEAD, allows CDT projects to veto the display of the Project References page in the Properties dialog for ICProject model objects.

If anyone tries running this for themselves, a bug in the Java common navigator framework content provider
  https://bugs.eclipse.org/bugs/show_bug.cgi?id=142330
  https://bugs.eclipse.org/bugs/show_bug.cgi?id=150404
means that both ICProject and IProject objects appear for CDT projects in the navigator. Only the ui element backed by an ICProject will have the Project References page vetoed. This is the desired behaviour, but is confusing as until the above bug is fixed, you need to choose the right one (of two identical ui elements..)
Comment 5 Andrew Ferguson CLA 2007-02-12 18:22:20 EST
Created attachment 58810 [details]
CDT usage as IEnablementVetoHolder implementor

(previous upload of patch was damaged)
Comment 6 Susan McCourt CLA 2009-07-09 19:36:31 EDT
As per http://wiki.eclipse.org/Platform_UI/Bug_Triage_Change_2009
Comment 7 Eclipse Webmaster CLA 2019-09-06 15:32:05 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.