From 76fe278b7b78d059e68f33f74b981a96caec4f2f Mon Sep 17 00:00:00 2001 From: Uwe Stieber Date: Mon, 12 Mar 2007 15:57:43 +0000 Subject: [PATCH] [fix] [163392] First connection created is shown duplicate in tree --- .../UI/org/eclipse/rse/ui/RSEUIPlugin.java | 29 ++++++++++++------- .../org/eclipse/rse/model/SystemRegistry.java | 16 ++++------ 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEUIPlugin.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEUIPlugin.java index 5acbb026bbd..e3ba673f947 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEUIPlugin.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEUIPlugin.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2006, 2007 IBM Corporation. All rights reserved. + * Copyright (c) 2006, 2007 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 @@ -11,7 +11,8 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * David Dykstal (IBM) - moved methods to SystemPreferencesManager + * David Dykstal (IBM) - moved methods to SystemPreferencesManager. + * Uwe Stieber (Wind River) - bugfixing. ********************************************************************************/ package org.eclipse.rse.ui; @@ -500,14 +501,22 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi //logError("Error creating default Local connection", exc); //} // } - // new support to allow products to not pre-create a local connection - if (SystemResourceManager.isFirstTime() && SystemPreferencesManager.getShowLocalConnection()) { - ISystemProfileManager profileManager = SystemProfileManager.getSystemProfileManager(); - ISystemProfile profile = profileManager.getDefaultPrivateSystemProfile(); - String userName = System.getProperty("user.name"); //$NON-NLS-1$ - registry.createLocalHost(profile, SystemResources.TERM_LOCAL, userName); - } - } + + // new support to allow products to not pre-create a local connection + if (SystemResourceManager.isFirstTime() && SystemPreferencesManager.getShowLocalConnection()) { + // create the connection only if the local system type is enabled! + IRSESystemType systemType = RSECorePlugin.getDefault().getRegistry().getSystemTypeById(IRSESystemType.SYSTEMTYPE_LOCAL_ID); + if (systemType != null) { + RSESystemTypeAdapter adapter = (RSESystemTypeAdapter)(systemType.getAdapter(IRSESystemType.class)); + if (adapter != null && adapter.isEnabled(systemType)) { + ISystemProfileManager profileManager = SystemProfileManager.getSystemProfileManager(); + ISystemProfile profile = profileManager.getDefaultPrivateSystemProfile(); + String userName = System.getProperty("user.name"); //$NON-NLS-1$ + registry.createLocalHost(profile, SystemResources.TERM_LOCAL, userName); + } + } + } + } /** * For pathpath access to our adapters for non-local objects in our model. Exploits the knowledge we use singleton adapters. diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRegistry.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRegistry.java index 54ba6a9c718..f87a1f05c31 100644 --- a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRegistry.java +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRegistry.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2006, 2007 IBM Corporation and Wind River Systems, Inc. All rights reserved. + * Copyright (c) 2006, 2007 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 @@ -13,6 +13,7 @@ * Contributors: * Michael Scharf (Wind River) - patch for an NPE in getSubSystemConfigurations() * David Dykstal (IBM) - moved SystemsPreferencesManager to a new package + * Uwe Stieber (Wind River) - bugfixing ********************************************************************************/ package org.eclipse.rse.model; @@ -256,16 +257,9 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemModelChangeEven IRSESystemType sysType = RSECorePlugin.getDefault().getRegistry().getSystemType(con.getSystemType()); if (sysType != null) { // sysType can be null if workspace contains a host that is no longer defined by the workbench RSESystemTypeAdapter adapter = (RSESystemTypeAdapter)(sysType.getAdapter(IRSESystemType.class)); - if (adapter.isEnabled(sysType)) { - - // Bug 154524 Local node is shown in RSE even though the Local subsystem is not installed - // so we check for subsystems - ISubSystem[] subsystems = con.getSubSystems(); - - if (subsystems != null && subsystems.length != 0) { - result.add(con); - } - } + // Note: System types without registered subsystems get disabled by the adapter itself! + // There is no need to re-check this here again. + if (adapter.isEnabled(sysType)) result.add(con); } } return result.toArray();