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 |
11 * or implied. See the License for the specific language governing permissions a
nd limitations under | 11 * or implied. See the License for the specific language governing permissions a
nd limitations under |
12 * the License. | 12 * the License. |
13 */ | 13 */ |
14 package com.google.dart.tools.debug.core; | 14 package com.google.dart.tools.debug.core; |
15 | 15 |
16 import com.google.dart.tools.core.DartCore; | |
17 import com.google.dart.tools.core.DartCoreDebug; | 16 import com.google.dart.tools.core.DartCoreDebug; |
18 import com.google.dart.tools.core.utilities.general.StringUtilities; | 17 import com.google.dart.tools.core.utilities.general.StringUtilities; |
19 import com.google.dart.tools.debug.core.pubserve.PubServeLaunchConfigurationDele
gate; | 18 import com.google.dart.tools.debug.core.pubserve.PubServeLaunchConfigurationDele
gate; |
20 import com.google.dart.tools.debug.core.pubserve.PubServeManager; | 19 import com.google.dart.tools.debug.core.pubserve.PubServeManager; |
21 import com.google.dart.tools.debug.core.util.BrowserManager; | 20 import com.google.dart.tools.debug.core.util.BrowserManager; |
22 import com.google.dart.tools.debug.core.util.ResourceChangeManager; | 21 import com.google.dart.tools.debug.core.util.ResourceChangeManager; |
23 import com.google.dart.tools.debug.core.util.ResourceServerManager; | 22 import com.google.dart.tools.debug.core.util.ResourceServerManager; |
24 | 23 |
25 import org.eclipse.core.resources.IFile; | |
26 import org.eclipse.core.resources.IProject; | |
27 import org.eclipse.core.runtime.IStatus; | 24 import org.eclipse.core.runtime.IStatus; |
28 import org.eclipse.core.runtime.Plugin; | 25 import org.eclipse.core.runtime.Plugin; |
29 import org.eclipse.core.runtime.Status; | 26 import org.eclipse.core.runtime.Status; |
30 import org.eclipse.core.runtime.preferences.IEclipsePreferences; | 27 import org.eclipse.core.runtime.preferences.IEclipsePreferences; |
31 import org.eclipse.core.runtime.preferences.InstanceScope; | 28 import org.eclipse.core.runtime.preferences.InstanceScope; |
32 import org.eclipse.debug.core.DebugEvent; | 29 import org.eclipse.debug.core.DebugEvent; |
33 import org.eclipse.debug.core.DebugPlugin; | 30 import org.eclipse.debug.core.DebugPlugin; |
34 import org.eclipse.debug.core.IDebugEventSetListener; | 31 import org.eclipse.debug.core.IDebugEventSetListener; |
35 import org.eclipse.debug.core.ILaunchConfiguration; | |
36 import org.osgi.framework.BundleContext; | 32 import org.osgi.framework.BundleContext; |
37 import org.osgi.service.prefs.BackingStoreException; | 33 import org.osgi.service.prefs.BackingStoreException; |
38 | 34 |
39 import java.io.IOException; | 35 import java.io.IOException; |
40 | 36 |
41 /** | 37 /** |
42 * The plugin activator for the com.google.dart.tools.debug.core plugin. | 38 * The plugin activator for the com.google.dart.tools.debug.core plugin. |
43 */ | 39 */ |
44 public class DartDebugCorePlugin extends Plugin { | 40 public class DartDebugCorePlugin extends Plugin { |
45 | 41 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 public static final String PREFS_BREAK_ON_EXCEPTIONS = "breakOnExceptions"; | 102 public static final String PREFS_BREAK_ON_EXCEPTIONS = "breakOnExceptions"; |
107 | 103 |
108 public static final String PREFS_SHOW_RUN_RESUME_DIALOG = "showRunResumeDialog
"; | 104 public static final String PREFS_SHOW_RUN_RESUME_DIALOG = "showRunResumeDialog
"; |
109 | 105 |
110 // TODO(keertip): preference used to clear manage launches dialog settings, re
move before M6 | 106 // TODO(keertip): preference used to clear manage launches dialog settings, re
move before M6 |
111 private static final String PREFS_CLEAR_LAUNCHES_DIALOG_SETTINGS = "launchesDi
alogSettings"; | 107 private static final String PREFS_CLEAR_LAUNCHES_DIALOG_SETTINGS = "launchesDi
alogSettings"; |
112 | 108 |
113 private static long loggingStart = System.currentTimeMillis(); | 109 private static long loggingStart = System.currentTimeMillis(); |
114 | 110 |
115 /** | 111 /** |
116 * Returns true if the given launch config can be launched w/o waiting on the
builder. | |
117 */ | |
118 public static boolean canFastLaunch(ILaunchConfiguration config) { | |
119 DartLaunchConfigWrapper wrapper = new DartLaunchConfigWrapper(config); | |
120 IProject project = wrapper.getProject(); | |
121 | |
122 if (project == null) { | |
123 return false; | |
124 } | |
125 | |
126 // if pubspec.yaml is not up-to-date, return false | |
127 IFile pubspecYamlFile = project.getFile(DartCore.PUBSPEC_FILE_NAME); | |
128 | |
129 if (pubspecYamlFile.exists()) { | |
130 IFile pubspecLockFile = project.getFile(DartCore.PUBSPEC_LOCK_FILE_NAME); | |
131 | |
132 if (!pubspecLockFile.exists()) { | |
133 return false; | |
134 } | |
135 | |
136 if (pubspecLockFile.getModificationStamp() < pubspecYamlFile.getModificati
onStamp()) { | |
137 return false; | |
138 } | |
139 } | |
140 | |
141 // no build.dart (though we can optimize this in the future) | |
142 if (project.getFile(DartCore.BUILD_DART_FILE_NAME).exists()) { | |
143 return false; | |
144 } | |
145 | |
146 return true; | |
147 } | |
148 | |
149 /** | |
150 * Create a Status object with the given message and this plugin's ID. | 112 * Create a Status object with the given message and this plugin's ID. |
151 * | 113 * |
152 * @param message | 114 * @param message |
153 * @return | 115 * @return |
154 */ | 116 */ |
155 public static Status createErrorStatus(String message) { | 117 public static Status createErrorStatus(String message) { |
156 return new Status(IStatus.ERROR, PLUGIN_ID, message); | 118 return new Status(IStatus.ERROR, PLUGIN_ID, message); |
157 } | 119 } |
158 | 120 |
159 /** | 121 /** |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 | 398 |
437 debugEventListener = null; | 399 debugEventListener = null; |
438 } | 400 } |
439 | 401 |
440 super.stop(context); | 402 super.stop(context); |
441 | 403 |
442 plugin = null; | 404 plugin = null; |
443 } | 405 } |
444 | 406 |
445 } | 407 } |
OLD | NEW |