core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetTreeNode.java
author timkelly
Tue, 31 Aug 2010 17:03:48 -0500
changeset 1931 d7c1f804f316
parent 1820 5c955fcfdc3d
child 1974 71a660e8393e
permissions -rw-r--r--
using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog) Removes API in BuildTargetTreeNode that presumed all nodes were SBSv1 (didn't appear to be used anywhere)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     1
/*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     3
* All rights reserved.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     8
*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    11
*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    12
* Contributors:
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    13
*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    14
* Description: 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    15
*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    16
*/
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    17
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    18
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    19
package com.nokia.carbide.cpp.sdk.ui.shared;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    20
1453
bd6bc4d000fd clean up SDK/Config tree by removing SDK Id from display (it's redundant) and also adding text that SDK location does not exist so users can see the config tree and know it won't work (not have it be hidden and users wonder why it's not there)
timkelly
parents: 1434
diff changeset
    21
import java.io.File;
1931
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
    22
import java.lang.reflect.InvocationTargetException;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    23
import java.util.ArrayList;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    24
import java.util.List;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    25
1931
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
    26
import org.eclipse.core.runtime.IProgressMonitor;
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
    27
import org.eclipse.jface.operation.IRunnableContext;
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
    28
import org.eclipse.jface.operation.IRunnableWithProgress;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    29
import org.eclipse.jface.viewers.TreeNode;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    30
1739
5f659a59d04a refactoring ISBSv2BuildContext, ISBSv1BuildContext, ISBSv2ConfigQueryData from public to internal package.
timkelly
parents: 1664
diff changeset
    31
import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildContext;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    32
import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    33
import com.nokia.carbide.cpp.sdk.core.ISDKManager;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    34
import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
    35
import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    36
import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    37
import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    38
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    39
/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    40
 * A tree node representing a Symbian OS SDK.  This node's children will be the
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    41
 * list of available build configurations.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    42
 */
1491
268b8ede3928 Update the SBSv2 filtering pref options from the Raptor alias query (union of all available build configs from Raptor).
timkelly
parents: 1476
diff changeset
    43
@SuppressWarnings("restriction")
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    44
public class BuildTargetTreeNode extends TreeNode {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    45
1820
5c955fcfdc3d fix npe, clear sbsv2 query cache data in memory when rebuilding sbsv2 cache from pref, other code clean-up
timkelly
parents: 1739
diff changeset
    46
	public static final String SDK_NODE_ERROR_EPOCROOT_INVALID = " SDK location does not exist! Check Symbian SDKs!"; //$NON-NLS
1460
26f585ac8a88 For IColorProvider on the SDK/Config tree LabelProvider, only check for existence of EPOCROOT in the data provider.
timkelly
parents: 1453
diff changeset
    47
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    48
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    49
	 * Constructs a new tree node for the given SDK
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    50
	 * @param value the SDK to create the tree node for
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    51
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    52
	public BuildTargetTreeNode(ISymbianSDK value) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    53
		this(value, false);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    54
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    55
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    56
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    57
	 * Constructs a new tree node for the given SDK
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    58
	 * @param value the SDK to create the tree node for
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    59
	 * @since 1.4
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    60
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    61
	public BuildTargetTreeNode(ISymbianSDK value, boolean sbsv2Project) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    62
		super(value);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    63
		
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
    64
		List<ISymbianBuildContext> configurations = sbsv2Project ? 
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1462
diff changeset
    65
				value.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER).getFilteredBuildConfigurations() : 
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1460
diff changeset
    66
				value.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER).getFilteredBuildConfigurations();
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1462
diff changeset
    67
				
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1462
diff changeset
    68
		if (configurations == null){
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1462
diff changeset
    69
			return;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1462
diff changeset
    70
		}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    71
		TreeNode[] children = new TreeNode[configurations.size()];
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    72
		int index = 0;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    73
		for (ISymbianBuildContext config : configurations) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    74
			children[index++] = new TreeNode(config) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    75
				@Override
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    76
				public String toString() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    77
					ISymbianBuildContext context = (ISymbianBuildContext)getValue();
1453
bd6bc4d000fd clean up SDK/Config tree by removing SDK Id from display (it's redundant) and also adding text that SDK location does not exist so users can see the config tree and know it won't work (not have it be hidden and users wonder why it's not there)
timkelly
parents: 1434
diff changeset
    78
					String sdkId = context.getSDK().getUniqueId();
1664
65c3d72a8793 fix some config refresh issues with SDK/Config tree management. Fixed some issues with showing proper configs re: SBSv2 config filtering prefs.
timkelly
parents: 1656
diff changeset
    79
					String newDisplayString = stripSDKIDFromConfigName(context.getDisplayString(), sdkId);
1491
268b8ede3928 Update the SBSv2 filtering pref options from the Raptor alias query (union of all available build configs from Raptor).
timkelly
parents: 1476
diff changeset
    80
					if (context instanceof ISBSv2BuildContext){
268b8ede3928 Update the SBSv2 filtering pref options from the Raptor alias query (union of all available build configs from Raptor).
timkelly
parents: 1476
diff changeset
    81
						ISBSv2BuildContext v2Context = (ISBSv2BuildContext)context;
1568
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1491
diff changeset
    82
						if (v2Context.getConfigQueryData().getConfigurationErrorMessage() != null && 
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1491
diff changeset
    83
							v2Context.getConfigQueryData().getConfigurationErrorMessage().length() > 0){
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1491
diff changeset
    84
							newDisplayString += " ERROR: " + v2Context.getConfigQueryData().getConfigurationErrorMessage();
1491
268b8ede3928 Update the SBSv2 filtering pref options from the Raptor alias query (union of all available build configs from Raptor).
timkelly
parents: 1476
diff changeset
    85
						}
268b8ede3928 Update the SBSv2 filtering pref options from the Raptor alias query (union of all available build configs from Raptor).
timkelly
parents: 1476
diff changeset
    86
					} 
268b8ede3928 Update the SBSv2 filtering pref options from the Raptor alias query (union of all available build configs from Raptor).
timkelly
parents: 1476
diff changeset
    87
					return newDisplayString;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    88
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    89
			};
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    90
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    91
		setChildren(children);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    92
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    93
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    94
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    95
	 * Returns the unique id the SDK associated with this node
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    96
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    97
	public String toString() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    98
		ISymbianSDK value = (ISymbianSDK) getValue();
1453
bd6bc4d000fd clean up SDK/Config tree by removing SDK Id from display (it's redundant) and also adding text that SDK location does not exist so users can see the config tree and know it won't work (not have it be hidden and users wonder why it's not there)
timkelly
parents: 1434
diff changeset
    99
		File f = new File(value.getEPOCROOT());
bd6bc4d000fd clean up SDK/Config tree by removing SDK Id from display (it's redundant) and also adding text that SDK location does not exist so users can see the config tree and know it won't work (not have it be hidden and users wonder why it's not there)
timkelly
parents: 1434
diff changeset
   100
		if (!f.exists()){
1820
5c955fcfdc3d fix npe, clear sbsv2 query cache data in memory when rebuilding sbsv2 cache from pref, other code clean-up
timkelly
parents: 1739
diff changeset
   101
			return value.getUniqueId() + " (" + f.getAbsolutePath() + ") " + SDK_NODE_ERROR_EPOCROOT_INVALID;
1453
bd6bc4d000fd clean up SDK/Config tree by removing SDK Id from display (it's redundant) and also adding text that SDK location does not exist so users can see the config tree and know it won't work (not have it be hidden and users wonder why it's not there)
timkelly
parents: 1434
diff changeset
   102
		}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   103
		return value.getUniqueId();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   104
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   105
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   106
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   107
	 * Get the SDK for this node
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   108
	 * @return the ISymbianSDK object for this tree node
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   109
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   110
	public ISymbianSDK getSymbianSDK() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   111
		return (ISymbianSDK) getValue();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   112
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   113
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   114
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   115
	 * Gets the list of SDK tree nodes for use in a tree viewer.  The SDK's are gathered
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   116
	 * from the SDK preferences page.  Only enabled SDK's are used.  Each SDK node will
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   117
	 * have build configurations for children appropriate for the SDK.  These configurations
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   118
	 * are filtered based on the platform filtering preference panel.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   119
	 * @param sbsv2Project true if this is an SBSv2 project which affects how the build
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   120
	 * configuration list is calculated
1931
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   121
	 * @param IRunnableContext - a runnable context for which to update a progress monitor. Cannot be null.
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   122
	 * @return array of BuildTargetTreeNode, or null
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   123
	 * @since 1.4
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   124
	 */
1931
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   125
	public static BuildTargetTreeNode[] getTreeViewerInput(final boolean sbsv2Project, IRunnableContext runnableContext) {
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   126
		
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   127
		final List<BuildTargetTreeNode> assembledInput = new ArrayList<BuildTargetTreeNode>();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   128
		
1931
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   129
		try {
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   130
			runnableContext.run(true, false, new IRunnableWithProgress(){
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   131
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   132
				public void run(IProgressMonitor monitor)
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   133
						throws InvocationTargetException, InterruptedException {
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   134
					
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   135
					String msgPrefix = "Building SDK/Configuration Model: "; //$NON-NLS-N$
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   136
					
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   137
					ISDKManager sdkMgr = SDKCorePlugin.getSDKManager();
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   138
					List<ISymbianSDK> sdkList = sdkMgr.getSDKList();
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   139
					monitor.beginTask(msgPrefix, sdkList.size() + 2);
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   140
					if (sdkList == null)
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   141
						return;
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   142
					
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   143
					monitor.worked(1);
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   144
					List<ISymbianSDK> sdkListCopy = new ArrayList<ISymbianSDK>();
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   145
					// Only add SDKs that are enabled
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   146
					for (ISymbianSDK currSDK : sdkList) {
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   147
						if (currSDK.isEnabled()) {
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   148
							sdkListCopy.add(currSDK);
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   149
						}
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   150
					}
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   151
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   152
					if (sbsv2Project) {
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   153
						// filter non-SBSv2 supported SDK's
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   154
						sdkListCopy = SBSv2Utils.getSupportedSDKs(sdkListCopy);
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   155
					}
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   156
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   157
					BuildTargetTreeNode[] input = new BuildTargetTreeNode[sdkListCopy
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   158
							.size()];
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   159
					int index = 0;
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   160
					monitor.worked(1);
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   161
					for (ISymbianSDK sdk : sdkListCopy) {
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   162
						monitor.worked(1);
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   163
						monitor.setTaskName(msgPrefix + sdk.getUniqueId());
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   164
						BuildTargetTreeNode treeNode = new BuildTargetTreeNode(
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   165
								sdk, sbsv2Project);
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   166
						if (treeNode.getChildren() != null || sbsv2Project) {
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   167
							input[index++] = treeNode;
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   168
						}
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   169
					}
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   170
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   171
					// Filter out any SDKs that don't have configs
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   172
					monitor.worked(1);
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   173
					for (BuildTargetTreeNode currNode : input) {
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   174
						if (currNode != null) {
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   175
							assembledInput.add(currNode);
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   176
						}
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   177
					}
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   178
					monitor.done();
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   179
				}
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   180
			
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   181
			
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   182
			});
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   183
		} catch (InvocationTargetException e) {
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   184
			e.printStackTrace();
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   185
		} catch (InterruptedException e) {
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   186
			e.printStackTrace();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   187
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   188
		
1931
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   189
		if (assembledInput.size() == 0){
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   190
			return null;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   191
		}
1931
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   192
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1820
diff changeset
   193
		return assembledInput.toArray(new BuildTargetTreeNode[assembledInput.size()]);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   194
	}
1664
65c3d72a8793 fix some config refresh issues with SDK/Config tree management. Fixed some issues with showing proper configs re: SBSv2 config filtering prefs.
timkelly
parents: 1656
diff changeset
   195
	
65c3d72a8793 fix some config refresh issues with SDK/Config tree management. Fixed some issues with showing proper configs re: SBSv2 config filtering prefs.
timkelly
parents: 1656
diff changeset
   196
	private static String stripSDKIDFromConfigName(String configName, String sdkID){
65c3d72a8793 fix some config refresh issues with SDK/Config tree management. Fixed some issues with showing proper configs re: SBSv2 config filtering prefs.
timkelly
parents: 1656
diff changeset
   197
		return configName.replace("[" + sdkID + "]", "");
65c3d72a8793 fix some config refresh issues with SDK/Config tree management. Fixed some issues with showing proper configs re: SBSv2 config filtering prefs.
timkelly
parents: 1656
diff changeset
   198
	}
65c3d72a8793 fix some config refresh issues with SDK/Config tree management. Fixed some issues with showing proper configs re: SBSv2 config filtering prefs.
timkelly
parents: 1656
diff changeset
   199
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 0
diff changeset
   200
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   201
}