Bug 173414 - [PropertiesDialog] [Preferences] Make PropertyAndPreferencePage available to other plug-ins (i.e. make it API)
Summary: [PropertiesDialog] [Preferences] Make PropertyAndPreferencePage available to ...
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC All
: P3 enhancement with 18 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: bugday, helpwanted
Depends on: 239904
Blocks:
  Show dependency tree
 
Reported: 2007-02-08 03:37 EST by Peter Friese CLA
Modified: 2020-11-03 11:17 EST (History)
20 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Friese CLA 2007-02-08 03:37:54 EST
PropertyAndPreferencePage provides a very neat way of letting the user configure project specific settings and giving him the chance to quickly navigate to the corresponding workspace preference. Many non-JDT plug-ins could benefit from this GUI concept. In my own plug-ins, I tend to either write my own version of PropertyAndPreferencePage or cut'n'paste the original version (which is problematic with respect to IP).

Therefore, I suggest making PropertyAndPreferencePage available to the public plug-in world by moving it over to JFace.
Comment 1 Martin Aeschlimann CLA 2007-02-13 11:06:52 EST
This would be someting that has to be offered by platform, as this is not Java specific.

PropertyAndPreferencePage is typically used to configure project specific settings: The same page can be used as global preference page and as property page on projects.

The page adds UI (link on top) to navigate from project specific settings to the workspace settings and vice versa.
As an example see all the Java Code Style preference pages.

Offering this class in platform would not only simplify the life of clients with project specific options, but also standardize the look of project specific settings pages.

Comment 2 Antoine Toulmé CLA 2007-06-11 02:58:10 EDT
+1
Comment 3 Andrey Loskutov CLA 2007-06-11 16:58:55 EDT
I have to deal with this both in my private plugins and within our product, so it would be nice to have it finally public API.
Comment 4 Tod Creasey CLA 2007-06-20 11:38:10 EDT
Martin do you think this class is API ready as is or does it need to be worked on still?
Comment 5 Martin Aeschlimann CLA 2007-06-20 12:02:04 EDT
It has some JDT references but can be easily replaced with JDT-neutral code.
Comment 6 Tod Creasey CLA 2007-06-22 11:07:58 EDT
This seems look a good chance to stop a lot of code copying
Comment 7 Peter Friese CLA 2007-10-26 05:53:56 EDT
How about marking this bug as "bugday"?
Comment 8 Remy Suen CLA 2007-11-22 20:00:56 EST
The preference page uses JDT's ProjectSelectionDialog. Is there something similar to this at the Platform level? I don't think so. ContainerSelectionDialog isn't quite the same since it shows a tree representation and lets the user select IFolders. I guess the idea here is to slowly chip away at JDT's code and then perform the move instead of just changing and moving in one fell swoop, correct?
Comment 9 Martin Aeschlimann CLA 2007-11-23 03:15:07 EST
You could use a ElementListSelectionDialog that also has a filter field. Would be useful for big workspaces.
Comment 10 Tod Creasey CLA 2007-11-23 08:41:31 EST
Yes the idea is to make an abstract superclass that the JDT specific code could subclass and put the superclass in the platform
Comment 11 Chris Aniszczyk CLA 2008-01-15 20:25:39 EST
I forgot about this bug when working with PDE's hellish preference pages (bug 168069). I'll see what I can do about the ProjectSelectionDialog (which btw, is used already in 3 places so far... JDT, Debug and PDE API Tools). Should I file a new bug to make ProjectSelectionDialog API also?
Comment 12 Andrey Loskutov CLA 2008-01-16 05:02:56 EST
Yes, most likely we would like to extend/reuse this project selection dialog.

We would then like to customize it:

- reduce the scope of projects shown: only some of projects (like "java only" or "custom nature" only) has to be shown for selection
- change also the text/checkboxes shown etc.

So to do all this things it would be nice to have this dialog as non-internal (API).
Comment 13 Tod Creasey CLA 2008-01-16 08:34:45 EST
Yes please do Chris as we would not want disagreement on one to block another.
Comment 14 Remy Suen CLA 2008-07-07 20:05:19 EDT
I opened bug 239904 against JDT/UI to make ProjectSelectionDialog API.
Comment 15 Chris Aniszczyk CLA 2008-07-07 20:06:58 EDT
This should be a good candidate for 3.5 iMHO... can remove some duplicate code out there in the ecosystem (and within the SDK... PDE UI / PDE API Tools)
Comment 16 Tod Creasey CLA 2008-07-08 09:01:38 EDT
Chris

Please do not set milestones for us as we have not committed anybody to working on this (which is why it is marked help wanted). If you want to work on it we would be happy to review any patches.
Comment 17 Mike Wilson CLA 2008-07-08 09:09:23 EDT
... or (Chris) if you want to take ownership of the bug, it's ok to say set the milestone to 3.5 if you are committing to fix it by then.

Comment 18 Chris Aniszczyk CLA 2008-07-08 10:43:07 EDT
Sorry, once bug 239904 is done, I will consider looking at this one for 3.5 to complete. I'm used to the PDE workflow where we target bugs for milestones which we hope to complete things by (ie., 3.5) and than a specific milestone (ie., 3.5M2) when we are done with it.
Comment 19 Remy Suen CLA 2008-07-24 14:45:29 EDT
(In reply to comment #12)
> Yes, most likely we would like to extend/reuse this project selection dialog.

Andrei and others CC'd on this bug, please move all such API requests about the specific ProjectSelectionDialog over to bug 239904 so that the Platform/UI team can capture it over there.
Comment 20 Susan McCourt CLA 2009-07-09 19:28:26 EDT
As per http://wiki.eclipse.org/Platform_UI/Bug_Triage_Change_2009
Comment 21 maarten meijer CLA 2012-09-27 16:09:15 EDT
As there is little progress on this bug I would like to point people that find this bug to the excellent but old (2003) article by Berthold Daum http://www.eclipse.org/articles/Article-Mutatis-mutandis/overlay-pages.html
for Eclipse 2.x

The code can be used directly in Eclipse 3.x easily with only one API tools warning and the preferences API now hiold more emethods, so retrieval of property of preference can be done with: 


package com.bdaum.overlayPages;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.jface.preference.IPreferenceStore;

import com.fold1.eulumdat.tools.EulumdatToolsActivator;
import com.fold1.eulumdat.tools.log.Logger;
import com.fold1.eulumdat.tools.preferences.ValidatorPreferencePage;

public class OverlayUtils {

	public static String getOverlayedPreferenceValue(IPreferenceStore store,
			IResource resource, String pageId, String key) {
		IProject project = resource.getProject();
		String value = null;
		if (useProjectSettings(project, pageId)) {
			value = getProperty(resource, pageId, key);
		}
		if (value != null)
			return value;
		return store.getString(key);
	}

	private static boolean useProjectSettings(IResource resource, String pageId) {
		String use = getProperty(resource, pageId,
				FieldEditorOverlayPage.USEPROJECTSETTINGS);
		return "true".equals(use);
	}

	public static final IPreferenceStore getStoreToUse(IResource p) {
		IPreferenceStore workspaceStore = EulumdatToolsActivator.getDefault()
				.getPreferenceStore();

		IPreferenceStore store = workspaceStore;
		String pageID = ValidatorPreferencePage.ID;
		if (null != p && OverlayUtils.useProjectSettings(p, pageID)) {
			store = new PropertyStore(p.getProject(), workspaceStore, pageID);
		}
		return store;
	}

	private static String getProperty(IResource resource, String pageId,
			String key) {
		try {
			return resource
					.getPersistentProperty(new QualifiedName(pageId, key));
		} catch (CoreException e) {
			Logger.logError(e);
		}
		return null;
	}

}
Comment 22 Lars Vogel CLA 2019-11-27 07:45:44 EST
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.

If the bug is still relevant, please remove the stalebug whiteboard tag.
Comment 23 maarten meijer CLA 2020-11-03 11:17:25 EST
This problem has not gone away and a solution exists but is only hard to find.
The use case is widespread as every development tool using projects wants to use general prefs and a per project override and be able to implement that easily.