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 169147 Details for
Bug 284557
Default Launchers preference settings are not imported
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]
Updated fix.
20100518_284557.patch (text/plain), 8.93 KB, created by
Pawel Piech
on 2010-05-19 12:24:16 EDT
(
hide
)
Description:
Updated fix.
Filename:
MIME Type:
Creator:
Pawel Piech
Created:
2010-05-19 12:24:16 EDT
Size:
8.93 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.debug.core >Index: core/org/eclipse/debug/internal/core/LaunchConfigurationType.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java,v >retrieving revision 1.56 >diff -u -r1.56 LaunchConfigurationType.java >--- core/org/eclipse/debug/internal/core/LaunchConfigurationType.java 18 Mar 2010 13:38:53 -0000 1.56 >+++ core/org/eclipse/debug/internal/core/LaunchConfigurationType.java 19 May 2010 16:19:23 -0000 >@@ -186,12 +186,14 @@ > } else { > fPreferredDelegates.put(modes, delegate); > } >+ ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).persistPreferredLaunchDelegate(this); > } > > /** > * @see org.eclipse.debug.core.ILaunchConfigurationType#getPreferredDelegate(java.util.Set) > */ > public ILaunchDelegate getPreferredDelegate(Set modes) { >+ initializePreferredDelegates(); > return (ILaunchDelegate) fPreferredDelegates.get(modes); > } > >@@ -208,6 +210,7 @@ > * @since 3.3 > */ > public Map getPreferredDelegates() { >+ initializePreferredDelegates(); > return fPreferredDelegates; > } > >@@ -503,5 +506,11 @@ > return fModeCombinations.contains(modes); > } > >+ /** >+ * Called on preference import to reset preferred delegates. >+ */ >+ void resetPreferredDelegates() { >+ fPreferredDelegates = null; >+ } > } > >Index: core/org/eclipse/debug/internal/core/LaunchManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java,v >retrieving revision 1.232 >diff -u -r1.232 LaunchManager.java >--- core/org/eclipse/debug/internal/core/LaunchManager.java 18 May 2010 19:11:26 -0000 1.232 >+++ core/org/eclipse/debug/internal/core/LaunchManager.java 19 May 2010 16:19:25 -0000 >@@ -1596,6 +1596,16 @@ > } > > /** >+ * Allows internal access to reset preferred delegates when re-importing >+ * preferences. >+ * >+ * @since 3.6 >+ */ >+ protected void resetPreferredDelegates() { >+ fPreferredDelegates = null; >+ } >+ >+ /** > * Allows internal access to a preferred delegate for a given type and mode set > * @param typeid the id of the <code>ILaunchConfigurationType</code> to find a delegate for > * @param modes the set of modes for the delegate >@@ -2347,43 +2357,50 @@ > * > * @since 3.3 > */ >- private void persistPreferredLaunchDelegates() { >+ public void persistPreferredLaunchDelegates() { > ILaunchConfigurationType[] types = getLaunchConfigurationTypes(); >- Map preferred = null; >- ILaunchDelegate delegate = null; >- Set modes = null; > for(int i = 0; i < types.length; i++) { >- String preferenceName = PREF_PREFERRED_DELEGATES + '/' + types[i].getIdentifier(); >- preferred = ((LaunchConfigurationType)types[i]).getPreferredDelegates(); >- if(preferred != null && preferred.size() > 0) { >- StringBuffer str = new StringBuffer(); >- for(Iterator iter = preferred.keySet().iterator(); iter.hasNext();) { >- modes = (Set) iter.next(); >- delegate = (ILaunchDelegate) preferred.get(modes); >- if(delegate != null) { >- str.append(delegate.getId()); >- str.append(','); >- for(Iterator iter2 = modes.iterator(); iter2.hasNext();) { >- str.append(iter2.next()); >- if(iter2.hasNext()) { >- str.append(','); >- } >- } >- if (iter.hasNext()) { >- str.append(';'); >+ persistPreferredLaunchDelegate((LaunchConfigurationType)types[i]); >+ } >+ } >+ >+ /** >+ * Persists the given launch configuration delegate. >+ * @param type Launch configuration type to persist >+ * >+ * @since 3.6 >+ */ >+ public void persistPreferredLaunchDelegate(LaunchConfigurationType type) { >+ String preferenceName = PREF_PREFERRED_DELEGATES + '/' + type.getIdentifier(); >+ Map preferred = type.getPreferredDelegates(); >+ if(preferred != null && preferred.size() > 0) { >+ StringBuffer str = new StringBuffer(); >+ for(Iterator iter = preferred.keySet().iterator(); iter.hasNext();) { >+ Set modes = (Set) iter.next(); >+ ILaunchDelegate delegate = (ILaunchDelegate) preferred.get(modes); >+ if(delegate != null) { >+ str.append(delegate.getId()); >+ str.append(','); >+ for(Iterator iter2 = modes.iterator(); iter2.hasNext();) { >+ str.append(iter2.next()); >+ if(iter2.hasNext()) { >+ str.append(','); > } > } >+ if (iter.hasNext()) { >+ str.append(';'); >+ } > } >- Preferences.setString(DebugPlugin.getUniqueIdentifier(), preferenceName, str.toString(), null); >- } else { >- Preferences.setToDefault(DebugPlugin.getUniqueIdentifier(), preferenceName); > } >+ Preferences.setString(DebugPlugin.getUniqueIdentifier(), preferenceName, str.toString(), null); >+ } else { >+ Preferences.setToDefault(DebugPlugin.getUniqueIdentifier(), preferenceName); > } > > // Reset the legacy preference string. > Preferences.setToDefault(DebugPlugin.getUniqueIdentifier(), PREF_PREFERRED_DELEGATES); >- } >- >+ } >+ > /** > * finds and terminates any running launch configurations associated with the given resource > * @param resource the resource to search for launch configurations and hence launches for >Index: core/org/eclipse/debug/internal/core/PreferredDelegateModifyListener.java >=================================================================== >RCS file: core/org/eclipse/debug/internal/core/PreferredDelegateModifyListener.java >diff -N core/org/eclipse/debug/internal/core/PreferredDelegateModifyListener.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ core/org/eclipse/debug/internal/core/PreferredDelegateModifyListener.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,55 @@ >+/******************************************************************************* >+ * 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.debug.internal.core; >+ >+import org.eclipse.core.runtime.preferences.IEclipsePreferences; >+import org.eclipse.core.runtime.preferences.IPreferenceNodeVisitor; >+import org.eclipse.core.runtime.preferences.PreferenceModifyListener; >+import org.eclipse.debug.core.DebugPlugin; >+import org.eclipse.debug.core.ILaunchConfigurationType; >+import org.osgi.service.prefs.BackingStoreException; >+ >+/** >+ * Used to listen for preference imports that include changes to >+ * preferred launch delegates. >+ * >+ * @since 3.6 >+ */ >+public class PreferredDelegateModifyListener extends PreferenceModifyListener { >+ class Visitor implements IPreferenceNodeVisitor { >+ >+ public boolean visit(IEclipsePreferences node) throws BackingStoreException { >+ if (node.name().equals(DebugPlugin.getUniqueIdentifier())) { >+ // reset preferred delegates, so they are re-initialized from the preferences >+ LaunchManager manager = (LaunchManager)DebugPlugin.getDefault().getLaunchManager(); >+ manager.resetPreferredDelegates(); >+ ILaunchConfigurationType[] types = manager.getLaunchConfigurationTypes(); >+ for (int i = 0; i < types.length; i++) { >+ ((LaunchConfigurationType) types[i]).resetPreferredDelegates(); >+ } >+ return false; >+ } >+ return true; >+ } >+ >+ } >+ >+ public IEclipsePreferences preApply(IEclipsePreferences node) { >+ try { >+ // force VMs to be initialized before we import the new VMs >+ node.accept(new Visitor()); >+ } catch (BackingStoreException e) { >+ DebugPlugin.log(e); >+ } >+ return node; >+ } >+ >+} >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/plugin.xml,v >retrieving revision 1.77 >diff -u -r1.77 plugin.xml >--- plugin.xml 27 Apr 2010 21:07:54 -0000 1.77 >+++ plugin.xml 19 May 2010 16:19:25 -0000 >@@ -234,6 +234,9 @@ > <initializer > class="org.eclipse.debug.internal.core.DebugPreferenceInitializer"> > </initializer> >+ <modifier >+ class="org.eclipse.debug.internal.core.PreferredDelegateModifyListener"> >+ </modifier> > </extension> > > <!-- ===================================== -->
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 284557
:
168962
| 169147