core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java
author timkelly
Thu, 12 Aug 2010 15:56:37 -0500
branchC3_BUILDER_WORK
changeset 1820 5c955fcfdc3d
parent 1776 ad19bba5eef8
child 1843 4d6f0ee23e9b
permissions -rw-r--r--
fix npe, clear sbsv2 query cache data in memory when rebuilding sbsv2 cache from pref, other code clean-up
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;
0
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
 * @since 1.4
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    57
 */
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
    58
@SuppressWarnings("restriction")
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    59
public class SBSv2PlatformFilterComposite extends Composite {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    60
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
    61
	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
    62
	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
    63
	
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
    64
	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
    65
	private ListViewer customVariantListViewer;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    66
	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
    67
	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
    68
	private Button removeVariantButton;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    69
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    70
	SBSv2PlatformFilterComposite(Composite parent) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    71
		super(parent, SWT.NONE);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    72
	}
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
	public void createControls() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    75
		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
    76
		gridLayout.numColumns =  2;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    77
		setLayout(gridLayout);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    78
		
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
    79
		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
    80
		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
    81
		gd.heightHint = 350;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    82
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
    83
		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
    84
		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
    85
		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
    86
		
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
		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
    88
		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
    89
		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
    90
		
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
		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
    92
		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
    93
		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
    94
		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
    95
		
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
    96
		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
    97
		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
    98
		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
    99
		customVariantListViewer.setLabelProvider(new LabelProvider());
1541
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   100
		customVariantListViewer.addSelectionChangedListener( new ISelectionChangedListener() {
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   101
			
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   102
			public void selectionChanged(SelectionChangedEvent event) {
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   103
				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
   104
					removeVariantButton.setEnabled(true);
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   105
				} else {
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   106
					removeVariantButton.setEnabled(false);
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   107
				}
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
		});
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   110
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   111
		refreshButton = new Button(this, SWT.NONE);		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   112
		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
   113
		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
   114
		
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   115
		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
   116
			
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   117
			public void widgetDefaultSelected(SelectionEvent e) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   118
				widgetSelected(e);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   119
			}
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
			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
   122
				refreshButton.setEnabled(false);
1688
7d2363cc40e5 fix text localization problem
timkelly
parents: 1686
diff changeset
   123
				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
   124
				SBSv2QueryUtils.removeAllCachedQueries();
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   125
				clearLocalSBSCacheData();
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   126
				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
   127
				
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
				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
   129
					((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
   130
				}
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
				
1685
5ad5dc631a3d fix refresh button on SBSv2 to rebuild product and aliases list from scratch
timkelly
parents: 1546
diff changeset
   132
				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
   133
				refreshButton.setEnabled(true);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   134
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   135
			
1691
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   136
			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
   137
				aliasMap.clear();
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   138
				productVariantList.clear();
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   139
			}
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
			
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   142
		});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   143
		
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
   144
		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
   145
		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
   146
		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
   147
		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
   148
		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
   149
		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
   150
		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
   151
		
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
		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
   153
		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
   154
		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
   155
		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
   156
		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
   157
		
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
   158
			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
   159
			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
   160
				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
   161
					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
   162
				} 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
   163
						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
   164
				} 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
   165
					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
   166
					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
   167
					
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
					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
   169
					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
   170
					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
   171
						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
   172
						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
   173
							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
   174
								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
   175
								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
   176
							}
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
					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
   180
					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
   181
						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
   182
							// 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
   183
							List<String> variantList = (List<String>)customVariantListViewer.getInput();
e884710be6ef fix problem with removing product variants.
timkelly
parents: 1541
diff changeset
   184
							variantList.add(addVariantDlg.getUserCreatedVariant());
e884710be6ef fix problem with removing product variants.
timkelly
parents: 1541
diff changeset
   185
							customVariantListViewer.setInput(variantList);
e884710be6ef fix problem with removing product variants.
timkelly
parents: 1541
diff changeset
   186
							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
   187
						}
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
		});
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
   193
		
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
		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
   195
		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
   196
		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
   197
		removeVariantButton.setLayoutData(gridData);
1541
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   198
		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
   199
		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
   200
			
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
			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
   202
			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
   203
				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
   204
				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
   205
					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
   206
					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
   207
					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
   208
					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
   209
					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
   210
					customVariantListViewer.refresh(true);
1541
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   211
					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
   212
				}
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
		
1691
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   217
		initTable();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   218
	}
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
	public void performOk() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   221
		// 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
   222
		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
   223
		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
   224
			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
   225
				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
   226
			}
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
		
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
   229
		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
   230
				checkedConfigs.add(variant);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   231
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   232
		
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
   233
		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
   234
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   235
	
1691
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   236
	private void initTable() {
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   237
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1138
diff changeset
   238
		SBSv2Utils.initDefaultConfigsToFilter();
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1138
diff changeset
   239
		
1691
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   240
		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
   241
			try {
1691
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   242
				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
   243
			} 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
   244
				// Force a scan for version in case system was updated
1776
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1709
diff changeset
   245
				((SDKManager)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
   246
				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
   247
					// 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
   248
					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
   249
				} 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
   250
					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
   251
				}
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
			} 
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
   253
		}
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
   254
		
1691
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   255
		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
   256
			try {
1691
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   257
				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
   258
			} 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
   259
				
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
		// 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
   263
		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
   264
		
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
		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
   266
		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
   267
		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
   268
			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
   269
		}
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
		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
   272
			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
   273
				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
   274
			}
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
		
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
   277
		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
   278
		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
   279
		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
   280
		
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
   281
		// 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
   282
		buildAliasTableViewer.setAllChecked(false);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   283
		
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
   284
		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
   285
			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
   286
				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
   287
					buildAliasTableViewer.setChecked(item.getData(), true);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   288
					break;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   289
				}
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
	}
266
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
   293
	
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
   294
	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
   295
		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
   296
		for (TableItem item : buildAliasTableViewer.getTable().getItems()) {
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
   297
			if (item.getText().toLowerCase().equals("armv5_udeb")  || 
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
   298
				item.getText().toLowerCase().equals("armv5_urel") ||
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
   299
				item.getText().toLowerCase().equals("armv5_udeb_gcce")  || 
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
   300
				item.getText().toLowerCase().equals("armv5_urel_gcce") ||
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
   301
				item.getText().toLowerCase().equals("winscw_udeb")  ||
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
   302
				item.getText().toLowerCase().equals("winscw_urel")) {
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
   303
				buildAliasTableViewer.setChecked(item.getData(), true);
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
   304
			} 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
   305
				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
   306
			}
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
   307
		}
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
   308
	}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   309
}