core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java
author timkelly
Mon, 26 Jul 2010 15:21:29 -0500
branchC3_BUILDER_WORK
changeset 1686 e0b67eb36bac
parent 1685 5ad5dc631a3d
child 1688 7d2363cc40e5
permissions -rw-r--r--
localize scanning message
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);
1686
e0b67eb36bac localize scanning message
timkelly
parents: 1685
diff changeset
   122
				refreshButton.setToolTipText(Messages.getString("SBSv2PlatformFilterComposite.RefreshButtonScanningText")); //$NON-NLS-1$
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   123
				initTable(true);
1685
5ad5dc631a3d fix refresh button on SBSv2 to rebuild product and aliases list from scratch
timkelly
parents: 1546
diff changeset
   124
				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
   125
				refreshButton.setEnabled(true);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   126
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   127
			
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
		
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
   130
		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
   131
		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
   132
		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
   133
		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
   134
		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
   135
		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
   136
		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
   137
		
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
		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
   139
		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
   140
		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
   141
		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
   142
		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
   143
		
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
   144
			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
   145
			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
   146
				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
   147
					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
   148
				} 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
   149
						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
   150
				} 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
   151
					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
   152
					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
   153
					
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
   154
					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
   155
					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
   156
					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
   157
						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
   158
						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
   159
							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
   160
								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
   161
								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
   162
							}
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
						}
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
					}
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
					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
   166
					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
   167
						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
   168
							// 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
   169
							List<String> variantList = (List<String>)customVariantListViewer.getInput();
e884710be6ef fix problem with removing product variants.
timkelly
parents: 1541
diff changeset
   170
							variantList.add(addVariantDlg.getUserCreatedVariant());
e884710be6ef fix problem with removing product variants.
timkelly
parents: 1541
diff changeset
   171
							customVariantListViewer.setInput(variantList);
e884710be6ef fix problem with removing product variants.
timkelly
parents: 1541
diff changeset
   172
							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
   173
						}
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
					}
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
   175
				}
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
			}
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
   177
			
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
   178
		});
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
   179
		
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
   180
		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
   181
		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
   182
		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
   183
		removeVariantButton.setLayoutData(gridData);
1541
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   184
		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
   185
		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
   186
			
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
			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
   188
			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
   189
				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
   190
				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
   191
					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
   192
					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
   193
					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
   194
					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
   195
					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
   196
					customVariantListViewer.refresh(true);
1541
71d1c8d0e56d add selectionListener on Remove Variant button. Only enable when a variant is selected.
timkelly
parents: 1522
diff changeset
   197
					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
   198
				}
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
			}
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
		});
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
		
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   203
		initTable(false);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   204
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   205
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   206
	public void performOk() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   207
		// 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
   208
		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
   209
		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
   210
			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
   211
				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
   212
			}
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
   213
		}
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
   214
		
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
   215
		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
   216
				checkedConfigs.add(variant);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   217
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   218
		
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
   219
		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
   220
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   221
	
1685
5ad5dc631a3d fix refresh button on SBSv2 to rebuild product and aliases list from scratch
timkelly
parents: 1546
diff changeset
   222
	private void initTable(boolean forceRescan) {
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   223
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1138
diff changeset
   224
		SBSv2Utils.initDefaultConfigsToFilter();
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1138
diff changeset
   225
		
1685
5ad5dc631a3d fix refresh button on SBSv2 to rebuild product and aliases list from scratch
timkelly
parents: 1546
diff changeset
   226
		if (aliasMap.size() == 0 || forceRescan){
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
   227
			try {
1685
5ad5dc631a3d fix refresh button on SBSv2 to rebuild product and aliases list from scratch
timkelly
parents: 1546
diff changeset
   228
				aliasMap = SBSv2QueryUtils.getCompleteAliasList(forceRescan);
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
   229
			} 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
   230
				// 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
   231
				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
   232
				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
   233
					// try, try again...
1685
5ad5dc631a3d fix refresh button on SBSv2 to rebuild product and aliases list from scratch
timkelly
parents: 1546
diff changeset
   234
					aliasMap = SBSv2QueryUtils.getCompleteAliasList(forceRescan);
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
				} 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
   236
					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
   237
				}
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
			} 
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
   239
		}
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
   240
		
1685
5ad5dc631a3d fix refresh button on SBSv2 to rebuild product and aliases list from scratch
timkelly
parents: 1546
diff changeset
   241
		if (productVariantList.size() == 0 || forceRescan){
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
   242
			try {
1685
5ad5dc631a3d fix refresh button on SBSv2 to rebuild product and aliases list from scratch
timkelly
parents: 1546
diff changeset
   243
				productVariantList = SBSv2QueryUtils.getCompleteProductVariantList(forceRescan);
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
   244
			} 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
   245
				
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
   246
			}
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
   247
		}
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
   248
		// 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
   249
		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
   250
		
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
   251
		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
   252
		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
   253
		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
   254
			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
   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
		
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
		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
   258
			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
   259
				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
   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
		
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
   263
		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
   264
		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
   265
		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
   266
		
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
   267
		// 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
   268
		buildAliasTableViewer.setAllChecked(false);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   269
		
1497
440c4eac1a5a Implement variant support for SBSv2 configuration management. Variants aren't selectable, only the global prefs allow you to create variants, if they exist in an SDK.
timkelly
parents: 1491
diff changeset
   270
		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
   271
			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
   272
				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
   273
					buildAliasTableViewer.setChecked(item.getData(), true);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   274
					break;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   275
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   276
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   277
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   278
	}
266
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
   279
	
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
   280
	public void setDefaults(){
1685
5ad5dc631a3d fix refresh button on SBSv2 to rebuild product and aliases list from scratch
timkelly
parents: 1546
diff changeset
   281
		initTable(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
   282
		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
   283
			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
   284
				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
   285
				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
   286
				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
   287
				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
   288
				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
   289
				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
   290
			} 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
   291
				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
   292
			}
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
	}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   295
}