1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-04 07:35:24 +02:00

[fix] [163392] First connection created is shown duplicate in tree

This commit is contained in:
Uwe Stieber 2007-03-12 15:57:43 +00:00
parent d33981c1db
commit 76fe278b7b
2 changed files with 24 additions and 21 deletions

View file

@ -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.

View file

@ -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();