Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 181881 Details for
Bug 328067
Deadlock during debugging
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
v1.0
327247.32M.patch (text/plain), 17.57 KB, created by
Angel Vera
on 2010-10-27 16:45:40 EDT
(
hide
)
Description:
v1.0
Filename:
MIME Type:
Creator:
Angel Vera
Created:
2010-10-27 16:45:40 EDT
Size:
17.57 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.wst.server.core >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/webtools/servertools/plugins/org.eclipse.wst.server.core/plugin.properties,v >retrieving revision 1.29 >diff -u -r1.29 plugin.properties >--- plugin.properties 11 May 2010 15:21:20 -0000 1.29 >+++ plugin.properties 15 Oct 2010 18:18:44 -0000 >@@ -29,6 +29,7 @@ > extensionPointServerMonitors=Server Monitors > extensionPointInstallableServers=Installable Servers > extensionPointInstallableRuntimes=Installable Runtimes >+extensionPointSaveEditorPrompter=Save Editor Prompter > > extensionPointRuntimeFacetComponentProviders=Runtime Facet Component Providers > >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/webtools/servertools/plugins/org.eclipse.wst.server.core/plugin.xml,v >retrieving revision 1.22.2.1 >diff -u -r1.22.2.1 plugin.xml >--- plugin.xml 8 Sep 2010 17:37:50 -0000 1.22.2.1 >+++ plugin.xml 15 Oct 2010 18:18:44 -0000 >@@ -20,6 +20,7 @@ > <extension-point id="installableRuntimes" name="%extensionPointInstallableRuntimes" schema="schema/installableRuntimes.exsd"/> > <extension-point id="runtimeFacetComponentProviders" name="%extensionPointRuntimeFacetComponentProviders" schema="schema/runtimeFacetComponentProviders.exsd"/> > <extension-point id="runtimeModuleType" name="%runtimeModuleType" schema="schema/runtimeModuleType.exsd"/> >+ <extension-point id="saveEditorPrompter" name="%extensionPointSaveEditorPrompter" schema="schema/saveEditorPrompter.exsd"/> > > <extension point="org.eclipse.wst.server.core.moduleTypes"> > <moduleType >Index: schema/saveEditorPrompter.exsd >=================================================================== >RCS file: schema/saveEditorPrompter.exsd >diff -N schema/saveEditorPrompter.exsd >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ schema/saveEditorPrompter.exsd 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,121 @@ >+<?xml version='1.0' encoding='UTF-8'?> >+<!-- Schema file written by PDE --> >+<schema targetNamespace="org.eclipse.wst.server.core" xmlns="http://www.w3.org/2001/XMLSchema"> >+<annotation> >+ <appInfo> >+ <meta.schema plugin="org.eclipse.wst.server.core" id="saveEditorPrompter" name="%saveEditorPrompter"/> >+ </appInfo> >+ <documentation> >+ This is an internal extension point that should only be adopted by org.eclipse.wst.server.core. It is used to transfer the control to the UI and save all the editors are open before continuing >+ </documentation> >+ </annotation> >+ >+ <element name="extension"> >+ <annotation> >+ <appInfo> >+ <meta.element /> >+ </appInfo> >+ </annotation> >+ <complexType> >+ <sequence> >+ <element ref="saveEditorPrompter"/> >+ </sequence> >+ <attribute name="point" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="id" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="name" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ <appInfo> >+ <meta.attribute translatable="true"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <element name="saveEditorPrompter"> >+ <complexType> >+ <attribute name="id" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="class" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ <appInfo> >+ <meta.attribute kind="java" basedOn="org.eclipse.wst.server.core.internal.SaveEditorPrompter:"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="since"/> >+ </appInfo> >+ <documentation> >+ [Enter the first release in which this extension point appears.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="examples"/> >+ </appInfo> >+ <documentation> >+ [Enter extension point usage example here.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="apiinfo"/> >+ </appInfo> >+ <documentation> >+ [Enter API information here.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="implementation"/> >+ </appInfo> >+ <documentation> >+ [Enter information about supplied implementation of this extension point.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="copyright"/> >+ </appInfo> >+ <documentation> >+ Copyright (c) 2010 IBM Corporation and others.<br> >+All rights reserved. This program and the accompanying materials are made >+available under the terms of the Eclipse Public License v1.0 which accompanies >+this distribution, and is available at >+<a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a> >+ </documentation> >+ </annotation> >+ >+</schema> >Index: servercore/org/eclipse/wst/server/core/internal/SaveEditorPrompter.java >=================================================================== >RCS file: servercore/org/eclipse/wst/server/core/internal/SaveEditorPrompter.java >diff -N servercore/org/eclipse/wst/server/core/internal/SaveEditorPrompter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ servercore/org/eclipse/wst/server/core/internal/SaveEditorPrompter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,37 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - Initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.wst.server.core.internal; >+ >+/** >+ * <p> >+ * SaveEditorPrompter is the abstract implementation of the .saveEditorPrompter extension >+ * point. This class is used for prompting to the user to save all the editors. The class >+ * transfer the control from the non-ui code to the UI code via an the extension point >+ * </p> >+ * <b>This class is not intended to be extended adopters.</b> >+ * >+ */ >+public class SaveEditorPrompter { >+ >+ /** >+ * Move the control to the UI and save all the editors according to <code>org.eclipse.debug.internal.ui.IInternalDebugUIConstants.PREF_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH</code> >+ */ >+ public void saveAllEditors(){ >+ // nothing to do, should be implemented >+ } >+ public void setDebugNeverSave(){ >+ // nothing to do, should be implemented >+ } >+ public void setDebugOriginalValue(){ >+ // nothing to do, should be implemented >+ } >+} >Index: servercore/org/eclipse/wst/server/core/internal/Server.java >=================================================================== >RCS file: /cvsroot/webtools/servertools/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Server.java,v >retrieving revision 1.185.2.2 >diff -u -r1.185.2.2 Server.java >--- servercore/org/eclipse/wst/server/core/internal/Server.java 23 Aug 2010 18:39:38 -0000 1.185.2.2 >+++ servercore/org/eclipse/wst/server/core/internal/Server.java 15 Oct 2010 18:18:44 -0000 >@@ -1911,7 +1911,11 @@ > else > pub = StartJob.PUBLISH_BEFORE; > } >- >+ >+ if (ServerPlugin.isRunningGUIMode()){ >+ ServerPlugin.getSaveEditorHelper().saveAllEditors(); >+ } >+ > StartJob startJob = new StartJob(mode2); > if (opListener != null && pub != StartJob.PUBLISH_AFTER) { > startJob.addJobChangeListener(new JobChangeAdapter() { >@@ -3198,15 +3202,23 @@ > > protected void startImpl2(String mode2, IProgressMonitor monitor) throws CoreException { > Trace.trace(Trace.FINEST, "Starting server: " + Server.this.toString() + ", launchMode: " + mode2); >- >+ SaveEditorPrompter editorHelper = (ServerPlugin.isRunningGUIMode()) ? ServerPlugin.getSaveEditorHelper() : null; > // make sure that the delegate is loaded and the server state is correct > loadAdapter(ServerBehaviourDelegate.class, monitor); > > try { > ILaunchConfiguration launchConfig = getLaunchConfiguration(true, monitor); >- //if (launchConfig == null) >- // throw new CoreException(); >+ >+ if (editorHelper != null){ >+ editorHelper.setDebugNeverSave(); >+ } >+ > launch = launchConfig.launch(mode2, monitor); // , true); - causes workspace lock >+ >+ if (editorHelper != null){ >+ editorHelper.setDebugOriginalValue(); >+ } >+ > Trace.trace(Trace.FINEST, "Launch: " + launch); > } catch (CoreException e) { > Trace.trace(Trace.SEVERE, "Error starting server " + Server.this.toString(), e); >Index: servercore/org/eclipse/wst/server/core/internal/ServerPlugin.java >=================================================================== >RCS file: /cvsroot/webtools/servertools/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerPlugin.java,v >retrieving revision 1.65 >diff -u -r1.65 ServerPlugin.java >--- servercore/org/eclipse/wst/server/core/internal/ServerPlugin.java 6 May 2010 18:37:03 -0000 1.65 >+++ servercore/org/eclipse/wst/server/core/internal/ServerPlugin.java 15 Oct 2010 18:18:44 -0000 >@@ -10,18 +10,16 @@ > *******************************************************************************/ > package org.eclipse.wst.server.core.internal; > >-import java.io.*; >-import java.util.*; >+import java.io.File; > import java.text.DateFormat; >+import java.util.*; > > import org.eclipse.core.resources.IProject; > import org.eclipse.core.runtime.*; > import org.eclipse.core.runtime.jobs.Job; > import org.eclipse.osgi.util.NLS; > import org.eclipse.wst.server.core.*; >-import org.osgi.framework.BundleContext; >-import org.osgi.framework.BundleEvent; >-import org.osgi.framework.BundleListener; >+import org.osgi.framework.*; > /** > * The main server plugin class. > */ >@@ -69,6 +67,12 @@ > // cached copy of all installable runtimes > private static List<IInstallableRuntime> installableRuntimes; > >+ // cached copy of SaveEditorPrompter >+ private static SaveEditorPrompter saveEditorPrompter; >+ >+ // cached copy of isRunningInGUICache >+ public static boolean isRunningInGUICache = false; >+ > // registry listener > private static IRegistryChangeListener registryListener; > >@@ -1282,4 +1286,52 @@ > return Platform.getProduct().getProperty(key); > return value; > } >+ >+ public static boolean isRunningGUIMode(){ >+ // check only when the the plugin is not Bundle.ACTIVE >+ if (isRunningInGUICache == true){ >+ return isRunningInGUICache; >+ } >+ >+ Bundle swtEclipseUIbndl = Platform.getBundle("org.eclipse.ui"); //running in GUI mode if it is active. >+ if(swtEclipseUIbndl != null){ >+ isRunningInGUICache= (swtEclipseUIbndl.getState() == Bundle.ACTIVE); >+ return isRunningInGUICache; >+ } >+ return false; >+ } >+ >+ >+ /** >+ * Transfer the control to the UI and prompts to save all the editors >+ */ >+ public static SaveEditorPrompter getSaveEditorHelper() { >+ loadSaveEditorExtension(); >+ return saveEditorPrompter; >+ } >+ >+ private static void loadSaveEditorExtension() { >+ if (saveEditorPrompter != null) >+ return; >+ Trace.trace(Trace.EXTENSION_POINT, "->- Loading .saveEditorPrompter extension point ->-"); >+ >+ IExtensionRegistry registry = Platform.getExtensionRegistry(); >+ IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerPlugin.PLUGIN_ID, "saveEditorPrompter"); >+ >+ int size = cf.length; >+ try{ >+ saveEditorPrompter = (SaveEditorPrompter)cf[0].createExecutableExtension("class"); >+ Trace.trace(Trace.EXTENSION_POINT, " Loaded saveEditorPrompter: " + cf[0].getAttribute("id")); >+ } catch (CoreException ce){ >+ Trace.trace(Trace.SEVERE, " Could not load saveEditorPrompter: " + cf[0].getAttribute("id"), ce); >+ } >+ if (size < 1) { >+ Trace.trace(Trace.WARNING, " More than one .saveEditorPrompter found, only one loaded =>"+ cf[0].getAttribute("id")); >+ } >+ >+ Trace.trace(Trace.EXTENSION_POINT, "-<- Done loading .saveEditorPrompter extension point -<-"); >+ >+ } >+ >+ > } >\ No newline at end of file >#P org.eclipse.wst.server.ui >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/webtools/servertools/plugins/org.eclipse.wst.server.ui/plugin.xml,v >retrieving revision 1.58.2.1 >diff -u -r1.58.2.1 plugin.xml >--- plugin.xml 25 Aug 2010 20:04:37 -0000 1.58.2.1 >+++ plugin.xml 15 Oct 2010 18:18:44 -0000 >@@ -623,4 +623,11 @@ > </enablement> > </decorator> > </extension> >+<extension >+ point="org.eclipse.wst.server.core.saveEditorPrompter"> >+ <saveEditorPrompter >+ class="org.eclipse.wst.server.ui.internal.SaveEditorPrompter" >+ id="org.eclipse.wst.server.ui.saveEditorPrompter1"> >+ </saveEditorPrompter> >+</extension> > </plugin> >Index: serverui/org/eclipse/wst/server/ui/internal/SaveEditorPrompter.java >=================================================================== >RCS file: serverui/org/eclipse/wst/server/ui/internal/SaveEditorPrompter.java >diff -N serverui/org/eclipse/wst/server/ui/internal/SaveEditorPrompter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ serverui/org/eclipse/wst/server/ui/internal/SaveEditorPrompter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,78 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.wst.server.ui.internal; >+ >+import org.eclipse.debug.ui.DebugUITools; >+import org.eclipse.jface.preference.IPreferenceStore; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.ui.IWorkbench; >+import org.eclipse.ui.PlatformUI; >+ >+public class SaveEditorPrompter extends >+ org.eclipse.wst.server.core.internal.SaveEditorPrompter { >+ >+ private String cachedSaveBeforeLaunch; >+ >+ @Override >+ public void saveAllEditors() { >+ IWorkbench w = PlatformUI.getWorkbench(); >+ String saveBeforeLaunch = DebugUITools.getPreferenceStore().getString(org.eclipse.debug.internal.ui.IInternalDebugUIConstants.PREF_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH); >+ if (saveBeforeLaunch.equalsIgnoreCase(org.eclipse.jface.dialogs.MessageDialogWithToggle.ALWAYS)){ >+ Display d =PlatformUI.getWorkbench().getDisplay(); >+ d.asyncExec(new SaveAllEditorsRunnable(w,false)); >+ } >+ else if (saveBeforeLaunch.equalsIgnoreCase(org.eclipse.jface.dialogs.MessageDialogWithToggle.PROMPT)){ >+ Display d =PlatformUI.getWorkbench().getDisplay(); >+ d.asyncExec(new SaveAllEditorsRunnable(w,true)); >+ } >+ } >+ >+ private class SaveAllEditorsRunnable implements Runnable{ >+ IWorkbench w; >+ boolean confirm; >+ public SaveAllEditorsRunnable(IWorkbench w, boolean confirm){ >+ this.w = w; >+ this.confirm = confirm; >+ } >+ >+ public void run() { >+ w.saveAllEditors(confirm); >+ } >+ } >+ >+ /** >+ * Sets <code>org.eclipse.debug.internal.ui.IInternalDebugUIConstants.PREF_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH</code> to >+ * the given value. The given value should be one of the following: >+ * <ul> >+ * <li><code>org.eclipse.jface.dialogs.MessageDialogWithToggle.ALWAYS</code></li> >+ * <li><code>org.eclipse.jface.dialogs.MessageDialogWithToggle.NEVER</code></li> >+ * <li><code>org.eclipse.jface.dialogs.MessageDialogWithToggle.PROMPT</code></li> >+ * </ul> >+ * @see org.eclipse.jface.dialogs.MessageDialogWithToggle >+ */ >+ public String setDebugSaveBeforeLaunching(String newValue){ >+ IPreferenceStore debugPrefs = DebugUITools.getPreferenceStore(); >+ String oldValue = debugPrefs.getString(org.eclipse.debug.internal.ui.IInternalDebugUIConstants.PREF_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH); >+ debugPrefs.setValue(org.eclipse.debug.internal.ui.IInternalDebugUIConstants.PREF_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH, newValue); >+ return oldValue; >+ } >+ >+ public void setDebugNeverSave(){ >+ cachedSaveBeforeLaunch = setDebugSaveBeforeLaunching(org.eclipse.jface.dialogs.MessageDialogWithToggle.NEVER); >+ } >+ >+ public void setDebugOriginalValue(){ >+ if (cachedSaveBeforeLaunch == null){ >+ cachedSaveBeforeLaunch = org.eclipse.jface.dialogs.MessageDialogWithToggle.PROMPT; >+ } >+ setDebugSaveBeforeLaunching(cachedSaveBeforeLaunch); >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 328067
: 181881