mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-10 01:35:39 +02:00
[235148] get rid of dead code for caching
This commit is contained in:
parent
359627faa0
commit
9e2fc1d12d
1 changed files with 42 additions and 57 deletions
|
@ -9,12 +9,11 @@
|
|||
* Uwe Stieber (Wind River) - initial API and implementation.
|
||||
* Javier Montalvo Orus (Symbian) - [174992] default wizard hides special ones
|
||||
* 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;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
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.
|
||||
*/
|
||||
public class RSENewConnectionWizardRegistry extends RSEAbstractWizardRegistry {
|
||||
private final Map cache = new HashMap();
|
||||
|
||||
// Initialize-On-Demand Holder Class idiom:
|
||||
// Lazy initialization and thread-safe single instance.
|
||||
|
@ -53,7 +51,6 @@ public class RSENewConnectionWizardRegistry extends RSEAbstractWizardRegistry {
|
|||
*/
|
||||
protected RSENewConnectionWizardRegistry() {
|
||||
super();
|
||||
cache.clear();
|
||||
}
|
||||
|
||||
protected IRSEWizardRegistryElement createWizardRegistryElementFor(IConfigurationElement element) {
|
||||
|
@ -103,17 +100,7 @@ public class RSENewConnectionWizardRegistry extends RSEAbstractWizardRegistry {
|
|||
IRSENewConnectionWizardDescriptor descriptor = null;
|
||||
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
|
||||
if (descriptor == null) {
|
||||
// Get the list of all wizards and always walk through _all_ of them
|
||||
// to find possible duplicates (which will be notified as warnings to
|
||||
// the user)
|
||||
|
@ -121,9 +108,8 @@ public class RSENewConnectionWizardRegistry extends RSEAbstractWizardRegistry {
|
|||
for (int i = 0; i < elements.length; i++) {
|
||||
IRSEWizardRegistryElement element = elements[i];
|
||||
if (element instanceof IRSENewConnectionWizardDescriptor) {
|
||||
IRSENewConnectionWizardDescriptor candidate = (IRSENewConnectionWizardDescriptor)element;
|
||||
if(candidate != defaultDescriptor)
|
||||
{
|
||||
IRSENewConnectionWizardDescriptor candidate = (IRSENewConnectionWizardDescriptor) element;
|
||||
if (candidate != defaultDescriptor) {
|
||||
String[] systemTypeIds = candidate.getSystemTypeIds();
|
||||
if (Arrays.asList(systemTypeIds).contains(id)) {
|
||||
if (descriptor == null) {
|
||||
|
@ -143,7 +129,6 @@ public class RSENewConnectionWizardRegistry extends RSEAbstractWizardRegistry {
|
|||
if (descriptor == null) {
|
||||
descriptor = defaultDescriptor;
|
||||
}
|
||||
}
|
||||
|
||||
return descriptor;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue