builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/ManageConfigurationsDialog.java
author timkelly
Tue, 31 Aug 2010 17:03:48 -0500
changeset 1931 d7c1f804f316
parent 1913 bcd5f4dbd8ac
child 1949 1531bcf5dea3
permissions -rw-r--r--
using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog) Removes API in BuildTargetTreeNode that presumed all nodes were SBSv1 (didn't appear to be used anywhere)
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.cdt.internal.api.builder.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;
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    20
import java.util.HashMap;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    21
import java.util.Iterator;
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
1931
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
    24
import org.eclipse.core.runtime.CoreException;
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
    25
import org.eclipse.core.runtime.IStatus;
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
    26
import org.eclipse.core.runtime.Status;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    27
import org.eclipse.jface.dialogs.IDialogConstants;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    28
import org.eclipse.jface.dialogs.TrayDialog;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    29
import org.eclipse.jface.viewers.CheckStateChangedEvent;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    30
import org.eclipse.jface.viewers.ICheckStateListener;
1458
c92585882c83 add label provider for SDK Config Tree to show SDK node in red when EPOCROOT does not exist.
timkelly
parents: 1453
diff changeset
    31
import org.eclipse.jface.viewers.IColorProvider;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    32
import org.eclipse.jface.viewers.IFilter;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    33
import org.eclipse.jface.viewers.ITreeContentProvider;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    34
import org.eclipse.jface.viewers.LabelProvider;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    35
import org.eclipse.jface.viewers.TreeNode;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    36
import org.eclipse.jface.viewers.TreeNodeContentProvider;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    37
import org.eclipse.jface.viewers.Viewer;
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
    38
import org.eclipse.jface.window.Window;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    39
import org.eclipse.swt.SWT;
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
    40
import org.eclipse.swt.events.SelectionAdapter;
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
    41
import org.eclipse.swt.events.SelectionEvent;
1458
c92585882c83 add label provider for SDK Config Tree to show SDK node in red when EPOCROOT does not exist.
timkelly
parents: 1453
diff changeset
    42
import org.eclipse.swt.graphics.Color;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    43
import org.eclipse.swt.graphics.Point;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    44
import org.eclipse.swt.layout.GridData;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    45
import org.eclipse.swt.layout.GridLayout;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    46
import org.eclipse.swt.widgets.Composite;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    47
import org.eclipse.swt.widgets.Control;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    48
import org.eclipse.swt.widgets.Label;
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
    49
import org.eclipse.swt.widgets.Link;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    50
import org.eclipse.swt.widgets.Shell;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    51
import org.eclipse.swt.widgets.TreeItem;
1931
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
    52
import org.eclipse.ui.IWorkbenchWindow;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    53
import org.eclipse.ui.PlatformUI;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    54
import org.eclipse.ui.dialogs.ContainerCheckedTreeViewer;
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
    55
import org.eclipse.ui.dialogs.PreferencesUtil;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    56
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    57
import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    58
import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    59
import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    60
import com.nokia.carbide.cdt.builder.project.ICarbideProjectModifier;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    61
import com.nokia.carbide.cdt.internal.builder.ui.CarbideCPPBuilderUIHelpIds;
1739
5f659a59d04a refactoring ISBSv2BuildContext, ISBSv1BuildContext, ISBSv2ConfigQueryData from public to internal package.
timkelly
parents: 1687
diff changeset
    62
import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildContext;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    63
import com.nokia.carbide.cpp.internal.api.sdk.ISDKManagerInternal;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    64
import com.nokia.carbide.cpp.internal.qt.core.QtConfigFilter;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    65
import com.nokia.carbide.cpp.internal.qt.core.QtCorePlugin;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    66
import com.nokia.carbide.cpp.internal.qt.core.QtSDKFilter;
1776
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1739
diff changeset
    67
import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManager;
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
    68
import com.nokia.carbide.cpp.sdk.core.ISDKManager;
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
    69
import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
    70
import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
    71
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
    72
import com.nokia.carbide.cpp.sdk.ui.shared.BuildTargetTreeNode;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    73
import com.nokia.cpp.internal.api.utils.core.Check;
1843
4d6f0ee23e9b Fix several issues for Linux around casting SDKManager to concrete class:
timkelly
parents: 1776
diff changeset
    74
import com.nokia.cpp.internal.api.utils.core.HostOS;
1458
c92585882c83 add label provider for SDK Config Tree to show SDK node in red when EPOCROOT does not exist.
timkelly
parents: 1453
diff changeset
    75
import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    76
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: 1460
diff changeset
    77
@SuppressWarnings("restriction")
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    78
public class ManageConfigurationsDialog extends TrayDialog {
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
	protected ContainerCheckedTreeViewer properSdkViewer;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    81
	private FilteringContentProviderWrapper filteringContentProviderWrapper;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    82
	private final ICarbideProjectInfo cpi;
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
	static class FilteringContentProviderWrapper implements ITreeContentProvider {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    85
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    86
		private ITreeContentProvider wrappedProvider;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    87
		private IFilter filter;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    88
		private IFilter configFilter;
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
		public FilteringContentProviderWrapper(ITreeContentProvider wrappedProvider) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    91
			super();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    92
			Check.checkArg(wrappedProvider);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    93
			this.wrappedProvider = wrappedProvider;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    94
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    95
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    96
		public Object[] getElements(Object inputElement) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    97
			ArrayList<Object> filteredElements = new ArrayList<Object>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    98
			Object[] elements = wrappedProvider.getElements(inputElement);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    99
			for (int i = 0; i < elements.length; i++) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   100
				Object object = elements[i];
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   101
				if (filter == null || filter.select(object))
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   102
					filteredElements.add(object);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   103
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   104
			
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   105
			return filteredElements.toArray();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   106
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   107
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   108
		public void dispose() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   109
			wrappedProvider.dispose();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   110
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   111
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   112
		public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   113
			wrappedProvider.inputChanged(viewer, oldInput, newInput);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   114
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   115
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   116
		public Object[] getChildren(Object parentElement) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   117
			List<Object> filteredElements = new ArrayList<Object>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   118
			Object[] elements = wrappedProvider.getChildren(parentElement);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   119
			if (elements != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   120
				for (int i = 0; i < elements.length; i++) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   121
					Object object = elements[i];
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   122
					if (configFilter == null || configFilter.select(object))
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   123
						filteredElements.add(object);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   124
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   125
			}
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
			return filteredElements.toArray();
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
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   130
		public Object getParent(Object element) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   131
			return wrappedProvider.getParent(element);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   132
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   133
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   134
		public boolean hasChildren(Object element) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   135
			return wrappedProvider.hasChildren(element);
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
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   138
		public void setFilter(IFilter filter) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   139
			this.filter = filter;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   140
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   141
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   142
		public void setConfigFilter(IFilter filter) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   143
			this.configFilter = filter;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   144
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   145
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   146
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   147
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   148
	 * Create the dialog
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   149
	 * @param parentShell
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   150
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   151
	public ManageConfigurationsDialog(Shell parentShell, ICarbideProjectInfo cpi) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   152
		super(parentShell);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   153
		this.cpi = cpi;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   154
		setShellStyle(getShellStyle() | SWT.RESIZE);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   155
		
1843
4d6f0ee23e9b Fix several issues for Linux around casting SDKManager to concrete class:
timkelly
parents: 1776
diff changeset
   156
		if (HostOS.IS_WIN32){
4d6f0ee23e9b Fix several issues for Linux around casting SDKManager to concrete class:
timkelly
parents: 1776
diff changeset
   157
			ISDKManager sdkMgr = SDKCorePlugin.getSDKManager();
1913
bcd5f4dbd8ac Fix for Bug 11467; added automatic scan for changes in drive specs on project import/creation.
stechong
parents: 1843
diff changeset
   158
			((SDKManager)sdkMgr).ensureSystemDrivesSynchronized();
1843
4d6f0ee23e9b Fix several issues for Linux around casting SDKManager to concrete class:
timkelly
parents: 1776
diff changeset
   159
			if (!((SDKManager)sdkMgr).checkDevicesXMLSynchronized()){
4d6f0ee23e9b Fix several issues for Linux around casting SDKManager to concrete class:
timkelly
parents: 1776
diff changeset
   160
				if (sdkMgr instanceof ISDKManagerInternal){
4d6f0ee23e9b Fix several issues for Linux around casting SDKManager to concrete class:
timkelly
parents: 1776
diff changeset
   161
					ISDKManagerInternal sdkMgrInternal = (ISDKManagerInternal)sdkMgr;
4d6f0ee23e9b Fix several issues for Linux around casting SDKManager to concrete class:
timkelly
parents: 1776
diff changeset
   162
					sdkMgrInternal.fireDevicesXMLChanged();
4d6f0ee23e9b Fix several issues for Linux around casting SDKManager to concrete class:
timkelly
parents: 1776
diff changeset
   163
				}	
4d6f0ee23e9b Fix several issues for Linux around casting SDKManager to concrete class:
timkelly
parents: 1776
diff changeset
   164
			}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   165
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   166
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   167
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   168
	/* (non-Javadoc)
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   169
	 * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   170
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   171
	protected void configureShell(Shell shell) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   172
		super.configureShell(shell);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   173
		shell.setText(Messages.getString("ManageConfigurationsDialog.Add_Remove_Build_Configs")); //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   174
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   175
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   176
	@Override
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   177
	protected void okPressed() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   178
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   179
		saveConfigurations();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   180
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   181
		super.okPressed();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   182
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   183
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   184
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   185
	 * Create contents of the dialog
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   186
	 * @param parent
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   187
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   188
	@Override
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   189
	protected Control createDialogArea(Composite parent) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   190
		Composite container = (Composite) super.createDialogArea(parent);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   191
		final GridLayout gridLayout = new GridLayout();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   192
		gridLayout.numColumns = 1;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   193
		container.setLayout(gridLayout);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   194
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   195
		final Label sdkConfigLabel = new Label(container, SWT.NONE);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   196
		sdkConfigLabel.setToolTipText(Messages.getString("ManageConfigurationsDialog.Config_Label_ToolTip")); //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   197
		sdkConfigLabel.setText(Messages.getString("ManageConfigurationsDialog.Available_SDks_and_Configs")); //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   198
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   199
		properSdkViewer = new ContainerCheckedTreeViewer(container, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   200
		properSdkViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
1458
c92585882c83 add label provider for SDK Config Tree to show SDK node in red when EPOCROOT does not exist.
timkelly
parents: 1453
diff changeset
   201
		
c92585882c83 add label provider for SDK Config Tree to show SDK node in red when EPOCROOT does not exist.
timkelly
parents: 1453
diff changeset
   202
		class SDKNodeLabelProvider extends LabelProvider implements IColorProvider {
c92585882c83 add label provider for SDK Config Tree to show SDK node in red when EPOCROOT does not exist.
timkelly
parents: 1453
diff changeset
   203
c92585882c83 add label provider for SDK Config Tree to show SDK node in red when EPOCROOT does not exist.
timkelly
parents: 1453
diff changeset
   204
			public Color getForeground(Object element) {
c92585882c83 add label provider for SDK Config Tree to show SDK node in red when EPOCROOT does not exist.
timkelly
parents: 1453
diff changeset
   205
				if (element instanceof BuildTargetTreeNode){
c92585882c83 add label provider for SDK Config Tree to show SDK node in red when EPOCROOT does not exist.
timkelly
parents: 1453
diff changeset
   206
					BuildTargetTreeNode treeNode = (BuildTargetTreeNode)element;
c92585882c83 add label provider for SDK Config Tree to show SDK node in red when EPOCROOT does not exist.
timkelly
parents: 1453
diff changeset
   207
					if (treeNode.getValue() instanceof ISymbianSDK){
1460
26f585ac8a88 For IColorProvider on the SDK/Config tree LabelProvider, only check for existence of EPOCROOT in the data provider.
timkelly
parents: 1458
diff changeset
   208
						if (treeNode.toString().contains(BuildTargetTreeNode.SDK_NODE_ERROR_EPOCROOT_INVALID)){
1458
c92585882c83 add label provider for SDK Config Tree to show SDK node in red when EPOCROOT does not exist.
timkelly
parents: 1453
diff changeset
   209
							return WorkbenchUtils.getSafeShell().getDisplay().getSystemColor(SWT.COLOR_RED);
c92585882c83 add label provider for SDK Config Tree to show SDK node in red when EPOCROOT does not exist.
timkelly
parents: 1453
diff changeset
   210
						}
c92585882c83 add label provider for SDK Config Tree to show SDK node in red when EPOCROOT does not exist.
timkelly
parents: 1453
diff changeset
   211
					}
c92585882c83 add label provider for SDK Config Tree to show SDK node in red when EPOCROOT does not exist.
timkelly
parents: 1453
diff changeset
   212
				}
c92585882c83 add label provider for SDK Config Tree to show SDK node in red when EPOCROOT does not exist.
timkelly
parents: 1453
diff changeset
   213
				
c92585882c83 add label provider for SDK Config Tree to show SDK node in red when EPOCROOT does not exist.
timkelly
parents: 1453
diff changeset
   214
				return null;
c92585882c83 add label provider for SDK Config Tree to show SDK node in red when EPOCROOT does not exist.
timkelly
parents: 1453
diff changeset
   215
			}
c92585882c83 add label provider for SDK Config Tree to show SDK node in red when EPOCROOT does not exist.
timkelly
parents: 1453
diff changeset
   216
c92585882c83 add label provider for SDK Config Tree to show SDK node in red when EPOCROOT does not exist.
timkelly
parents: 1453
diff changeset
   217
			public Color getBackground(Object element) {
c92585882c83 add label provider for SDK Config Tree to show SDK node in red when EPOCROOT does not exist.
timkelly
parents: 1453
diff changeset
   218
				return null;
c92585882c83 add label provider for SDK Config Tree to show SDK node in red when EPOCROOT does not exist.
timkelly
parents: 1453
diff changeset
   219
			}
c92585882c83 add label provider for SDK Config Tree to show SDK node in red when EPOCROOT does not exist.
timkelly
parents: 1453
diff changeset
   220
		}
c92585882c83 add label provider for SDK Config Tree to show SDK node in red when EPOCROOT does not exist.
timkelly
parents: 1453
diff changeset
   221
		
c92585882c83 add label provider for SDK Config Tree to show SDK node in red when EPOCROOT does not exist.
timkelly
parents: 1453
diff changeset
   222
		properSdkViewer.setLabelProvider(new SDKNodeLabelProvider());
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   223
		TreeNodeContentProvider treeNodeContentProvider = new TreeNodeContentProvider();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   224
		filteringContentProviderWrapper = 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   225
			new FilteringContentProviderWrapper(treeNodeContentProvider);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   226
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   227
		// add filters for Qt projects
593
7dbb2f97454a Refactor checks for Qt project nature into one place.
Ed Swartz <ed.swartz@nokia.com>
parents: 0
diff changeset
   228
		if (QtCorePlugin.isQtProject(cpi.getProject())) {
7dbb2f97454a Refactor checks for Qt project nature into one place.
Ed Swartz <ed.swartz@nokia.com>
parents: 0
diff changeset
   229
			filteringContentProviderWrapper.setFilter(new QtSDKFilter());
7dbb2f97454a Refactor checks for Qt project nature into one place.
Ed Swartz <ed.swartz@nokia.com>
parents: 0
diff changeset
   230
			filteringContentProviderWrapper.setConfigFilter(new QtConfigFilter());
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   231
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   232
		
1931
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
   233
		try {
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
   234
			drawSDKConfigTree();
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
   235
		} catch (CoreException e1) {
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
   236
			e1.printStackTrace();
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
   237
		}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   238
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   239
		BrokenConfigurationInProjectTreeNode[] brokenTreeInput = BrokenConfigurationInProjectTreeNode.getTreeViewerInput(cpi);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   240
		if (brokenTreeInput.length > 0) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   241
			final Label uninstalledSdkConfigLabel = new Label(container, SWT.NONE);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   242
			uninstalledSdkConfigLabel.setToolTipText(Messages.getString("ManageConfigurationsDialog.Unavailable_Config_Label_ToolTip")); //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   243
			uninstalledSdkConfigLabel.setText(Messages.getString("ManageConfigurationsDialog.Unavailable_SDks_and_Configs")); //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   244
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   245
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   246
		final Label sdkStaticHelp = new Label(parent, SWT.WRAP);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   247
		sdkStaticHelp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   248
		sdkStaticHelp.setText(Messages.getString("ManageConfigurationsDialog.Select_config_help_text")); //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   249
		
1552
76b07aca4d4f bug 11547. Add "See Symbian SDKs" link to Manage Config Dialog.
timkelly
parents: 1497
diff changeset
   250
		Link configPrefLink = new Link(parent, SWT.WRAP);
76b07aca4d4f bug 11547. Add "See Symbian SDKs" link to Manage Config Dialog.
timkelly
parents: 1497
diff changeset
   251
		configPrefLink.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
76b07aca4d4f bug 11547. Add "See Symbian SDKs" link to Manage Config Dialog.
timkelly
parents: 1497
diff changeset
   252
		configPrefLink.setText(Messages.getString("ManageConfigurationsDialog.Select_Filtering_Prefs_Link")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
76b07aca4d4f bug 11547. Add "See Symbian SDKs" link to Manage Config Dialog.
timkelly
parents: 1497
diff changeset
   253
		configPrefLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
76b07aca4d4f bug 11547. Add "See Symbian SDKs" link to Manage Config Dialog.
timkelly
parents: 1497
diff changeset
   254
		configPrefLink.addSelectionListener(new SelectionAdapter() {
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
   255
			public void widgetSelected(SelectionEvent e) {
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
   256
				// I don't see a way to open it to a specific tab, only the page
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
   257
				if (Window.OK == PreferencesUtil.createPreferenceDialogOn(getShell(), "com.nokia.carbide.cpp.sdk.ui.preferences.BuildPlatformFilterPage", null, null, 0).open()){ //$NON-NLS-1$
1931
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
   258
					try {
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
   259
						drawSDKConfigTree();
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
   260
					} catch (CoreException e1) {
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
   261
						e1.printStackTrace();
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
   262
					}
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
   263
				}
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
   264
			}
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
   265
		});
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
   266
		
1552
76b07aca4d4f bug 11547. Add "See Symbian SDKs" link to Manage Config Dialog.
timkelly
parents: 1497
diff changeset
   267
		Link sdkLink = new Link(parent, SWT.WRAP);
76b07aca4d4f bug 11547. Add "See Symbian SDKs" link to Manage Config Dialog.
timkelly
parents: 1497
diff changeset
   268
		sdkLink.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
76b07aca4d4f bug 11547. Add "See Symbian SDKs" link to Manage Config Dialog.
timkelly
parents: 1497
diff changeset
   269
		sdkLink.setText(Messages.getString("ManageConfigurationsDialog.Select_SymbianSDKs_Prefs_Link")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
76b07aca4d4f bug 11547. Add "See Symbian SDKs" link to Manage Config Dialog.
timkelly
parents: 1497
diff changeset
   270
		sdkLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
76b07aca4d4f bug 11547. Add "See Symbian SDKs" link to Manage Config Dialog.
timkelly
parents: 1497
diff changeset
   271
		sdkLink.addSelectionListener(new SelectionAdapter() {
76b07aca4d4f bug 11547. Add "See Symbian SDKs" link to Manage Config Dialog.
timkelly
parents: 1497
diff changeset
   272
			public void widgetSelected(SelectionEvent e) {
76b07aca4d4f bug 11547. Add "See Symbian SDKs" link to Manage Config Dialog.
timkelly
parents: 1497
diff changeset
   273
				// I don't see a way to open it to a specific tab, only the page
76b07aca4d4f bug 11547. Add "See Symbian SDKs" link to Manage Config Dialog.
timkelly
parents: 1497
diff changeset
   274
				if (Window.OK == PreferencesUtil.createPreferenceDialogOn(getShell(), "com.nokia.carbide.cpp.sdk.ui.preferences.SDKPreferencePage", null, null, 0).open()){ //$NON-NLS-1$
1931
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
   275
					try {
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
   276
						drawSDKConfigTree();
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
   277
					} catch (CoreException e1) {
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
   278
						e1.printStackTrace();
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
   279
					}
1552
76b07aca4d4f bug 11547. Add "See Symbian SDKs" link to Manage Config Dialog.
timkelly
parents: 1497
diff changeset
   280
				}
76b07aca4d4f bug 11547. Add "See Symbian SDKs" link to Manage Config Dialog.
timkelly
parents: 1497
diff changeset
   281
			}
76b07aca4d4f bug 11547. Add "See Symbian SDKs" link to Manage Config Dialog.
timkelly
parents: 1497
diff changeset
   282
		});
76b07aca4d4f bug 11547. Add "See Symbian SDKs" link to Manage Config Dialog.
timkelly
parents: 1497
diff changeset
   283
		
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   284
		PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, CarbideCPPBuilderUIHelpIds.CARBIDE_BUILDER_MANAGE_CONFIGURATIONS_DLG);
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
		return container;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   287
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   288
1931
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
   289
	private void drawSDKConfigTree() throws CoreException {
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
   290
		boolean sbsv2Project = CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(cpi.getProject());
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
   291
	
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
   292
		properSdkViewer.setContentProvider(filteringContentProviderWrapper);
1931
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
   293
		IWorkbenchWindow wbw = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
   294
		BuildTargetTreeNode[] sdkConfigTreeNodes = null;
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
   295
		if (wbw != null){
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
   296
			sdkConfigTreeNodes = BuildTargetTreeNode.getTreeViewerInput(sbsv2Project, wbw);
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
   297
		} else {
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
   298
			IStatus s = new Status(IStatus.ERROR, CarbideBuilderPlugin.PLUGIN_ID, 0, "Error retrieving workbench window. Cannot display configuration tree.", null);
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
   299
			throw new CoreException(s);
d7c1f804f316 using IRunnableContext for retrieving BuildTargetTreeNode input so progress dialog can be displayed for wizards or in the status bar when on the UI thread (e.g. ManageConfigurationsDialog)
timkelly
parents: 1913
diff changeset
   300
		}
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   301
		if (sbsv2Project){
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   302
			replaceFilteredConfigsFromProject(sdkConfigTreeNodes);
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   303
		}
1453
bd6bc4d000fd clean up SDK/Config tree by removing SDK Id from display (it's redundant) and also adding text that SDK location does not exist so users can see the config tree and know it won't work (not have it be hidden and users wonder why it's not there)
timkelly
parents: 1438
diff changeset
   304
		
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   305
		properSdkViewer.setInput(sdkConfigTreeNodes);
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
   306
		propagateSdkTree();
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
   307
		properSdkViewer.addCheckStateListener(new ICheckStateListener() {
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
   308
			public void checkStateChanged(CheckStateChangedEvent event) {
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
   309
				// Disclose the tree if the user selected the parent node
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
   310
				Object obj = event.getElement();
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
   311
				if (obj instanceof BuildTargetTreeNode){
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
   312
					BuildTargetTreeNode bttn = (BuildTargetTreeNode)obj;
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
   313
						properSdkViewer.setExpandedState(bttn, true);
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
   314
				}
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
   315
				validatePage();
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
   316
			}
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
   317
		});
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
   318
		
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
   319
	}
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1156
diff changeset
   320
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   321
	/**
1437
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   322
	 * When displaying build configs there may be configurations in the project that may not be displayed
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   323
	 * We add those back in so they reside in the checked tree viewer in case the user wants to remove them.
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   324
	 * @param sdkConfigTreeNodes
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   325
	 */
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   326
	private void replaceFilteredConfigsFromProject(BuildTargetTreeNode[] sdkConfigTreeNodes) {
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   327
		List<ICarbideBuildConfiguration> bldConfigs = cpi.getBuildConfigurations();
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   328
		
1437
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   329
		HashMap<BuildTargetTreeNode, List<ISymbianBuildContext>> missingConfigMap = new HashMap<BuildTargetTreeNode, List<ISymbianBuildContext>>();
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   330
		for (ICarbideBuildConfiguration config : bldConfigs){
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   331
			boolean foundConfig = false;
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   332
			// Add in configs that are only defined in the project and not the
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   333
			// suggested filtered config cache
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   334
			for (BuildTargetTreeNode sdkConfigNode : sdkConfigTreeNodes){
1437
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   335
				ISymbianSDK sdk = sdkConfigNode.getSymbianSDK();
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   336
				if (!sdk.getUniqueId().equals(config.getSDK().getUniqueId())){
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   337
					continue; // not in this SDK, don't bother looking at all configs
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   338
				} else {
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   339
					// Found the right SDK, now check and see if the config exists
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   340
					TreeNode[] configNodes = sdkConfigNode.getChildren();
1656
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   341
					if (configNodes != null){
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   342
						for (TreeNode childConfig : configNodes){
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   343
							if (childConfig == null){
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   344
								continue;
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   345
							}
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   346
							if (childConfig.getValue() instanceof ISymbianBuildContext){
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   347
								ISymbianBuildContext context = (ISymbianBuildContext)(childConfig.getValue());
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   348
								if (config.getBuildContext().equals(context)){
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   349
									foundConfig = true;
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   350
									break;
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   351
								}
1437
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   352
							}
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   353
						}
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   354
					}
1437
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   355
					if (!foundConfig){
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   356
						// save config off, we'll add it back in later
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   357
						List<ISymbianBuildContext> contextsToAdd = new ArrayList<ISymbianBuildContext>();
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   358
						if (null == missingConfigMap.get(sdkConfigNode)){
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   359
							contextsToAdd.add(config.getBuildContext());
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   360
						} else {
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   361
							contextsToAdd = missingConfigMap.get(sdkConfigNode);
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   362
							contextsToAdd.add(config.getBuildContext());
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   363
						}
1437
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   364
						missingConfigMap.put(sdkConfigNode, contextsToAdd);
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   365
						
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   366
					}
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   367
				}
1437
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   368
			}			
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   369
		}
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   370
		
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   371
		for (BuildTargetTreeNode sdkNode : missingConfigMap.keySet()){
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   372
			List<ISymbianBuildContext> configsToAdd = missingConfigMap.get(sdkNode);
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   373
			TreeNode[] oldConfigNodes = sdkNode.getChildren();
1656
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   374
			if (oldConfigNodes == null || oldConfigNodes.length == 0){
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   375
				continue;
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   376
			}
1437
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   377
			TreeNode[] newConfigNodes = new TreeNode[oldConfigNodes.length + configsToAdd.size()];
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   378
			int index = 0;
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   379
			// build up the old list....
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   380
			for (TreeNode newConfigNode : oldConfigNodes){
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   381
				if (newConfigNode == null){
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   382
					continue;
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   383
				}
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   384
				if (newConfigNode.getValue() instanceof ISymbianBuildContext){
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   385
					ISymbianBuildContext context = (ISymbianBuildContext)(newConfigNode.getValue());
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   386
					newConfigNodes[index++] = new TreeNode(context) {
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   387
						@Override
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   388
						public String toString() {
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   389
							ISymbianBuildContext context = (ISymbianBuildContext)getValue();
1687
faa2341135d2 Fix error message for existing configs in projects that have errors, but were filtered out by filtering prefs. Error message was left off, if there was one.
timkelly
parents: 1664
diff changeset
   390
							String sdkId = context.getSDK().getUniqueId();
faa2341135d2 Fix error message for existing configs in projects that have errors, but were filtered out by filtering prefs. Error message was left off, if there was one.
timkelly
parents: 1664
diff changeset
   391
							String newDisplayString = stripSDKIDFromConfigName(context.getDisplayString(), sdkId);
faa2341135d2 Fix error message for existing configs in projects that have errors, but were filtered out by filtering prefs. Error message was left off, if there was one.
timkelly
parents: 1664
diff changeset
   392
							if (context instanceof ISBSv2BuildContext){
faa2341135d2 Fix error message for existing configs in projects that have errors, but were filtered out by filtering prefs. Error message was left off, if there was one.
timkelly
parents: 1664
diff changeset
   393
								ISBSv2BuildContext v2Context = (ISBSv2BuildContext)context;
faa2341135d2 Fix error message for existing configs in projects that have errors, but were filtered out by filtering prefs. Error message was left off, if there was one.
timkelly
parents: 1664
diff changeset
   394
								if (v2Context.getConfigQueryData() == null){
faa2341135d2 Fix error message for existing configs in projects that have errors, but were filtered out by filtering prefs. Error message was left off, if there was one.
timkelly
parents: 1664
diff changeset
   395
									newDisplayString += " ERROR: " + "Unable to load configuration data because the query to sbs failed."; // $NON-NLS-N$
faa2341135d2 Fix error message for existing configs in projects that have errors, but were filtered out by filtering prefs. Error message was left off, if there was one.
timkelly
parents: 1664
diff changeset
   396
								}
faa2341135d2 Fix error message for existing configs in projects that have errors, but were filtered out by filtering prefs. Error message was left off, if there was one.
timkelly
parents: 1664
diff changeset
   397
								else if (v2Context.getConfigQueryData().getConfigurationErrorMessage() != null && 
faa2341135d2 Fix error message for existing configs in projects that have errors, but were filtered out by filtering prefs. Error message was left off, if there was one.
timkelly
parents: 1664
diff changeset
   398
									v2Context.getConfigQueryData().getConfigurationErrorMessage().length() > 0){
faa2341135d2 Fix error message for existing configs in projects that have errors, but were filtered out by filtering prefs. Error message was left off, if there was one.
timkelly
parents: 1664
diff changeset
   399
									newDisplayString += " ERROR: " + v2Context.getConfigQueryData().getConfigurationErrorMessage();
faa2341135d2 Fix error message for existing configs in projects that have errors, but were filtered out by filtering prefs. Error message was left off, if there was one.
timkelly
parents: 1664
diff changeset
   400
								}
faa2341135d2 Fix error message for existing configs in projects that have errors, but were filtered out by filtering prefs. Error message was left off, if there was one.
timkelly
parents: 1664
diff changeset
   401
							} 
faa2341135d2 Fix error message for existing configs in projects that have errors, but were filtered out by filtering prefs. Error message was left off, if there was one.
timkelly
parents: 1664
diff changeset
   402
							return newDisplayString;
1437
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   403
						}
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   404
					};
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   405
				}
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   406
			}
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   407
			
1437
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   408
			// ... then add the project specific items...
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   409
			for (ISymbianBuildContext newContext : configsToAdd){
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   410
				newConfigNodes[index++] = new TreeNode(newContext) {
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   411
					@Override
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   412
					public String toString() {
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   413
						ISymbianBuildContext context = (ISymbianBuildContext)getValue();
1687
faa2341135d2 Fix error message for existing configs in projects that have errors, but were filtered out by filtering prefs. Error message was left off, if there was one.
timkelly
parents: 1664
diff changeset
   414
						String sdkId = context.getSDK().getUniqueId();
faa2341135d2 Fix error message for existing configs in projects that have errors, but were filtered out by filtering prefs. Error message was left off, if there was one.
timkelly
parents: 1664
diff changeset
   415
						String newDisplayString = stripSDKIDFromConfigName(context.getDisplayString(), sdkId);
faa2341135d2 Fix error message for existing configs in projects that have errors, but were filtered out by filtering prefs. Error message was left off, if there was one.
timkelly
parents: 1664
diff changeset
   416
						if (context instanceof ISBSv2BuildContext){
faa2341135d2 Fix error message for existing configs in projects that have errors, but were filtered out by filtering prefs. Error message was left off, if there was one.
timkelly
parents: 1664
diff changeset
   417
							ISBSv2BuildContext v2Context = (ISBSv2BuildContext)context;
faa2341135d2 Fix error message for existing configs in projects that have errors, but were filtered out by filtering prefs. Error message was left off, if there was one.
timkelly
parents: 1664
diff changeset
   418
							if (v2Context.getConfigQueryData() == null){
faa2341135d2 Fix error message for existing configs in projects that have errors, but were filtered out by filtering prefs. Error message was left off, if there was one.
timkelly
parents: 1664
diff changeset
   419
								newDisplayString += " ERROR: " + "Unable to load configuration data because the query to sbs failed."; // $NON-NLS-N$
faa2341135d2 Fix error message for existing configs in projects that have errors, but were filtered out by filtering prefs. Error message was left off, if there was one.
timkelly
parents: 1664
diff changeset
   420
							}
faa2341135d2 Fix error message for existing configs in projects that have errors, but were filtered out by filtering prefs. Error message was left off, if there was one.
timkelly
parents: 1664
diff changeset
   421
							else if (v2Context.getConfigQueryData().getConfigurationErrorMessage() != null && 
faa2341135d2 Fix error message for existing configs in projects that have errors, but were filtered out by filtering prefs. Error message was left off, if there was one.
timkelly
parents: 1664
diff changeset
   422
								v2Context.getConfigQueryData().getConfigurationErrorMessage().length() > 0){
faa2341135d2 Fix error message for existing configs in projects that have errors, but were filtered out by filtering prefs. Error message was left off, if there was one.
timkelly
parents: 1664
diff changeset
   423
								newDisplayString += " ERROR: " + v2Context.getConfigQueryData().getConfigurationErrorMessage();
faa2341135d2 Fix error message for existing configs in projects that have errors, but were filtered out by filtering prefs. Error message was left off, if there was one.
timkelly
parents: 1664
diff changeset
   424
							}
faa2341135d2 Fix error message for existing configs in projects that have errors, but were filtered out by filtering prefs. Error message was left off, if there was one.
timkelly
parents: 1664
diff changeset
   425
						} 
faa2341135d2 Fix error message for existing configs in projects that have errors, but were filtered out by filtering prefs. Error message was left off, if there was one.
timkelly
parents: 1664
diff changeset
   426
						return newDisplayString;
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   427
					}
1437
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   428
				};
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   429
			}
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   430
			
1437
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   431
			sdkNode.setChildren(newConfigNodes);
8534c28043b9 clean up some code as part of displaying configs remvoed from filtering.
timkelly
parents: 1433
diff changeset
   432
			
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   433
		}
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   434
		
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   435
	}
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   436
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   437
	/**
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   438
	 * Create contents of the button bar
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   439
	 * @param parent
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   440
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   441
	@Override
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   442
	protected void createButtonsForButtonBar(Composite parent) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   443
		createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   444
				true);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   445
		createButton(parent, IDialogConstants.CANCEL_ID,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   446
				IDialogConstants.CANCEL_LABEL, false);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   447
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   448
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   449
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   450
	 * Return the initial size of the dialog
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   451
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   452
	@Override
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   453
	protected Point getInitialSize() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   454
		return new Point(650, 500);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   455
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   456
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   457
	protected boolean validatePage() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   458
		boolean isValid = false;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   459
		if (properSdkViewer.getCheckedElements().length == 0) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   460
			getButton(IDialogConstants.OK_ID).setEnabled(false);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   461
		} else {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   462
			getButton(IDialogConstants.OK_ID).setEnabled(true);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   463
			isValid = true;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   464
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   465
		return isValid;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   466
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   467
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   468
	private void propagateSdkTree(){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   469
		 List<ICarbideBuildConfiguration> buildConfigList = cpi.getBuildConfigurations();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   470
		TreeItem[] items = properSdkViewer.getTree().getItems();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   471
		for (int i=0; i<items.length; i++) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   472
			TreeNode sdkNode = (TreeNode)items[i].getData();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   473
			if (sdkNode.getValue() instanceof ISymbianSDK && sdkNode.hasChildren()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   474
				TreeNode[] configNode = sdkNode.getChildren();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   475
				for (TreeNode currConfigNode : configNode){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   476
					if (currConfigNode.getValue() instanceof ISymbianBuildContext){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   477
						// if the current config is already a config set it to checked.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   478
						ISymbianBuildContext buildContext = (ISymbianBuildContext)currConfigNode.getValue();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   479
						for (ICarbideBuildConfiguration currExistingConfig : buildConfigList){
1156
1ae1b4979954 bug 10674 continuation. Allow SBSv1-style build config names to co-exist with newer SBSv2 configuraiton names that use aliases. This does not use project converstion, just adds the support to differentiate between the two. Also, write new .cproject data to a SBSV2_DATA_ID node (which is not currently read, but to be used for future purposes)
timkelly
parents: 593
diff changeset
   480
							boolean checkIt = false;
1425
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1418
diff changeset
   481
							checkIt = currExistingConfig.getBuildContext().equals(buildContext);
1156
1ae1b4979954 bug 10674 continuation. Allow SBSv1-style build config names to co-exist with newer SBSv2 configuraiton names that use aliases. This does not use project converstion, just adds the support to differentiate between the two. Also, write new .cproject data to a SBSV2_DATA_ID node (which is not currently read, but to be used for future purposes)
timkelly
parents: 593
diff changeset
   482
							if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(cpi.getProject()) &&
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1309
diff changeset
   483
											!checkIt){
1156
1ae1b4979954 bug 10674 continuation. Allow SBSv1-style build config names to co-exist with newer SBSv2 configuraiton names that use aliases. This does not use project converstion, just adds the support to differentiate between the two. Also, write new .cproject data to a SBSV2_DATA_ID node (which is not currently read, but to be used for future purposes)
timkelly
parents: 593
diff changeset
   484
								
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1309
diff changeset
   485
								if (buildContext instanceof ISBSv2BuildContext){
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1309
diff changeset
   486
									ISBSv2BuildContext v2Context = (ISBSv2BuildContext)buildContext;
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   487
									ISBSv2BuildContext currV2Context = (ISBSv2BuildContext)currExistingConfig.getBuildContext();
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1309
diff changeset
   488
									// extra check to see if we're using SBSv2 and config display name is older SBSv1 style
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   489
									if (currV2Context.getConfigID().startsWith(ISBSv2BuildContext.BUILDER_ID)){
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   490
										if (v2Context.getConfigID().equals(currV2Context.getConfigID())	){
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   491
											checkIt = true;
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   492
										}
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   493
									}
1156
1ae1b4979954 bug 10674 continuation. Allow SBSv1-style build config names to co-exist with newer SBSv2 configuraiton names that use aliases. This does not use project converstion, just adds the support to differentiate between the two. Also, write new .cproject data to a SBSV2_DATA_ID node (which is not currently read, but to be used for future purposes)
timkelly
parents: 593
diff changeset
   494
								}
1ae1b4979954 bug 10674 continuation. Allow SBSv1-style build config names to co-exist with newer SBSv2 configuraiton names that use aliases. This does not use project converstion, just adds the support to differentiate between the two. Also, write new .cproject data to a SBSV2_DATA_ID node (which is not currently read, but to be used for future purposes)
timkelly
parents: 593
diff changeset
   495
							}
1ae1b4979954 bug 10674 continuation. Allow SBSv1-style build config names to co-exist with newer SBSv2 configuraiton names that use aliases. This does not use project converstion, just adds the support to differentiate between the two. Also, write new .cproject data to a SBSV2_DATA_ID node (which is not currently read, but to be used for future purposes)
timkelly
parents: 593
diff changeset
   496
							if (checkIt){
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   497
								// must expand parent before checking, otherwise, we won't succeed
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   498
								properSdkViewer.setExpandedState(sdkNode, true);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   499
								properSdkViewer.setChecked(currConfigNode, true);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   500
								break;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   501
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   502
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   503
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   504
				}				
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   505
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   506
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   507
		properSdkViewer.refresh();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   508
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   509
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   510
	private void saveConfigurations(){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   511
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   512
		// get the modifier
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   513
		ICarbideProjectModifier cpm = CarbideBuilderPlugin.getBuildManager().getProjectModifier(cpi.getProject());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   514
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   515
		// First go through all the checked tree items and add any configurations that are checked that don't already exist
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   516
		Object[] checkedElements = properSdkViewer.getCheckedElements();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   517
		//List<ICarbideBuildConfiguration> buildConfigList = new ArrayList<ICarbideBuildConfiguration>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   518
		List<ICarbideBuildConfiguration> buildConfigList  = cpm.getBuildConfigurations();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   519
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   520
		for (Object obj : checkedElements){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   521
			TreeNode node = (TreeNode)obj;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   522
			boolean configAlreadyExists = false;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   523
			if (node.getValue() instanceof ISymbianBuildContext) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   524
				ISymbianBuildContext context = (ISymbianBuildContext)node.getValue();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   525
				// Now check to see if the config already exists, if not create a new one
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   526
				for (ICarbideBuildConfiguration currExistingConfig : buildConfigList){
1425
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1418
diff changeset
   527
					if (currExistingConfig.getBuildContext().equals(context)){
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   528
						configAlreadyExists = true;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   529
						break;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   530
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   531
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   532
				
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   533
				if (!configAlreadyExists){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   534
					cpm.createNewConfiguration(context, false);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   535
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   536
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   537
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   538
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   539
		// Now check for good SDK configurations we need to remove. We need to be very careful here because a user may have a configuration
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   540
		// in the .settings but it may not actually appear in the tree view because the SDK is currently invalid or the license expired
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   541
		// so we cannot delete these.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   542
		buildConfigList = cpm.getBuildConfigurations(); // get the list again as we may have added to it
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   543
		Iterator<ICarbideBuildConfiguration> configListIter = buildConfigList.iterator();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   544
		while(configListIter.hasNext()){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   545
			ICarbideBuildConfiguration currExistingConfig = configListIter.next();	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   546
			TreeItem[] items = properSdkViewer.getTree().getItems();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   547
			for (TreeItem currTreeItem : items) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   548
				TreeNode sdkNode = (TreeNode)currTreeItem.getData();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   549
				if (sdkNode.getValue() instanceof ISymbianSDK) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   550
					TreeNode[] configNode = sdkNode.getChildren();
1656
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   551
					if (configNode != null){
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   552
						for (TreeNode currConfigNode : configNode){
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   553
							if (currConfigNode.getValue() instanceof ISymbianBuildContext){
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   554
								// if the current config is already a config set it to checked.
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   555
								ISymbianBuildContext buildContext = (ISymbianBuildContext)currConfigNode.getValue();
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   556
								if (currExistingConfig.getBuildContext().equals(buildContext)){
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   557
									// The configuration is in both the tree viewer and the .settings
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   558
									// Now find out if it's checked. If it's not checked remove it
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   559
									if (!properSdkViewer.getChecked(currConfigNode)){
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   560
										ICarbideBuildConfiguration config = cpm.getNamedConfiguration(buildContext.getDisplayString());
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   561
										if (config == null){
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   562
											config = cpm.getNamedConfiguration(currExistingConfig.getDisplayString());
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   563
										}
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   564
										if (config != null){
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   565
											cpm.deleteConfiguration(config);
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   566
											break;
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   567
										}
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   568
										
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   569
									} 
d1edeecb12af make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
timkelly
parents: 1552
diff changeset
   570
								}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   571
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   572
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   573
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   574
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   575
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   576
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   577
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   578
		// now apply any changes
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   579
		cpm.saveChanges();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   580
	}
1664
65c3d72a8793 fix some config refresh issues with SDK/Config tree management. Fixed some issues with showing proper configs re: SBSv2 config filtering prefs.
timkelly
parents: 1656
diff changeset
   581
	
65c3d72a8793 fix some config refresh issues with SDK/Config tree management. Fixed some issues with showing proper configs re: SBSv2 config filtering prefs.
timkelly
parents: 1656
diff changeset
   582
	private static String stripSDKIDFromConfigName(String configName, String sdkID){
65c3d72a8793 fix some config refresh issues with SDK/Config tree management. Fixed some issues with showing proper configs re: SBSv2 config filtering prefs.
timkelly
parents: 1656
diff changeset
   583
		return configName.replace("[" + sdkID + "]", "");
65c3d72a8793 fix some config refresh issues with SDK/Config tree management. Fixed some issues with showing proper configs re: SBSv2 config filtering prefs.
timkelly
parents: 1656
diff changeset
   584
	}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   585
1664
65c3d72a8793 fix some config refresh issues with SDK/Config tree management. Fixed some issues with showing proper configs re: SBSv2 config filtering prefs.
timkelly
parents: 1656
diff changeset
   586
	
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   587
}