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 146231 Details for
Bug 288299
Debug core should not be using the deprecated preferences code
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]
proposed fix
debug_core_preferences.patch (text/plain), 41.28 KB, created by
Michael Rennie
on 2009-09-01 16:16:13 EDT
(
hide
)
Description:
proposed fix
Filename:
MIME Type:
Creator:
Michael Rennie
Created:
2009-09-01 16:16:13 EDT
Size:
41.28 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.debug.core >Index: core/org/eclipse/debug/internal/core/LogicalStructureManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureManager.java,v >retrieving revision 1.14 >diff -u -r1.14 LogicalStructureManager.java >--- core/org/eclipse/debug/internal/core/LogicalStructureManager.java 27 Mar 2007 01:47:29 -0000 1.14 >+++ core/org/eclipse/debug/internal/core/LogicalStructureManager.java 1 Sep 2009 20:12:37 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 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 >@@ -107,7 +107,7 @@ > */ > private void loadStructureTypeSelections() { > fStructureTypeSelections= new HashMap(); >- String selections= DebugPlugin.getDefault().getPluginPreferences().getString(PREF_STRUCTURE_SELECTIONS); >+ String selections= Platform.getPreferencesService().getString(DebugPlugin.getUniqueIdentifier(), PREF_STRUCTURE_SELECTIONS, IInternalDebugCoreConstants.EMPTY_STRING, null); > // selections are stored in the form: > // selection|selection|...selection| > StringTokenizer tokenizer= new StringTokenizer(selections, "|"); //$NON-NLS-1$ >@@ -136,7 +136,7 @@ > buffer.append(entry.getValue()); > buffer.append('|'); > } >- DebugPlugin.getDefault().getPluginPreferences().setValue(PREF_STRUCTURE_SELECTIONS, buffer.toString()); >+ Preferences.setString(DebugPlugin.getUniqueIdentifier(), PREF_STRUCTURE_SELECTIONS, buffer.toString(), null); > } > > /** >@@ -145,7 +145,7 @@ > private void loadStructureTypeIds() { > fStructureTypeIds= new ArrayList(); > // Types are stored as a comma-separated, ordered list. >- String types= DebugPlugin.getDefault().getPluginPreferences().getString(PREF_STRUCTURE_IDS); >+ String types= Platform.getPreferencesService().getString(DebugPlugin.getUniqueIdentifier(), PREF_STRUCTURE_IDS, IInternalDebugCoreConstants.EMPTY_STRING, null); > StringTokenizer tokenizer= new StringTokenizer(types, ","); //$NON-NLS-1$ > while (tokenizer.hasMoreTokens()) { > String id= tokenizer.nextToken(); >@@ -164,7 +164,7 @@ > while (iter.hasNext()) { > buffer.append(iter.next()).append(','); > } >- DebugPlugin.getDefault().getPluginPreferences().setValue(PREF_STRUCTURE_IDS, buffer.toString()); >+ Preferences.setString(DebugPlugin.getUniqueIdentifier(), PREF_STRUCTURE_IDS, buffer.toString(), null); > } > > /** >Index: core/org/eclipse/debug/internal/core/StepFilterManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StepFilterManager.java,v >retrieving revision 1.3 >diff -u -r1.3 StepFilterManager.java >--- core/org/eclipse/debug/internal/core/StepFilterManager.java 27 Mar 2007 01:47:29 -0000 1.3 >+++ core/org/eclipse/debug/internal/core/StepFilterManager.java 1 Sep 2009 20:12:37 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 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 >@@ -10,6 +10,7 @@ > *******************************************************************************/ > package org.eclipse.debug.internal.core; > >+import org.eclipse.core.runtime.Platform; > import org.eclipse.debug.core.DebugPlugin; > import org.eclipse.debug.core.ILaunch; > import org.eclipse.debug.core.ILaunchListener; >@@ -63,7 +64,7 @@ > * @return whether to use step filters > */ > public boolean isUseStepFilters() { >- return DebugPlugin.getDefault().getPluginPreferences().getBoolean(PREF_USE_STEP_FILTERS); >+ return Platform.getPreferencesService().getBoolean(DebugPlugin.getUniqueIdentifier(), PREF_USE_STEP_FILTERS, false, null); > } > > /** >@@ -72,7 +73,7 @@ > * @param useFilters whether to use step filters > */ > public void setUseStepFilters(boolean useFilters) { >- DebugPlugin.getDefault().getPluginPreferences().setValue(PREF_USE_STEP_FILTERS, useFilters); >+ Preferences.setBoolean(DebugPlugin.getUniqueIdentifier(), PREF_USE_STEP_FILTERS, useFilters, null); > ILaunch[] launchs = DebugPlugin.getDefault().getLaunchManager().getLaunches(); > for (int i = 0; i < launchs.length; i++) { > ILaunch launch = launchs[i]; >Index: core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java,v >retrieving revision 1.77 >diff -u -r1.77 LaunchConfigurationWorkingCopy.java >--- core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java 3 Oct 2008 20:27:07 -0000 1.77 >+++ core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java 1 Sep 2009 20:12:37 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 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 >@@ -21,9 +21,6 @@ > import java.util.Map; > import java.util.Set; > >-import javax.xml.parsers.ParserConfigurationException; >-import javax.xml.transform.TransformerException; >- > import org.eclipse.core.filesystem.EFS; > import org.eclipse.core.filesystem.IFileStore; > import org.eclipse.core.resources.IContainer; >@@ -267,25 +264,17 @@ > */ > protected void writeNewFile(IProgressMonitor monitor) throws CoreException { > String xml = null; >- Exception e= null; > try { > xml = getInfo().getAsXML(); >- } catch (IOException ioe) { >- e= ioe; >- } catch (ParserConfigurationException pce) { >- e= pce; >- } catch (TransformerException te) { >- e= te; >- } >- if (e != null) { >+ } catch (Exception e) { > throw new DebugException( >- new Status( >- IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), >- DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.LaunchConfigurationWorkingCopy__0__occurred_generating_launch_configuration_XML__1, new String[]{e.toString()}), null >- ) >- ); >+ new Status( >+ IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), >+ DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.LaunchConfigurationWorkingCopy__0__occurred_generating_launch_configuration_XML__1, new String[]{e.toString()}), null >+ ) >+ ); > } >- SubMonitor lmonitor = SubMonitor.convert(monitor, "", 5); //$NON-NLS-1$ >+ SubMonitor lmonitor = SubMonitor.convert(monitor, IInternalDebugCoreConstants.EMPTY_STRING, 5); > try { > if (isLocal()) { > // use java.io to update configuration file >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.222 >diff -u -r1.222 LaunchManager.java >--- core/org/eclipse/debug/internal/core/LaunchManager.java 3 Apr 2009 14:04:42 -0000 1.222 >+++ core/org/eclipse/debug/internal/core/LaunchManager.java 1 Sep 2009 20:12:37 -0000 >@@ -76,7 +76,6 @@ > import org.eclipse.core.runtime.Path; > import org.eclipse.core.runtime.Platform; > import org.eclipse.core.runtime.PlatformObject; >-import org.eclipse.core.runtime.Preferences; > import org.eclipse.core.runtime.SafeRunner; > import org.eclipse.core.runtime.Status; > import org.eclipse.core.variables.VariablesPlugin; >@@ -1551,8 +1550,7 @@ > private synchronized void initializePreferredDelegates() { > if(fPreferredDelegates == null) { > fPreferredDelegates = new HashSet(); >- Preferences prefs = DebugPlugin.getDefault().getPluginPreferences(); >- String preferred = prefs.getString(LaunchManager.PREF_PREFERRED_DELEGATES); >+ String preferred = Platform.getPreferencesService().getString(DebugPlugin.getUniqueIdentifier(), LaunchManager.PREF_PREFERRED_DELEGATES, IInternalDebugCoreConstants.EMPTY_STRING, null); > if(!IInternalDebugCoreConstants.EMPTY_STRING.equals(preferred)) { > try { > Element root = DebugPlugin.parseDocument(preferred); >@@ -1603,8 +1601,7 @@ > // @since 3.5 > // If the legacy mechanism didn't work, try the new preference name for > // the given launch type. >- Preferences prefs = DebugPlugin.getDefault().getPluginPreferences(); >- String preferred = prefs.getString(LaunchManager.PREF_PREFERRED_DELEGATES + '/' + typeid); >+ String preferred = Platform.getPreferencesService().getString(DebugPlugin.getUniqueIdentifier(), LaunchManager.PREF_PREFERRED_DELEGATES + '/' + typeid, IInternalDebugCoreConstants.EMPTY_STRING, null); > if (preferred != null && preferred.length() != 0) { > StringTokenizer tokenizer = new StringTokenizer(preferred, ";"); //$NON-NLS-1$ > while(tokenizer.hasMoreTokens()) { >@@ -2014,7 +2011,7 @@ > * @return whether to auto-delete configurations > */ > private boolean isDeleteConfigurations() { >- return DebugPlugin.getDefault().getPluginPreferences().getBoolean(PREF_DELETE_CONFIGS_ON_PROJECT_DELETE); >+ return Platform.getPreferencesService().getBoolean(DebugPlugin.getUniqueIdentifier(), PREF_DELETE_CONFIGS_ON_PROJECT_DELETE, true, null); > } > > /* (non-Javadoc) >@@ -2330,7 +2327,6 @@ > * @since 3.3 > */ > private void persistPreferredLaunchDelegates() { >- Preferences prefs = DebugPlugin.getDefault().getPluginPreferences(); > ILaunchConfigurationType[] types = getLaunchConfigurationTypes(); > Map preferred = null; > ILaunchDelegate delegate = null; >@@ -2357,14 +2353,14 @@ > } > } > } >- prefs.setValue(preferenceName, str.toString()); >+ Preferences.setString(DebugPlugin.getUniqueIdentifier(), preferenceName, str.toString(), null); > } else { >- prefs.setToDefault(preferenceName); >+ Preferences.setToDefault(DebugPlugin.getUniqueIdentifier(), preferenceName); > } > } > > // Reset the legacy preference string. >- prefs.setToDefault(PREF_PREFERRED_DELEGATES); >+ Preferences.setToDefault(DebugPlugin.getUniqueIdentifier(), PREF_PREFERRED_DELEGATES); > } > > /** >Index: core/org/eclipse/debug/internal/core/DebugPreferenceInitializer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugPreferenceInitializer.java,v >retrieving revision 1.3 >diff -u -r1.3 DebugPreferenceInitializer.java >--- core/org/eclipse/debug/internal/core/DebugPreferenceInitializer.java 27 Mar 2007 01:47:29 -0000 1.3 >+++ core/org/eclipse/debug/internal/core/DebugPreferenceInitializer.java 1 Sep 2009 20:12:37 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006, 2007 IBM Corporation and others. >+ * Copyright (c) 2006, 2009 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 >@@ -10,7 +10,6 @@ > *******************************************************************************/ > package org.eclipse.debug.internal.core; > >-import org.eclipse.core.runtime.Preferences; > import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; > import org.eclipse.debug.core.DebugPlugin; > >@@ -25,10 +24,11 @@ > * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() > */ > public void initializeDefaultPreferences() { >- Preferences prefs = DebugPlugin.getDefault().getPluginPreferences(); > // Step filter preferences >- prefs.setDefault(StepFilterManager.PREF_USE_STEP_FILTERS, false); >- prefs.setDefault(LaunchManager.PREF_DELETE_CONFIGS_ON_PROJECT_DELETE, true); >+ Preferences.setDefaultBoolean(DebugPlugin.getUniqueIdentifier(), StepFilterManager.PREF_USE_STEP_FILTERS, false); >+ //launch configurations preferences >+ Preferences.setDefaultBoolean(DebugPlugin.getUniqueIdentifier(), LaunchManager.PREF_DELETE_CONFIGS_ON_PROJECT_DELETE, true); >+ Preferences.savePreferences(DebugPlugin.getUniqueIdentifier()); > } > > } >Index: core/org/eclipse/debug/internal/core/ExpressionManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.java,v >retrieving revision 1.57 >diff -u -r1.57 ExpressionManager.java >--- core/org/eclipse/debug/internal/core/ExpressionManager.java 19 Sep 2007 19:59:42 -0000 1.57 >+++ core/org/eclipse/debug/internal/core/ExpressionManager.java 1 Sep 2009 20:12:37 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 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 >@@ -29,7 +29,6 @@ > import org.eclipse.core.runtime.ListenerList; > import org.eclipse.core.runtime.Platform; > import org.eclipse.core.runtime.PlatformObject; >-import org.eclipse.core.runtime.Preferences; > import org.eclipse.core.runtime.SafeRunner; > import org.eclipse.core.runtime.Status; > import org.eclipse.debug.core.DebugPlugin; >@@ -150,7 +149,7 @@ > * will cause an infinite loop (see Bug 27281). > */ > private void loadPersistedExpressions() { >- String expressionsString= DebugPlugin.getDefault().getPluginPreferences().getString(PREF_WATCH_EXPRESSIONS); >+ String expressionsString = Platform.getPreferencesService().getString(DebugPlugin.getUniqueIdentifier(), PREF_WATCH_EXPRESSIONS, IInternalDebugCoreConstants.EMPTY_STRING, null); > if (expressionsString.length() == 0) { > return; > } >@@ -213,8 +212,7 @@ > * preference store. > */ > public void storeWatchExpressions() { >- Preferences prefs= DebugPlugin.getDefault().getPluginPreferences(); >- String expressionString= ""; //$NON-NLS-1$ >+ String expressionString = IInternalDebugCoreConstants.EMPTY_STRING; > try { > expressionString= getWatchExpressionsAsXML(); > } catch (IOException e) { >@@ -224,7 +222,7 @@ > } catch (TransformerException e) { > DebugPlugin.log(e); > } >- prefs.setValue(PREF_WATCH_EXPRESSIONS, expressionString); >+ Preferences.setString(DebugPlugin.getUniqueIdentifier(), PREF_WATCH_EXPRESSIONS, expressionString, null); > } > > /** >Index: core/org/eclipse/debug/core/DebugPlugin.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java,v >retrieving revision 1.164 >diff -u -r1.164 DebugPlugin.java >--- core/org/eclipse/debug/core/DebugPlugin.java 5 Dec 2008 20:12:08 -0000 1.164 >+++ core/org/eclipse/debug/core/DebugPlugin.java 1 Sep 2009 20:12:37 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 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 >@@ -57,6 +57,7 @@ > import org.eclipse.debug.internal.core.BreakpointManager; > import org.eclipse.debug.internal.core.DebugCoreMessages; > import org.eclipse.debug.internal.core.DebugOptions; >+import org.eclipse.debug.internal.core.Preferences; > import org.eclipse.debug.internal.core.ExpressionManager; > import org.eclipse.debug.internal.core.IConfigurationElementConstants; > import org.eclipse.debug.internal.core.LaunchManager; >@@ -604,7 +605,7 @@ > SourceLookupUtils.shutdown(); > setDefault(null); > ResourcesPlugin.getWorkspace().removeSaveParticipant(this); >- savePluginPreferences(); >+ Preferences.savePreferences(DebugPlugin.getUniqueIdentifier()); > } finally { > super.stop(context); > } >@@ -619,7 +620,7 @@ > ResourcesPlugin.getWorkspace().addSaveParticipant(this, > new ISaveParticipant() { > public void saving(ISaveContext saveContext) throws CoreException { >- savePluginPreferences(); >+ Preferences.savePreferences(DebugPlugin.getUniqueIdentifier()); > } > public void rollback(ISaveContext saveContext) {} > public void prepareToSave(ISaveContext saveContext) throws CoreException {} >Index: core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java,v >retrieving revision 1.10 >diff -u -r1.10 ContainerSourceContainer.java >--- core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java 29 May 2008 15:11:53 -0000 1.10 >+++ core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java 1 Sep 2009 20:12:37 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2003, 2008 IBM Corporation and others. >+ * Copyright (c) 2003, 2009 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 >@@ -101,7 +101,7 @@ > return EMPTY; > } > // See bug 98090 - we need to handle relative path names >- IFileStore target = fRootFile.getChild(new Path(name)); >+ IFileStore target = fRootFile.getFileStore(new Path(name)); > if (target.fetchInfo().exists()) { > // We no longer have to account for bug 95832, and URIs take care > // of canonical paths (fix to bug 95679 was removed). >Index: core/org/eclipse/debug/core/sourcelookup/containers/CompositeSourceContainer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/CompositeSourceContainer.java,v >retrieving revision 1.15 >diff -u -r1.15 CompositeSourceContainer.java >--- core/org/eclipse/debug/core/sourcelookup/containers/CompositeSourceContainer.java 31 Jul 2007 15:40:49 -0000 1.15 >+++ core/org/eclipse/debug/core/sourcelookup/containers/CompositeSourceContainer.java 1 Sep 2009 20:12:37 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2003, 2007 IBM Corporation and others. >+ * Copyright (c) 2003, 2009 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 >@@ -78,7 +78,9 @@ > try { > Object[] objects = container.findSourceElements(name); > if (objects.length > 0) { >- if (isFindDuplicates()) { >+ //it will only not be null when we care about duplicates >+ //saves the computation in isFindDuplicates() >+ if (results != null) { > for (int j = 0; j < objects.length; j++) { > results.add(objects[j]); > } >Index: core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupDirector.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupDirector.java,v >retrieving revision 1.33 >diff -u -r1.33 AbstractSourceLookupDirector.java >--- core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupDirector.java 19 Aug 2009 15:35:11 -0000 1.33 >+++ core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupDirector.java 1 Sep 2009 20:12:37 -0000 >@@ -255,15 +255,17 @@ > abort(SourceLookupMessages.AbstractSourceLookupDirector_11, null); > } > ISourceContainerType type = DebugPlugin.getDefault().getLaunchManager().getSourceContainerType(typeId); >- if(type == null) { >- abort(MessageFormat.format(SourceLookupMessages.AbstractSourceLookupDirector_12, new String[]{typeId}), null); >- } >- String memento = element.getAttribute(CONTAINER_MEMENTO_ATTR); >- if (memento == null || memento.equals("")) { //$NON-NLS-1$ >- abort(SourceLookupMessages.AbstractSourceLookupDirector_13, null); >+ if(type != null) { >+ String memento = element.getAttribute(CONTAINER_MEMENTO_ATTR); >+ if (memento == null || memento.equals("")) { //$NON-NLS-1$ >+ abort(SourceLookupMessages.AbstractSourceLookupDirector_13, null); >+ } >+ ISourceContainer container = type.createSourceContainer(memento); >+ containers.add(container); > } >- ISourceContainer container = type.createSourceContainer(memento); >- containers.add(container); >+ else { >+ abort(MessageFormat.format(SourceLookupMessages.AbstractSourceLookupDirector_12, new String[]{typeId}), null); >+ } > } > return containers; > } >Index: core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupParticipant.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupParticipant.java,v >retrieving revision 1.14 >diff -u -r1.14 AbstractSourceLookupParticipant.java >--- core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupParticipant.java 21 May 2009 20:43:51 -0000 1.14 >+++ core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupParticipant.java 1 Sep 2009 20:12:37 -0000 >@@ -66,7 +66,9 @@ > if (container != null) { > Object[] objects = container.findSourceElements(name); > if (objects.length > 0) { >- if (isFindDuplicates()) { >+ //it will only not be null when we care about duplicates >+ //saves the computation in isFindDuplicates() >+ if (results != null) { > for (int j = 0; j < objects.length; j++) { > results.add(objects[j]); > } >Index: core/org/eclipse/debug/internal/core/Preferences.java >=================================================================== >RCS file: core/org/eclipse/debug/internal/core/Preferences.java >diff -N core/org/eclipse/debug/internal/core/Preferences.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ core/org/eclipse/debug/internal/core/Preferences.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,415 @@ >+/******************************************************************************* >+ * Copyright (c) 2009 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.DefaultScope; >+import org.eclipse.core.runtime.preferences.IEclipsePreferences; >+import org.eclipse.core.runtime.preferences.IScopeContext; >+import org.eclipse.core.runtime.preferences.InstanceScope; >+import org.eclipse.debug.core.DebugPlugin; >+import org.osgi.service.prefs.BackingStoreException; >+ >+/** >+ * Convenience class to facilitate using the new {@link IEclipsePreferences} story >+ * >+ * @since 3.6 >+ * @noinstantiate This class is not intended to be instantiated by clients. >+ */ >+public final class Preferences { >+ >+ static final IScopeContext[] contexts = new IScopeContext[] {new DefaultScope(), new InstanceScope()}; >+ >+ static final int DEFAULT_CONTEXT = 0; >+ static final int INSTANCE_CONTEXT = 1; >+ >+ /** >+ * Constructor >+ */ >+ private Preferences() { >+ // no direct instantiation >+ } >+ >+ /** >+ * Sets a string preference in the {@link InstanceScope} or the given {@link IScopeContext} if it >+ * is not <code>null</code>. Preferences set in a given context are flushed as they are set. >+ * @param qualifier >+ * @param key the key >+ * @param value the value >+ * @param context >+ */ >+ public static synchronized void setString(String qualifier, String key, String value, IScopeContext context) { >+ if(context != null) { >+ try { >+ IEclipsePreferences node = context.getNode(qualifier); >+ node.put(key, value); >+ node.flush(); >+ } >+ catch(BackingStoreException bse) { >+ DebugPlugin.log(bse); >+ } >+ } >+ else { >+ contexts[INSTANCE_CONTEXT].getNode(qualifier).put(key, value); >+ } >+ } >+ >+ /** >+ * Sets a boolean preference in the {@link InstanceScope} or the given {@link IScopeContext} if it >+ * is not <code>null</code>. Preferences set in a given context are flushed as they are set. >+ * @param qualifier >+ * @param key the key >+ * @param value the value >+ * @param context >+ */ >+ public static synchronized void setBoolean(String qualifier, String key, boolean value, IScopeContext context) { >+ if(context != null) { >+ try { >+ IEclipsePreferences node = context.getNode(qualifier); >+ node.putBoolean(key, value); >+ node.flush(); >+ } >+ catch(BackingStoreException bse) { >+ DebugPlugin.log(bse); >+ } >+ } >+ else { >+ contexts[INSTANCE_CONTEXT].getNode(qualifier).putBoolean(key, value); >+ } >+ } >+ >+ /** >+ * Sets a integer preference in the {@link InstanceScope} or the given {@link IScopeContext} if it >+ * is not <code>null</code>. Preferences set in a given context are flushed as they are set. >+ * @param qualifier >+ * @param key the key >+ * @param value the value >+ * @param context >+ */ >+ public static synchronized void setInt(String qualifier, String key, int value, IScopeContext context) { >+ if(context != null) { >+ try { >+ IEclipsePreferences node = context.getNode(qualifier); >+ node.putInt(key, value); >+ node.flush(); >+ } >+ catch(BackingStoreException bse) { >+ DebugPlugin.log(bse); >+ } >+ } >+ else { >+ contexts[INSTANCE_CONTEXT].getNode(qualifier).putInt(key, value); >+ } >+ } >+ >+ /** >+ * Sets a long preference in the {@link InstanceScope} or the given {@link IScopeContext} if it >+ * is not <code>null</code>. Preferences set in a given context are flushed as they are set. >+ * @param qualifier >+ * @param key the key >+ * @param value the value >+ * @param context >+ */ >+ public static synchronized void setLong(String qualifier, String key, long value, IScopeContext context) { >+ if(context != null) { >+ try { >+ IEclipsePreferences node = context.getNode(qualifier); >+ node.putLong(key, value); >+ node.flush(); >+ } >+ catch(BackingStoreException bse) { >+ DebugPlugin.log(bse); >+ } >+ } >+ else { >+ contexts[INSTANCE_CONTEXT].getNode(qualifier).putLong(key, value); >+ } >+ } >+ >+ /** >+ * Sets a byte array preference in the {@link InstanceScope} or the given {@link IScopeContext} if it >+ * is not <code>null</code>. Preferences set in a given context are flushed as they are set. >+ * @param qualifier >+ * @param key the key >+ * @param value the value >+ * @param context >+ */ >+ public static synchronized void setByteArray(String qualifier, String key, byte[] value, IScopeContext context) { >+ if(context != null) { >+ try { >+ IEclipsePreferences node = context.getNode(qualifier); >+ node.putByteArray(key, value); >+ node.flush(); >+ } >+ catch(BackingStoreException bse) { >+ DebugPlugin.log(bse); >+ } >+ } >+ else { >+ contexts[INSTANCE_CONTEXT].getNode(qualifier).putByteArray(key, value); >+ } >+ } >+ >+ /** >+ * Sets a double preference in the {@link InstanceScope} or the given {@link IScopeContext} if it >+ * is not <code>null</code>. Preferences set in a given context are flushed as they are set. >+ * @param qualifier >+ * @param key the key >+ * @param value the value >+ * @param context >+ */ >+ public static synchronized void setDouble(String qualifier, String key, double value, IScopeContext context) { >+ if(context != null) { >+ try { >+ IEclipsePreferences node = context.getNode(qualifier); >+ node.putDouble(key, value); >+ node.flush(); >+ } >+ catch(BackingStoreException bse) { >+ DebugPlugin.log(bse); >+ } >+ } >+ else { >+ contexts[INSTANCE_CONTEXT].getNode(qualifier).putDouble(key, value); >+ } >+ } >+ >+ /** >+ * Sets a float preference in the {@link InstanceScope} or the given {@link IScopeContext} if it >+ * is not <code>null</code>. Preferences set in a given context are flushed as they are set. >+ * @param qualifier >+ * @param key the key >+ * @param value the value >+ * @param context >+ */ >+ public static synchronized void setFloat(String qualifier, String key, float value, IScopeContext context) { >+ if(context != null) { >+ try { >+ IEclipsePreferences node = context.getNode(qualifier); >+ node.putFloat(key, value); >+ node.flush(); >+ } >+ catch(BackingStoreException bse) { >+ DebugPlugin.log(bse); >+ } >+ } >+ else { >+ contexts[INSTANCE_CONTEXT].getNode(qualifier).putFloat(key, value); >+ } >+ } >+ >+ /** >+ * Sets a string in the {@link DefaultScope} >+ * @param qualifier >+ * @param key the key >+ * @param value the new value >+ */ >+ public static synchronized void setDefaultString(String qualifier, String key, String value) { >+ contexts[DEFAULT_CONTEXT].getNode(qualifier).put(key, value); >+ } >+ >+ /** >+ * Sets a boolean in the {@link DefaultScope} >+ * @param qualifier >+ * @param key the key >+ * @param value the new value >+ */ >+ public static synchronized void setDefaultBoolean(String qualifier, String key, boolean value) { >+ contexts[DEFAULT_CONTEXT].getNode(qualifier).putBoolean(key, value); >+ } >+ >+ /** >+ * Sets a byte array in the {@link DefaultScope} >+ * @param qualifier >+ * @param key the key >+ * @param value the new value >+ */ >+ public static synchronized void setDefaultByteArray(String qualifier, String key, byte[] value) { >+ contexts[DEFAULT_CONTEXT].getNode(qualifier).putByteArray(key, value); >+ } >+ >+ /** >+ * Sets a double in the {@link DefaultScope} >+ * @param qualifier >+ * @param key the key >+ * @param value the new value >+ */ >+ public static synchronized void setDefaultDouble(String qualifier, String key, double value) { >+ contexts[DEFAULT_CONTEXT].getNode(qualifier).putDouble(key, value); >+ } >+ >+ /** >+ * Sets a float in the {@link DefaultScope} >+ * @param qualifier >+ * @param key the key >+ * @param value the new value >+ */ >+ public static synchronized void setDefaultFloat(String qualifier, String key, float value) { >+ contexts[DEFAULT_CONTEXT].getNode(qualifier).putFloat(key, value); >+ } >+ >+ /** >+ * Sets a integer in the {@link DefaultScope} >+ * @param qualifier >+ * @param key the key >+ * @param value the new value >+ */ >+ public static synchronized void setDefaultInt(String qualifier, String key, int value) { >+ contexts[DEFAULT_CONTEXT].getNode(qualifier).putInt(key, value); >+ } >+ >+ /** >+ * Sets a long in the {@link DefaultScope} >+ * @param qualifier >+ * @param key the key >+ * @param value the new value >+ */ >+ public static synchronized void setDefaultLong(String qualifier, String key, long value) { >+ contexts[DEFAULT_CONTEXT].getNode(qualifier).putLong(key, value); >+ } >+ >+ /** >+ * Sets the given preference to its default value. This is done by removing any set value >+ * from the {@link InstanceScope}. Has no effect if the given key is <code>null</code>. >+ * @param qualifier >+ * @param key the key for the preference >+ */ >+ public static synchronized void setToDefault(String qualifier, String key) { >+ if(key != null) { >+ contexts[INSTANCE_CONTEXT].getNode(qualifier).remove(key); >+ } >+ } >+ >+ /** >+ * Returns the default boolean value stored in the {@link DefaultScope} for the given key >+ * or the specified default value if the key does not appear in the {@link DefaultScope} >+ * @param qualifier >+ * @param key >+ * @param defaultvalue >+ * >+ * @return the boolean value set in the {@link DefaultScope} for the given key, or the specified default value. >+ */ >+ public static synchronized boolean getDefaultBoolean(String qualifier, String key, boolean defaultvalue) { >+ return contexts[DEFAULT_CONTEXT].getNode(qualifier).getBoolean(key, defaultvalue); >+ } >+ >+ /** >+ * Returns the default string value stored in the {@link DefaultScope} for the given key >+ * or the specified default value if the key does not appear in the {@link DefaultScope} >+ * @param qualifier >+ * @param key >+ * @param defaultvalue >+ * >+ * @return the string value set in the {@link DefaultScope} for the given key, or the specified default value. >+ */ >+ public static synchronized String getDefaultString(String qualifier, String key, String defaultvalue) { >+ return contexts[DEFAULT_CONTEXT].getNode(qualifier).get(key, defaultvalue); >+ } >+ >+ /** >+ * Returns the default byte array value stored in the {@link DefaultScope} for the given key >+ * or the specified default value if the key does not appear in the {@link DefaultScope} >+ * @param qualifier >+ * @param key >+ * @param defaultvalue >+ * >+ * @return the byte array value set in the {@link DefaultScope} for the given key, or the specified default value. >+ */ >+ public static synchronized byte[] getDefaultByteArray(String qualifier, String key, byte[] defaultvalue) { >+ return contexts[DEFAULT_CONTEXT].getNode(qualifier).getByteArray(key, defaultvalue); >+ } >+ >+ /** >+ * Returns the default integer value stored in the {@link DefaultScope} for the given key >+ * or the specified default value if the key does not appear in the {@link DefaultScope} >+ * @param qualifier >+ * @param key >+ * @param defaultvalue >+ * >+ * @return the integer value set in the {@link DefaultScope} for the given key, or the specified default value. >+ */ >+ public static synchronized int getDefaultInt(String qualifier, String key, int defaultvalue) { >+ return contexts[DEFAULT_CONTEXT].getNode(qualifier).getInt(key, defaultvalue); >+ } >+ >+ /** >+ * Returns the default long value stored in the {@link DefaultScope} for the given key >+ * or the specified default value if the key does not appear in the {@link DefaultScope} >+ * @param qualifier >+ * @param key >+ * @param defaultvalue >+ * >+ * @return the long value set in the {@link DefaultScope} for the given key, or the specified default value. >+ */ >+ public static synchronized long getDefaultLong(String qualifier, String key, long defaultvalue) { >+ return contexts[DEFAULT_CONTEXT].getNode(qualifier).getLong(key, defaultvalue); >+ } >+ >+ /** >+ * Returns the default double value stored in the {@link DefaultScope} for the given key >+ * or the specified default value if the key does not appear in the {@link DefaultScope} >+ * @param qualifier >+ * @param key >+ * @param defaultvalue >+ * >+ * @return the double value set in the {@link DefaultScope} for the given key, or the specified default value. >+ */ >+ public static synchronized double getDefaultDouble(String qualifier, String key, double defaultvalue) { >+ return contexts[DEFAULT_CONTEXT].getNode(qualifier).getDouble(key, defaultvalue); >+ } >+ >+ /** >+ * Returns the default float value stored in the {@link DefaultScope} for the given key >+ * or the specified default value if the key does not appear in the {@link DefaultScope} >+ * @param qualifier >+ * @param key >+ * @param defaultvalue >+ * >+ * @return the float value set in the {@link DefaultScope} for the given key, or the specified default value. >+ */ >+ public static synchronized float getDefaultFloat(String qualifier, String key, float defaultvalue) { >+ return contexts[DEFAULT_CONTEXT].getNode(qualifier).getFloat(key, defaultvalue); >+ } >+ >+ /** >+ * Save the preferences for the given plugin identifier. >+ * It should be noted that all pending preference changes will be flushed with this method. >+ * @param qualifier >+ */ >+ public static synchronized void savePreferences(String qualifier) { >+ try { >+ contexts[DEFAULT_CONTEXT].getNode(qualifier).flush(); >+ contexts[INSTANCE_CONTEXT].getNode(qualifier).flush(); >+ } >+ catch(BackingStoreException bse) { >+ DebugPlugin.log(bse); >+ } >+ } >+ >+ /** >+ * Adds the given preference listener to the {@link DefaultScope} and the {@link InstanceScope} >+ * @param qualifier >+ * @param listener >+ */ >+ public static void addPreferenceListener(String qualifier, IEclipsePreferences.IPreferenceChangeListener listener) { >+ contexts[DEFAULT_CONTEXT].getNode(qualifier).addPreferenceChangeListener(listener); >+ contexts[INSTANCE_CONTEXT].getNode(qualifier).addPreferenceChangeListener(listener); >+ } >+ >+ /** >+ * Removes the given preference listener from the {@link DefaultScope} and the {@link InstanceScope} >+ * @param qualifier >+ * @param listener >+ */ >+ public static void removePreferenceListener(String qualifier, IEclipsePreferences.IPreferenceChangeListener listener) { >+ contexts[DEFAULT_CONTEXT].getNode(qualifier).removePreferenceChangeListener(listener); >+ contexts[INSTANCE_CONTEXT].getNode(qualifier).removePreferenceChangeListener(listener); >+ } >+} >#P org.eclipse.debug.ui >Index: ui/org/eclipse/debug/internal/ui/preferences/LaunchConfigurationsPreferencePage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchConfigurationsPreferencePage.java,v >retrieving revision 1.26 >diff -u -r1.26 LaunchConfigurationsPreferencePage.java >--- ui/org/eclipse/debug/internal/ui/preferences/LaunchConfigurationsPreferencePage.java 4 Jan 2008 16:08:46 -0000 1.26 >+++ ui/org/eclipse/debug/internal/ui/preferences/LaunchConfigurationsPreferencePage.java 1 Sep 2009 20:12:39 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2004, 2008 IBM Corporation and others. >+ * Copyright (c) 2004, 2009 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 >@@ -14,10 +14,12 @@ > import java.util.List; > > import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.Platform; > import org.eclipse.debug.core.DebugPlugin; > import org.eclipse.debug.core.ILaunchConfiguration; > import org.eclipse.debug.core.ILaunchConfigurationType; > import org.eclipse.debug.core.ILaunchManager; >+import org.eclipse.debug.internal.core.Preferences; > import org.eclipse.debug.internal.core.IInternalDebugCoreConstants; > import org.eclipse.debug.internal.core.LaunchManager; > import org.eclipse.debug.internal.ui.AbstractDebugCheckboxSelectionDialog; >@@ -336,8 +338,9 @@ > editor.setPreferenceStore(getPreferenceStore()); > editor.load(); > } >- fDeleteConfigs.setSelection(DebugPlugin.getDefault().getPluginPreferences().getBoolean( >- LaunchManager.PREF_DELETE_CONFIGS_ON_PROJECT_DELETE)); >+ fDeleteConfigs.setSelection( >+ Platform.getPreferencesService().getBoolean(DebugPlugin.getUniqueIdentifier(), >+ LaunchManager.PREF_DELETE_CONFIGS_ON_PROJECT_DELETE, true, null)); > //restore the tables' checked state > String[] types = getPreferenceStore().getString(IInternalDebugUIConstants.PREF_FILTER_TYPE_LIST).split("\\,"); //$NON-NLS-1$ > TableItem[] items = fTable.getItems(); >@@ -356,6 +359,7 @@ > * @see org.eclipse.jface.preference.PreferencePage#performDefaults() > */ > protected void performDefaults() { >+ fDeleteConfigs.setSelection(Preferences.getDefaultBoolean(DebugPlugin.getUniqueIdentifier(), LaunchManager.PREF_DELETE_CONFIGS_ON_PROJECT_DELETE, true)); > FieldEditor editor = null; > for(int i = 0; i < fFieldEditors.size(); i++) { > editor = (FieldEditor)fFieldEditors.get(i); >@@ -375,8 +379,7 @@ > for(int i = 0; i < fFieldEditors.size(); i++) { > ((FieldEditor)fFieldEditors.get(i)).store(); > } >- DebugPlugin.getDefault().getPluginPreferences().setValue( >- LaunchManager.PREF_DELETE_CONFIGS_ON_PROJECT_DELETE, fDeleteConfigs.getSelection()); >+ Preferences.setBoolean(DebugPlugin.getUniqueIdentifier(), LaunchManager.PREF_DELETE_CONFIGS_ON_PROJECT_DELETE, fDeleteConfigs.getSelection(), null); > //save table > String types = IInternalDebugCoreConstants.EMPTY_STRING; > TableItem[] items = fTable.getItems();
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 288299
: 146231