diff --git a/rse/plugins/org.eclipse.rse.core/META-INF/MANIFEST.MF b/rse/plugins/org.eclipse.rse.core/META-INF/MANIFEST.MF
index c7ba8b81e78..4348192ffbe 100644
--- a/rse/plugins/org.eclipse.rse.core/META-INF/MANIFEST.MF
+++ b/rse/plugins/org.eclipse.rse.core/META-INF/MANIFEST.MF
@@ -7,7 +7,8 @@ Bundle-Activator: org.eclipse.rse.core.RSECorePlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,
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
Eclipse-LazyStart: true
Export-Package: org.eclipse.rse.core,
diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RSECorePlugin.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RSECorePlugin.java
index c32884cf8a9..07dfa624c68 100644
--- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RSECorePlugin.java
+++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RSECorePlugin.java
@@ -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
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* 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
* 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) - [215820] Move SystemRegistry implementation to 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.Plugin;
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.subsystems.ISubSystemConfigurationProxy;
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.SubSystemConfigurationProxyComparator;
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 Logger logger = null;
- private ISystemRegistry _registry = null;
+ private ISystemRegistry _systemRegistry = null;
private IRSEPersistenceManager _persistenceManager = null;
private ISubSystemConfigurationProxy[] _subsystemConfigurations = null;
@@ -76,15 +80,6 @@ public class RSECorePlugin extends Plugin {
return plugin;
}
- /**
- * A static convenience method - fully equivalent to
- * RSECorePlugin.getDefault().getPersistenceManager()
.
- * @return the persistence manager currently in use for RSE
- */
- public static IRSEPersistenceManager getThePersistenceManager() {
- return getDefault().getPersistenceManager();
- }
-
/**
* A static convenience method - fully equivalent to
* RSECorePlugin.getDefault().getRegistry()
.
@@ -94,9 +89,42 @@ public class RSECorePlugin extends Plugin {
return getDefault().getCoreRegistry();
}
+ /**
+ * A static convenience method - fully equivalent to
+ * RSECorePlugin.getDefault().getPersistenceManager()
.
+ * @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 true
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
* RSECorePlugin.getDefault().getSystemRegistry()
.
+ * The SystemRegistry is used to gain access to the basic services
+ * and components used in RSE.
* @return the RSE System Registry.
*/
public static ISystemRegistry getTheSystemRegistry() {
@@ -173,7 +201,11 @@ public class RSECorePlugin extends Plugin {
*/
public IRSEPersistenceManager getPersistenceManager() {
if (_persistenceManager == null) {
- _persistenceManager = new RSEPersistenceManager(_registry);
+ synchronized(this) {
+ if (_persistenceManager==null) {
+ _persistenceManager = new RSEPersistenceManager(getSystemRegistry());
+ }
+ }
}
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
* not by any external client.
* @param registry the implementation of ISystemRegistry that the core should remember.
+ * @deprecated Do not use this method.
*/
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 true
if the system registry has been instantiated already.
+ */
+ private boolean isSystemRegistryActive()
+ {
+ return (_systemRegistry != null);
+ }
+
/**
- * Gets the system registry set by {@link #setSystemRegistry(ISystemRegistry)}.
- * This registry is used to gain access to the basic services and components used in
- * the RSE user interface.
+ * Return the SystemRegistry singleton.
+ * Clients should use static @{link getTheSystemRegistry()} instead.
* @return the RSE system registry
*/
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;
}
/**
diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemRegistry.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemRegistry.java
index 14272a20f42..efd4c3fa814 100644
--- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemRegistry.java
+++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemRegistry.java
@@ -23,6 +23,7 @@
* David Dykstal (IBM) - [197036] adding new createHost and getSubSystemConfigurationsBySYstemType which
* are able to delay the creation of subsystems.
* David Dykstal (IBM) - [217556] remove service subsystem types
+ * Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
********************************************************************************/
package org.eclipse.rse.core.model;
@@ -144,34 +145,6 @@ public interface ISystemRegistry extends ISchedulingRule, IAdaptable, ISystemVie
*/
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...
// ----------------------------
@@ -324,12 +297,15 @@ public interface ISystemRegistry extends ISchedulingRule, IAdaptable, ISystemVie
// CONNECTION METHODS...
// ----------------------------
/**
- * Return the first connection to localhost we can find. While we always create a default one in
- * 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
- * until we find one, and return it.
- * If no localhost connection is found, this will return null. If one is needed, it can be created
- * easily by calling {@link #createLocalHost(ISystemProfile, String, String)}.
+ * Return the first connection to the local host we can find.
+ *
+ * While we always create a default one in the user's profile, it is possible that
+ * this profile is not active or the connection was deleted. However, since any
+ * connection to the local host will usually do, we just search all active profiles
+ * until we find one, and return it.
+ * If no connection to the local host can be found, this will return null
.
+ * If one is needed, it can be created easily by calling
+ * {@link #createLocalHost(ISystemProfile, String, String)}.
*/
public IHost getLocalHost();
diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSECoreMessages.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSECoreMessages.java
index a96792eddca..fbdf93b5bc0 100644
--- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSECoreMessages.java
+++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSECoreMessages.java
@@ -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
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -8,6 +8,7 @@
* David Dykstal (IBM) - initial API and implementation
* 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) - [215820] Move SystemRegistry implementation to Core
********************************************************************************/
package org.eclipse.rse.internal.core;
@@ -51,6 +52,17 @@ public class RSECoreMessages extends NLS {
// Password Persistence Manager
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() {
}
}
diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/messages.properties b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/messages.properties
index 1d1a347bbd7..b7f143f7b63 100644
--- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/messages.properties
+++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/messages.properties
@@ -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
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -9,6 +9,7 @@
# David Dykstal (IBM) - initial API and implementation
# 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) - [215820] Move SystemRegistry implementation to Core
###############################################################################
# NLS_MESSAGEFORMAT_VAR
@@ -44,3 +45,14 @@ SerializingProvider_UnexpectedException=Unexpected Exception
# Password Persistence Manager
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
diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemPostableEventNotifier.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemPostableEventNotifier.java
similarity index 88%
rename from rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemPostableEventNotifier.java
rename to rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemPostableEventNotifier.java
index d18dedd6c76..9c5d4d84fbf 100644
--- a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemPostableEventNotifier.java
+++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemPostableEventNotifier.java
@@ -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
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -12,9 +12,10 @@
*
* Contributors:
* 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.ISystemResourceChangeListener;
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
* the code to execute via the run() method.
*
- * 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 * the shell which we get by calling getShell on the given listener. *
diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemRegistry.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemRegistry.java
similarity index 90%
rename from rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemRegistry.java
rename to rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemRegistry.java
index fac7b3da092..49b6afa6a2e 100644
--- a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemRegistry.java
+++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemRegistry.java
@@ -43,9 +43,10 @@
* rewrote createHost to better pick default subsystem configurations to activate
* rewrote getSubSystemConfigurationsBySystemType to be able to delay the creation (and loading) of subsystem configurations
* 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.Arrays;
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.Status;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.rse.core.IRSESystemType;
import org.eclipse.rse.core.IRSEUserIdConstants;
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.references.IRSEBaseReferencingObject;
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.ISubSystemConfiguration;
import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
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.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.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 com.ibm.icu.text.MessageFormat;
-
/**
* Registry for all connections.
*/
@@ -124,13 +110,12 @@ public class SystemRegistry implements ISystemRegistry
{
private static Exception lastException = null;
private static SystemRegistry registry = null;
- private SystemResourceChangeManager listenerManager = null;
- private SystemPreferenceChangeManager preferenceListManager = null;
- private SystemModelChangeEventManager modelListenerManager = null;
+ private final SystemResourceChangeManager listenerManager = new SystemResourceChangeManager();
+ private final SystemPreferenceChangeManager preferenceListManager = new SystemPreferenceChangeManager();
+ private final SystemModelChangeEventManager modelListenerManager = new SystemModelChangeEventManager();
+ private final SystemRemoteChangeEventManager remoteListManager = new SystemRemoteChangeEventManager();
private SystemModelChangeEvent modelEvent;
- private SystemRemoteChangeEventManager remoteListManager = null;
private SystemRemoteChangeEvent remoteEvent;
-
private int listenerCount = 0;
private int modelListenerCount = 0;
private int remoteListCount = 0;
@@ -139,7 +124,6 @@ public class SystemRegistry implements ISystemRegistry
private boolean errorLoadingFactory = false;
//For ISystemViewInputProvider
- private Object shell = null;
private Object viewer = null;
/**
@@ -152,11 +136,6 @@ public class SystemRegistry implements ISystemRegistry
{
super();
- listenerManager = new SystemResourceChangeManager();
- modelListenerManager = new SystemModelChangeEventManager();
- remoteListManager = new SystemRemoteChangeEventManager();
- preferenceListManager = new SystemPreferenceChangeManager();
-
// get initial shell
//FIXME - this can cause problems - don't think we should do this here anyway
//getShell(); // will quietly fail in headless mode. Phil
@@ -372,82 +351,6 @@ public class SystemRegistry implements ISystemRegistry
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...
// ----------------------------
@@ -566,10 +469,11 @@ public class SystemRegistry implements ISystemRegistry
ssf.renameSubSystemProfile(ss, oldName, newName);
}
}
- SystemPreferencesManager.setConnectionNamesOrder(); // update preferences order list
- boolean namesQualifed = getQualifiedHostNames();
- if (namesQualifed)
- setQualifiedHostNames(namesQualifed); // causes refresh events to be fired
+ ////Listening to events now
+ //SystemPreferencesManager.setConnectionNamesOrder(); // update preferences order list
+ //boolean namesQualifed = SystemPreferencesManager.getQualifyConnectionNames();
+ //if (namesQualifed)
+ // setQualifiedHostNames(namesQualifed); // causes refresh events to be fired
fireModelChangeEvent(
ISystemModelChangeEvents.SYSTEM_RESOURCE_RENAMED,
@@ -589,7 +493,7 @@ public class SystemRegistry implements ISystemRegistry
String oldName = profile.getName();
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.
// 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!
@@ -613,12 +517,12 @@ public class SystemRegistry implements ISystemRegistry
if ((conns != null) && (conns.length > 0))
{
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++)
{
- msgNoSubs.makeSubstitution(conns[idx].getAliasName());
- SystemBasePlugin.logDebugMessage(this.getClass().getName(), msgNoSubs.getLevelOneText());
- monitor.subTask(msgNoSubs.getLevelOneText());
+ msg = NLS.bind(msgNoSubs, conns[idx].getAliasName());
+ RSECorePlugin.getDefault().getLogger().logDebugMessage(this.getClass().getName(), msg);
+ monitor.subTask(msg);
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) {}
}
}
- msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COPYFILTERPOOLS_PROGRESS).getLevelOneText();
+ msg = RSECoreMessages.MSG_COPYFILTERPOOLS_PROGRESS;
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 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);
msg = "Copying filterPools for factory " + factory.getName(); //$NON-NLS-1$
//monitor.subTask(msg);
- SystemBasePlugin.logDebugMessage(this.getClass().getName(), msg);
+ RSECorePlugin.getDefault().getLogger().logDebugMessage(this.getClass().getName(), msg);
factory.copyFilterPoolManager(profile, newProfile);
//try { java.lang.Thread.sleep(3000l); } catch (InterruptedException e) {}
}
@@ -645,9 +549,9 @@ public class SystemRegistry implements ISystemRegistry
monitor.worked(1);
// 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);
- SystemBasePlugin.logDebugMessage(this.getClass().getName(), msg);
+ RSECorePlugin.getDefault().getLogger().logDebugMessage(this.getClass().getName(), msg);
if ((conns != null) && (conns.length > 0))
{
ISubSystem[] subsystems = null;
@@ -656,7 +560,7 @@ public class SystemRegistry implements ISystemRegistry
{
msg = "Copying subsystems for connection " + conns[idx].getAliasName(); //$NON-NLS-1$
//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
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$
//monitor.subTask(msg);
- SystemBasePlugin.logDebugMessage(this.getClass().getName(), msg);
+ RSECorePlugin.getDefault().getLogger().logDebugMessage(this.getClass().getName(), msg);
factory = subsystems[jdx].getSubSystemConfiguration();
factory.cloneSubSystem(subsystems[jdx], newConns[idx], true); // true=>copy profile op vs copy connection op
//try { java.lang.Thread.sleep(3000l); } catch (InterruptedException e) {}
@@ -698,7 +602,7 @@ public class SystemRegistry implements ISystemRegistry
}
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);
}
@@ -712,7 +616,7 @@ public class SystemRegistry implements ISystemRegistry
ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_PROFILE,
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;
}
@@ -749,7 +653,8 @@ public class SystemRegistry implements ISystemRegistry
}
// last step... physically blow away the profile...
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
fireEvent(new SystemResourceChangeEvent(connections, ISystemResourceChangeEvents.EVENT_DELETE_MANY, this));
@@ -786,26 +691,29 @@ public class SystemRegistry implements ISystemRegistry
}
if (activeReferenceVector.size() > 0)
{
- SystemBasePlugin.logWarning(
- ISystemMessages.MSG_LOADING_PROFILE_SHOULDNOTBE_DEACTIVATED
- + ": De-Activativing profile " //$NON-NLS-1$
- + profile.getName()
- + " for which there are subsystems containing references to filter pools:"); //$NON-NLS-1$
+ //RSEG1069: De-Activativing profile {0} for which there are subsystems containing references to filter pools:
+ String msg = NLS.bind(RSECoreMessages.MSG_LOADING_PROFILE_WARNING_FILTERPOOL_REFS, profile.getName());
+ RSECorePlugin.getDefault().getLogger().logWarning(msg);
for (int idx = 0; idx < activeReferenceVector.size(); idx++)
{
+ //\ \ {refname} in connection {1} in profile {2}
ISubSystem activeReference = (ISubSystem) activeReferenceVector.elementAt(idx);
- SystemBasePlugin.logWarning(
- " " + activeReference.getName() + " in connection " + activeReference.getHost().getAliasName() + " in profile " + activeReference.getSystemProfileName()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ msg = " " + activeReference.getName(); //$NON-NLS-1$
+ 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);
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.
- //FIXME I think it should be sufficient to log this as warning rather than open a dialog
- SystemMessage sysMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_LOADING_PROFILE_SHOULDNOTBE_DEACTIVATED);
- sysMsg.makeSubstitution(profile.getName(), connectionName);
- SystemBasePlugin.logWarning(sysMsg.getFullMessageID() + ": " + sysMsg.getLevelOneText()); //$NON-NLS-1$
- SystemMessageDialog msgDlg = new SystemMessageDialog(null, sysMsg);
- msgDlg.open();
+ //RSEG1069: Warning. Profile '%1' should be active. Active connection '%2' contains a reference to it.
+ msg = NLS.bind(RSECoreMessages.MSG_LOADING_PROFILE_SHOULDNOTBE_DEACTIVATED, profile.getName(), connectionName);
+ RSECorePlugin.getDefault().getLogger().logWarning(msg);
+ //// I think it should be sufficient to log this as warning rather than open a dialog
+ //SystemMessage sysMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_LOADING_PROFILE_SHOULDNOTBE_DEACTIVATED);
+ //sysMsg.makeSubstitution(profile.getName(), connectionName);
+ //SystemMessageDialog msgDlg = new SystemMessageDialog(null, sysMsg);
+ //msgDlg.open();
}
getSystemProfileManager().makeSystemProfileActive(profile, makeActive);
@@ -848,7 +756,8 @@ public class SystemRegistry implements ISystemRegistry
SystemResourceChangeEvent event = new SystemResourceChangeEvent(affectedConnections, ISystemResourceChangeEvents.EVENT_ADD_MANY, this);
fireEvent(event);
}
- SystemPreferencesManager.setConnectionNamesOrder(); // update preferences order list
+ ////Listening to Events now
+ //SystemPreferencesManager.setConnectionNamesOrder(); // update preferences order list
fireModelChangeEvent(
ISystemModelChangeEvents.SYSTEM_RESOURCE_CHANGED,
@@ -1611,7 +1520,7 @@ public class SystemRegistry implements ISystemRegistry
}
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;
}
@@ -1687,8 +1596,8 @@ public class SystemRegistry implements ISystemRegistry
host = pool.getHost(hostName);
}
} catch (Exception e) {
- String pluginId = RSEUIPlugin.getDefault().getSymbolicName();
- String message = MessageFormat.format("Exception in createHost for {0}", new Object[] {hostName});
+ String pluginId = RSECorePlugin.getDefault().getBundle().getSymbolicName();
+ String message = NLS.bind(RSECoreMessages.MSG_CREATEHOST_EXCEPTION, hostName);
status = new Status(IStatus.ERROR, pluginId, message, e);
}
if (status.isOK()) {
@@ -1736,14 +1645,15 @@ public class SystemRegistry implements ISystemRegistry
IStatus status = SystemProfileManager.run(op);
lastException = (Exception) status.getException();
if (lastException != null) {
- SystemBasePlugin.logError(status.getMessage(), lastException);
+ RSECorePlugin.getDefault().getLogger().logError(status.getMessage(), lastException);
throw lastException;
}
IHost host = op.getHost();
ISubSystem[] subsystems = op.getSubSystems();
FireNewHostEvents fire = new FireNewHostEvents(host, subsystems, sr);
Display.getDefault().asyncExec(fire);
- SystemPreferencesManager.setConnectionNamesOrder(); // update preferences order list
+ ////Listening to FireNewHostEvents now
+ //SystemPreferencesManager.setConnectionNamesOrder(); // update preferences order list
return host;
}
@@ -2032,13 +1942,13 @@ public class SystemRegistry implements ISystemRegistry
}
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;
return;
}
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;
return;
}
@@ -2101,7 +2011,8 @@ public class SystemRegistry implements ISystemRegistry
((ISubSystemConfiguration) affectedSubSystemFactories.elementAt(idx)).deleteSubSystemsByConnection(conn);
}
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(
ISystemModelChangeEvents.SYSTEM_RESOURCE_REMOVED,
ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_CONNECTION,
@@ -2134,7 +2045,8 @@ public class SystemRegistry implements ISystemRegistry
((ISubSystemConfiguration) affectedSubSystemFactories.elementAt(idx)).renameSubSystemsByConnection(conn, newName);
*/
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(
ISystemModelChangeEvents.SYSTEM_RESOURCE_RENAMED,
ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_CONNECTION,
@@ -2150,7 +2062,8 @@ public class SystemRegistry implements ISystemRegistry
{
ISystemHostPool pool = getHostPool(profileName);
pool.moveHosts(conns, delta);
- SystemPreferencesManager.setConnectionNamesOrder();
+ ////Listening to Event now
+ //SystemPreferencesManager.setConnectionNamesOrder();
//fireEvent(new SystemResourceChangeEvent(pool.getSystemConnections(),ISystemResourceChangeEvent.EVENT_MOVE_MANY,this));
SystemResourceChangeEvent event = new SystemResourceChangeEvent(conns, ISystemResourceChangeEvents.EVENT_MOVE_MANY, this);
event.setPosition(delta);
@@ -2177,7 +2090,7 @@ public class SystemRegistry implements ISystemRegistry
ISystemHostPool targetPool = getHostPool(targetProfile);
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.
getSubSystemFactories(conn);
@@ -2190,15 +2103,15 @@ public class SystemRegistry implements ISystemRegistry
newConn = oldPool.cloneHost(targetPool, conn, newName);
// 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);
- SystemBasePlugin.logDebugMessage(this.getClass().getName(), msg);
+ RSECorePlugin.getDefault().getLogger().logDebugMessage(this.getClass().getName(), msg);
ISubSystem[] subsystems = null;
ISubSystemConfiguration factory = null;
msg = "Copying subsystems for connection " + conn.getAliasName(); //$NON-NLS-1$
//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
if ((subsystems != null) && (subsystems.length > 0))
{
@@ -2206,7 +2119,7 @@ public class SystemRegistry implements ISystemRegistry
{
msg += ": subsystem " + subsystems[jdx].getName(); //$NON-NLS-1$
//monitor.subTask(msg);
- SystemBasePlugin.logDebugMessage(this.getClass().getName(), msg);
+ RSECorePlugin.getDefault().getLogger().logDebugMessage(this.getClass().getName(), msg);
factory = subsystems[jdx].getSubSystemConfiguration();
factory.cloneSubSystem(subsystems[jdx], newConn, false); // false=>copy connection op vs copy profile op
//try { java.lang.Thread.sleep(3000l); } catch (InterruptedException e) {}
@@ -2229,11 +2142,11 @@ public class SystemRegistry implements ISystemRegistry
}
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);
}
- 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()))
{
int eventType = ISystemResourceChangeEvents.EVENT_ADD_RELATIVE;
@@ -2263,13 +2176,13 @@ public class SystemRegistry implements ISystemRegistry
if (newConn != null)
{
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));
}
}
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;
}
return newConn;
@@ -2770,9 +2683,34 @@ public class SystemRegistry implements ISystemRegistry
* Returns the implementation of ISystemRemoteElement for the given
* 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)
@@ -2787,17 +2725,17 @@ public class SystemRegistry implements ISystemRegistry
ISystemFilterReference ref = (ISystemFilterReference)remoteResource;
ISubSystem ss = ref.getSubSystem();
remoteResource = ss.getTargetForFilter(ref);
- ISystemRemoteElementAdapter ra = getRemoteAdapter(remoteResource);
- if (ra == null)
+ IRemoteObjectIdentifier rid = getRemoteObjectIdentifier(remoteResource);
+ if (rid == null)
return null;
- remoteResourceName = ra.getAbsoluteName(remoteResource);
+ remoteResourceName = rid.getAbsoluteName(remoteResource);
}
else
{
- ISystemRemoteElementAdapter ra = getRemoteAdapter(remoteResource);
- if (ra == null)
+ IRemoteObjectIdentifier rid = getRemoteObjectIdentifier(remoteResource);
+ if (rid == null)
return null;
- remoteResourceName = ra.getAbsoluteName(remoteResource);
+ remoteResourceName = rid.getAbsoluteName(remoteResource);
}
return remoteResourceName;
}
@@ -3024,11 +2962,11 @@ public class SystemRegistry implements ISystemRegistry
boolean ok = true;
lastException = null;
/*
- SystemProfileManager profileManager = SystemStartHere.getSystemProfileManager();
+ SystemProfileManager profileManager = RSECorePlugin.getTheSystemProfileManager();
SystemHostPool pool = null;
SystemPreferencesManager prefmgr = SystemPreferencesManager.getPreferencesManager();
- if (!RSEUIPlugin.getThePersistenceManager().restore(profileManager))
+ if (!RSECorePlugin.getThePersistenceManager().restore(profileManager))
{
SystemProfile[] profiles = profileManager.getActiveSystemProfiles();
for (int idx = 0; idx < profiles.length; idx++)
@@ -3042,7 +2980,7 @@ public class SystemRegistry implements ISystemRegistry
catch (Exception 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.
- * We return all connections for all active profiles.
+ * Return the child objects to constitute the root elements in the system view tree.
+ * We return all connections that have an enabled system type.
*/
public Object[] getSystemViewRoots()
{
@@ -3077,11 +3015,11 @@ public class SystemRegistry implements ISystemRegistry
for (int i = 0; i < connections.length; i++) {
IHost con = connections[i];
IRSESystemType sysType = con.getSystemType();
- if (sysType != null) { // sysType can be null if workspace contains a host that is no longer defined by the workbench
- RSESystemTypeAdapter adapter = (RSESystemTypeAdapter)(sysType.getAdapter(RSESystemTypeAdapter.class));
- // Note: System types without registered subsystems get disabled by the adapter itself!
- // There is no need to re-check this here again.
- if (adapter.isEnabled(sysType)) result.add(con);
+ // sysType can be null if workspace contains a host that is no longer defined by the workbench
+ if (sysType != null && sysType.isEnabled()) {
+ // Note: System types without registered subsystems get disabled by the default
+ // AbstractRSESystemType implementation itself! There is no need to re-check this here again.
+ result.add(con);
}
}
return result.toArray();
@@ -3105,42 +3043,6 @@ public class SystemRegistry implements ISystemRegistry
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)
* @see org.eclipse.rse.ui.view.ISystemViewInputProvider#setViewer(java.lang.Object)
diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemResourceChangeManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemResourceChangeManager.java
similarity index 96%
rename from rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemResourceChangeManager.java
rename to rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemResourceChangeManager.java
index 0ea2c4b38c8..5039bf7b8f0 100644
--- a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemResourceChangeManager.java
+++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemResourceChangeManager.java
@@ -13,9 +13,10 @@
* Contributors:
* 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) - [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.List;
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemPreferenceQualifyConnectionNamesAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemPreferenceQualifyConnectionNamesAction.java
index d85af49599d..1e63e432770 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemPreferenceQualifyConnectionNamesAction.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemPreferenceQualifyConnectionNamesAction.java
@@ -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
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -13,12 +13,12 @@
* Contributors:
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
* 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;
import org.eclipse.rse.core.RSECorePlugin;
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.ui.SystemResources;
import org.eclipse.rse.ui.RSEUIPlugin;
@@ -33,8 +33,6 @@ import org.eclipse.swt.widgets.Shell;
public class SystemPreferenceQualifyConnectionNamesAction extends SystemBaseAction
{
-
- private ISystemRegistry sr = null;
/**
* Constructor
*/
@@ -44,8 +42,7 @@ public class SystemPreferenceQualifyConnectionNamesAction extends SystemBaseActi
parent);
setSelectionSensitive(false);
allowOnMultipleSelection(true);
- sr = RSECorePlugin.getTheSystemRegistry();
- setChecked(sr.getQualifiedHostNames());
+ setChecked(RSEUIPlugin.getTheSystemRegistryUI().getQualifiedHostNames());
setHelp(RSEUIPlugin.HELPPREFIX+"actn0008"); //$NON-NLS-1$
}
@@ -57,7 +54,7 @@ public class SystemPreferenceQualifyConnectionNamesAction extends SystemBaseActi
public void run()
{
boolean newState = isChecked();
- sr.setQualifiedHostNames(newState);
+ RSEUIPlugin.getTheSystemRegistryUI().setQualifiedHostNames(newState);
firePreferenceChangeEvent(ISystemPreferenceChangeEvents.EVENT_QUALIFYCONNECTIONNAMES,
!newState,newState); // defect 41794
}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/RemoteSystemsPreferencePage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/RemoteSystemsPreferencePage.java
index 817c617a158..c457b4d6244 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/RemoteSystemsPreferencePage.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/RemoteSystemsPreferencePage.java
@@ -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
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* 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) - [168975] Move RSE Events API to Core
* 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;
@@ -195,14 +196,14 @@ public class RemoteSystemsPreferencePage
{
boolean ok = super.performOk();
SystemPreferencesManager.savePreferences(); // better save to disk, just in case.
- if (!RSEUIPlugin.getDefault().isSystemRegistryActive())
+ if (!RSECorePlugin.isTheSystemRegistryActive())
return ok;
if (showFilterPoolsEditor != null)
{
boolean newValue = showFilterPoolsEditor.getBooleanValue();
if (newValue != lastShowFilterPoolsValue)
{
- RSECorePlugin.getTheSystemRegistry().setShowFilterPools(newValue);
+ RSEUIPlugin.getTheSystemRegistryUI().setShowFilterPools(newValue);
firePreferenceChangeEvent(ISystemPreferenceChangeEvents.EVENT_SHOWFILTERPOOLS,lastShowFilterPoolsValue,newValue);
}
lastShowFilterPoolsValue = newValue;
@@ -212,7 +213,7 @@ public class RemoteSystemsPreferencePage
boolean newValue = showNewConnectionPromptEditor.getBooleanValue();
if (newValue != lastShowNewConnectionPromptValue)
{
- RSECorePlugin.getTheSystemRegistry().setShowNewHostPrompt(newValue);
+ RSEUIPlugin.getTheSystemRegistryUI().setShowNewHostPrompt(newValue);
}
lastShowNewConnectionPromptValue = newValue;
}
@@ -221,7 +222,7 @@ public class RemoteSystemsPreferencePage
boolean newValue = qualifyConnectionNamesEditor.getBooleanValue();
if (newValue != lastQualifyConnectionNamesValue)
{
- RSECorePlugin.getTheSystemRegistry().setQualifiedHostNames(newValue);
+ RSEUIPlugin.getTheSystemRegistryUI().setQualifiedHostNames(newValue);
firePreferenceChangeEvent(ISystemPreferenceChangeEvents.EVENT_QUALIFYCONNECTIONNAMES,lastQualifyConnectionNamesValue,newValue);
}
lastQualifyConnectionNamesValue = newValue;
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/ElementComparer.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/ElementComparer.java
index 855d01e2907..da331567589 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/ElementComparer.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/ElementComparer.java
@@ -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
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -12,6 +12,7 @@
*
* Contributors:
* 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;
@@ -20,7 +21,7 @@ import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.viewers.IElementComparer;
import org.eclipse.rse.core.RSECorePlugin;
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;
public class ElementComparer implements IElementComparer
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewPart.java
index 5e99125566a..363fd7a7fc8 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewPart.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewPart.java
@@ -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
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* 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
* 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
+ * Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
********************************************************************************/
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.subsystems.ISubSystem;
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.SystemResources;
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.dialogs.SystemPromptDialog;
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.model.ISystemShellProvider;
import org.eclipse.rse.ui.view.IRSEViewPart;
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewConnectionAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewConnectionAdapter.java
index b9b4f62981e..c2ba16a35b5 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewConnectionAdapter.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewConnectionAdapter.java
@@ -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
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* 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
* Martin Oberhuber (Wind River) - [216266] Consider stateless subsystems (supportsSubSystemConnect==false)
* 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;
@@ -234,7 +235,7 @@ public class SystemViewConnectionAdapter
public String getText(Object element)
{
IHost conn = (IHost)element;
- boolean qualifyNames = RSECorePlugin.getTheSystemRegistry().getQualifiedHostNames();
+ boolean qualifyNames = RSEUIPlugin.getTheSystemRegistryUI().getQualifiedHostNames();
if (!qualifyNames)
return conn.getAliasName();
else
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEUIPlugin.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEUIPlugin.java
index 68bdbac7e6e..e126f0d3183 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEUIPlugin.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEUIPlugin.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation 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
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* 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 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
+ * Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
********************************************************************************/
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.ISystemProfileManager;
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.ISubSystemConfigurationProxy;
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.SystemResourceListener;
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.SystemMessage;
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.model.ISystemRegistryUI;
import org.osgi.framework.BundleContext;
@@ -89,8 +89,8 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
public IStatus run(IProgressMonitor monitor) {
//System.err.println("InitRSEJob started"); //$NON-NLS-1$
- ISystemRegistry registry = getSystemRegistryInternal();
- SystemStartHere.getSystemProfileManager(); // create folders per profile
+ ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
+ RSECorePlugin.getTheSystemProfileManager(); // create folders per profile
// add workspace listener for our project
IProject remoteSystemsProject = SystemResourceManager.getRemoteSystemsProject(false);
SystemResourceListener listener = SystemResourceListener.getListener(remoteSystemsProject);
@@ -105,7 +105,7 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
if (systemType != null) {
RSESystemTypeAdapter adapter = (RSESystemTypeAdapter)(systemType.getAdapter(RSESystemTypeAdapter.class));
if (adapter != null && adapter.isEnabled(systemType)) {
- ISystemProfileManager profileManager = SystemProfileManager.getDefault();
+ ISystemProfileManager profileManager = RSECorePlugin.getTheSystemProfileManager();
ISystemProfile profile = profileManager.getDefaultPrivateSystemProfile();
String userName = System.getProperty("user.name"); //$NON-NLS-1$
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 defaultMessageFile = null;
-
-// private SystemType[] allSystemTypes = null;
- private SystemRegistryUI _systemRegistryUI = null;
- private SystemRegistry _systemRegistry = null;
private Vector viewSuppliers = new Vector();
private SystemViewAdapterFactory svaf; // for fastpath access
@@ -439,9 +435,9 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
messageFile = getMessageFile("systemmessages.xml"); //$NON-NLS-1$
defaultMessageFile = getDefaultMessageFile("systemmessages.xml"); //$NON-NLS-1$
-
- ISystemRegistry registry = getSystemRegistryInternal();
- RSECorePlugin.getDefault().setSystemRegistry(registry);
+
+ //Force load the SystemRegistry - TODO Is this really necessary?
+ RSECorePlugin.getTheSystemRegistry();
IAdapterManager manager = Platform.getAdapterManager();
@@ -461,11 +457,8 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
svraf = new SystemTeamViewResourceAdapterFactory();
svraf.registerWithManager(manager);
-
InitRSEJob initJob = new InitRSEJob();
initJob.schedule();
-
-
}
/**
@@ -482,39 +475,42 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
*/
public void restart()
{
- if (_systemRegistry != null)
- {
- // disconnect all active connections
- disconnectAll(false); // don't save ?
- // collapse and flush all nodes in all views
- _systemRegistry.fireEvent(new SystemResourceChangeEvent("dummy", ISystemResourceChangeEvents.EVENT_COLLAPSE_ALL, null)); //$NON-NLS-1$
+ if (RSECorePlugin.isTheSystemRegistryActive()) {
+ ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
+
+ // disconnect all active connections
+ disconnectAll(false); // don't save ?
+ // 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
- closeViews();
-
- // clear in-memory settings for all filter pools and subsystems
- ISubSystemConfigurationProxy[] proxies = getSystemRegistryInternal().getSubSystemConfigurationProxies();
- if (proxies != null)
- for (int idx=0; idx < proxies.length; idx++)
- proxies[idx].reset();
- // clear in-memory settings for all profiles
- SystemProfileManager.clearDefault();
+ // allow child classes to override
+ closeViews();
+
+ // clear in-memory settings for all filter pools and subsystems
+ ISubSystemConfigurationProxy[] proxies = sr.getSubSystemConfigurationProxies();
+ if (proxies != null) {
+ for (int idx=0; idx < proxies.length; idx++)
+ proxies[idx].reset();
+ }
+ // clear in-memory settings for all profiles
+ SystemProfileManager.clearDefault();
- // rebuild profiles
- SystemStartHere.getSystemProfileManager(); // create folders per profile
- // clear in-memory settings for all connections, then restore from disk
- _systemRegistry.reset();
- // restore in-memory settings for all filter pools and subsystems
- if (proxies != null)
- for (int idx=0; idx < proxies.length; idx++)
- proxies[idx].restore();
-
- // refresh GUIs
- _systemRegistry.fireEvent(new SystemResourceChangeEvent(_systemRegistry, ISystemResourceChangeEvents.EVENT_REFRESH, null));
+ // rebuild profiles
+ RSECorePlugin.getTheSystemProfileManager(); // create folders per profile
+ // clear in-memory settings for all connections, then restore from disk
+ ((SystemRegistry)sr).reset();
+ // restore in-memory settings for all filter pools and subsystems
+ if (proxies != null) {
+ for (int idx=0; idx < proxies.length; idx++)
+ proxies[idx].restore();
+ }
+
+ // refresh GUIs
+ sr.fireEvent(new SystemResourceChangeEvent(sr, ISystemResourceChangeEvents.EVENT_REFRESH, null));
- // allow child classes to override
- openViews();
- }
+ // allow child classes to override
+ openViews();
+ }
}
/**
@@ -569,9 +565,10 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
*/
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)
{
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.
+ * @return true
if the System Registry has been instantiated already.
+ * @deprecated use {@link RSECorePlugin#isTheSystemRegistryActive()}
*/
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
+ * @deprecated use {@link RSECorePlugin#getThePersistenceManager()}
*/
public IRSEPersistenceManager getPersistenceManager()
{
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.
- * Clients should use static @{link getTheSystemRegistry()} instead.
- */
- private SystemRegistryUI getSystemRegistryUIInternal()
- {
- if (_systemRegistryUI == null)
- {
- _systemRegistryUI = SystemRegistryUI.getInstance();
- }
- return _systemRegistryUI;
- }
-
- /**
- * A static version for convenience
- * Returns the master registry singleton.
+ * @return the SystemRegistryUI singleton.
*/
public static ISystemRegistryUI getTheSystemRegistryUI()
{
- return getDefault().getSystemRegistryUIInternal();
+ return SystemRegistryUI.getInstance();
}
/**
- * A static version for convenience
- * Returns the master profile manager singleton.
+ * Return the master profile manager singleton.
+ * @return the RSE Profile Manager Singleton.
+ * @deprecated use {@link RSECorePlugin#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 true
if the System Registry has been instantiated already.
+ * @deprecated use {@link RSECorePlugin#isTheSystemRegistryActive()}
*/
- public static boolean isTheSystemRegistryActive()
- {
- if (inst == null)
- return false;
- else
- return getDefault().isSystemRegistryActive();
+ public static boolean isTheSystemRegistryActive() {
+ return RSECorePlugin.isTheSystemRegistryActive();
}
/**
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPreferencesManager.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPreferencesManager.java
index 37d79f2cf32..ff4fc5dfc0f 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPreferencesManager.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPreferencesManager.java
@@ -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
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* 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
* the org.eclipse.rse.core package of the UI plugin.
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
+ * Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
********************************************************************************/
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.rse.core.IRSEPreferenceNames;
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.ISystemRegistry;
@@ -49,6 +58,22 @@ public class SystemPreferencesManager {
private static boolean showProfilePage; // 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() {
String[] keys = {
IRSEPreferenceNames.ACTIVEUSERPROFILES,
@@ -80,11 +105,12 @@ public class SystemPreferencesManager {
migrateCorePreferences();
initDefaultsUI();
savePreferences();
+ fInstance.startModelChangeListening();
}
private static void initDefaultsUI() {
- String showProp = System.getProperty("rse.showNewConnectionPrompt");
+ //String showProp = System.getProperty("rse.showNewConnectionPrompt");
RSEUIPlugin ui = RSEUIPlugin.getDefault();
Preferences store = ui.getPluginPreferences();
showNewConnectionPrompt= getBooleanProperty("rse.showNewConnectionPrompt", ISystemPreferencesConstants.DEFAULT_SHOWNEWCONNECTIONPROMPT); //$NON-NLS-1$
@@ -155,15 +181,13 @@ public class SystemPreferencesManager {
String[] allConnectionNamesOrder = SystemPreferencesManager.getConnectionNamesOrder();
profileName = profileName + "."; //$NON-NLS-1$
int profileNameLength = profileName.length();
- Vector v = new Vector();
+ List l = new ArrayList();
for (int idx = 0; idx < allConnectionNamesOrder.length; idx++)
if (allConnectionNamesOrder[idx].startsWith(profileName)) {
- v.addElement(allConnectionNamesOrder[idx].substring(profileNameLength));
+ l.add(allConnectionNamesOrder[idx].substring(profileNameLength));
}
- String[] names = new String[v.size()];
- for (int idx = 0; idx < names.length; idx++) {
- names[idx] = (String) v.elementAt(idx);
- }
+ String[] names = new String[l.size()];
+ l.toArray(names);
return names;
}
@@ -191,6 +215,9 @@ public class SystemPreferencesManager {
/**
* Sets user's preference for the order of the connection names according to the
* 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() {
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
@@ -231,14 +258,14 @@ public class SystemPreferencesManager {
* a restored ordered list of names.
*/
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...
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...
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()];
finalList.toArray(resolved);
@@ -335,7 +362,7 @@ public class SystemPreferencesManager {
store.setValue(ISystemPreferencesConstants.SHOWFILTERPOOLS, show);
savePreferences();
if (show != prevValue) {
- RSECorePlugin.getTheSystemRegistry().setShowFilterPools(show);
+ RSEUIPlugin.getTheSystemRegistryUI().setShowFilterPools(show);
}
}
@@ -435,10 +462,64 @@ public class SystemPreferencesManager {
RSEUIPlugin.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();
+ }
+ }
+
+ }
+
}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemRegistryUI.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemRegistryUI.java
index c6fa4a9ba6e..67584a7b4c7 100644
--- a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemRegistryUI.java
+++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemRegistryUI.java
@@ -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
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* 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
* initialize correctly in getInstance()
* 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;
@@ -28,11 +30,17 @@ import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.rse.core.RSECorePlugin;
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.SystemResourceChangeEvent;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.model.ISystemRegistry;
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.SystemPerspectiveHelpers;
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.ui.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin;
+import org.eclipse.rse.ui.SystemPreferencesManager;
import org.eclipse.rse.ui.model.ISystemRegistryUI;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.FileTransfer;
@@ -436,6 +445,85 @@ public class SystemRegistryUI implements ISystemRegistryUI {
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...
// ----------------------------
diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/model/ISystemRegistryUI.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/model/ISystemRegistryUI.java
index 6e34ae97d50..fcc9a90a501 100644
--- a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/model/ISystemRegistryUI.java
+++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/model/ISystemRegistryUI.java
@@ -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
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* 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) - [189123] Prepare ISystemRegistry for move into non-UI
* 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;
@@ -69,6 +70,34 @@ public interface ISystemRegistryUI extends ISystemShellProvider {
*/
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...
// ----------------------------------