core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/BuildPlatformFilterPage.java
author timkelly
Mon, 21 Jun 2010 14:27:08 -0500
branchC3_BUILDER_WORK
changeset 1502 31f428aec716
parent 1497 440c4eac1a5a
child 1543 69d5b194482b
permissions -rw-r--r--
add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts. some hacks added for re-loading configurations when the default config is a variant.
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) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     3
* All rights reserved.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     8
*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    11
*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    12
* Contributors:
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    13
*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    14
* Description: 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    15
*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    16
*/
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    17
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    18
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    19
package com.nokia.carbide.cpp.internal.api.sdk.ui;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    20
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    21
import org.eclipse.jface.preference.PreferencePage;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    22
import org.eclipse.swt.SWT;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    23
import org.eclipse.swt.layout.GridData;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    24
import org.eclipse.swt.layout.GridLayout;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    25
import org.eclipse.swt.widgets.Composite;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    26
import org.eclipse.swt.widgets.Control;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    27
import org.eclipse.swt.widgets.TabFolder;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    28
import org.eclipse.swt.widgets.TabItem;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    29
import org.eclipse.ui.IWorkbench;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    30
import org.eclipse.ui.IWorkbenchPreferencePage;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    31
import org.eclipse.ui.PlatformUI;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    32
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    33
import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    34
import com.nokia.carbide.cpp.internal.sdk.ui.Messages;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    35
import com.nokia.carbide.cpp.internal.sdk.ui.SDKUIHelpIds;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    36
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    37
public class BuildPlatformFilterPage extends PreferencePage implements IWorkbenchPreferencePage { 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    38
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    39
	SBSv1PlatformFilterComposite sbsv1Tab;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    40
	SBSv2PlatformFilterComposite sbsv2Tab;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    41
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    42
	public BuildPlatformFilterPage() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    43
		super();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    44
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    45
	
266
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
    46
	
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
    47
	public Control createContents(Composite parent) {
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    48
		Composite content = new Composite(parent, SWT.NONE);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    49
		GridLayout gridLayout = new GridLayout();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    50
		content.setLayout(gridLayout);
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
		TabFolder tabFolder = new TabFolder(content, SWT.NONE);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    53
		GridData tabFolderGridData = new GridData(SWT.FILL, SWT.FILL, true, true);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    54
		tabFolder.setLayoutData(tabFolderGridData);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    55
		
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 628
diff changeset
    56
		if (SBSv2Utils.enableSBSv2Support()) {
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 628
diff changeset
    57
			TabItem sbsv2TabItem = new TabItem(tabFolder, SWT.NONE);
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 628
diff changeset
    58
			sbsv2TabItem.setText(Messages.getString("BuildPlatformFilterPage.SBSv2TabText")); //$NON-NLS-1$
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 628
diff changeset
    59
			sbsv2TabItem.setToolTipText(Messages.getString("BuildPlatformFilterPage.SBSv2TabToolTip")); //$NON-NLS-1$
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 628
diff changeset
    60
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 628
diff changeset
    61
			sbsv2Tab = new SBSv2PlatformFilterComposite(tabFolder);
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 628
diff changeset
    62
			sbsv2Tab.createControls();
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 628
diff changeset
    63
			sbsv2TabItem.setControl(sbsv2Tab);
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 628
diff changeset
    64
		}
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 628
diff changeset
    65
		
628
149f2223eff0 Make sure that SBSv2 platform filtering preferences are used when SBSv1 is not enabled.
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
    66
		if (SBSv2Utils.enableSBSv1Support()) {
149f2223eff0 Make sure that SBSv2 platform filtering preferences are used when SBSv1 is not enabled.
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
    67
			TabItem sbsv1TabItem = new TabItem(tabFolder, SWT.NONE);
149f2223eff0 Make sure that SBSv2 platform filtering preferences are used when SBSv1 is not enabled.
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
    68
			sbsv1TabItem.setText(Messages.getString("BuildPlatformFilterPage.SBSv1TabText")); //$NON-NLS-1$
149f2223eff0 Make sure that SBSv2 platform filtering preferences are used when SBSv1 is not enabled.
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
    69
			sbsv1TabItem.setToolTipText(Messages.getString("BuildPlatformFilterPage.SBSv1TabToolTip")); //$NON-NLS-1$
149f2223eff0 Make sure that SBSv2 platform filtering preferences are used when SBSv1 is not enabled.
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
    70
	
149f2223eff0 Make sure that SBSv2 platform filtering preferences are used when SBSv1 is not enabled.
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
    71
			sbsv1Tab = new SBSv1PlatformFilterComposite(tabFolder);
149f2223eff0 Make sure that SBSv2 platform filtering preferences are used when SBSv1 is not enabled.
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
    72
			sbsv1Tab.createControls();
149f2223eff0 Make sure that SBSv2 platform filtering preferences are used when SBSv1 is not enabled.
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
    73
			sbsv1TabItem.setControl(sbsv1Tab);
149f2223eff0 Make sure that SBSv2 platform filtering preferences are used when SBSv1 is not enabled.
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
    74
		}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    75
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    76
		PlatformUI.getWorkbench().getHelpSystem().setHelp(super.getControl(), SDKUIHelpIds.SDK_BUILD_FILTER_PAGE);
266
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
    77
		
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
    78
		return content;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    79
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    80
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    81
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    82
	public void init(IWorkbench workbench) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    83
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    84
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    85
	public boolean performOk() {
628
149f2223eff0 Make sure that SBSv2 platform filtering preferences are used when SBSv1 is not enabled.
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
    86
		if (sbsv1Tab != null) {
149f2223eff0 Make sure that SBSv2 platform filtering preferences are used when SBSv1 is not enabled.
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
    87
			sbsv1Tab.performOk();
149f2223eff0 Make sure that SBSv2 platform filtering preferences are used when SBSv1 is not enabled.
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
    88
		}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    89
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    90
		if (sbsv2Tab != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    91
			sbsv2Tab.performOk();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    92
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    93
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    94
		return super.performOk();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    95
	}
266
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
    96
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
    97
	@Override
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
    98
	protected void performApply() {
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
    99
		performOk();
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
   100
		super.performApply();
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
   101
	}
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
   102
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
   103
	@Override
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
   104
	protected void performDefaults() {
628
149f2223eff0 Make sure that SBSv2 platform filtering preferences are used when SBSv1 is not enabled.
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   105
		if (sbsv1Tab != null) {
149f2223eff0 Make sure that SBSv2 platform filtering preferences are used when SBSv1 is not enabled.
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   106
			sbsv1Tab.setDefaults();
149f2223eff0 Make sure that SBSv2 platform filtering preferences are used when SBSv1 is not enabled.
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   107
		}
149f2223eff0 Make sure that SBSv2 platform filtering preferences are used when SBSv1 is not enabled.
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   108
		if (sbsv2Tab != null) {
149f2223eff0 Make sure that SBSv2 platform filtering preferences are used when SBSv1 is not enabled.
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   109
			sbsv2Tab.setDefaults();
149f2223eff0 Make sure that SBSv2 platform filtering preferences are used when SBSv1 is not enabled.
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   110
		}
266
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
   111
		super.performDefaults();
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
   112
	}
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
   113
	
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
   114
	
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 0
diff changeset
   115
	
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   116
}