|
Lines 10-27
Link Here
|
| 10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
| 11 |
package org.eclipse.wst.server.core.internal; |
11 |
package org.eclipse.wst.server.core.internal; |
| 12 |
|
12 |
|
| 13 |
import java.io.*; |
13 |
import java.io.File; |
| 14 |
import java.util.*; |
|
|
| 15 |
import java.text.DateFormat; |
14 |
import java.text.DateFormat; |
|
|
15 |
import java.util.*; |
| 16 |
|
16 |
|
| 17 |
import org.eclipse.core.resources.IProject; |
17 |
import org.eclipse.core.resources.IProject; |
| 18 |
import org.eclipse.core.runtime.*; |
18 |
import org.eclipse.core.runtime.*; |
| 19 |
import org.eclipse.core.runtime.jobs.Job; |
19 |
import org.eclipse.core.runtime.jobs.Job; |
| 20 |
import org.eclipse.osgi.util.NLS; |
20 |
import org.eclipse.osgi.util.NLS; |
| 21 |
import org.eclipse.wst.server.core.*; |
21 |
import org.eclipse.wst.server.core.*; |
| 22 |
import org.osgi.framework.BundleContext; |
22 |
import org.osgi.framework.*; |
| 23 |
import org.osgi.framework.BundleEvent; |
|
|
| 24 |
import org.osgi.framework.BundleListener; |
| 25 |
/** |
23 |
/** |
| 26 |
* The main server plugin class. |
24 |
* The main server plugin class. |
| 27 |
*/ |
25 |
*/ |
|
Lines 69-74
Link Here
|
| 69 |
// cached copy of all installable runtimes |
67 |
// cached copy of all installable runtimes |
| 70 |
private static List<IInstallableRuntime> installableRuntimes; |
68 |
private static List<IInstallableRuntime> installableRuntimes; |
| 71 |
|
69 |
|
|
|
70 |
// cached copy of SaveEditorPrompter |
| 71 |
private static SaveEditorPrompter saveEditorPrompter; |
| 72 |
|
| 73 |
// cached copy of isRunningInGUICache |
| 74 |
public static boolean isRunningInGUICache = false; |
| 75 |
|
| 72 |
// registry listener |
76 |
// registry listener |
| 73 |
private static IRegistryChangeListener registryListener; |
77 |
private static IRegistryChangeListener registryListener; |
| 74 |
|
78 |
|
|
Lines 1282-1285
Link Here
|
| 1282 |
return Platform.getProduct().getProperty(key); |
1286 |
return Platform.getProduct().getProperty(key); |
| 1283 |
return value; |
1287 |
return value; |
| 1284 |
} |
1288 |
} |
|
|
1289 |
|
| 1290 |
public static boolean isRunningGUIMode(){ |
| 1291 |
// check only when the the plugin is not Bundle.ACTIVE |
| 1292 |
if (isRunningInGUICache == true){ |
| 1293 |
return isRunningInGUICache; |
| 1294 |
} |
| 1295 |
|
| 1296 |
Bundle swtEclipseUIbndl = Platform.getBundle("org.eclipse.ui"); //running in GUI mode if it is active. |
| 1297 |
if(swtEclipseUIbndl != null){ |
| 1298 |
isRunningInGUICache= (swtEclipseUIbndl.getState() == Bundle.ACTIVE); |
| 1299 |
return isRunningInGUICache; |
| 1300 |
} |
| 1301 |
return false; |
| 1302 |
} |
| 1303 |
|
| 1304 |
|
| 1305 |
/** |
| 1306 |
* Transfer the control to the UI and prompts to save all the editors |
| 1307 |
*/ |
| 1308 |
public static SaveEditorPrompter getSaveEditorHelper() { |
| 1309 |
loadSaveEditorExtension(); |
| 1310 |
return saveEditorPrompter; |
| 1311 |
} |
| 1312 |
|
| 1313 |
private static void loadSaveEditorExtension() { |
| 1314 |
if (saveEditorPrompter != null) |
| 1315 |
return; |
| 1316 |
Trace.trace(Trace.EXTENSION_POINT, "->- Loading .saveEditorPrompter extension point ->-"); |
| 1317 |
|
| 1318 |
IExtensionRegistry registry = Platform.getExtensionRegistry(); |
| 1319 |
IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerPlugin.PLUGIN_ID, "saveEditorPrompter"); |
| 1320 |
|
| 1321 |
int size = cf.length; |
| 1322 |
try{ |
| 1323 |
saveEditorPrompter = (SaveEditorPrompter)cf[0].createExecutableExtension("class"); |
| 1324 |
Trace.trace(Trace.EXTENSION_POINT, " Loaded saveEditorPrompter: " + cf[0].getAttribute("id")); |
| 1325 |
} catch (CoreException ce){ |
| 1326 |
Trace.trace(Trace.SEVERE, " Could not load saveEditorPrompter: " + cf[0].getAttribute("id"), ce); |
| 1327 |
} |
| 1328 |
if (size < 1) { |
| 1329 |
Trace.trace(Trace.WARNING, " More than one .saveEditorPrompter found, only one loaded =>"+ cf[0].getAttribute("id")); |
| 1330 |
} |
| 1331 |
|
| 1332 |
Trace.trace(Trace.EXTENSION_POINT, "-<- Done loading .saveEditorPrompter extension point -<-"); |
| 1333 |
|
| 1334 |
} |
| 1335 |
|
| 1336 |
|
| 1285 |
} |
1337 |
} |