1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-14 20:45:22 +02:00

[215820][api][breaking] Move SystemRegistry implementation to Core

This commit is contained in:
Martin Oberhuber 2008-02-12 18:40:57 +00:00
parent 298a3d5a29
commit 52a332ae0b
17 changed files with 531 additions and 406 deletions

View file

@ -7,7 +7,8 @@ Bundle-Activator: org.eclipse.rse.core.RSECorePlugin
Bundle-Localization: plugin Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime, Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources, org.eclipse.core.resources,
org.eclipse.rse.services;bundle-version="[2.0.0,3.0.0)" org.eclipse.rse.services;bundle-version="[2.0.0,3.0.0)",
org.eclipse.swt
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Eclipse-LazyStart: true Eclipse-LazyStart: true
Export-Package: org.eclipse.rse.core, Export-Package: org.eclipse.rse.core,

View file

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
@ -19,6 +19,7 @@
* Martin Oberhuber (Wind River) - [160293] NPE on startup when only Core feature is installed * Martin Oberhuber (Wind River) - [160293] NPE on startup when only Core feature is installed
* Uwe Stieber (Wind River) - [192611] RSE Core plugin may fail to initialize because of cyclic code invocation * Uwe Stieber (Wind River) - [192611] RSE Core plugin may fail to initialize because of cyclic code invocation
* Martin Oberhuber (Wind River) - [165674] Sort subsystem configurations by priority then Id * Martin Oberhuber (Wind River) - [165674] Sort subsystem configurations by priority then Id
* Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.core; package org.eclipse.rse.core;
@ -33,9 +34,12 @@ import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin; import org.eclipse.core.runtime.Plugin;
import org.eclipse.rse.core.comm.SystemKeystoreProviderManager; import org.eclipse.rse.core.comm.SystemKeystoreProviderManager;
import org.eclipse.rse.core.model.ISystemProfileManager;
import org.eclipse.rse.core.model.ISystemRegistry; import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy; import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
import org.eclipse.rse.internal.core.RSECoreRegistry; import org.eclipse.rse.internal.core.RSECoreRegistry;
import org.eclipse.rse.internal.core.model.SystemProfileManager;
import org.eclipse.rse.internal.core.model.SystemRegistry;
import org.eclipse.rse.internal.core.subsystems.SubSystemConfigurationProxy; import org.eclipse.rse.internal.core.subsystems.SubSystemConfigurationProxy;
import org.eclipse.rse.internal.core.subsystems.SubSystemConfigurationProxyComparator; import org.eclipse.rse.internal.core.subsystems.SubSystemConfigurationProxyComparator;
import org.eclipse.rse.internal.persistence.RSEPersistenceManager; import org.eclipse.rse.internal.persistence.RSEPersistenceManager;
@ -64,7 +68,7 @@ public class RSECorePlugin extends Plugin {
private static RSECorePlugin plugin = null; // the singleton instance of this plugin private static RSECorePlugin plugin = null; // the singleton instance of this plugin
private Logger logger = null; private Logger logger = null;
private ISystemRegistry _registry = null; private ISystemRegistry _systemRegistry = null;
private IRSEPersistenceManager _persistenceManager = null; private IRSEPersistenceManager _persistenceManager = null;
private ISubSystemConfigurationProxy[] _subsystemConfigurations = null; private ISubSystemConfigurationProxy[] _subsystemConfigurations = null;
@ -76,15 +80,6 @@ public class RSECorePlugin extends Plugin {
return plugin; return plugin;
} }
/**
* A static convenience method - fully equivalent to
* <code>RSECorePlugin.getDefault().getPersistenceManager()</code>.
* @return the persistence manager currently in use for RSE
*/
public static IRSEPersistenceManager getThePersistenceManager() {
return getDefault().getPersistenceManager();
}
/** /**
* A static convenience method - fully equivalent to * A static convenience method - fully equivalent to
* <code>RSECorePlugin.getDefault().getRegistry()</code>. * <code>RSECorePlugin.getDefault().getRegistry()</code>.
@ -94,9 +89,42 @@ public class RSECorePlugin extends Plugin {
return getDefault().getCoreRegistry(); return getDefault().getCoreRegistry();
} }
/**
* A static convenience method - fully equivalent to
* <code>RSECorePlugin.getDefault().getPersistenceManager()</code>.
* @return the persistence manager currently in use for RSE
*/
public static IRSEPersistenceManager getThePersistenceManager() {
return getDefault().getPersistenceManager();
}
/**
* Return the master profile manager singleton.
* @return the RSE Profile Manager Singleton.
*/
public static ISystemProfileManager getTheSystemProfileManager() {
return SystemProfileManager.getDefault();
}
/**
* Check if the SystemRegistry has been instantiated already.
* Use this when you don't want to start the system registry as a
* side effect of retrieving it.
* @return <code>true</code> if the System Registry has been instantiated already.
*/
public static boolean isTheSystemRegistryActive()
{
if (plugin == null) {
return false;
}
return getDefault().isSystemRegistryActive();
}
/** /**
* A static convenience method - fully equivalent to * A static convenience method - fully equivalent to
* <code>RSECorePlugin.getDefault().getSystemRegistry()</code>. * <code>RSECorePlugin.getDefault().getSystemRegistry()</code>.
* The SystemRegistry is used to gain access to the basic services
* and components used in RSE.
* @return the RSE System Registry. * @return the RSE System Registry.
*/ */
public static ISystemRegistry getTheSystemRegistry() { public static ISystemRegistry getTheSystemRegistry() {
@ -173,7 +201,11 @@ public class RSECorePlugin extends Plugin {
*/ */
public IRSEPersistenceManager getPersistenceManager() { public IRSEPersistenceManager getPersistenceManager() {
if (_persistenceManager == null) { if (_persistenceManager == null) {
_persistenceManager = new RSEPersistenceManager(_registry); synchronized(this) {
if (_persistenceManager==null) {
_persistenceManager = new RSEPersistenceManager(getSystemRegistry());
}
}
} }
return _persistenceManager; return _persistenceManager;
} }
@ -183,19 +215,43 @@ public class RSECorePlugin extends Plugin {
* that require a user interface. This should be set only by RSE startup components and * that require a user interface. This should be set only by RSE startup components and
* not by any external client. * not by any external client.
* @param registry the implementation of ISystemRegistry that the core should remember. * @param registry the implementation of ISystemRegistry that the core should remember.
* @deprecated Do not use this method.
*/ */
public void setSystemRegistry(ISystemRegistry registry) { public void setSystemRegistry(ISystemRegistry registry) {
_registry = registry; _systemRegistry = registry;
} }
/**
* Test if the SystemRegistry has been instantiated already.
* Use this when you don't want to start the system registry as a
* side effect of retrieving it.
* @return <code>true</code> if the system registry has been instantiated already.
*/
private boolean isSystemRegistryActive()
{
return (_systemRegistry != null);
}
/** /**
* Gets the system registry set by {@link #setSystemRegistry(ISystemRegistry)}. * Return the SystemRegistry singleton.
* This registry is used to gain access to the basic services and components used in * Clients should use static @{link getTheSystemRegistry()} instead.
* the RSE user interface.
* @return the RSE system registry * @return the RSE system registry
*/ */
public ISystemRegistry getSystemRegistry() { public ISystemRegistry getSystemRegistry() {
return _registry; if (_systemRegistry == null) {
synchronized(this) {
if (_systemRegistry == null) {
String logfilePath = getStateLocation().toOSString();
SystemRegistry sr = SystemRegistry.getInstance(logfilePath);
ISubSystemConfigurationProxy[] proxies = getSubSystemConfigurationProxies();
if (proxies != null) {
sr.setSubSystemConfigurationProxies(proxies);
}
_systemRegistry = sr;
}
}
}
return _systemRegistry;
} }
/** /**

View file

@ -23,6 +23,7 @@
* David Dykstal (IBM) - [197036] adding new createHost and getSubSystemConfigurationsBySYstemType which * David Dykstal (IBM) - [197036] adding new createHost and getSubSystemConfigurationsBySYstemType which
* are able to delay the creation of subsystems. * are able to delay the creation of subsystems.
* David Dykstal (IBM) - [217556] remove service subsystem types * David Dykstal (IBM) - [217556] remove service subsystem types
* Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.core.model; package org.eclipse.rse.core.model;
@ -144,34 +145,6 @@ public interface ISystemRegistry extends ISchedulingRule, IAdaptable, ISystemVie
*/ */
public boolean hasConnectionChildren(IHost selectedConnection); public boolean hasConnectionChildren(IHost selectedConnection);
// ----------------------------
// USER PREFERENCE METHODS...
// ----------------------------
/**
* Are connection names to be qualified by profile name?
*/
public boolean getQualifiedHostNames();
/**
* Set if connection names are to be qualified by profile name
*/
public void setQualifiedHostNames(boolean set);
/**
* Reflect the user changing the preference for showing filter pools.
*/
public void setShowFilterPools(boolean show);
/*
* Reflect the user changing the preference for showing filter strings.
*
public void setShowFilterStrings(boolean show);
*/
/**
* Reflect the user changing the preference for showing new connection prompt
*/
public void setShowNewHostPrompt(boolean show);
// ---------------------------- // ----------------------------
// PROFILE METHODS... // PROFILE METHODS...
// ---------------------------- // ----------------------------
@ -324,12 +297,15 @@ public interface ISystemRegistry extends ISchedulingRule, IAdaptable, ISystemVie
// CONNECTION METHODS... // CONNECTION METHODS...
// ---------------------------- // ----------------------------
/** /**
* Return the first connection to localhost we can find. While we always create a default one in * Return the first connection to the local host we can find.
* the user's profile, it is possible that this profile is not active or the connection was deleted. *
* However, since any connection to localHost will usually do, we just search all active profiles * While we always create a default one in the user's profile, it is possible that
* until we find one, and return it. <br> * this profile is not active or the connection was deleted. However, since any
* If no localhost connection is found, this will return null. If one is needed, it can be created * connection to the local host will usually do, we just search all active profiles
* easily by calling {@link #createLocalHost(ISystemProfile, String, String)}. * until we find one, and return it. <br>
* If no connection to the local host can be found, this will return <code>null</code>.
* If one is needed, it can be created easily by calling
* {@link #createLocalHost(ISystemProfile, String, String)}.
*/ */
public IHost getLocalHost(); public IHost getLocalHost();

View file

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
@ -8,6 +8,7 @@
* David Dykstal (IBM) - initial API and implementation * David Dykstal (IBM) - initial API and implementation
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies * David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
* Martin Oberhuber (Wind River) - [184095] combined RSEModelResources and persistence.Messages into this file * Martin Oberhuber (Wind River) - [184095] combined RSEModelResources and persistence.Messages into this file
* Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.core; package org.eclipse.rse.internal.core;
@ -51,6 +52,17 @@ public class RSECoreMessages extends NLS {
// Password Persistence Manager // Password Persistence Manager
public static String DefaultSystemType_Label; public static String DefaultSystemType_Label;
// SystemRegistry: Loading Profile Warning Messages - See also ISystemMessages
public static String MSG_LOADING_PROFILE_WARNING_FILTERPOOL_REFS;
public static String MSG_LOADING_PROFILE_WARNING_FILTERPOOL_REF;
public static String MSG_LOADING_PROFILE_SHOULDNOTBE_DEACTIVATED; //RSEG1069
public static String MSG_CREATEHOST_EXCEPTION;
// SystemRegistry: Progress Reporting - See also ISystemMessages
public static String MSG_COPYCONNECTION_PROGRESS; //RSEG1073
public static String MSG_COPYFILTERPOOLS_PROGRESS; //RSEG1075
public static String MSG_COPYSUBSYSTEMS_PROGRESS; //RSEG1081
private RSECoreMessages() { private RSECoreMessages() {
} }
} }

View file

@ -1,5 +1,5 @@
############################################################################### ###############################################################################
# Copyright (c) 2000, 2007 IBM Corporation and others. # Copyright (c) 2000, 2008 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0 # are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at # which accompanies this distribution, and is available at
@ -9,6 +9,7 @@
# David Dykstal (IBM) - initial API and implementation # David Dykstal (IBM) - initial API and implementation
# David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies # David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
# Martin Oberhuber (Wind River) - [184095] combined RSEModelResources and persistence.Messages into this file # Martin Oberhuber (Wind River) - [184095] combined RSEModelResources and persistence.Messages into this file
# Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
############################################################################### ###############################################################################
# NLS_MESSAGEFORMAT_VAR # NLS_MESSAGEFORMAT_VAR
@ -44,3 +45,14 @@ SerializingProvider_UnexpectedException=Unexpected Exception
# Password Persistence Manager # Password Persistence Manager
DefaultSystemType_Label=Default DefaultSystemType_Label=Default
# SystemRegistry: Loading Profile Warning Messages - See also ISystemMessages
MSG_LOADING_PROFILE_WARNING_FILTERPOOL_REFS=RSEG1069: De-Activating profile {0} for which there are subsystems containing references to filter pools:
MSG_LOADING_PROFILE_WARNING_FILTERPOOL_REF=\ in connection {1} in profile {2}
MSG_LOADING_PROFILE_SHOULDNOTBE_DEACTIVATED=RSEG1069: Warning. Profile '{0}' should be active. Active connection '{1}' contains a reference to it.
MSG_CREATEHOST_EXCEPTION=Exception in createHost for {0}
# SystemRegistry: Progress Reporting - See also ISystemMessages
MSG_COPYCONNECTION_PROGRESS=Copying connection {0}
MSG_COPYFILTERPOOLS_PROGRESS=Copying filter pools
MSG_COPYSUBSYSTEMS_PROGRESS=Copying subsystems

View file

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
@ -12,9 +12,10 @@
* *
* Contributors: * Contributors:
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
* Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui.internal.model; package org.eclipse.rse.internal.core.model;
import org.eclipse.rse.core.events.ISystemResourceChangeEvent; import org.eclipse.rse.core.events.ISystemResourceChangeEvent;
import org.eclipse.rse.core.events.ISystemResourceChangeListener; import org.eclipse.rse.core.events.ISystemResourceChangeListener;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
@ -24,7 +25,7 @@ import org.eclipse.swt.widgets.Display;
* To support posted events versus synchronous events, this class encapsulates * To support posted events versus synchronous events, this class encapsulates
* the code to execute via the run() method. * the code to execute via the run() method.
* <p> * <p>
* The post behaviour is accomplished by calling the asyncExec method in the swt * The post behavior is accomplished by calling the asyncExec method in the SWT
* widget Display class. The Display object comes from calling getDisplay() on * widget Display class. The Display object comes from calling getDisplay() on
* the shell which we get by calling getShell on the given listener. * the shell which we get by calling getShell on the given listener.
* <p> * <p>

View file

@ -43,9 +43,10 @@
* rewrote createHost to better pick default subsystem configurations to activate * rewrote createHost to better pick default subsystem configurations to activate
* rewrote getSubSystemConfigurationsBySystemType to be able to delay the creation (and loading) of subsystem configurations * rewrote getSubSystemConfigurationsBySystemType to be able to delay the creation (and loading) of subsystem configurations
* David Dykstal (IBM) - [217556] remove service subsystem types * David Dykstal (IBM) - [217556] remove service subsystem types
* Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui.internal.model; package org.eclipse.rse.internal.core.model;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
@ -60,6 +61,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.ISchedulingRule; import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.osgi.util.NLS;
import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.IRSESystemType;
import org.eclipse.rse.core.IRSEUserIdConstants; import org.eclipse.rse.core.IRSEUserIdConstants;
import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.RSECorePlugin;
@ -91,32 +93,16 @@ import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.model.SystemChildrenContentsType; import org.eclipse.rse.core.model.SystemChildrenContentsType;
import org.eclipse.rse.core.references.IRSEBaseReferencingObject; import org.eclipse.rse.core.references.IRSEBaseReferencingObject;
import org.eclipse.rse.core.subsystems.IConnectorService; import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier;
import org.eclipse.rse.core.subsystems.ISubSystem; import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy; import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter; import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter;
import org.eclipse.rse.internal.core.RSECoreMessages;
import org.eclipse.rse.internal.core.filters.SystemFilterStartHere; import org.eclipse.rse.internal.core.filters.SystemFilterStartHere;
import org.eclipse.rse.internal.core.model.ISystemProfileOperation;
import org.eclipse.rse.internal.core.model.SystemHostPool;
import org.eclipse.rse.internal.core.model.SystemModelChangeEvent;
import org.eclipse.rse.internal.core.model.SystemModelChangeEventManager;
import org.eclipse.rse.internal.core.model.SystemPreferenceChangeManager;
import org.eclipse.rse.internal.core.model.SystemProfileManager;
import org.eclipse.rse.internal.core.model.SystemRemoteChangeEventManager;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException; import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.RSESystemTypeAdapter;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemBasePlugin;
import org.eclipse.rse.ui.SystemPreferencesManager;
import org.eclipse.rse.ui.messages.SystemMessageDialog;
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
import org.eclipse.rse.ui.view.SystemAdapterHelpers;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import com.ibm.icu.text.MessageFormat;
/** /**
* Registry for all connections. * Registry for all connections.
*/ */
@ -124,13 +110,12 @@ public class SystemRegistry implements ISystemRegistry
{ {
private static Exception lastException = null; private static Exception lastException = null;
private static SystemRegistry registry = null; private static SystemRegistry registry = null;
private SystemResourceChangeManager listenerManager = null; private final SystemResourceChangeManager listenerManager = new SystemResourceChangeManager();
private SystemPreferenceChangeManager preferenceListManager = null; private final SystemPreferenceChangeManager preferenceListManager = new SystemPreferenceChangeManager();
private SystemModelChangeEventManager modelListenerManager = null; private final SystemModelChangeEventManager modelListenerManager = new SystemModelChangeEventManager();
private final SystemRemoteChangeEventManager remoteListManager = new SystemRemoteChangeEventManager();
private SystemModelChangeEvent modelEvent; private SystemModelChangeEvent modelEvent;
private SystemRemoteChangeEventManager remoteListManager = null;
private SystemRemoteChangeEvent remoteEvent; private SystemRemoteChangeEvent remoteEvent;
private int listenerCount = 0; private int listenerCount = 0;
private int modelListenerCount = 0; private int modelListenerCount = 0;
private int remoteListCount = 0; private int remoteListCount = 0;
@ -139,7 +124,6 @@ public class SystemRegistry implements ISystemRegistry
private boolean errorLoadingFactory = false; private boolean errorLoadingFactory = false;
//For ISystemViewInputProvider //For ISystemViewInputProvider
private Object shell = null;
private Object viewer = null; private Object viewer = null;
/** /**
@ -152,11 +136,6 @@ public class SystemRegistry implements ISystemRegistry
{ {
super(); super();
listenerManager = new SystemResourceChangeManager();
modelListenerManager = new SystemModelChangeEventManager();
remoteListManager = new SystemRemoteChangeEventManager();
preferenceListManager = new SystemPreferenceChangeManager();
// get initial shell // get initial shell
//FIXME - this can cause problems - don't think we should do this here anyway //FIXME - this can cause problems - don't think we should do this here anyway
//getShell(); // will quietly fail in headless mode. Phil //getShell(); // will quietly fail in headless mode. Phil
@ -372,82 +351,6 @@ public class SystemRegistry implements ISystemRegistry
return result; return result;
} }
// ----------------------------
// USER PREFERENCE METHODS...
// ----------------------------
/**
* Are connection names to be qualified by profile name?
*/
public boolean getQualifiedHostNames()
{
return SystemPreferencesManager.getQualifyConnectionNames();
}
/**
* Set if connection names are to be qualified by profile name
*/
public void setQualifiedHostNames(boolean set)
{
SystemPreferencesManager.setQualifyConnectionNames(set);
IHost[] conns = getHosts();
if (conns != null)
{
for (int idx = 0; idx < conns.length; idx++)
{
fireEvent(new SystemResourceChangeEvent(conns[idx], ISystemResourceChangeEvents.EVENT_RENAME, this));
}
}
if (SystemPreferencesManager.getShowFilterPools())
{
fireEvent(new SystemResourceChangeEvent(this, ISystemResourceChangeEvents.EVENT_REFRESH, this));
}
}
/**
* Reflect the user changing the preference for showing filter pools.
*/
public void setShowFilterPools(boolean show)
{
if (subsystemConfigurationProxies != null)
{
for (int idx = 0; idx < subsystemConfigurationProxies.length; idx++)
{
if (subsystemConfigurationProxies[idx].isSubSystemConfigurationActive())
{
ISubSystemConfiguration factory = subsystemConfigurationProxies[idx].getSubSystemConfiguration();
if ((factory != null) && factory.supportsFilters())
factory.setShowFilterPools(show);
}
}
}
}
/*
* Reflect the user changing the preference for showing filter strings.
*
public void setShowFilterStrings(boolean show)
{
if (subsystemConfigurationProxies != null)
{
for (int idx = 0; idx < subsystemConfigurationProxies.length; idx++)
{
if (subsystemConfigurationProxies[idx].isSubSystemConfigurationActive())
{
SubSystemConfiguration factory = subsystemConfigurationProxies[idx].getSubSystemConfiguration();
if ((factory!=null)&&factory.supportsFilters())
factory.setShowFilterStrings(show);
}
}
}
}*/
/**
* Reflect the user changing the preference for showing new connection prompt
*/
public void setShowNewHostPrompt(boolean show)
{
fireEvent(new SystemResourceChangeEvent(this, ISystemResourceChangeEvents.EVENT_REFRESH, null));
}
// ---------------------------- // ----------------------------
// PROFILE METHODS... // PROFILE METHODS...
// ---------------------------- // ----------------------------
@ -566,10 +469,11 @@ public class SystemRegistry implements ISystemRegistry
ssf.renameSubSystemProfile(ss, oldName, newName); ssf.renameSubSystemProfile(ss, oldName, newName);
} }
} }
SystemPreferencesManager.setConnectionNamesOrder(); // update preferences order list ////Listening to events now
boolean namesQualifed = getQualifiedHostNames(); //SystemPreferencesManager.setConnectionNamesOrder(); // update preferences order list
if (namesQualifed) //boolean namesQualifed = SystemPreferencesManager.getQualifyConnectionNames();
setQualifiedHostNames(namesQualifed); // causes refresh events to be fired //if (namesQualifed)
// setQualifiedHostNames(namesQualifed); // causes refresh events to be fired
fireModelChangeEvent( fireModelChangeEvent(
ISystemModelChangeEvents.SYSTEM_RESOURCE_RENAMED, ISystemModelChangeEvents.SYSTEM_RESOURCE_RENAMED,
@ -589,7 +493,7 @@ public class SystemRegistry implements ISystemRegistry
String oldName = profile.getName(); String oldName = profile.getName();
IHost[] newConns = null; IHost[] newConns = null;
//RSEUIPlugin.logDebugMessage(this.getClass().getName(), "Start of system profile copy. From: "+oldName+" to: "+newName+", makeActive: "+makeActive); //RSECorePlugin.getDefault().getLogger().logDebugMessage(this.getClass().getName(), "Start of system profile copy. From: "+oldName+" to: "+newName+", makeActive: "+makeActive);
// STEP 0: BRING ALL IMPACTED SUBSYSTEM FACTORIES TO LIFE NOW, BEFORE CREATING THE NEW PROFILE. // STEP 0: BRING ALL IMPACTED SUBSYSTEM FACTORIES TO LIFE NOW, BEFORE CREATING THE NEW PROFILE.
// IF WE DO NOT DO THIS NOW, THEN THEY WILL CREATE A FILTER POOL MGR FOR THE NEW PROFILE AS THEY COME // IF WE DO NOT DO THIS NOW, THEN THEY WILL CREATE A FILTER POOL MGR FOR THE NEW PROFILE AS THEY COME
// TO LIFE... SOMETHING WE DON'T WANT! // TO LIFE... SOMETHING WE DON'T WANT!
@ -613,12 +517,12 @@ public class SystemRegistry implements ISystemRegistry
if ((conns != null) && (conns.length > 0)) if ((conns != null) && (conns.length > 0))
{ {
newConns = new IHost[conns.length]; newConns = new IHost[conns.length];
SystemMessage msgNoSubs = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COPYCONNECTION_PROGRESS); String msgNoSubs = RSECoreMessages.MSG_COPYCONNECTION_PROGRESS;
for (int idx = 0; idx < conns.length; idx++) for (int idx = 0; idx < conns.length; idx++)
{ {
msgNoSubs.makeSubstitution(conns[idx].getAliasName()); msg = NLS.bind(msgNoSubs, conns[idx].getAliasName());
SystemBasePlugin.logDebugMessage(this.getClass().getName(), msgNoSubs.getLevelOneText()); RSECorePlugin.getDefault().getLogger().logDebugMessage(this.getClass().getName(), msg);
monitor.subTask(msgNoSubs.getLevelOneText()); monitor.subTask(msg);
newConns[idx] = oldPool.cloneHost(newPool, conns[idx], conns[idx].getAliasName()); newConns[idx] = oldPool.cloneHost(newPool, conns[idx], conns[idx].getAliasName());
@ -626,9 +530,9 @@ public class SystemRegistry implements ISystemRegistry
//try { java.lang.Thread.sleep(3000l); } catch (InterruptedException e) {} //try { java.lang.Thread.sleep(3000l); } catch (InterruptedException e) {}
} }
} }
msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COPYFILTERPOOLS_PROGRESS).getLevelOneText(); msg = RSECoreMessages.MSG_COPYFILTERPOOLS_PROGRESS;
monitor.subTask(msg); monitor.subTask(msg);
SystemBasePlugin.logDebugMessage(this.getClass().getName(), msg); RSECorePlugin.getDefault().getLogger().logDebugMessage(this.getClass().getName(), msg);
// STEP 4: CREATE NEW FILTER POOL MANAGER // STEP 4: CREATE NEW FILTER POOL MANAGER
// STEP 5: COPY ALL FILTER POOLS FROM OLD MANAGER TO NEW MANAGER // STEP 5: COPY ALL FILTER POOLS FROM OLD MANAGER TO NEW MANAGER
@ -637,7 +541,7 @@ public class SystemRegistry implements ISystemRegistry
ISubSystemConfiguration factory = (ISubSystemConfiguration) factories.elementAt(idx); ISubSystemConfiguration factory = (ISubSystemConfiguration) factories.elementAt(idx);
msg = "Copying filterPools for factory " + factory.getName(); //$NON-NLS-1$ msg = "Copying filterPools for factory " + factory.getName(); //$NON-NLS-1$
//monitor.subTask(msg); //monitor.subTask(msg);
SystemBasePlugin.logDebugMessage(this.getClass().getName(), msg); RSECorePlugin.getDefault().getLogger().logDebugMessage(this.getClass().getName(), msg);
factory.copyFilterPoolManager(profile, newProfile); factory.copyFilterPoolManager(profile, newProfile);
//try { java.lang.Thread.sleep(3000l); } catch (InterruptedException e) {} //try { java.lang.Thread.sleep(3000l); } catch (InterruptedException e) {}
} }
@ -645,9 +549,9 @@ public class SystemRegistry implements ISystemRegistry
monitor.worked(1); monitor.worked(1);
// STEP 6: COPY ALL SUBSYSTEMS FOR EACH COPIED CONNECTION // STEP 6: COPY ALL SUBSYSTEMS FOR EACH COPIED CONNECTION
msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COPYSUBSYSTEMS_PROGRESS).getLevelOneText(); msg = RSECoreMessages.MSG_COPYSUBSYSTEMS_PROGRESS;
monitor.subTask(msg); monitor.subTask(msg);
SystemBasePlugin.logDebugMessage(this.getClass().getName(), msg); RSECorePlugin.getDefault().getLogger().logDebugMessage(this.getClass().getName(), msg);
if ((conns != null) && (conns.length > 0)) if ((conns != null) && (conns.length > 0))
{ {
ISubSystem[] subsystems = null; ISubSystem[] subsystems = null;
@ -656,7 +560,7 @@ public class SystemRegistry implements ISystemRegistry
{ {
msg = "Copying subsystems for connection " + conns[idx].getAliasName(); //$NON-NLS-1$ msg = "Copying subsystems for connection " + conns[idx].getAliasName(); //$NON-NLS-1$
//monitor.subTask(msg); //monitor.subTask(msg);
SystemBasePlugin.logDebugMessage(this.getClass().getName(), msg); RSECorePlugin.getDefault().getLogger().logDebugMessage(this.getClass().getName(), msg);
subsystems = getSubSystems(conns[idx]); // get old subsystems for this connection subsystems = getSubSystems(conns[idx]); // get old subsystems for this connection
if ((subsystems != null) && (subsystems.length > 0) && newConns != null) if ((subsystems != null) && (subsystems.length > 0) && newConns != null)
{ {
@ -664,7 +568,7 @@ public class SystemRegistry implements ISystemRegistry
{ {
msg += ": subsystem " + subsystems[jdx].getName(); //$NON-NLS-1$ msg += ": subsystem " + subsystems[jdx].getName(); //$NON-NLS-1$
//monitor.subTask(msg); //monitor.subTask(msg);
SystemBasePlugin.logDebugMessage(this.getClass().getName(), msg); RSECorePlugin.getDefault().getLogger().logDebugMessage(this.getClass().getName(), msg);
factory = subsystems[jdx].getSubSystemConfiguration(); factory = subsystems[jdx].getSubSystemConfiguration();
factory.cloneSubSystem(subsystems[jdx], newConns[idx], true); // true=>copy profile op vs copy connection op factory.cloneSubSystem(subsystems[jdx], newConns[idx], true); // true=>copy profile op vs copy connection op
//try { java.lang.Thread.sleep(3000l); } catch (InterruptedException e) {} //try { java.lang.Thread.sleep(3000l); } catch (InterruptedException e) {}
@ -698,7 +602,7 @@ public class SystemRegistry implements ISystemRegistry
} }
catch (Exception exc) catch (Exception exc)
{ {
SystemBasePlugin.logError("Exception (ignored) cleaning up from copy-profile exception.", exc); //$NON-NLS-1$ RSECorePlugin.getDefault().getLogger().logError("Exception (ignored) cleaning up from copy-profile exception.", exc); //$NON-NLS-1$
} }
throw (lastExc); throw (lastExc);
} }
@ -712,7 +616,7 @@ public class SystemRegistry implements ISystemRegistry
ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_PROFILE, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_PROFILE,
newProfile, null); newProfile, null);
SystemBasePlugin.logDebugMessage(this.getClass().getName(), "Copy of system profile " + oldName + " to " + newName + " successful"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ RSECorePlugin.getDefault().getLogger().logDebugMessage(this.getClass().getName(), "Copy of system profile " + oldName + " to " + newName + " successful"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
return newProfile; return newProfile;
} }
@ -749,7 +653,8 @@ public class SystemRegistry implements ISystemRegistry
} }
// last step... physically blow away the profile... // last step... physically blow away the profile...
getSystemProfileManager().deleteSystemProfile(profile, true); getSystemProfileManager().deleteSystemProfile(profile, true);
SystemPreferencesManager.setConnectionNamesOrder(); // update preferences order list ////Listening to Events now
//SystemPreferencesManager.setConnectionNamesOrder(); // update preferences order list
if (connections.length > 0) // defect 42112 if (connections.length > 0) // defect 42112
fireEvent(new SystemResourceChangeEvent(connections, ISystemResourceChangeEvents.EVENT_DELETE_MANY, this)); fireEvent(new SystemResourceChangeEvent(connections, ISystemResourceChangeEvents.EVENT_DELETE_MANY, this));
@ -786,26 +691,29 @@ public class SystemRegistry implements ISystemRegistry
} }
if (activeReferenceVector.size() > 0) if (activeReferenceVector.size() > 0)
{ {
SystemBasePlugin.logWarning( //RSEG1069: De-Activativing profile {0} for which there are subsystems containing references to filter pools:
ISystemMessages.MSG_LOADING_PROFILE_SHOULDNOTBE_DEACTIVATED String msg = NLS.bind(RSECoreMessages.MSG_LOADING_PROFILE_WARNING_FILTERPOOL_REFS, profile.getName());
+ ": De-Activativing profile " //$NON-NLS-1$ RSECorePlugin.getDefault().getLogger().logWarning(msg);
+ profile.getName()
+ " for which there are subsystems containing references to filter pools:"); //$NON-NLS-1$
for (int idx = 0; idx < activeReferenceVector.size(); idx++) for (int idx = 0; idx < activeReferenceVector.size(); idx++)
{ {
//\ \ {refname} in connection {1} in profile {2}
ISubSystem activeReference = (ISubSystem) activeReferenceVector.elementAt(idx); ISubSystem activeReference = (ISubSystem) activeReferenceVector.elementAt(idx);
SystemBasePlugin.logWarning( msg = " " + activeReference.getName(); //$NON-NLS-1$
" " + activeReference.getName() + " in connection " + activeReference.getHost().getAliasName() + " in profile " + activeReference.getSystemProfileName()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ msg += NLS.bind(RSECoreMessages.MSG_LOADING_PROFILE_WARNING_FILTERPOOL_REF,
activeReference.getHost().getAliasName(),
activeReference.getSystemProfileName());
RSECorePlugin.getDefault().getLogger().logWarning(msg);
} }
ISubSystem firstSubSystem = (ISubSystem) activeReferenceVector.elementAt(0); ISubSystem firstSubSystem = (ISubSystem) activeReferenceVector.elementAt(0);
String connectionName = firstSubSystem.getHost().getSystemProfileName() + "." + firstSubSystem.getHost().getAliasName(); //$NON-NLS-1$ String connectionName = firstSubSystem.getHost().getSystemProfileName() + "." + firstSubSystem.getHost().getAliasName(); //$NON-NLS-1$
//Warning. Profile '%1' should be active. Active connection '%2' contains a reference to it. //RSEG1069: Warning. Profile '%1' should be active. Active connection '%2' contains a reference to it.
//FIXME I think it should be sufficient to log this as warning rather than open a dialog msg = NLS.bind(RSECoreMessages.MSG_LOADING_PROFILE_SHOULDNOTBE_DEACTIVATED, profile.getName(), connectionName);
SystemMessage sysMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_LOADING_PROFILE_SHOULDNOTBE_DEACTIVATED); RSECorePlugin.getDefault().getLogger().logWarning(msg);
sysMsg.makeSubstitution(profile.getName(), connectionName); //// I think it should be sufficient to log this as warning rather than open a dialog
SystemBasePlugin.logWarning(sysMsg.getFullMessageID() + ": " + sysMsg.getLevelOneText()); //$NON-NLS-1$ //SystemMessage sysMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_LOADING_PROFILE_SHOULDNOTBE_DEACTIVATED);
SystemMessageDialog msgDlg = new SystemMessageDialog(null, sysMsg); //sysMsg.makeSubstitution(profile.getName(), connectionName);
msgDlg.open(); //SystemMessageDialog msgDlg = new SystemMessageDialog(null, sysMsg);
//msgDlg.open();
} }
getSystemProfileManager().makeSystemProfileActive(profile, makeActive); getSystemProfileManager().makeSystemProfileActive(profile, makeActive);
@ -848,7 +756,8 @@ public class SystemRegistry implements ISystemRegistry
SystemResourceChangeEvent event = new SystemResourceChangeEvent(affectedConnections, ISystemResourceChangeEvents.EVENT_ADD_MANY, this); SystemResourceChangeEvent event = new SystemResourceChangeEvent(affectedConnections, ISystemResourceChangeEvents.EVENT_ADD_MANY, this);
fireEvent(event); fireEvent(event);
} }
SystemPreferencesManager.setConnectionNamesOrder(); // update preferences order list ////Listening to Events now
//SystemPreferencesManager.setConnectionNamesOrder(); // update preferences order list
fireModelChangeEvent( fireModelChangeEvent(
ISystemModelChangeEvents.SYSTEM_RESOURCE_CHANGED, ISystemModelChangeEvents.SYSTEM_RESOURCE_CHANGED,
@ -1611,7 +1520,7 @@ public class SystemRegistry implements ISystemRegistry
} }
catch (Exception exc) catch (Exception exc)
{ {
SystemBasePlugin.logError("Error creating local connection", exc); //$NON-NLS-1$ RSECorePlugin.getDefault().getLogger().logError("Error creating local connection", exc); //$NON-NLS-1$
} }
return localConn; return localConn;
} }
@ -1687,8 +1596,8 @@ public class SystemRegistry implements ISystemRegistry
host = pool.getHost(hostName); host = pool.getHost(hostName);
} }
} catch (Exception e) { } catch (Exception e) {
String pluginId = RSEUIPlugin.getDefault().getSymbolicName(); String pluginId = RSECorePlugin.getDefault().getBundle().getSymbolicName();
String message = MessageFormat.format("Exception in createHost for {0}", new Object[] {hostName}); String message = NLS.bind(RSECoreMessages.MSG_CREATEHOST_EXCEPTION, hostName);
status = new Status(IStatus.ERROR, pluginId, message, e); status = new Status(IStatus.ERROR, pluginId, message, e);
} }
if (status.isOK()) { if (status.isOK()) {
@ -1736,14 +1645,15 @@ public class SystemRegistry implements ISystemRegistry
IStatus status = SystemProfileManager.run(op); IStatus status = SystemProfileManager.run(op);
lastException = (Exception) status.getException(); lastException = (Exception) status.getException();
if (lastException != null) { if (lastException != null) {
SystemBasePlugin.logError(status.getMessage(), lastException); RSECorePlugin.getDefault().getLogger().logError(status.getMessage(), lastException);
throw lastException; throw lastException;
} }
IHost host = op.getHost(); IHost host = op.getHost();
ISubSystem[] subsystems = op.getSubSystems(); ISubSystem[] subsystems = op.getSubSystems();
FireNewHostEvents fire = new FireNewHostEvents(host, subsystems, sr); FireNewHostEvents fire = new FireNewHostEvents(host, subsystems, sr);
Display.getDefault().asyncExec(fire); Display.getDefault().asyncExec(fire);
SystemPreferencesManager.setConnectionNamesOrder(); // update preferences order list ////Listening to FireNewHostEvents now
//SystemPreferencesManager.setConnectionNamesOrder(); // update preferences order list
return host; return host;
} }
@ -2032,13 +1942,13 @@ public class SystemRegistry implements ISystemRegistry
} }
catch (SystemMessageException exc) catch (SystemMessageException exc)
{ {
SystemBasePlugin.logError("Exception in updateConnection for " + connectionName, exc); //$NON-NLS-1$ RSECorePlugin.getDefault().getLogger().logError("Exception in updateConnection for " + connectionName, exc); //$NON-NLS-1$
lastException = exc; lastException = exc;
return; return;
} }
catch (Exception exc) catch (Exception exc)
{ {
SystemBasePlugin.logError("Exception in updateConnection for " + connectionName, exc); //$NON-NLS-1$ RSECorePlugin.getDefault().getLogger().logError("Exception in updateConnection for " + connectionName, exc); //$NON-NLS-1$
lastException = exc; lastException = exc;
return; return;
} }
@ -2101,7 +2011,8 @@ public class SystemRegistry implements ISystemRegistry
((ISubSystemConfiguration) affectedSubSystemFactories.elementAt(idx)).deleteSubSystemsByConnection(conn); ((ISubSystemConfiguration) affectedSubSystemFactories.elementAt(idx)).deleteSubSystemsByConnection(conn);
} }
conn.getHostPool().deleteHost(conn); // delete from memory and from disk. conn.getHostPool().deleteHost(conn); // delete from memory and from disk.
SystemPreferencesManager.setConnectionNamesOrder(); // update preferences order list ////Listening to Events now
//SystemPreferencesManager.setConnectionNamesOrder(); // update preferences order list
fireModelChangeEvent( fireModelChangeEvent(
ISystemModelChangeEvents.SYSTEM_RESOURCE_REMOVED, ISystemModelChangeEvents.SYSTEM_RESOURCE_REMOVED,
ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_CONNECTION, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_CONNECTION,
@ -2134,7 +2045,8 @@ public class SystemRegistry implements ISystemRegistry
((ISubSystemConfiguration) affectedSubSystemFactories.elementAt(idx)).renameSubSystemsByConnection(conn, newName); ((ISubSystemConfiguration) affectedSubSystemFactories.elementAt(idx)).renameSubSystemsByConnection(conn, newName);
*/ */
conn.getHostPool().renameHost(conn, newName); // rename in memory and disk conn.getHostPool().renameHost(conn, newName); // rename in memory and disk
SystemPreferencesManager.setConnectionNamesOrder(); // update preferences order list ////Listening to events now
//SystemPreferencesManager.setConnectionNamesOrder(); // update preferences order list
fireModelChangeEvent( fireModelChangeEvent(
ISystemModelChangeEvents.SYSTEM_RESOURCE_RENAMED, ISystemModelChangeEvents.SYSTEM_RESOURCE_RENAMED,
ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_CONNECTION, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_CONNECTION,
@ -2150,7 +2062,8 @@ public class SystemRegistry implements ISystemRegistry
{ {
ISystemHostPool pool = getHostPool(profileName); ISystemHostPool pool = getHostPool(profileName);
pool.moveHosts(conns, delta); pool.moveHosts(conns, delta);
SystemPreferencesManager.setConnectionNamesOrder(); ////Listening to Event now
//SystemPreferencesManager.setConnectionNamesOrder();
//fireEvent(new SystemResourceChangeEvent(pool.getSystemConnections(),ISystemResourceChangeEvent.EVENT_MOVE_MANY,this)); //fireEvent(new SystemResourceChangeEvent(pool.getSystemConnections(),ISystemResourceChangeEvent.EVENT_MOVE_MANY,this));
SystemResourceChangeEvent event = new SystemResourceChangeEvent(conns, ISystemResourceChangeEvents.EVENT_MOVE_MANY, this); SystemResourceChangeEvent event = new SystemResourceChangeEvent(conns, ISystemResourceChangeEvents.EVENT_MOVE_MANY, this);
event.setPosition(delta); event.setPosition(delta);
@ -2177,7 +2090,7 @@ public class SystemRegistry implements ISystemRegistry
ISystemHostPool targetPool = getHostPool(targetProfile); ISystemHostPool targetPool = getHostPool(targetProfile);
IHost newConn = null; IHost newConn = null;
SystemBasePlugin.logDebugMessage(this.getClass().getName(), "Start of system connection copy. From: " + oldName + " to: " + newName); //$NON-NLS-1$ //$NON-NLS-2$ RSECorePlugin.getDefault().getLogger().logDebugMessage(this.getClass().getName(), "Start of system connection copy. From: " + oldName + " to: " + newName); //$NON-NLS-1$ //$NON-NLS-2$
// STEP 0: BRING ALL IMPACTED SUBSYSTEM FACTORIES TO LIFE NOW, BEFORE DOING THE CLONE. // STEP 0: BRING ALL IMPACTED SUBSYSTEM FACTORIES TO LIFE NOW, BEFORE DOING THE CLONE.
getSubSystemFactories(conn); getSubSystemFactories(conn);
@ -2190,15 +2103,15 @@ public class SystemRegistry implements ISystemRegistry
newConn = oldPool.cloneHost(targetPool, conn, newName); newConn = oldPool.cloneHost(targetPool, conn, newName);
// STEP 2: COPY ALL SUBSYSTEMS FOR THE COPIED CONNECTION // STEP 2: COPY ALL SUBSYSTEMS FOR THE COPIED CONNECTION
msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COPYSUBSYSTEMS_PROGRESS).getLevelOneText(); msg = RSECoreMessages.MSG_COPYSUBSYSTEMS_PROGRESS;
//monitor.subTask(msg); //monitor.subTask(msg);
SystemBasePlugin.logDebugMessage(this.getClass().getName(), msg); RSECorePlugin.getDefault().getLogger().logDebugMessage(this.getClass().getName(), msg);
ISubSystem[] subsystems = null; ISubSystem[] subsystems = null;
ISubSystemConfiguration factory = null; ISubSystemConfiguration factory = null;
msg = "Copying subsystems for connection " + conn.getAliasName(); //$NON-NLS-1$ msg = "Copying subsystems for connection " + conn.getAliasName(); //$NON-NLS-1$
//monitor.subTask(msg); //monitor.subTask(msg);
SystemBasePlugin.logDebugMessage(this.getClass().getName(), msg); RSECorePlugin.getDefault().getLogger().logDebugMessage(this.getClass().getName(), msg);
subsystems = getSubSystems(conn); // get old subsystems for this connection subsystems = getSubSystems(conn); // get old subsystems for this connection
if ((subsystems != null) && (subsystems.length > 0)) if ((subsystems != null) && (subsystems.length > 0))
{ {
@ -2206,7 +2119,7 @@ public class SystemRegistry implements ISystemRegistry
{ {
msg += ": subsystem " + subsystems[jdx].getName(); //$NON-NLS-1$ msg += ": subsystem " + subsystems[jdx].getName(); //$NON-NLS-1$
//monitor.subTask(msg); //monitor.subTask(msg);
SystemBasePlugin.logDebugMessage(this.getClass().getName(), msg); RSECorePlugin.getDefault().getLogger().logDebugMessage(this.getClass().getName(), msg);
factory = subsystems[jdx].getSubSystemConfiguration(); factory = subsystems[jdx].getSubSystemConfiguration();
factory.cloneSubSystem(subsystems[jdx], newConn, false); // false=>copy connection op vs copy profile op factory.cloneSubSystem(subsystems[jdx], newConn, false); // false=>copy connection op vs copy profile op
//try { java.lang.Thread.sleep(3000l); } catch (InterruptedException e) {} //try { java.lang.Thread.sleep(3000l); } catch (InterruptedException e) {}
@ -2229,11 +2142,11 @@ public class SystemRegistry implements ISystemRegistry
} }
catch (Exception exc) catch (Exception exc)
{ {
SystemBasePlugin.logError("Exception (ignored) cleaning up from copy-connection exception.", exc); //$NON-NLS-1$ RSECorePlugin.getDefault().getLogger().logError("Exception (ignored) cleaning up from copy-connection exception.", exc); //$NON-NLS-1$
} }
throw (lastExc); throw (lastExc);
} }
SystemBasePlugin.logDebugMessage(this.getClass().getName(), "Copy of system connection " + oldName + " to " + newName + " successful"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ RSECorePlugin.getDefault().getLogger().logDebugMessage(this.getClass().getName(), "Copy of system connection " + oldName + " to " + newName + " successful"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
if (getSystemProfileManager().isSystemProfileActive(targetProfile.getName())) if (getSystemProfileManager().isSystemProfileActive(targetProfile.getName()))
{ {
int eventType = ISystemResourceChangeEvents.EVENT_ADD_RELATIVE; int eventType = ISystemResourceChangeEvents.EVENT_ADD_RELATIVE;
@ -2263,13 +2176,13 @@ public class SystemRegistry implements ISystemRegistry
if (newConn != null) if (newConn != null)
{ {
deleteHost(conn); // delete old connection now that new one created successfully deleteHost(conn); // delete old connection now that new one created successfully
SystemBasePlugin.logDebugMessage(this.getClass().getName(), "Move of system connection " + conn.getAliasName() + " to profile " + targetProfile.getName() + " successful"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ RSECorePlugin.getDefault().getLogger().logDebugMessage(this.getClass().getName(), "Move of system connection " + conn.getAliasName() + " to profile " + targetProfile.getName() + " successful"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
fireEvent(new SystemResourceChangeEvent(conn, ISystemResourceChangeEvents.EVENT_DELETE, this)); fireEvent(new SystemResourceChangeEvent(conn, ISystemResourceChangeEvents.EVENT_DELETE, this));
} }
} }
catch (Exception exc) catch (Exception exc)
{ {
//RSEUIPlugin.logError("Exception moving system connection " + conn.getAliasName() + " to profile " + targetProfile.getName(), exc); //RSECorePlugin.getDefault().getLogger().logError("Exception moving system connection " + conn.getAliasName() + " to profile " + targetProfile.getName(), exc);
throw exc; throw exc;
} }
return newConn; return newConn;
@ -2770,9 +2683,34 @@ public class SystemRegistry implements ISystemRegistry
* Returns the implementation of ISystemRemoteElement for the given * Returns the implementation of ISystemRemoteElement for the given
* object. Returns null if this object does not adaptable to this. * object. Returns null if this object does not adaptable to this.
*/ */
protected ISystemRemoteElementAdapter getRemoteAdapter(Object o) protected IRemoteObjectIdentifier getRemoteObjectIdentifier(Object o)
{ {
return SystemAdapterHelpers.getRemoteAdapter(o); //Try 1: element already an instance of IRemoteObjectIdentifier?
if (o instanceof IRemoteObjectIdentifier) {
return (IRemoteObjectIdentifier)o;
}
//Try 2: adapts to IRemoteObjectIdentifier (non-UI code only!)
IRemoteObjectIdentifier adapter = null;
if (o instanceof IAdaptable) {
adapter = (IRemoteObjectIdentifier)((IAdaptable)o).getAdapter(IRemoteObjectIdentifier.class);
if (adapter!=null) return adapter;
} else if (o==null) {
return null;
}
//Try 3: IRemoteObjectIdentifier via factories.
//TODO Try loadAdapter() to force lazy loading?
adapter = (IRemoteObjectIdentifier)Platform.getAdapterManager().getAdapter(o, IRemoteObjectIdentifier.class);
if (adapter==null) {
//Try 4: ISystemDragDropAdapter, fallback to old factories provided via AbstractSystemViewRemoteAdapterFactory
//This is a fallback for pre-RSE-3.0 code and may introduce UI dependency!
if (o instanceof IAdaptable) {
//TODO Try loadAdapter() to force lazy loading?
adapter = (ISystemDragDropAdapter)((IAdaptable)o).getAdapter(ISystemDragDropAdapter.class);
if (adapter!=null) return adapter;
}
adapter = (ISystemDragDropAdapter)Platform.getAdapterManager().getAdapter(o, ISystemDragDropAdapter.class);
}
return adapter;
} }
private String getRemoteResourceAbsoluteName(Object remoteResource) private String getRemoteResourceAbsoluteName(Object remoteResource)
@ -2787,17 +2725,17 @@ public class SystemRegistry implements ISystemRegistry
ISystemFilterReference ref = (ISystemFilterReference)remoteResource; ISystemFilterReference ref = (ISystemFilterReference)remoteResource;
ISubSystem ss = ref.getSubSystem(); ISubSystem ss = ref.getSubSystem();
remoteResource = ss.getTargetForFilter(ref); remoteResource = ss.getTargetForFilter(ref);
ISystemRemoteElementAdapter ra = getRemoteAdapter(remoteResource); IRemoteObjectIdentifier rid = getRemoteObjectIdentifier(remoteResource);
if (ra == null) if (rid == null)
return null; return null;
remoteResourceName = ra.getAbsoluteName(remoteResource); remoteResourceName = rid.getAbsoluteName(remoteResource);
} }
else else
{ {
ISystemRemoteElementAdapter ra = getRemoteAdapter(remoteResource); IRemoteObjectIdentifier rid = getRemoteObjectIdentifier(remoteResource);
if (ra == null) if (rid == null)
return null; return null;
remoteResourceName = ra.getAbsoluteName(remoteResource); remoteResourceName = rid.getAbsoluteName(remoteResource);
} }
return remoteResourceName; return remoteResourceName;
} }
@ -3024,11 +2962,11 @@ public class SystemRegistry implements ISystemRegistry
boolean ok = true; boolean ok = true;
lastException = null; lastException = null;
/* /*
SystemProfileManager profileManager = SystemStartHere.getSystemProfileManager(); SystemProfileManager profileManager = RSECorePlugin.getTheSystemProfileManager();
SystemHostPool pool = null; SystemHostPool pool = null;
SystemPreferencesManager prefmgr = SystemPreferencesManager.getPreferencesManager(); SystemPreferencesManager prefmgr = SystemPreferencesManager.getPreferencesManager();
if (!RSEUIPlugin.getThePersistenceManager().restore(profileManager)) if (!RSECorePlugin.getThePersistenceManager().restore(profileManager))
{ {
SystemProfile[] profiles = profileManager.getActiveSystemProfiles(); SystemProfile[] profiles = profileManager.getActiveSystemProfiles();
for (int idx = 0; idx < profiles.length; idx++) for (int idx = 0; idx < profiles.length; idx++)
@ -3042,7 +2980,7 @@ public class SystemRegistry implements ISystemRegistry
catch (Exception exc) catch (Exception exc)
{ {
lastException = exc; lastException = exc;
RSEUIPlugin.logError("Exception in restore for connection pool " + profiles[idx].getName(), exc); RSECorePlugin.getDefault().getLogger().logError("Exception in restore for connection pool " + profiles[idx].getName(), exc);
} }
} }
} }
@ -3066,8 +3004,8 @@ public class SystemRegistry implements ISystemRegistry
// ---------------------------------- // ----------------------------------
/** /**
* Return the children objects to constitute the root elements in the system view tree. * Return the child objects to constitute the root elements in the system view tree.
* We return all connections for all active profiles. * We return all connections that have an enabled system type.
*/ */
public Object[] getSystemViewRoots() public Object[] getSystemViewRoots()
{ {
@ -3077,11 +3015,11 @@ public class SystemRegistry implements ISystemRegistry
for (int i = 0; i < connections.length; i++) { for (int i = 0; i < connections.length; i++) {
IHost con = connections[i]; IHost con = connections[i];
IRSESystemType sysType = con.getSystemType(); IRSESystemType sysType = con.getSystemType();
if (sysType != null) { // sysType can be null if workspace contains a host that is no longer defined by the workbench // sysType can be null if workspace contains a host that is no longer defined by the workbench
RSESystemTypeAdapter adapter = (RSESystemTypeAdapter)(sysType.getAdapter(RSESystemTypeAdapter.class)); if (sysType != null && sysType.isEnabled()) {
// Note: System types without registered subsystems get disabled by the adapter itself! // Note: System types without registered subsystems get disabled by the default
// There is no need to re-check this here again. // AbstractRSESystemType implementation itself! There is no need to re-check this here again.
if (adapter.isEnabled(sysType)) result.add(con); result.add(con);
} }
} }
return result.toArray(); return result.toArray();
@ -3105,42 +3043,6 @@ public class SystemRegistry implements ISystemRegistry
return true; return true;
} }
/*
* (non-Javadoc)
* @see org.eclipse.rse.ui.view.ISystemViewInputProvider#setShell(java.lang.Object)
*/
public void setShell(Object shell)
{
this.shell = shell;
}
/*
* (non-Javadoc)
* @see org.eclipse.rse.ui.model.ISystemShellProvider#getShell()
*/
public Object getShell()
{
// // thread safe shell
// IWorkbench workbench = RSEUIPlugin.getDefault().getWorkbench();
// if (workbench != null)
// {
// // first try to get the active workbench window
// IWorkbenchWindow ww = workbench.getActiveWorkbenchWindow();
// if (ww == null) // no active window so just get the first one
// ww = workbench.getWorkbenchWindows()[0];
// if (ww != null)
// {
// Shell shell = ww.getShell();
// if (!shell.isDisposed())
// {
// return shell;
// }
// }
// }
// return null;
return this.shell;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* @see org.eclipse.rse.ui.view.ISystemViewInputProvider#setViewer(java.lang.Object) * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#setViewer(java.lang.Object)

View file

@ -13,9 +13,10 @@
* Contributors: * Contributors:
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
* Martin Oberhuber (Wind River) - [218659] Make *EventManager, *ChangeManager thread-safe * Martin Oberhuber (Wind River) - [218659] Make *EventManager, *ChangeManager thread-safe
* Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui.internal.model; package org.eclipse.rse.internal.core.model;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View file

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
@ -13,12 +13,12 @@
* Contributors: * Contributors:
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.ui.actions; package org.eclipse.rse.internal.ui.actions;
import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.events.ISystemPreferenceChangeEvents; import org.eclipse.rse.core.events.ISystemPreferenceChangeEvents;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.internal.core.model.SystemPreferenceChangeEvent; import org.eclipse.rse.internal.core.model.SystemPreferenceChangeEvent;
import org.eclipse.rse.internal.ui.SystemResources; import org.eclipse.rse.internal.ui.SystemResources;
import org.eclipse.rse.ui.RSEUIPlugin; import org.eclipse.rse.ui.RSEUIPlugin;
@ -33,8 +33,6 @@ import org.eclipse.swt.widgets.Shell;
public class SystemPreferenceQualifyConnectionNamesAction extends SystemBaseAction public class SystemPreferenceQualifyConnectionNamesAction extends SystemBaseAction
{ {
private ISystemRegistry sr = null;
/** /**
* Constructor * Constructor
*/ */
@ -44,8 +42,7 @@ public class SystemPreferenceQualifyConnectionNamesAction extends SystemBaseActi
parent); parent);
setSelectionSensitive(false); setSelectionSensitive(false);
allowOnMultipleSelection(true); allowOnMultipleSelection(true);
sr = RSECorePlugin.getTheSystemRegistry(); setChecked(RSEUIPlugin.getTheSystemRegistryUI().getQualifiedHostNames());
setChecked(sr.getQualifiedHostNames());
setHelp(RSEUIPlugin.HELPPREFIX+"actn0008"); //$NON-NLS-1$ setHelp(RSEUIPlugin.HELPPREFIX+"actn0008"); //$NON-NLS-1$
} }
@ -57,7 +54,7 @@ public class SystemPreferenceQualifyConnectionNamesAction extends SystemBaseActi
public void run() public void run()
{ {
boolean newState = isChecked(); boolean newState = isChecked();
sr.setQualifiedHostNames(newState); RSEUIPlugin.getTheSystemRegistryUI().setQualifiedHostNames(newState);
firePreferenceChangeEvent(ISystemPreferenceChangeEvents.EVENT_QUALIFYCONNECTIONNAMES, firePreferenceChangeEvent(ISystemPreferenceChangeEvents.EVENT_QUALIFYCONNECTIONNAMES,
!newState,newState); // defect 41794 !newState,newState); // defect 41794
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
@ -16,6 +16,7 @@
* Martin Oberhuber (Wind River) - [180562] don't implement ISystemPreferencesConstants * Martin Oberhuber (Wind River) - [180562] don't implement ISystemPreferencesConstants
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.ui.propertypages; package org.eclipse.rse.internal.ui.propertypages;
@ -195,14 +196,14 @@ public class RemoteSystemsPreferencePage
{ {
boolean ok = super.performOk(); boolean ok = super.performOk();
SystemPreferencesManager.savePreferences(); // better save to disk, just in case. SystemPreferencesManager.savePreferences(); // better save to disk, just in case.
if (!RSEUIPlugin.getDefault().isSystemRegistryActive()) if (!RSECorePlugin.isTheSystemRegistryActive())
return ok; return ok;
if (showFilterPoolsEditor != null) if (showFilterPoolsEditor != null)
{ {
boolean newValue = showFilterPoolsEditor.getBooleanValue(); boolean newValue = showFilterPoolsEditor.getBooleanValue();
if (newValue != lastShowFilterPoolsValue) if (newValue != lastShowFilterPoolsValue)
{ {
RSECorePlugin.getTheSystemRegistry().setShowFilterPools(newValue); RSEUIPlugin.getTheSystemRegistryUI().setShowFilterPools(newValue);
firePreferenceChangeEvent(ISystemPreferenceChangeEvents.EVENT_SHOWFILTERPOOLS,lastShowFilterPoolsValue,newValue); firePreferenceChangeEvent(ISystemPreferenceChangeEvents.EVENT_SHOWFILTERPOOLS,lastShowFilterPoolsValue,newValue);
} }
lastShowFilterPoolsValue = newValue; lastShowFilterPoolsValue = newValue;
@ -212,7 +213,7 @@ public class RemoteSystemsPreferencePage
boolean newValue = showNewConnectionPromptEditor.getBooleanValue(); boolean newValue = showNewConnectionPromptEditor.getBooleanValue();
if (newValue != lastShowNewConnectionPromptValue) if (newValue != lastShowNewConnectionPromptValue)
{ {
RSECorePlugin.getTheSystemRegistry().setShowNewHostPrompt(newValue); RSEUIPlugin.getTheSystemRegistryUI().setShowNewHostPrompt(newValue);
} }
lastShowNewConnectionPromptValue = newValue; lastShowNewConnectionPromptValue = newValue;
} }
@ -221,7 +222,7 @@ public class RemoteSystemsPreferencePage
boolean newValue = qualifyConnectionNamesEditor.getBooleanValue(); boolean newValue = qualifyConnectionNamesEditor.getBooleanValue();
if (newValue != lastQualifyConnectionNamesValue) if (newValue != lastQualifyConnectionNamesValue)
{ {
RSECorePlugin.getTheSystemRegistry().setQualifiedHostNames(newValue); RSEUIPlugin.getTheSystemRegistryUI().setQualifiedHostNames(newValue);
firePreferenceChangeEvent(ISystemPreferenceChangeEvents.EVENT_QUALIFYCONNECTIONNAMES,lastQualifyConnectionNamesValue,newValue); firePreferenceChangeEvent(ISystemPreferenceChangeEvents.EVENT_QUALIFYCONNECTIONNAMES,lastQualifyConnectionNamesValue,newValue);
} }
lastQualifyConnectionNamesValue = newValue; lastQualifyConnectionNamesValue = newValue;

View file

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2007 IBM Corporation. All rights reserved. * Copyright (c) 2007, 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
@ -12,6 +12,7 @@
* *
* Contributors: * Contributors:
* Kevin Doyle (IBM) - [195537] Move ElementComparer From SystemView to Separate File * Kevin Doyle (IBM) - [195537] Move ElementComparer From SystemView to Separate File
* Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.ui.view; package org.eclipse.rse.internal.ui.view;
@ -20,7 +21,7 @@ import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.viewers.IElementComparer; import org.eclipse.jface.viewers.IElementComparer;
import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.model.ISystemRegistry; import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.ui.internal.model.SystemRegistry; import org.eclipse.rse.internal.core.model.SystemRegistry;
import org.eclipse.rse.ui.view.ISystemViewElementAdapter; import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
public class ElementComparer implements IElementComparer public class ElementComparer implements IElementComparer

View file

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
@ -25,6 +25,7 @@
* Martin Oberhuber (Wind River) - [199585] Fix NPE during testConnectionRemoval unit test * Martin Oberhuber (Wind River) - [199585] Fix NPE during testConnectionRemoval unit test
* David McKnight (IBM) - [187543] use view filter to only show containers for set input dialog * David McKnight (IBM) - [187543] use view filter to only show containers for set input dialog
* David McKnight (IBM) - [210229] table refresh needs unique table-specific tooltip-text * David McKnight (IBM) - [210229] table refresh needs unique table-specific tooltip-text
* Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.ui.view; package org.eclipse.rse.internal.ui.view;
@ -71,6 +72,7 @@ import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.model.ISystemRegistry; import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.subsystems.ISubSystem; import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter; import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter;
import org.eclipse.rse.internal.core.model.SystemRegistry;
import org.eclipse.rse.internal.ui.SystemPropertyResources; import org.eclipse.rse.internal.ui.SystemPropertyResources;
import org.eclipse.rse.internal.ui.SystemResources; import org.eclipse.rse.internal.ui.SystemResources;
import org.eclipse.rse.internal.ui.actions.SystemCommonDeleteAction; import org.eclipse.rse.internal.ui.actions.SystemCommonDeleteAction;
@ -87,7 +89,6 @@ import org.eclipse.rse.ui.actions.SystemRefreshAction;
import org.eclipse.rse.ui.actions.SystemTablePrintAction; import org.eclipse.rse.ui.actions.SystemTablePrintAction;
import org.eclipse.rse.ui.dialogs.SystemPromptDialog; import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
import org.eclipse.rse.ui.dialogs.SystemSelectAnythingDialog; import org.eclipse.rse.ui.dialogs.SystemSelectAnythingDialog;
import org.eclipse.rse.ui.internal.model.SystemRegistry;
import org.eclipse.rse.ui.messages.ISystemMessageLine; import org.eclipse.rse.ui.messages.ISystemMessageLine;
import org.eclipse.rse.ui.model.ISystemShellProvider; import org.eclipse.rse.ui.model.ISystemShellProvider;
import org.eclipse.rse.ui.view.IRSEViewPart; import org.eclipse.rse.ui.view.IRSEViewPart;

View file

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
@ -31,6 +31,7 @@
* Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
* Martin Oberhuber (Wind River) - [216266] Consider stateless subsystems (supportsSubSystemConnect==false) * Martin Oberhuber (Wind River) - [216266] Consider stateless subsystems (supportsSubSystemConnect==false)
* David Dykstal (IBM) - [197036] minor refactoring caused by SystemRegistry fix for this bug * David Dykstal (IBM) - [197036] minor refactoring caused by SystemRegistry fix for this bug
* Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.ui.view; package org.eclipse.rse.internal.ui.view;
@ -234,7 +235,7 @@ public class SystemViewConnectionAdapter
public String getText(Object element) public String getText(Object element)
{ {
IHost conn = (IHost)element; IHost conn = (IHost)element;
boolean qualifyNames = RSECorePlugin.getTheSystemRegistry().getQualifiedHostNames(); boolean qualifyNames = RSEUIPlugin.getTheSystemRegistryUI().getQualifiedHostNames();
if (!qualifyNames) if (!qualifyNames)
return conn.getAliasName(); return conn.getAliasName();
else else

View file

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
@ -29,6 +29,7 @@
* David Dykstal (IBM) - [191038] initialize SystemRegistryUI without a log file, it was not used * David Dykstal (IBM) - [191038] initialize SystemRegistryUI without a log file, it was not used
* David McKnight (IBM) - [196838] Don't recreate local after it has been deleted * David McKnight (IBM) - [196838] Don't recreate local after it has been deleted
* David Dykstal (IBM) - [197036] formatted the initialize job to be able to read it * David Dykstal (IBM) - [197036] formatted the initialize job to be able to read it
* Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui; package org.eclipse.rse.ui;
@ -53,10 +54,10 @@ import org.eclipse.rse.core.events.SystemResourceChangeEvent;
import org.eclipse.rse.core.model.ISystemProfile; import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.model.ISystemProfileManager; import org.eclipse.rse.core.model.ISystemProfileManager;
import org.eclipse.rse.core.model.ISystemRegistry; import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.model.SystemStartHere;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy; import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
import org.eclipse.rse.internal.core.model.SystemProfileManager; import org.eclipse.rse.internal.core.model.SystemProfileManager;
import org.eclipse.rse.internal.core.model.SystemRegistry;
import org.eclipse.rse.internal.ui.RSESystemTypeAdapterFactory; import org.eclipse.rse.internal.ui.RSESystemTypeAdapterFactory;
import org.eclipse.rse.internal.ui.SystemResourceListener; import org.eclipse.rse.internal.ui.SystemResourceListener;
import org.eclipse.rse.internal.ui.SystemResources; import org.eclipse.rse.internal.ui.SystemResources;
@ -69,7 +70,6 @@ import org.eclipse.rse.persistence.IRSEPersistenceManager;
import org.eclipse.rse.services.clientserver.messages.ISystemMessageProvider; import org.eclipse.rse.services.clientserver.messages.ISystemMessageProvider;
import org.eclipse.rse.services.clientserver.messages.SystemMessage; import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.services.clientserver.messages.SystemMessageFile; import org.eclipse.rse.services.clientserver.messages.SystemMessageFile;
import org.eclipse.rse.ui.internal.model.SystemRegistry;
import org.eclipse.rse.ui.internal.model.SystemRegistryUI; import org.eclipse.rse.ui.internal.model.SystemRegistryUI;
import org.eclipse.rse.ui.model.ISystemRegistryUI; import org.eclipse.rse.ui.model.ISystemRegistryUI;
import org.osgi.framework.BundleContext; import org.osgi.framework.BundleContext;
@ -89,8 +89,8 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
public IStatus run(IProgressMonitor monitor) { public IStatus run(IProgressMonitor monitor) {
//System.err.println("InitRSEJob started"); //$NON-NLS-1$ //System.err.println("InitRSEJob started"); //$NON-NLS-1$
ISystemRegistry registry = getSystemRegistryInternal(); ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
SystemStartHere.getSystemProfileManager(); // create folders per profile RSECorePlugin.getTheSystemProfileManager(); // create folders per profile
// add workspace listener for our project // add workspace listener for our project
IProject remoteSystemsProject = SystemResourceManager.getRemoteSystemsProject(false); IProject remoteSystemsProject = SystemResourceManager.getRemoteSystemsProject(false);
SystemResourceListener listener = SystemResourceListener.getListener(remoteSystemsProject); SystemResourceListener listener = SystemResourceListener.getListener(remoteSystemsProject);
@ -105,7 +105,7 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
if (systemType != null) { if (systemType != null) {
RSESystemTypeAdapter adapter = (RSESystemTypeAdapter)(systemType.getAdapter(RSESystemTypeAdapter.class)); RSESystemTypeAdapter adapter = (RSESystemTypeAdapter)(systemType.getAdapter(RSESystemTypeAdapter.class));
if (adapter != null && adapter.isEnabled(systemType)) { if (adapter != null && adapter.isEnabled(systemType)) {
ISystemProfileManager profileManager = SystemProfileManager.getDefault(); ISystemProfileManager profileManager = RSECorePlugin.getTheSystemProfileManager();
ISystemProfile profile = profileManager.getDefaultPrivateSystemProfile(); ISystemProfile profile = profileManager.getDefaultPrivateSystemProfile();
String userName = System.getProperty("user.name"); //$NON-NLS-1$ String userName = System.getProperty("user.name"); //$NON-NLS-1$
registry.createLocalHost(profile, SystemResources.TERM_LOCAL, userName); registry.createLocalHost(profile, SystemResources.TERM_LOCAL, userName);
@ -130,10 +130,6 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
private static SystemMessageFile messageFile = null; private static SystemMessageFile messageFile = null;
private static SystemMessageFile defaultMessageFile = null; private static SystemMessageFile defaultMessageFile = null;
// private SystemType[] allSystemTypes = null;
private SystemRegistryUI _systemRegistryUI = null;
private SystemRegistry _systemRegistry = null;
private Vector viewSuppliers = new Vector(); private Vector viewSuppliers = new Vector();
private SystemViewAdapterFactory svaf; // for fastpath access private SystemViewAdapterFactory svaf; // for fastpath access
@ -439,9 +435,9 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
messageFile = getMessageFile("systemmessages.xml"); //$NON-NLS-1$ messageFile = getMessageFile("systemmessages.xml"); //$NON-NLS-1$
defaultMessageFile = getDefaultMessageFile("systemmessages.xml"); //$NON-NLS-1$ defaultMessageFile = getDefaultMessageFile("systemmessages.xml"); //$NON-NLS-1$
ISystemRegistry registry = getSystemRegistryInternal(); //Force load the SystemRegistry - TODO Is this really necessary?
RSECorePlugin.getDefault().setSystemRegistry(registry); RSECorePlugin.getTheSystemRegistry();
IAdapterManager manager = Platform.getAdapterManager(); IAdapterManager manager = Platform.getAdapterManager();
@ -461,11 +457,8 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
svraf = new SystemTeamViewResourceAdapterFactory(); svraf = new SystemTeamViewResourceAdapterFactory();
svraf.registerWithManager(manager); svraf.registerWithManager(manager);
InitRSEJob initJob = new InitRSEJob(); InitRSEJob initJob = new InitRSEJob();
initJob.schedule(); initJob.schedule();
} }
/** /**
@ -482,39 +475,42 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
*/ */
public void restart() public void restart()
{ {
if (_systemRegistry != null) if (RSECorePlugin.isTheSystemRegistryActive()) {
{ ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
// disconnect all active connections
disconnectAll(false); // don't save ? // disconnect all active connections
// collapse and flush all nodes in all views disconnectAll(false); // don't save ?
_systemRegistry.fireEvent(new SystemResourceChangeEvent("dummy", ISystemResourceChangeEvents.EVENT_COLLAPSE_ALL, null)); //$NON-NLS-1$ // collapse and flush all nodes in all views
sr.fireEvent(new SystemResourceChangeEvent("dummy", ISystemResourceChangeEvents.EVENT_COLLAPSE_ALL, null)); //$NON-NLS-1$
// allow child classes to override // allow child classes to override
closeViews(); closeViews();
// clear in-memory settings for all filter pools and subsystems // clear in-memory settings for all filter pools and subsystems
ISubSystemConfigurationProxy[] proxies = getSystemRegistryInternal().getSubSystemConfigurationProxies(); ISubSystemConfigurationProxy[] proxies = sr.getSubSystemConfigurationProxies();
if (proxies != null) if (proxies != null) {
for (int idx=0; idx < proxies.length; idx++) for (int idx=0; idx < proxies.length; idx++)
proxies[idx].reset(); proxies[idx].reset();
// clear in-memory settings for all profiles }
SystemProfileManager.clearDefault(); // clear in-memory settings for all profiles
SystemProfileManager.clearDefault();
// rebuild profiles // rebuild profiles
SystemStartHere.getSystemProfileManager(); // create folders per profile RSECorePlugin.getTheSystemProfileManager(); // create folders per profile
// clear in-memory settings for all connections, then restore from disk // clear in-memory settings for all connections, then restore from disk
_systemRegistry.reset(); ((SystemRegistry)sr).reset();
// restore in-memory settings for all filter pools and subsystems // restore in-memory settings for all filter pools and subsystems
if (proxies != null) if (proxies != null) {
for (int idx=0; idx < proxies.length; idx++) for (int idx=0; idx < proxies.length; idx++)
proxies[idx].restore(); proxies[idx].restore();
}
// refresh GUIs
_systemRegistry.fireEvent(new SystemResourceChangeEvent(_systemRegistry, ISystemResourceChangeEvents.EVENT_REFRESH, null)); // refresh GUIs
sr.fireEvent(new SystemResourceChangeEvent(sr, ISystemResourceChangeEvents.EVENT_REFRESH, null));
// allow child classes to override // allow child classes to override
openViews(); openViews();
} }
} }
/** /**
@ -569,9 +565,10 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
*/ */
protected void disconnectAll(boolean doSave) protected void disconnectAll(boolean doSave)
{ {
if (isSystemRegistryActive()) if (RSECorePlugin.isTheSystemRegistryActive())
{ {
ISubSystemConfigurationProxy[] proxies = getSystemRegistryInternal().getSubSystemConfigurationProxies(); ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
ISubSystemConfigurationProxy[] proxies = sr.getSubSystemConfigurationProxies();
if (proxies != null) if (proxies != null)
{ {
for (int idx=0; idx < proxies.length; idx++) for (int idx=0; idx < proxies.length; idx++)
@ -605,86 +602,54 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
} }
/** /**
* Returns true if the SystemRegistry has been instantiated already. * Test if the SystemRegistry has been instantiated already.
* Use this when you don't want to start the system registry as a side effect of retrieving it. * Use this when you don't want to start the system registry as a side effect of retrieving it.
* @return <code>true</code> if the System Registry has been instantiated already.
* @deprecated use {@link RSECorePlugin#isTheSystemRegistryActive()}
*/ */
public boolean isSystemRegistryActive() public boolean isSystemRegistryActive()
{ {
return (_systemRegistry != null); return RSECorePlugin.isTheSystemRegistryActive();
} }
/** /**
* Return the persistence manager used for persisting RSE profiles.
* @return the persistence manager used for persisting RSE profiles * @return the persistence manager used for persisting RSE profiles
* @deprecated use {@link RSECorePlugin#getThePersistenceManager()}
*/ */
public IRSEPersistenceManager getPersistenceManager() public IRSEPersistenceManager getPersistenceManager()
{ {
return RSECorePlugin.getThePersistenceManager(); return RSECorePlugin.getThePersistenceManager();
} }
/**
* Return the SystemRegistry singleton.
* Clients should use static @{link getTheSystemRegistry()} instead.
*/
private SystemRegistry getSystemRegistryInternal()
{
if (_systemRegistry == null)
{
String logfilePath = getStateLocation().toOSString();
_systemRegistry = SystemRegistry.getInstance(logfilePath);
ISubSystemConfigurationProxy[] proxies = RSECorePlugin.getDefault().getSubSystemConfigurationProxies();
if (proxies != null)
{
_systemRegistry.setSubSystemConfigurationProxies(proxies);
}
}
return _systemRegistry;
}
/** /**
* Return the SystemRegistryUI singleton. * Return the SystemRegistryUI singleton.
* Clients should use static @{link getTheSystemRegistry()} instead. * @return the SystemRegistryUI singleton.
*/
private SystemRegistryUI getSystemRegistryUIInternal()
{
if (_systemRegistryUI == null)
{
_systemRegistryUI = SystemRegistryUI.getInstance();
}
return _systemRegistryUI;
}
/**
* A static version for convenience
* Returns the master registry singleton.
*/ */
public static ISystemRegistryUI getTheSystemRegistryUI() public static ISystemRegistryUI getTheSystemRegistryUI()
{ {
return getDefault().getSystemRegistryUIInternal(); return SystemRegistryUI.getInstance();
} }
/** /**
* A static version for convenience * Return the master profile manager singleton.
* Returns the master profile manager singleton. * @return the RSE Profile Manager Singleton.
* @deprecated use {@link RSECorePlugin#getTheSystemProfileManager()}
*/ */
public static ISystemProfileManager getTheSystemProfileManager() public static ISystemProfileManager getTheSystemProfileManager()
{ {
return SystemProfileManager.getDefault(); return RSECorePlugin.getTheSystemProfileManager();
} }
/** /**
* A static version for convenience * Check if the SystemRegistry has been instantiated already.
* Use this when you don't want to start the system registry as a side effect
* of retrieving it.
* @return <code>true</code> if the System Registry has been instantiated already.
* @deprecated use {@link RSECorePlugin#isTheSystemRegistryActive()}
*/ */
public static boolean isTheSystemRegistryActive() public static boolean isTheSystemRegistryActive() {
{ return RSECorePlugin.isTheSystemRegistryActive();
if (inst == null)
return false;
else
return getDefault().isSystemRegistryActive();
} }
/** /**

View file

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2000, 2007 IBM Corporation. All rights reserved. * Copyright (c) 2000, 2008 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
@ -14,14 +14,23 @@
* David Dykstal (IBM) - moved SystemPreferencesManager to a this package, was in * David Dykstal (IBM) - moved SystemPreferencesManager to a this package, was in
* the org.eclipse.rse.core package of the UI plugin. * the org.eclipse.rse.core package of the UI plugin.
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui; package org.eclipse.rse.ui;
import java.util.Vector; import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.Preferences; import org.eclipse.core.runtime.Preferences;
import org.eclipse.rse.core.IRSEPreferenceNames; import org.eclipse.rse.core.IRSEPreferenceNames;
import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.events.ISystemModelChangeEvent;
import org.eclipse.rse.core.events.ISystemModelChangeEvents;
import org.eclipse.rse.core.events.ISystemModelChangeListener;
import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
import org.eclipse.rse.core.events.ISystemResourceChangeEvent;
import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
import org.eclipse.rse.core.events.ISystemResourceChangeListener;
import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemRegistry; import org.eclipse.rse.core.model.ISystemRegistry;
@ -49,6 +58,22 @@ public class SystemPreferencesManager {
private static boolean showProfilePage; // This is not a persistent preference private static boolean showProfilePage; // This is not a persistent preference
private static boolean showNewConnectionPrompt; // This is not a persistent preference private static boolean showNewConnectionPrompt; // This is not a persistent preference
/*
* Singleton instance to support listening to model change events
*/
private static SystemPreferencesManager fInstance = new SystemPreferencesManager();
private int fModelChangeListeners = 0;
private ISystemModelChangeListener fModelChangeListener = null;
/*
* Private Constructor to discourage instance creation other than by ourselves.
*/
private SystemPreferencesManager() {
}
/**
* Migrate Preferences from UI Preference Store into Core Preference store
*/
private static void migrateCorePreferences() { private static void migrateCorePreferences() {
String[] keys = { String[] keys = {
IRSEPreferenceNames.ACTIVEUSERPROFILES, IRSEPreferenceNames.ACTIVEUSERPROFILES,
@ -80,11 +105,12 @@ public class SystemPreferencesManager {
migrateCorePreferences(); migrateCorePreferences();
initDefaultsUI(); initDefaultsUI();
savePreferences(); savePreferences();
fInstance.startModelChangeListening();
} }
private static void initDefaultsUI() { private static void initDefaultsUI() {
String showProp = System.getProperty("rse.showNewConnectionPrompt"); //String showProp = System.getProperty("rse.showNewConnectionPrompt");
RSEUIPlugin ui = RSEUIPlugin.getDefault(); RSEUIPlugin ui = RSEUIPlugin.getDefault();
Preferences store = ui.getPluginPreferences(); Preferences store = ui.getPluginPreferences();
showNewConnectionPrompt= getBooleanProperty("rse.showNewConnectionPrompt", ISystemPreferencesConstants.DEFAULT_SHOWNEWCONNECTIONPROMPT); //$NON-NLS-1$ showNewConnectionPrompt= getBooleanProperty("rse.showNewConnectionPrompt", ISystemPreferencesConstants.DEFAULT_SHOWNEWCONNECTIONPROMPT); //$NON-NLS-1$
@ -155,15 +181,13 @@ public class SystemPreferencesManager {
String[] allConnectionNamesOrder = SystemPreferencesManager.getConnectionNamesOrder(); String[] allConnectionNamesOrder = SystemPreferencesManager.getConnectionNamesOrder();
profileName = profileName + "."; //$NON-NLS-1$ profileName = profileName + "."; //$NON-NLS-1$
int profileNameLength = profileName.length(); int profileNameLength = profileName.length();
Vector v = new Vector(); List l = new ArrayList();
for (int idx = 0; idx < allConnectionNamesOrder.length; idx++) for (int idx = 0; idx < allConnectionNamesOrder.length; idx++)
if (allConnectionNamesOrder[idx].startsWith(profileName)) { if (allConnectionNamesOrder[idx].startsWith(profileName)) {
v.addElement(allConnectionNamesOrder[idx].substring(profileNameLength)); l.add(allConnectionNamesOrder[idx].substring(profileNameLength));
} }
String[] names = new String[v.size()]; String[] names = new String[l.size()];
for (int idx = 0; idx < names.length; idx++) { l.toArray(names);
names[idx] = (String) v.elementAt(idx);
}
return names; return names;
} }
@ -191,6 +215,9 @@ public class SystemPreferencesManager {
/** /**
* Sets user's preference for the order of the connection names according to the * Sets user's preference for the order of the connection names according to the
* list kept in the system registry. * list kept in the system registry.
* This resets any user-specified ordering of profiles since the SystemRegistry
* has no concept of ordered profiles. The hosts inside a profile, though,
* will be ordered according to user preference.
*/ */
public static void setConnectionNamesOrder() { public static void setConnectionNamesOrder() {
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
@ -231,14 +258,14 @@ public class SystemPreferencesManager {
* a restored ordered list of names. * a restored ordered list of names.
*/ */
private static String[] resolveOrderPreferenceVersusReality(String[] reality, String[] ordered) { private static String[] resolveOrderPreferenceVersusReality(String[] reality, String[] ordered) {
Vector finalList = new Vector(); List finalList = new ArrayList();
// step 1: include all names from preferences list which do exist in reality... // step 1: include all names from preferences list which do exist in reality...
for (int idx = 0; idx < ordered.length; idx++) { for (int idx = 0; idx < ordered.length; idx++) {
if (SystemPreferencesManager.find(reality, ordered[idx])) finalList.addElement(ordered[idx]); if (SystemPreferencesManager.find(reality, ordered[idx])) finalList.add(ordered[idx]);
} }
// step 2: add all names in reality which do not exist in preferences list... // step 2: add all names in reality which do not exist in preferences list...
for (int idx = 0; idx < reality.length; idx++) { for (int idx = 0; idx < reality.length; idx++) {
if (!SystemPreferencesManager.find(ordered, reality[idx])) finalList.addElement(reality[idx]); if (!SystemPreferencesManager.find(ordered, reality[idx])) finalList.add(reality[idx]);
} }
String[] resolved = new String[finalList.size()]; String[] resolved = new String[finalList.size()];
finalList.toArray(resolved); finalList.toArray(resolved);
@ -335,7 +362,7 @@ public class SystemPreferencesManager {
store.setValue(ISystemPreferencesConstants.SHOWFILTERPOOLS, show); store.setValue(ISystemPreferencesConstants.SHOWFILTERPOOLS, show);
savePreferences(); savePreferences();
if (show != prevValue) { if (show != prevValue) {
RSECorePlugin.getTheSystemRegistry().setShowFilterPools(show); RSEUIPlugin.getTheSystemRegistryUI().setShowFilterPools(show);
} }
} }
@ -435,10 +462,64 @@ public class SystemPreferencesManager {
RSEUIPlugin.getDefault().savePluginPreferences(); RSEUIPlugin.getDefault().savePluginPreferences();
RSECorePlugin.getDefault().savePluginPreferences(); RSECorePlugin.getDefault().savePluginPreferences();
} }
/* /*
* Private to discourage instance creation. * Start listening to SystemRegistry model change events
*/ */
private SystemPreferencesManager() { private void startModelChangeListening() {
//TODO Register a listener for shutdown, to stop model change listening
boolean alreadyListening;
synchronized(this) {
alreadyListening = (fModelChangeListeners>0);
fModelChangeListeners++;
}
if (!alreadyListening) {
fModelChangeListener = new ModelChangeListener();
RSECorePlugin.getTheSystemRegistry().addSystemModelChangeListener(fModelChangeListener);
}
} }
/*
* A listener for SystemRegistry Model Change events
*/
private static class ModelChangeListener implements ISystemModelChangeListener, ISystemResourceChangeListener {
public void systemModelResourceChanged(ISystemModelChangeEvent event) {
int rt = event.getResourceType();
if (rt==ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_CONNECTION) {
switch(event.getEventType()) {
case ISystemModelChangeEvents.SYSTEM_RESOURCE_RENAMED:
case ISystemModelChangeEvents.SYSTEM_RESOURCE_REMOVED:
case ISystemModelChangeEvents.SYSTEM_RESOURCE_ADDED:
//TODO Change order of hosts from affected profile only?
SystemPreferencesManager.setConnectionNamesOrder();
break;
}
} else if (rt==ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_PROFILE) {
switch (event.getEventType()) {
case ISystemModelChangeEvents.SYSTEM_RESOURCE_RENAMED:
case ISystemModelChangeEvents.SYSTEM_RESOURCE_REMOVED:
case ISystemModelChangeEvents.SYSTEM_RESOURCE_CHANGED:
//TODO Change order of hosts from affected profile only?
SystemPreferencesManager.setConnectionNamesOrder();
break;
}
if (event.getEventType()==ISystemModelChangeEvents.SYSTEM_RESOURCE_RENAMED) {
boolean namesQualified = SystemPreferencesManager.getQualifyConnectionNames();
RSEUIPlugin.getTheSystemRegistryUI().setQualifiedHostNames(namesQualified); // causes refresh events to be fired
}
}
}
public void systemResourceChanged(ISystemResourceChangeEvent event) {
if (event.getType()==ISystemResourceChangeEvents.EVENT_MOVE_MANY
&& (event.getSource() instanceof IHost[])
) {
//TODO Change order of hosts from affected profile only?
SystemPreferencesManager.setConnectionNamesOrder();
}
}
}
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
@ -16,6 +16,8 @@
* David Dykstal (IBM) - [191038] remove getInstance(logFilePath) log file was not used * David Dykstal (IBM) - [191038] remove getInstance(logFilePath) log file was not used
* initialize correctly in getInstance() * initialize correctly in getInstance()
* Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
* Martin Oberhuber (Wind River) - [] Move SystemRegistry impl into Core
* Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui.internal.model; package org.eclipse.rse.ui.internal.model;
@ -28,11 +30,17 @@ import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.events.ISystemResourceChangeEvent; import org.eclipse.rse.core.events.ISystemResourceChangeEvent;
import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
import org.eclipse.rse.core.events.ISystemResourceChangeListener; import org.eclipse.rse.core.events.ISystemResourceChangeListener;
import org.eclipse.rse.core.events.SystemResourceChangeEvent;
import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemProfile; import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.model.ISystemRegistry; import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.subsystems.ISubSystem; import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
import org.eclipse.rse.internal.core.model.SystemPostableEventNotifier;
import org.eclipse.rse.internal.core.model.SystemRegistry;
import org.eclipse.rse.internal.ui.view.SystemDNDTransferRunnable; import org.eclipse.rse.internal.ui.view.SystemDNDTransferRunnable;
import org.eclipse.rse.internal.ui.view.SystemPerspectiveHelpers; import org.eclipse.rse.internal.ui.view.SystemPerspectiveHelpers;
import org.eclipse.rse.internal.ui.view.SystemView; import org.eclipse.rse.internal.ui.view.SystemView;
@ -41,6 +49,7 @@ import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException; import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.ui.ISystemMessages; import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin; import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemPreferencesManager;
import org.eclipse.rse.ui.model.ISystemRegistryUI; import org.eclipse.rse.ui.model.ISystemRegistryUI;
import org.eclipse.swt.dnd.Clipboard; import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.FileTransfer; import org.eclipse.swt.dnd.FileTransfer;
@ -436,6 +445,85 @@ public class SystemRegistryUI implements ISystemRegistryUI {
return scratchpad; return scratchpad;
} }
// ----------------------------
// USER PREFERENCE METHODS...
// ----------------------------
/**
* Are connection names to be qualified by profile name?
*/
public boolean getQualifiedHostNames()
{
return SystemPreferencesManager.getQualifyConnectionNames();
}
/**
* Set if connection names are to be qualified by profile name
*/
public void setQualifiedHostNames(boolean set)
{
SystemPreferencesManager.setQualifyConnectionNames(set);
IHost[] conns = registry.getHosts();
if (conns != null)
{
for (int idx = 0; idx < conns.length; idx++)
{
//FIXME it seems wrong to fire a RENAME event just because a user preference changed.
//Showing qualified host names or not should be a view-only setting!
registry.fireEvent(new SystemResourceChangeEvent(conns[idx], ISystemResourceChangeEvents.EVENT_RENAME, registry));
}
}
if (SystemPreferencesManager.getShowFilterPools())
{
registry.fireEvent(new SystemResourceChangeEvent(registry, ISystemResourceChangeEvents.EVENT_REFRESH, registry));
}
}
/**
* Reflect the user changing the preference for showing filter pools.
*/
public void setShowFilterPools(boolean show)
{
ISubSystemConfigurationProxy[] proxies = registry.getSubSystemConfigurationProxies();
if (proxies != null)
{
for (int idx = 0; idx < proxies.length; idx++)
{
if (proxies[idx].isSubSystemConfigurationActive())
{
ISubSystemConfiguration factory = proxies[idx].getSubSystemConfiguration();
if ((factory != null) && factory.supportsFilters())
factory.setShowFilterPools(show);
}
}
}
}
/*
* Reflect the user changing the preference for showing filter strings.
*
public void setShowFilterStrings(boolean show)
{
ISubSystemConfigurationProxy[] proxies = registry.getSubSystemConfigurationProxies();
if (proxies != null)
{
for (int idx = 0; idx < proxies.length; idx++)
{
if (proxies[idx].isSubSystemConfigurationActive())
{
SubSystemConfiguration factory = proxies[idx].getSubSystemConfiguration();
if ((factory!=null)&&factory.supportsFilters())
factory.setShowFilterStrings(show);
}
}
}
}*/
/**
* Reflect the user changing the preference for showing new connection prompt
*/
public void setShowNewHostPrompt(boolean show)
{
registry.fireEvent(new SystemResourceChangeEvent(this, ISystemResourceChangeEvents.EVENT_REFRESH, null));
}
// ---------------------------- // ----------------------------
// RESOURCE EVENT METHODS... // RESOURCE EVENT METHODS...
// ---------------------------- // ----------------------------

View file

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
@ -15,6 +15,7 @@
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* Martin Oberhuber (Wind River) - [189123] Prepare ISystemRegistry for move into non-UI * Martin Oberhuber (Wind River) - [189123] Prepare ISystemRegistry for move into non-UI
* Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
* Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui.model; package org.eclipse.rse.ui.model;
@ -69,6 +70,34 @@ public interface ISystemRegistryUI extends ISystemShellProvider {
*/ */
public List getSystemClipboardObjects(int srcType); public List getSystemClipboardObjects(int srcType);
// ----------------------------
// USER PREFERENCE METHODS...
// ----------------------------
/**
* Are connection names to be qualified by profile name?
*/
public boolean getQualifiedHostNames();
/**
* Set if connection names are to be qualified by profile name
*/
public void setQualifiedHostNames(boolean set);
/**
* Reflect the user changing the preference for showing filter pools.
*/
public void setShowFilterPools(boolean show);
/*
* Reflect the user changing the preference for showing filter strings.
*
public void setShowFilterStrings(boolean show);
*/
/**
* Reflect the user changing the preference for showing new connection prompt
*/
public void setShowNewHostPrompt(boolean show);
// ---------------------------------- // ----------------------------------
// ACTIVE PROGRESS MONITOR METHODS... // ACTIVE PROGRESS MONITOR METHODS...
// ---------------------------------- // ----------------------------------