1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 package com.nokia.carbide.cdt.internal.builder.ui; |
|
18 |
|
19 import java.io.File; |
|
20 |
|
21 import org.eclipse.swt.SWT; |
|
22 import org.eclipse.swt.events.KeyEvent; |
|
23 import org.eclipse.swt.events.KeyListener; |
|
24 import org.eclipse.swt.events.SelectionListener; |
|
25 import org.eclipse.swt.layout.GridData; |
|
26 import org.eclipse.swt.layout.GridLayout; |
|
27 import org.eclipse.swt.widgets.Composite; |
|
28 import org.eclipse.swt.widgets.Group; |
|
29 import org.eclipse.swt.widgets.Label; |
|
30 import org.eclipse.swt.widgets.TabItem; |
|
31 import org.eclipse.swt.widgets.Text; |
|
32 |
|
33 import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; |
|
34 import com.nokia.carbide.cdt.internal.builder.CarbideBuildConfiguration; |
|
35 import com.nokia.carbide.cdt.internal.builder.ISBSv2BuildConfigInfo; |
|
36 import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils; |
|
37 import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; |
|
38 |
|
39 public class SBSv2BuildConfigTabComposite extends Composite { |
|
40 |
|
41 private static final String configCmdLabelPrefixText = "Configuration Command: -c "; // $NON-NLS-N$ |
|
42 private static final String releaseTreeLabelPrefixText = "Release Tree: "; // $NON-NLS-N$ |
|
43 |
|
44 Text variantEdit; |
|
45 |
|
46 Label configCmdLabel; |
|
47 Label releaseTreeLabel; |
|
48 private ICarbideBuildConfiguration config; |
|
49 |
|
50 public SBSv2BuildConfigTabComposite(TabItem tabItem) { |
|
51 super(tabItem.getParent(), SWT.NONE); |
|
52 } |
|
53 |
|
54 public void createControls() { |
|
55 setLayout(new GridLayout(2, false)); |
|
56 |
|
57 Label variantLabel = new Label(this, SWT.NONE); |
|
58 variantLabel.setText(Messages.getString("CarbideSBSv2ConfigTab.VariantLabel")); //$NON-NLS-1$ |
|
59 variantLabel.setToolTipText(Messages.getString("CarbideSBSv2ConfigTab.VariantLabel_ToolTip")); //$NON-NLS-1$ |
|
60 |
|
61 variantEdit = new Text(this, SWT.BORDER); |
|
62 variantEdit.setToolTipText(Messages.getString("CarbideSBSv2ConfigTab.VariantLabel_ToolTip")); //$NON-NLS-1$ |
|
63 variantEdit.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); |
|
64 SelectionListener listener; |
|
65 variantEdit.addKeyListener( new KeyListener() { |
|
66 |
|
67 public void keyReleased(KeyEvent e) { |
|
68 setVaraintDetailsText(); |
|
69 } |
|
70 |
|
71 public void keyPressed(KeyEvent e) { |
|
72 // ignore |
|
73 } |
|
74 }); |
|
75 |
|
76 Group emulatorBuildOptionsGroup; |
|
77 emulatorBuildOptionsGroup = new Group(this, SWT.NONE); |
|
78 emulatorBuildOptionsGroup.setLayout(new GridLayout(1, false)); |
|
79 GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1); |
|
80 emulatorBuildOptionsGroup.setLayoutData(gd); |
|
81 emulatorBuildOptionsGroup.setText("Build Variant Details"); //$NON-NLS-1$ |
|
82 |
|
83 configCmdLabel = new Label(emulatorBuildOptionsGroup, SWT.CHECK); |
|
84 configCmdLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); |
|
85 releaseTreeLabel = new Label(emulatorBuildOptionsGroup, SWT.CHECK); |
|
86 releaseTreeLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); |
|
87 } |
|
88 |
|
89 public void initData(ICarbideBuildConfiguration buildConfig) { |
|
90 this.config = buildConfig; |
|
91 ISBSv2BuildConfigInfo sbsv2ConfigInfo = ((CarbideBuildConfiguration)buildConfig).getSBSv2ConfigInfo(); |
|
92 if (sbsv2ConfigInfo != null && sbsv2ConfigInfo.getSBSv2Setting(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT) != null){ |
|
93 variantEdit.setText(sbsv2ConfigInfo.getSBSv2Setting(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT)); |
|
94 } else { |
|
95 variantEdit.setText(""); |
|
96 } |
|
97 |
|
98 setVaraintDetailsText(); |
|
99 } |
|
100 |
|
101 private void setVaraintDetailsText() { |
|
102 |
|
103 String configCmdText = configCmdLabelPrefixText; |
|
104 if (config != null){ |
|
105 if (config.getSBSv2Alias() == null){ |
|
106 configCmdText += config.getPlatformString().toLowerCase() + "_" + config.getTargetString().toLowerCase() + variantEdit.getText(); |
|
107 } else { |
|
108 configCmdText += config.getSBSv2Alias() + variantEdit.getText(); |
|
109 } |
|
110 } |
|
111 configCmdLabel.setText(configCmdText); |
|
112 |
|
113 String variantText = SBSv2Utils.getVariantOutputDirModifier(variantEdit.getText()); |
|
114 if (variantText == null) variantText = ""; |
|
115 String relTreeText = releaseTreeLabelPrefixText; |
|
116 if (config != null){ |
|
117 relTreeText += " " + config.getSDK().getEPOCROOT() + "epoc32" + File.separator + "release" + File.separator + config.getPlatformString().toLowerCase() + variantText + File.separator + config.getTargetString().toLowerCase(); |
|
118 } |
|
119 releaseTreeLabel.setText(relTreeText); |
|
120 } |
|
121 |
|
122 |
|
123 |
|
124 public boolean compareConfigurationSettings(ICarbideBuildConfiguration selectedConfig, boolean writeToConfig) { |
|
125 boolean settingsEqual = true; |
|
126 |
|
127 ISBSv2BuildConfigInfo currSBSv2Info = ((CarbideBuildConfiguration)selectedConfig).getSBSv2ConfigInfo(); |
|
128 if (currSBSv2Info != null){ |
|
129 settingsEqual = currSBSv2Info.getSBSv2Setting(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT).equals(variantEdit.getText()); |
|
130 |
|
131 if (!settingsEqual && writeToConfig) { |
|
132 currSBSv2Info.setSBSv2Setting(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT, variantEdit.getText()); |
|
133 } |
|
134 } |
|
135 |
|
136 return settingsEqual; |
|
137 } |
|
138 |
|
139 public void performDefaults(ISymbianSDK sdk) { |
|
140 variantEdit.setText(""); |
|
141 } |
|
142 } |
|