core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java
author timkelly
Tue, 27 Jul 2010 10:31:29 -0500
branchC3_BUILDER_WORK
changeset 1691 b249ba29f642
parent 1688 7d2363cc40e5
child 1709 6bd6640867aa
permissions -rw-r--r--
Remove boolean API to force rescan the SBS cache (there was API to do that already)
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;
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
    47
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
    48
import com.nokia.carbide.cpp.internal.sdk.ui.Messages;
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
    49
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
    50
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    51
/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    52
 * @since 1.4
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    53
 */
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
    54
@SuppressWarnings("restriction")
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    55
public class SBSv2PlatformFilterComposite extends Composite {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    56
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
    57
	// TODO: Temporary map. We need a way to ensure we only get the alias map
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
	// when needed and that the data we are getting is properly cached to avoid
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
	// having to run Raptor queries too often
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
    60
	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
    61
	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
    62
	
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 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
    64
	private ListViewer customVariantListViewer;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    65
	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
    66
	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
    67
	private Button removeVariantButton;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    68
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    69
	SBSv2PlatformFilterComposite(Composite parent) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    70
		super(parent, SWT.NONE);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    71
	}
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
	public void createControls() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    74
		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
    75
		gridLayout.numColumns =  2;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    76
		setLayout(gridLayout);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    77
		
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
    78
		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
    79
		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
    80
		gd.heightHint = 350;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    81
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
    82
		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
    83
		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
    84
		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
    85
		
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
		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
    87
		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
    88
		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
    89
		
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
		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
    91
		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
    92
		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
    93
		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
    94
		
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
    95
		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
    96
		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
    97
		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
    98
		customVariantListViewer.setLabelProvider(new LabelProvider());
1541
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
    99
		customVariantListViewer.addSelectionChangedListener( new ISelectionChangedListener() {
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   100
			
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   101
			public void selectionChanged(SelectionChangedEvent event) {
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   102
				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
   103
					removeVariantButton.setEnabled(true);
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   104
				} else {
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   105
					removeVariantButton.setEnabled(false);
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   106
				}
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
		});
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   109
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   110
		refreshButton = new Button(this, SWT.NONE);		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   111
		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
   112
		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
   113
		
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   114
		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
   115
			
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   116
			public void widgetDefaultSelected(SelectionEvent e) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   117
				widgetSelected(e);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   118
			}
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
			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
   121
				refreshButton.setEnabled(false);
1688
7d2363cc40e5 fix text localization problem
timkelly
parents: 1686
diff changeset
   122
				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
   123
				SBSv2QueryUtils.removeAllCachedQueries();
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   124
				clearLocalSBSCacheData();
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   125
				initTable();
1685
5ad5dc631a3d fix refresh button on SBSv2 to rebuild product and aliases list from scratch
timkelly
parents: 1546
diff changeset
   126
				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
   127
				refreshButton.setEnabled(true);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   128
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   129
			
1691
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   130
			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
   131
				aliasMap.clear();
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   132
				productVariantList.clear();
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   133
			}
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   134
			
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   135
			
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   136
		});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   137
		
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
   138
		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
   139
		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
   140
		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
   141
		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
   142
		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
   143
		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
   144
		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
   145
		
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
		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
   147
		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
   148
		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
   149
		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
   150
		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
   151
		
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
   152
			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
   153
			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
   154
				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
   155
					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
   156
				} 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
   157
						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
   158
				} 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
   159
					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
   160
					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
   161
					
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
   162
					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
   163
					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
   164
					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
   165
						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
   166
						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
   167
							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
   168
								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
   169
								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
   170
							}
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
						}
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
					}
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
					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
   174
					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
   175
						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
   176
							// 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
   177
							List<String> variantList = (List<String>)customVariantListViewer.getInput();
e884710be6ef fix problem with removing product variants.
timkelly
parents: 1541
diff changeset
   178
							variantList.add(addVariantDlg.getUserCreatedVariant());
e884710be6ef fix problem with removing product variants.
timkelly
parents: 1541
diff changeset
   179
							customVariantListViewer.setInput(variantList);
e884710be6ef fix problem with removing product variants.
timkelly
parents: 1541
diff changeset
   180
							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
   181
						}
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
					}
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
				}
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
   184
			}
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
   185
			
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
   186
		});
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
   187
		
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
   188
		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
   189
		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
   190
		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
   191
		removeVariantButton.setLayoutData(gridData);
1541
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   192
		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
   193
		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
   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
			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
   196
			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
   197
				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
   198
				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
   199
					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
   200
					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
   201
					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
   202
					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
   203
					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
   204
					customVariantListViewer.refresh(true);
1541
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   205
					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
   206
				}
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
			}
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
			
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
		});
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
		
1691
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   211
		initTable();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   212
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   213
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   214
	public void performOk() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   215
		// 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
   216
		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
   217
		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
   218
			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
   219
				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
   220
			}
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
   221
		}
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
   222
		
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
   223
		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
   224
				checkedConfigs.add(variant);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   225
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   226
		
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
   227
		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
   228
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   229
	
1691
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   230
	private void initTable() {
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   231
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1138
diff changeset
   232
		SBSv2Utils.initDefaultConfigsToFilter();
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1138
diff changeset
   233
		
1691
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   234
		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
   235
			try {
1691
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   236
				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
   237
			} 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
   238
				// Force a scan for version in case system was updated
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
   239
				SDKCorePlugin.getSDKManager().getSBSv2Version(true);
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
   240
				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
   241
					// 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
   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 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
   244
					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
   245
				}
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
			} 
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
   247
		}
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
   248
		
1691
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   249
		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
   250
			try {
1691
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1688
diff changeset
   251
				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
   252
			} 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
   253
				
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
   254
			}
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
   255
		}
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
		// 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
   257
		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
   258
		
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
		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
   260
		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
   261
		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
   262
			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
   263
		}
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
		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
   266
			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
   267
				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
   268
			}
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
		
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
   271
		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
   272
		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
   273
		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
   274
		
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
   275
		// 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
   276
		buildAliasTableViewer.setAllChecked(false);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   277
		
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
		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
   279
			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
   280
				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
   281
					buildAliasTableViewer.setChecked(item.getData(), true);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   282
					break;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   283
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   284
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   285
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   286
	}
266
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
   287
	
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
   288
	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
   289
		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
   290
		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
   291
			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
   292
				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
   293
				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
   294
				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
   295
				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
   296
				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
   297
				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
   298
			} 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
   299
				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
   300
			}
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
   301
		}
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
   302
	}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   303
}