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

Bug 365718

Summary: Support tree option style in managed build options
Product: [Tools] CDT Reporter: Mohamed Hussein <mohamed_hussein>
Component: cdt-build-managedAssignee: Doug Schaefer <cdtdoug>
Status: RESOLVED FIXED QA Contact: Chris Recoskie <recoskie>
Severity: enhancement    
Priority: P3 CC: cdtdoug, malaperle, yevshif
Version: 8.0   
Target Milestone: 8.1.0   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Proposed implementation of tree options
none
Tree field editor and popup dialog
none
Show filter in action
none
Sample order
none
Sample plugin.xml for shown images
none
Update1: Proposal to implement tree build option cdtdoug: iplog+

Description Mohamed Hussein CLA 2011-12-06 08:07:28 EST
Build Identifier: 20110615-0604

Managed build options in tools provide several styles for option type,
for example: string, boolean, libPaths, enumerated, ...
The enumerated type allows the user to select from a pre-defined list of
values.

A usability problem might happen if the list of possible values is Huge,
in this case the simple drop-box wouldn't be sufficient for the user to
properly and easily select the needed option. In most of those cases the
huge list of options can be organized in some hierarchy that allows the
user to easily pick the needed option.

The attached patch attempts to support this by doing the following:

1- Adding support of a new option valueType "tree"
    - Adding schema for treeOption
    - Adding support for tree type similar to enumerated option type
2- Provide UI to easily select items from this tree
    - Provide a field editor with a text box and browse button
    - Provide popup tree picker with filtered search
    - Each item in the tree can optionally provide an icon, and specify
its relative order among its peers.

Reproducible: Always
Comment 1 Mohamed Hussein CLA 2011-12-06 08:08:07 EST
Created attachment 207978 [details]
Proposed implementation of tree options
Comment 2 Mohamed Hussein CLA 2011-12-06 08:09:02 EST
Created attachment 207979 [details]
Tree field editor and popup dialog
Comment 3 Mohamed Hussein CLA 2011-12-06 08:09:45 EST
Created attachment 207980 [details]
Show filter in action
Comment 4 Mohamed Hussein CLA 2011-12-06 08:10:20 EST
Created attachment 207981 [details]
Sample order
Comment 5 Mohamed Hussein CLA 2011-12-06 08:12:05 EST
Created attachment 207982 [details]
Sample plugin.xml for shown images

plugin.xml for org.eclipse.cdt.managedbuilder.gnu.ui modified to include dummy tree option, represents data shown in previously attached images.
Comment 6 Mohamed Hussein CLA 2011-12-26 05:06:32 EST
Created attachment 208801 [details]
Update1: Proposal to implement tree build option

Update to expose TreeRoot and TreeSelectionDialog to allow using in other contexts
Comment 7 Mohamed Hussein CLA 2012-04-10 10:49:09 EDT
Pushed change to Gerrit @ https://git.eclipse.org/r/5556
Comment 8 Doug Schaefer CLA 2012-05-04 10:10:03 EDT
Patch applied: https://git.eclipse.org/r/5558
Comment 9 Marc-André Laperle CLA 2012-05-07 11:43:52 EDT
Hi,
ManagedBuildCoreTests.testTreeOptions is failing. Mohamed, can you take a look?
https://hudson.eclipse.org/hudson/job/cdt-nightly/1076/testReport/
Comment 10 Mohamed Hussein CLA 2012-05-08 03:38:02 EDT
Hi Mark,
This is so weird, as it stands, this test should never pass, though I am sure I ran it and it was passing, and I guess Doug did so as well.

The fix is simple, we should just change the order of couple of statements in the method as below.

Shall I send an updated patch on gerrit?

From 97e4c2ad9acda603261cef3c9b1889d6aee5b26c Tue, 8 May 2012 10:37:14 +0300
From: mhussein <mohamed_hussein@mentor.com>
Date: Tue, 8 May 2012 10:36:23 +0300
Subject: [PATCH] Make code consistent with JavaDoc and unit test to throw exception if the type of the node is not a tree.

diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
index 07d69fe..fd06364 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
@@ -2975,6 +2975,10 @@
 
 	@Override
 	public ITreeRoot getTreeRoot() throws BuildException {
+		if (getValueType() != TREE) {
+			throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
+		}
+
 		if (treeRoot == null) {
 			if (superClass != null) {
 				return superClass.getTreeRoot();
@@ -2982,10 +2986,6 @@
 				return null;
 			}
 		}
-		if (getValueType() != TREE) {
-			throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
-		}
-
 		return treeRoot;
 	}
 }
Comment 11 Marc-André Laperle CLA 2012-05-13 20:22:06 EDT
(In reply to comment #10)
> Shall I send an updated patch on gerrit?

Thanks. Can you add the patch as an attachment to this this bug so I can enter it in the iplog? I can't use Gerrit right now :( (bug 379338)
Comment 12 Doug Schaefer CLA 2012-05-13 22:16:25 EDT
Or put it in Gerrit and I'll apply it. I didn't actually run the test, I was just using the build def to see the UI in action.
Comment 13 Mohamed Hussein CLA 2012-05-14 04:01:00 EDT
Pushed as https://git.eclipse.org/r/5969