1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-11 02:05:39 +02:00

[235148] get rid of dead code for caching

This commit is contained in:
Martin Oberhuber 2008-06-03 08:51:37 +00:00
parent 359627faa0
commit 9e2fc1d12d

View file

@ -9,12 +9,11 @@
* Uwe Stieber (Wind River) - initial API and implementation. * Uwe Stieber (Wind River) - initial API and implementation.
* Javier Montalvo Orus (Symbian) - [174992] default wizard hides special ones * Javier Montalvo Orus (Symbian) - [174992] default wizard hides special ones
* David McKnight (IBM) - [216252] MessageFormat.format -> NLS.bind * David McKnight (IBM) - [216252] MessageFormat.format -> NLS.bind
* Martin Oberhuber (Wind River) - [235148] get rid of dead code for caching
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.ui.wizards.newconnection; package org.eclipse.rse.ui.wizards.newconnection;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.IStructuredSelection;
@ -32,7 +31,6 @@ import org.eclipse.rse.ui.wizards.registries.RSEAbstractWizardRegistry;
* @noinstantiate This class is not intended to be instantiated by clients. * @noinstantiate This class is not intended to be instantiated by clients.
*/ */
public class RSENewConnectionWizardRegistry extends RSEAbstractWizardRegistry { public class RSENewConnectionWizardRegistry extends RSEAbstractWizardRegistry {
private final Map cache = new HashMap();
// Initialize-On-Demand Holder Class idiom: // Initialize-On-Demand Holder Class idiom:
// Lazy initialization and thread-safe single instance. // Lazy initialization and thread-safe single instance.
@ -53,7 +51,6 @@ public class RSENewConnectionWizardRegistry extends RSEAbstractWizardRegistry {
*/ */
protected RSENewConnectionWizardRegistry() { protected RSENewConnectionWizardRegistry() {
super(); super();
cache.clear();
} }
protected IRSEWizardRegistryElement createWizardRegistryElementFor(IConfigurationElement element) { protected IRSEWizardRegistryElement createWizardRegistryElementFor(IConfigurationElement element) {
@ -103,17 +100,7 @@ public class RSENewConnectionWizardRegistry extends RSEAbstractWizardRegistry {
IRSENewConnectionWizardDescriptor descriptor = null; IRSENewConnectionWizardDescriptor descriptor = null;
String id = systemType.getId(); String id = systemType.getId();
if (cache.containsKey(id)) {
Object candidate = cache.get(id);
if (candidate instanceof IRSENewConnectionWizardDescriptor) {
descriptor = (IRSENewConnectionWizardDescriptor)candidate;
} else {
cache.remove(id);
}
}
// check if there is any wizard explicitly registered for the given system type // check if there is any wizard explicitly registered for the given system type
if (descriptor == null) {
// Get the list of all wizards and always walk through _all_ of them // Get the list of all wizards and always walk through _all_ of them
// to find possible duplicates (which will be notified as warnings to // to find possible duplicates (which will be notified as warnings to
// the user) // the user)
@ -121,9 +108,8 @@ public class RSENewConnectionWizardRegistry extends RSEAbstractWizardRegistry {
for (int i = 0; i < elements.length; i++) { for (int i = 0; i < elements.length; i++) {
IRSEWizardRegistryElement element = elements[i]; IRSEWizardRegistryElement element = elements[i];
if (element instanceof IRSENewConnectionWizardDescriptor) { if (element instanceof IRSENewConnectionWizardDescriptor) {
IRSENewConnectionWizardDescriptor candidate = (IRSENewConnectionWizardDescriptor)element; IRSENewConnectionWizardDescriptor candidate = (IRSENewConnectionWizardDescriptor) element;
if(candidate != defaultDescriptor) if (candidate != defaultDescriptor) {
{
String[] systemTypeIds = candidate.getSystemTypeIds(); String[] systemTypeIds = candidate.getSystemTypeIds();
if (Arrays.asList(systemTypeIds).contains(id)) { if (Arrays.asList(systemTypeIds).contains(id)) {
if (descriptor == null) { if (descriptor == null) {
@ -143,7 +129,6 @@ public class RSENewConnectionWizardRegistry extends RSEAbstractWizardRegistry {
if (descriptor == null) { if (descriptor == null) {
descriptor = defaultDescriptor; descriptor = defaultDescriptor;
} }
}
return descriptor; return descriptor;
} }