OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012, the Dart project authors. | 2 * Copyright (c) 2012, the Dart project authors. |
3 * | 3 * |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
6 * | 6 * |
7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
8 * | 8 * |
9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
(...skipping 20 matching lines...) Expand all Loading... |
31 import org.eclipse.ui.IWorkbench; | 31 import org.eclipse.ui.IWorkbench; |
32 import org.eclipse.ui.IWorkbenchPreferencePage; | 32 import org.eclipse.ui.IWorkbenchPreferencePage; |
33 | 33 |
34 /** | 34 /** |
35 * The preference page for update. | 35 * The preference page for update. |
36 */ | 36 */ |
37 public class UpdatePreferencePage extends PreferencePage implements IWorkbenchPr
eferencePage { | 37 public class UpdatePreferencePage extends PreferencePage implements IWorkbenchPr
eferencePage { |
38 | 38 |
39 public static final String PAGE_ID = "com.google.dart.tools.ui.update.updatePr
eferencePage"; //$NON-NLS-1$ | 39 public static final String PAGE_ID = "com.google.dart.tools.ui.update.updatePr
eferencePage"; //$NON-NLS-1$ |
40 | 40 |
| 41 private static String getChannelLabel() { |
| 42 //TODO (pquitslund): move to UpdateUtils |
| 43 String updateUrl = UpdateCore.getUpdateUrl(); |
| 44 if (updateUrl != null) { |
| 45 if (updateUrl.contains("/channels/be/")) { |
| 46 return "(BLEEDING EDGE) "; |
| 47 } |
| 48 if (updateUrl.contains("/channels/dev/")) { |
| 49 return "(DEV) "; |
| 50 } |
| 51 if (updateUrl.contains("/channels/stable/")) { |
| 52 return "(STABLE) "; |
| 53 } |
| 54 } |
| 55 //Fall through |
| 56 return ""; |
| 57 } |
| 58 |
41 private Button autoDownloadCheck; | 59 private Button autoDownloadCheck; |
| 60 |
42 private Group statusGroup; | 61 private Group statusGroup; |
43 | 62 |
44 @Override | 63 @Override |
45 public void init(IWorkbench workbench) { | 64 public void init(IWorkbench workbench) { |
46 noDefaultAndApplyButton(); | 65 noDefaultAndApplyButton(); |
47 } | 66 } |
48 | 67 |
49 @Override | 68 @Override |
50 public boolean performOk() { | 69 public boolean performOk() { |
51 | 70 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 PreferencesMessages.DartBasePreferencePage_auto_download_tooltip); | 109 PreferencesMessages.DartBasePreferencePage_auto_download_tooltip); |
91 GridDataFactory.fillDefaults().applyTo(autoDownloadCheck); | 110 GridDataFactory.fillDefaults().applyTo(autoDownloadCheck); |
92 | 111 |
93 statusGroup = new Group(composite, SWT.NONE); | 112 statusGroup = new Group(composite, SWT.NONE); |
94 statusGroup.setText("Update"); //$NON-NLS-1$ | 113 statusGroup.setText("Update"); //$NON-NLS-1$ |
95 GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.BEGINNI
NG).applyTo( | 114 GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.BEGINNI
NG).applyTo( |
96 statusGroup); | 115 statusGroup); |
97 GridLayoutFactory.fillDefaults().numColumns(1).margins(8, 8).applyTo(statusG
roup); | 116 GridLayoutFactory.fillDefaults().numColumns(1).margins(8, 8).applyTo(statusG
roup); |
98 | 117 |
99 CLabel currentVersionLabel = new CLabel(statusGroup, SWT.NONE); | 118 CLabel currentVersionLabel = new CLabel(statusGroup, SWT.NONE); |
100 currentVersionLabel.setText(NLS.bind("Dart Editor build {0}", UpdateCore.get
CurrentRevision())); | 119 currentVersionLabel.setText(NLS.bind( |
| 120 "Dart Editor " + getChannelLabel() + "build {0}", |
| 121 UpdateCore.getCurrentRevision())); |
101 GridDataFactory.fillDefaults().applyTo(currentVersionLabel); | 122 GridDataFactory.fillDefaults().applyTo(currentVersionLabel); |
102 | 123 |
103 new UpdateStatusControl(statusGroup, null, new Point(0, 0), false); | 124 new UpdateStatusControl(statusGroup, null, new Point(0, 0), false); |
104 } | 125 } |
105 | 126 |
106 private void initFromPrefs() { | 127 private void initFromPrefs() { |
107 autoDownloadCheck.setSelection(UpdateCore.isAutoDownloadEnabled()); | 128 autoDownloadCheck.setSelection(UpdateCore.isAutoDownloadEnabled()); |
108 } | 129 } |
109 | 130 |
110 } | 131 } |
OLD | NEW |