core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKPreferencePage.java
equal
deleted
inserted
replaced
36 import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent; |
36 import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent; |
37 import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy; |
37 import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy; |
38 import org.eclipse.jface.viewers.EditingSupport; |
38 import org.eclipse.jface.viewers.EditingSupport; |
39 import org.eclipse.jface.viewers.ISelectionChangedListener; |
39 import org.eclipse.jface.viewers.ISelectionChangedListener; |
40 import org.eclipse.jface.viewers.IStructuredSelection; |
40 import org.eclipse.jface.viewers.IStructuredSelection; |
|
41 import org.eclipse.jface.viewers.ITableColorProvider; |
41 import org.eclipse.jface.viewers.ITableLabelProvider; |
42 import org.eclipse.jface.viewers.ITableLabelProvider; |
42 import org.eclipse.jface.viewers.LabelProvider; |
43 import org.eclipse.jface.viewers.LabelProvider; |
43 import org.eclipse.jface.viewers.SelectionChangedEvent; |
44 import org.eclipse.jface.viewers.SelectionChangedEvent; |
44 import org.eclipse.jface.viewers.StructuredSelection; |
45 import org.eclipse.jface.viewers.StructuredSelection; |
45 import org.eclipse.jface.viewers.TableViewerColumn; |
46 import org.eclipse.jface.viewers.TableViewerColumn; |
80 |
81 |
81 public class SDKPreferencePage |
82 public class SDKPreferencePage |
82 extends PreferencePage |
83 extends PreferencePage |
83 implements IWorkbenchPreferencePage { |
84 implements IWorkbenchPreferencePage { |
84 |
85 |
85 private class SDKLabelProvider extends LabelProvider implements ITableLabelProvider { |
86 private class SDKLabelProvider extends LabelProvider implements ITableLabelProvider, ITableColorProvider { |
86 public Image getColumnImage(Object element, int columnIndex) { |
87 public Image getColumnImage(Object element, int columnIndex) { |
87 return null; |
88 return null; |
88 } |
89 } |
89 |
90 |
90 public String getColumnText(Object element, int columnIndex) { |
91 public String getColumnText(Object element, int columnIndex) { |
95 case 2: |
96 case 2: |
96 return sdk.getEPOCROOT(); |
97 return sdk.getEPOCROOT(); |
97 default: |
98 default: |
98 return ""; |
99 return ""; |
99 } |
100 } |
|
101 } |
|
102 |
|
103 public Color getForeground(Object element, int columnIndex) { |
|
104 ISymbianSDK sdk = (ISymbianSDK) element; |
|
105 return updateSDKcolor(sdk); |
|
106 } |
|
107 |
|
108 public Color getBackground(Object element, int columnIndex) { |
|
109 return white; |
100 } |
110 } |
101 } |
111 } |
102 |
112 |
103 private class IdEditingSupport extends EditingSupport { |
113 private class IdEditingSupport extends EditingSupport { |
104 private TextCellEditor editor; |
114 private TextCellEditor editor; |
250 private Button scanForNewPluginsButton; |
260 private Button scanForNewPluginsButton; |
251 private Button rescanButton; |
261 private Button rescanButton; |
252 private Label iconLabel; |
262 private Label iconLabel; |
253 private Label statusLabel; |
263 private Label statusLabel; |
254 |
264 |
255 private Color red; |
|
256 private Color black; |
265 private Color black; |
257 private Color gray; |
266 private Color gray; |
|
267 private Color red; |
|
268 private Color white; |
258 |
269 |
259 /** |
270 /** |
260 * Constructor. |
271 * Constructor. |
261 */ |
272 */ |
262 public SDKPreferencePage() { |
273 public SDKPreferencePage() { |
337 */ |
348 */ |
338 @Override |
349 @Override |
339 protected Control createContents(Composite parent) { |
350 protected Control createContents(Composite parent) { |
340 // Set up colors used in this preference page |
351 // Set up colors used in this preference page |
341 Shell shell = parent.getShell(); |
352 Shell shell = parent.getShell(); |
342 red = shell.getDisplay().getSystemColor(SWT.COLOR_RED); |
|
343 black = shell.getDisplay().getSystemColor(SWT.COLOR_BLACK); |
353 black = shell.getDisplay().getSystemColor(SWT.COLOR_BLACK); |
344 gray = shell.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND); |
354 gray = shell.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND); |
|
355 red = shell.getDisplay().getSystemColor(SWT.COLOR_RED); |
|
356 white = shell.getDisplay().getSystemColor(SWT.COLOR_WHITE); |
345 |
357 |
346 Composite content = new Composite(parent, SWT.NONE); |
358 Composite content = new Composite(parent, SWT.NONE); |
347 GridLayout gridLayout = new GridLayout(); |
359 GridLayout gridLayout = new GridLayout(); |
348 gridLayout.numColumns = 2; |
360 gridLayout.numColumns = 2; |
349 content.setLayout(gridLayout); |
361 content.setLayout(gridLayout); |
634 statusLabel.setBackground(gray); |
646 statusLabel.setBackground(gray); |
635 statusLabel.update(); |
647 statusLabel.update(); |
636 statusLabel.getParent().layout(true); |
648 statusLabel.getParent().layout(true); |
637 } |
649 } |
638 |
650 |
|
651 private Color updateSDKcolor(ISymbianSDK sdk){ |
|
652 Color color = black; |
|
653 |
|
654 // Check SDK EPOCROOT |
|
655 String epocRootStr = sdk.getEPOCROOT(); |
|
656 IPath epocRoot = new Path(epocRootStr); |
|
657 epocRoot = epocRoot.append("epoc32"); |
|
658 File epocRootFile = epocRoot.toFile(); |
|
659 if (!epocRootFile.exists()) { |
|
660 color = red; |
|
661 } |
|
662 |
|
663 // Check SDK OS Version |
|
664 if ((sdk.getOSVersion().getMajor() < 9 || |
|
665 (sdk.getOSVersion().getMajor() == 9 && sdk.getOSVersion().getMinor() < 4))) { |
|
666 color = red; |
|
667 } |
|
668 |
|
669 return color; |
|
670 } |
|
671 |
639 private void updateSDKStatus(ISymbianSDK sdk){ |
672 private void updateSDKStatus(ISymbianSDK sdk){ |
640 // No SDK selected |
673 // No SDK selected |
641 if (sdk == null) { |
674 if (sdk == null) { |
642 statusWarning(Messages.getString("SDKPreferencePage.No_SDKs_Available_Message")); //$NON-NLS-1$ |
675 statusWarning(Messages.getString("SDKPreferencePage.No_SDKs_Available_Message")); //$NON-NLS-1$ |
643 return; |
676 return; |