core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java
author timkelly
Tue, 17 Aug 2010 15:50:47 -0700
branchC3_BUILDER_WORK
changeset 1847 5a696c4ef747
parent 1843 4d6f0ee23e9b
child 1894 0909e3336f6d
permissions -rw-r--r--
more Linux related fixes
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) 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
package com.nokia.carbide.cpp.internal.api.sdk.ui;
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
import java.util.ArrayList;
1138
352c0236f181 bug 10674. Sort sbsv2 configuration names with same platform_target alias prefix. ensure gcce error parser is used for sbsv2 GCCE4 build configs, add a project specific (sbsv2 only) edit box that allows user to append whatever they want to the -c parameter (the build alias). Also, fixed SDK support for TB kits now that TB92SF appears as a prefix rather than a suffix in the buildinfo.txt file.
timkelly
parents: 1134
diff changeset
    20
import java.util.Collections;
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: 1270
diff changeset
    21
import java.util.HashMap;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    22
import java.util.List;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    23
1480
c26f1a4c14aa Add exception handling (SBSv2MinimumVersionException) before trying to query raptor for config info. Min Raptor version is 2.15
timkelly
parents: 1478
diff changeset
    24
import org.eclipse.jface.dialogs.MessageDialog;
1497
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
    25
import org.eclipse.jface.dialogs.TrayDialog;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    26
import org.eclipse.jface.viewers.ArrayContentProvider;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    27
import org.eclipse.jface.viewers.CheckboxTableViewer;
1511
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
    28
import org.eclipse.jface.viewers.ISelection;
1541
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
    29
import org.eclipse.jface.viewers.ISelectionChangedListener;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    30
import org.eclipse.jface.viewers.LabelProvider;
1522
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
    31
import org.eclipse.jface.viewers.ListViewer;
1541
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
    32
import org.eclipse.jface.viewers.SelectionChangedEvent;
1511
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
    33
import org.eclipse.jface.viewers.StructuredSelection;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    34
import org.eclipse.swt.SWT;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    35
import org.eclipse.swt.events.SelectionEvent;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    36
import org.eclipse.swt.events.SelectionListener;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    37
import org.eclipse.swt.layout.GridData;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    38
import org.eclipse.swt.layout.GridLayout;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    39
import org.eclipse.swt.widgets.Button;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    40
import org.eclipse.swt.widgets.Composite;
1511
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
    41
import org.eclipse.swt.widgets.Label;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    42
import org.eclipse.swt.widgets.TableItem;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    43
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    44
import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils;
1480
c26f1a4c14aa Add exception handling (SBSv2MinimumVersionException) before trying to query raptor for config info. Min Raptor version is 2.15
timkelly
parents: 1478
diff changeset
    45
import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2MinimumVersionException;
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: 1270
diff changeset
    46
import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2QueryUtils;
1820
5c955fcfdc3d fix npe, clear sbsv2 query cache data in memory when rebuilding sbsv2 cache from pref, other code clean-up
timkelly
parents: 1776
diff changeset
    47
import com.nokia.carbide.cpp.internal.sdk.core.model.SBSv2BuildInfo;
1776
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1709
diff changeset
    48
import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManager;
1497
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
    49
import com.nokia.carbide.cpp.internal.sdk.ui.AddSBSv2ProductVariant;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    50
import com.nokia.carbide.cpp.internal.sdk.ui.Messages;
1820
5c955fcfdc3d fix npe, clear sbsv2 query cache data in memory when rebuilding sbsv2 cache from pref, other code clean-up
timkelly
parents: 1776
diff changeset
    51
import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID;
5c955fcfdc3d fix npe, clear sbsv2 query cache data in memory when rebuilding sbsv2 cache from pref, other code clean-up
timkelly
parents: 1776
diff changeset
    52
import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
1491
268b8ede3928 Update the SBSv2 filtering pref options from the Raptor alias query (union of all available build configs from Raptor).
timkelly
parents: 1480
diff changeset
    53
import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
1843
4d6f0ee23e9b Fix several issues for Linux around casting SDKManager to concrete class:
timkelly
parents: 1820
diff changeset
    54
import com.nokia.cpp.internal.api.utils.core.HostOS;
0
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
 * @since 1.4
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    58
 */
1491
268b8ede3928 Update the SBSv2 filtering pref options from the Raptor alias query (union of all available build configs from Raptor).
timkelly
parents: 1480
diff changeset
    59
@SuppressWarnings("restriction")
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    60
public class SBSv2PlatformFilterComposite extends Composite {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    61
1491
268b8ede3928 Update the SBSv2 filtering pref options from the Raptor alias query (union of all available build configs from Raptor).
timkelly
parents: 1480
diff changeset
    62
	private static HashMap<String, String> aliasMap = new HashMap<String, String>();
1497
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
    63
	private static List<String> productVariantList = new ArrayList<String>();
1491
268b8ede3928 Update the SBSv2 filtering pref options from the Raptor alias query (union of all available build configs from Raptor).
timkelly
parents: 1480
diff changeset
    64
	
1497
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
    65
	private CheckboxTableViewer buildAliasTableViewer;
1522
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
    66
	private ListViewer customVariantListViewer;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    67
	private Button refreshButton;
1497
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
    68
	private Button addVariantButton;
1522
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
    69
	private Button removeVariantButton;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    70
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    71
	SBSv2PlatformFilterComposite(Composite parent) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    72
		super(parent, SWT.NONE);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    73
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    74
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    75
	public void createControls() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    76
		GridLayout gridLayout = new GridLayout();
1497
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
    77
		gridLayout.numColumns =  2;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    78
		setLayout(gridLayout);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    79
		
1511
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
    80
		GridData gd = new GridData(SWT.LEFT, SWT.LEFT, true, false);
1497
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
    81
		gd.widthHint = 200;
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
    82
		gd.heightHint = 350;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    83
1511
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
    84
		Label aliasBoxLabel = new Label(this, SWT.NONE);
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
    85
		aliasBoxLabel.setText(Messages.getString("SBSv2PlatformFilterComposite.PlatformsGroupText"));
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
    86
		aliasBoxLabel.setToolTipText(Messages.getString("SBSv2PlatformFilterComposite.PlatformsGroupToolTip"));
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
    87
		
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
    88
		Label variantBoxLabel = new Label(this, SWT.NONE);
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
    89
		variantBoxLabel.setText(Messages.getString("SBSv2PlatformFilterComposite.ProductsGroupText"));
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
    90
		variantBoxLabel.setToolTipText(Messages.getString("SBSv2PlatformFilterComposite.ProductsGroupToolTip"));
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
    91
		
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
    92
		buildAliasTableViewer = CheckboxTableViewer.newCheckList(this, SWT.BORDER);
1497
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
    93
		buildAliasTableViewer.getTable().setLayoutData(gd);
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
    94
		buildAliasTableViewer.setContentProvider(new ArrayContentProvider());
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
    95
		buildAliasTableViewer.setLabelProvider(new LabelProvider());
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
    96
		
1522
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
    97
		customVariantListViewer = new ListViewer(this);
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
    98
		customVariantListViewer.getList().setLayoutData(gd);
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
    99
		customVariantListViewer.setContentProvider(new ArrayContentProvider());
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   100
		customVariantListViewer.setLabelProvider(new LabelProvider());
1541
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   101
		customVariantListViewer.addSelectionChangedListener( new ISelectionChangedListener() {
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   102
			
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   103
			public void selectionChanged(SelectionChangedEvent event) {
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   104
				if (customVariantListViewer.getSelection() != null && !customVariantListViewer.getSelection().isEmpty()){
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   105
					removeVariantButton.setEnabled(true);
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   106
				} else {
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   107
					removeVariantButton.setEnabled(false);
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   108
				}
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   109
			}
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   110
		});
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   111
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   112
		refreshButton = new Button(this, SWT.NONE);		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   113
		refreshButton.setText(Messages.getString("SBSv2PlatformFilterComposite.RefreshButtonText")); //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   114
		refreshButton.setToolTipText(Messages.getString("SBSv2PlatformFilterComposite.RefreshButtonToolTip")); //$NON-NLS-1$
1522
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   115
		
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   116
		refreshButton.addSelectionListener(new SelectionListener() {
1497
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   117
			
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   118
			public void widgetDefaultSelected(SelectionEvent e) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   119
				widgetSelected(e);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   120
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   121
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   122
			public void widgetSelected(SelectionEvent e) {
1685
5ad5dc631a3d fix refresh button on SBSv2 to rebuild product and aliases list from scratch
timkelly
parents: 1546
diff changeset
   123
				refreshButton.setEnabled(false);
1688
7d2363cc40e5 fix text localization problem
timkelly
parents: 1686
diff changeset
   124
				refreshButton.setText(Messages.getString("SBSv2PlatformFilterComposite.RefreshButtonScanningText")); //$NON-NLS-1$
1691
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   125
				SBSv2QueryUtils.removeAllCachedQueries();
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   126
				clearLocalSBSCacheData();
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   127
				initTable();
1820
5c955fcfdc3d fix npe, clear sbsv2 query cache data in memory when rebuilding sbsv2 cache from pref, other code clean-up
timkelly
parents: 1776
diff changeset
   128
				
5c955fcfdc3d fix npe, clear sbsv2 query cache data in memory when rebuilding sbsv2 cache from pref, other code clean-up
timkelly
parents: 1776
diff changeset
   129
				for (ISymbianSDK sdk : SDKCorePlugin.getSDKManager().getSDKList()){
5c955fcfdc3d fix npe, clear sbsv2 query cache data in memory when rebuilding sbsv2 cache from pref, other code clean-up
timkelly
parents: 1776
diff changeset
   130
					((SBSv2BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER)).clearDataFromBuildCache();
5c955fcfdc3d fix npe, clear sbsv2 query cache data in memory when rebuilding sbsv2 cache from pref, other code clean-up
timkelly
parents: 1776
diff changeset
   131
				}
5c955fcfdc3d fix npe, clear sbsv2 query cache data in memory when rebuilding sbsv2 cache from pref, other code clean-up
timkelly
parents: 1776
diff changeset
   132
				
1685
5ad5dc631a3d fix refresh button on SBSv2 to rebuild product and aliases list from scratch
timkelly
parents: 1546
diff changeset
   133
				refreshButton.setText(Messages.getString("SBSv2PlatformFilterComposite.RefreshButtonText")); //$NON-NLS-1$
5ad5dc631a3d fix refresh button on SBSv2 to rebuild product and aliases list from scratch
timkelly
parents: 1546
diff changeset
   134
				refreshButton.setEnabled(true);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   135
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   136
			
1691
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   137
			private void clearLocalSBSCacheData(){
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   138
				aliasMap.clear();
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   139
				productVariantList.clear();
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   140
			}
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   141
			
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   142
			
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   143
		});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   144
		
1522
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   145
		Composite variantButtonsComposite = new Composite(this, SWT.NONE);
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   146
		gridLayout = new GridLayout();
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   147
		gridLayout.makeColumnsEqualWidth = true;
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   148
		gridLayout.numColumns = 2;
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   149
		variantButtonsComposite.setLayout(gridLayout);
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   150
		GridData gridData = new GridData(SWT.LEFT, SWT.TOP, true, false);
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   151
		variantButtonsComposite.setLayoutData(gridData);
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   152
		
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   153
		addVariantButton = new Button(variantButtonsComposite, SWT.NONE);		
1497
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   154
		addVariantButton.setText(Messages.getString("SBSv2PlatformFilterComposite.AddProductButtonText")); //$NON-NLS-1$
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   155
		addVariantButton.setToolTipText(Messages.getString("SBSv2PlatformFilterComposite.AddProductButtonToolTip")); //$NON-NLS-1$
1522
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   156
		addVariantButton.setLayoutData(gridData);
1497
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   157
		addVariantButton.addSelectionListener(new SelectionListener() {
1522
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   158
		
1497
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   159
			public void widgetDefaultSelected(SelectionEvent e) {widgetSelected(e);}
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   160
			public void widgetSelected(SelectionEvent e) {
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   161
				if (aliasMap.size() == 0){
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   162
					MessageDialog.openError(getShell(), "No build configurations found.", "No build configurations (aliases) were found from any SDKs. Attempted 'sbs --query=aliases' but found no results.");
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   163
				} else if  (productVariantList.size() == 0){
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   164
						MessageDialog.openError(getShell(), "No products found.", "No products were found from any SDKs. Attempted 'sbs --query=products' but found no results.");
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   165
				} else {
1511
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
   166
					String selectedAlias = "";
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
   167
					ISelection selectedItem = buildAliasTableViewer.getSelection();
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
   168
					
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
   169
					StructuredSelection selection = (StructuredSelection)selectedItem;
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
   170
					String stringSelection = (String)selection.getFirstElement();
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
   171
					if (stringSelection != null){
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
   172
						TableItem[] tableItems = buildAliasTableViewer.getTable().getItems();
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
   173
						for (TableItem item : tableItems){
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
   174
							if (stringSelection.equals(item.getText())){
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
   175
								selectedAlias = item.getText();
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
   176
								break;
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
   177
							}
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
   178
						}
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
   179
					}
a0d2867d6a81 clean up the Manage Configs dialog. When adding a variant, ensure that the selected build alias is selected in the alias combo.
timkelly
parents: 1497
diff changeset
   180
					AddSBSv2ProductVariant addVariantDlg = new AddSBSv2ProductVariant(getShell(), selectedAlias, aliasMap, productVariantList);
1497
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   181
					if (addVariantDlg.open() == TrayDialog.OK){
1522
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   182
						if (customVariantListViewer.testFindItem(addVariantDlg.getUserCreatedVariant()) == null){
1497
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   183
							// doesn't exist, add it. if it does exist just ignore it
1546
e884710be6ef fix problem with removing product variants.
timkelly
parents: 1541
diff changeset
   184
							List<String> variantList = (List<String>)customVariantListViewer.getInput();
e884710be6ef fix problem with removing product variants.
timkelly
parents: 1541
diff changeset
   185
							variantList.add(addVariantDlg.getUserCreatedVariant());
e884710be6ef fix problem with removing product variants.
timkelly
parents: 1541
diff changeset
   186
							customVariantListViewer.setInput(variantList);
e884710be6ef fix problem with removing product variants.
timkelly
parents: 1541
diff changeset
   187
							customVariantListViewer.refresh();
1497
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   188
						}
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   189
					}
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   190
				}
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   191
			}
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   192
			
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   193
		});
1522
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   194
		
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   195
		removeVariantButton = new Button(variantButtonsComposite, SWT.NONE);		
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   196
		removeVariantButton.setText(Messages.getString("SBSv2PlatformFilterComposite.RemoveProductButtonText")); //$NON-NLS-1$
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   197
		removeVariantButton.setToolTipText(Messages.getString("SBSv2PlatformFilterComposite.RemoveProductButtonToolTip")); //$NON-NLS-1$
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   198
		removeVariantButton.setLayoutData(gridData);
1541
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   199
		removeVariantButton.setEnabled(false);
1522
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   200
		removeVariantButton.addSelectionListener(new SelectionListener() {
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   201
			
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   202
			public void widgetDefaultSelected(SelectionEvent e) {widgetSelected(e);}
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   203
			public void widgetSelected(SelectionEvent e) {
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   204
				ISelection selectedVariant = customVariantListViewer.getSelection();
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   205
				if (selectedVariant != null){
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   206
					StructuredSelection selection = (StructuredSelection)selectedVariant;
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   207
					String stringSelection = (String)selection.getFirstElement();
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   208
					List<String> data = (List<String>)customVariantListViewer.getInput();
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   209
					data.remove(stringSelection);
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   210
					customVariantListViewer.setInput(data);
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   211
					customVariantListViewer.refresh(true);
1541
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   212
					removeVariantButton.setEnabled(false);
1522
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   213
				}
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   214
			}
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   215
			
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   216
		});
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   217
		
1691
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   218
		initTable();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   219
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   220
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   221
	public void performOk() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   222
		// save the list of unchecked configs
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: 1270
diff changeset
   223
		List<String> checkedConfigs = new ArrayList<String>();
1497
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   224
		for (TableItem item : buildAliasTableViewer.getTable().getItems()) {
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   225
			if (buildAliasTableViewer.getChecked(item.getData())) {
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   226
				checkedConfigs.add(item.getText());
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   227
			}
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   228
		}
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   229
		
1522
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   230
		for (String variant : customVariantListViewer.getList().getItems()) {
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   231
				checkedConfigs.add(variant);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   232
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   233
		
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: 1270
diff changeset
   234
		SBSv2Utils.setSBSv2FilteredConfigs(checkedConfigs.toArray(new String[checkedConfigs.size()]));
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   235
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   236
	
1691
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   237
	private void initTable() {
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   238
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1138
diff changeset
   239
		SBSv2Utils.initDefaultConfigsToFilter();
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1138
diff changeset
   240
		
1691
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   241
		if (aliasMap.size() == 0){
1491
268b8ede3928 Update the SBSv2 filtering pref options from the Raptor alias query (union of all available build configs from Raptor).
timkelly
parents: 1480
diff changeset
   242
			try {
1691
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   243
				aliasMap = SBSv2QueryUtils.getCompleteAliasList();
1491
268b8ede3928 Update the SBSv2 filtering pref options from the Raptor alias query (union of all available build configs from Raptor).
timkelly
parents: 1480
diff changeset
   244
			} catch (SBSv2MinimumVersionException e) {
268b8ede3928 Update the SBSv2 filtering pref options from the Raptor alias query (union of all available build configs from Raptor).
timkelly
parents: 1480
diff changeset
   245
				// Force a scan for version in case system was updated
1847
5a696c4ef747 more Linux related fixes
timkelly
parents: 1843
diff changeset
   246
				SDKCorePlugin.getSDKManager().getSBSv2Version(true);
1491
268b8ede3928 Update the SBSv2 filtering pref options from the Raptor alias query (union of all available build configs from Raptor).
timkelly
parents: 1480
diff changeset
   247
				try {
268b8ede3928 Update the SBSv2 filtering pref options from the Raptor alias query (union of all available build configs from Raptor).
timkelly
parents: 1480
diff changeset
   248
					// try, try again...
1691
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   249
					aliasMap = SBSv2QueryUtils.getCompleteAliasList();
1491
268b8ede3928 Update the SBSv2 filtering pref options from the Raptor alias query (union of all available build configs from Raptor).
timkelly
parents: 1480
diff changeset
   250
				} catch (SBSv2MinimumVersionException e2) {
268b8ede3928 Update the SBSv2 filtering pref options from the Raptor alias query (union of all available build configs from Raptor).
timkelly
parents: 1480
diff changeset
   251
					MessageDialog.openError(getShell(), "Minimum sbs version not met.", e.getMessage());
268b8ede3928 Update the SBSv2 filtering pref options from the Raptor alias query (union of all available build configs from Raptor).
timkelly
parents: 1480
diff changeset
   252
				}
268b8ede3928 Update the SBSv2 filtering pref options from the Raptor alias query (union of all available build configs from Raptor).
timkelly
parents: 1480
diff changeset
   253
			} 
1480
c26f1a4c14aa Add exception handling (SBSv2MinimumVersionException) before trying to query raptor for config info. Min Raptor version is 2.15
timkelly
parents: 1478
diff changeset
   254
		}
1491
268b8ede3928 Update the SBSv2 filtering pref options from the Raptor alias query (union of all available build configs from Raptor).
timkelly
parents: 1480
diff changeset
   255
		
1691
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   256
		if (productVariantList.size() == 0){
1497
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   257
			try {
1691
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   258
				productVariantList = SBSv2QueryUtils.getCompleteProductVariantList();
1497
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   259
			} catch (SBSv2MinimumVersionException e) {
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   260
				
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   261
			}
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   262
		}
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   263
		// get saved configs in the store
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   264
		List<String> checkedConfigsFromStore = SBSv2Utils.getSBSv2FilteredConfigPreferences();
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   265
		
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   266
		List<String> sbsAliases = new ArrayList<String>(); // global build aliases
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   267
		List<String> savedVariants = new ArrayList<String>(); // custom variants
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   268
		for (String key : aliasMap.keySet()){
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: 1270
diff changeset
   269
			sbsAliases.add(key);
1497
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   270
		}
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   271
		
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   272
		for (String config : checkedConfigsFromStore){
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   273
			if (config.contains(".")){
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   274
				savedVariants.add(config);
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   275
			}
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   276
		}
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   277
		
1138
352c0236f181 bug 10674. Sort sbsv2 configuration names with same platform_target alias prefix. ensure gcce error parser is used for sbsv2 GCCE4 build configs, add a project specific (sbsv2 only) edit box that allows user to append whatever they want to the -c parameter (the build alias). Also, fixed SDK support for TB kits now that TB92SF appears as a prefix rather than a suffix in the buildinfo.txt file.
timkelly
parents: 1134
diff changeset
   278
		Collections.sort(sbsAliases);
1497
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   279
		buildAliasTableViewer.setInput(sbsAliases);
1522
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   280
		customVariantListViewer.setInput(savedVariants);
1138
352c0236f181 bug 10674. Sort sbsv2 configuration names with same platform_target alias prefix. ensure gcce error parser is used for sbsv2 GCCE4 build configs, add a project specific (sbsv2 only) edit box that allows user to append whatever they want to the -c parameter (the build alias). Also, fixed SDK support for TB kits now that TB92SF appears as a prefix rather than a suffix in the buildinfo.txt file.
timkelly
parents: 1134
diff changeset
   281
		
1522
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1511
diff changeset
   282
		// uncheck all configs to init
1497
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   283
		buildAliasTableViewer.setAllChecked(false);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   284
		
1497
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   285
		for (String config : checkedConfigsFromStore) {
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   286
			for (TableItem item : buildAliasTableViewer.getTable().getItems()) {
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   287
				if (item.getText().equals(config) && !item.getText().contains(".")) {
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   288
					buildAliasTableViewer.setChecked(item.getData(), true);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   289
					break;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   290
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   291
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   292
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   293
	}
266
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
   294
	
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
   295
	public void setDefaults(){
1691
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   296
		initTable();
1497
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   297
		for (TableItem item : buildAliasTableViewer.getTable().getItems()) {
1843
4d6f0ee23e9b Fix several issues for Linux around casting SDKManager to concrete class:
timkelly
parents: 1820
diff changeset
   298
			String tableItemText = item.getText().toLowerCase();
4d6f0ee23e9b Fix several issues for Linux around casting SDKManager to concrete class:
timkelly
parents: 1820
diff changeset
   299
			if (tableItemText.equals("armv5_udeb")  || 
4d6f0ee23e9b Fix several issues for Linux around casting SDKManager to concrete class:
timkelly
parents: 1820
diff changeset
   300
				tableItemText.equals("armv5_urel") ||
4d6f0ee23e9b Fix several issues for Linux around casting SDKManager to concrete class:
timkelly
parents: 1820
diff changeset
   301
				tableItemText.equals("armv5_udeb_gcce")  || 
4d6f0ee23e9b Fix several issues for Linux around casting SDKManager to concrete class:
timkelly
parents: 1820
diff changeset
   302
				tableItemText.equals("armv5_urel_gcce") ||
4d6f0ee23e9b Fix several issues for Linux around casting SDKManager to concrete class:
timkelly
parents: 1820
diff changeset
   303
				tableItemText.equals("winscw_udeb")  ||
4d6f0ee23e9b Fix several issues for Linux around casting SDKManager to concrete class:
timkelly
parents: 1820
diff changeset
   304
				tableItemText.equals("winscw_urel")) {
4d6f0ee23e9b Fix several issues for Linux around casting SDKManager to concrete class:
timkelly
parents: 1820
diff changeset
   305
				
4d6f0ee23e9b Fix several issues for Linux around casting SDKManager to concrete class:
timkelly
parents: 1820
diff changeset
   306
				if (HostOS.IS_UNIX && tableItemText.startsWith("winscw"))
4d6f0ee23e9b Fix several issues for Linux around casting SDKManager to concrete class:
timkelly
parents: 1820
diff changeset
   307
					;  // ignore winscw as an option for Unix
4d6f0ee23e9b Fix several issues for Linux around casting SDKManager to concrete class:
timkelly
parents: 1820
diff changeset
   308
				else
4d6f0ee23e9b Fix several issues for Linux around casting SDKManager to concrete class:
timkelly
parents: 1820
diff changeset
   309
					buildAliasTableViewer.setChecked(item.getData(), true);
4d6f0ee23e9b Fix several issues for Linux around casting SDKManager to concrete class:
timkelly
parents: 1820
diff changeset
   310
				
4d6f0ee23e9b Fix several issues for Linux around casting SDKManager to concrete class:
timkelly
parents: 1820
diff changeset
   311
				
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: 1270
diff changeset
   312
			} else {
1497
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   313
				buildAliasTableViewer.setChecked(item.getData(), false);
266
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
   314
			}
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
   315
		}
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
   316
	}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   317
}