mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-04 07:35:24 +02:00
[refactoring] Separate UI dependencies from ISystemRegistry. A new interface ISystemRegistryUI now contains methods that have UI dependencies.
This commit is contained in:
parent
b21ec93769
commit
692138a429
12 changed files with 78 additions and 51 deletions
|
@ -27,8 +27,6 @@ import org.eclipse.rse.core.subsystems.IConnectorService;
|
|||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
|
||||
import org.eclipse.swt.dnd.Clipboard;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -401,11 +399,6 @@ public interface ISystemRegistry extends ISchedulingRule
|
|||
* Return array of previously specified hostnames for a given system type.
|
||||
*/
|
||||
public String[] getHostNames(String systemType);
|
||||
|
||||
/**
|
||||
* Returns the clipboard used for copy actions
|
||||
*/
|
||||
public Clipboard getSystemClipboard();
|
||||
|
||||
/**
|
||||
* Returns the list of objects on the system clipboard
|
||||
|
@ -506,33 +499,6 @@ public interface ISystemRegistry extends ISchedulingRule
|
|||
*/
|
||||
public IHost createHost(String systemType, String connectionName, String hostName, String description)
|
||||
throws Exception;
|
||||
|
||||
/**
|
||||
* Update an existing connection given the new information.
|
||||
* This method:
|
||||
* <ul>
|
||||
* <li>calls the setXXX methods on the given connection object, updating the information in it.
|
||||
* <li>save the connection's connection pool to disk
|
||||
* <li>fires an ISystemResourceChangeEvent event of type EVENT_CHANGE to all registered listeners
|
||||
* <li>if the systemtype or hostname is changed, calls disconnect on each associated subsystem.
|
||||
* We must do this because a hostname changes fundamentally affects the connection,
|
||||
* rendering any information currently displayed under
|
||||
* that connection obsolete. That is, the user will have to reconnect.
|
||||
* </ul>
|
||||
* <p>
|
||||
* @param conn SystemConnection to be updated
|
||||
* @param systemType system type matching one of the system type names defined via the
|
||||
* systemTypes extension point.
|
||||
* @param connectionName unique connection name.
|
||||
* @param hostName ip name of host.
|
||||
* @param description optional description of the connection. Can be null.
|
||||
* @param defaultUserIdLocation one of the constants in {@link org.eclipse.rse.core.ISystemUserIdConstants ISystemUserIdConstants}
|
||||
* that tells us where to set the user Id
|
||||
* @param defaultUserId userId to use as the default for the subsystems.
|
||||
*/
|
||||
public void updateHost(Shell shell, IHost conn, String systemType,
|
||||
String connectionName, String hostName,
|
||||
String description,String defaultUserId, int defaultUserIdLocation);
|
||||
|
||||
/**
|
||||
* Update the workoffline mode for a connection.
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.eclipse.rse.core.SystemBasePlugin;
|
|||
import org.eclipse.rse.core.filters.ISystemFilter;
|
||||
import org.eclipse.rse.core.filters.ISystemFilterPool;
|
||||
import org.eclipse.rse.core.model.ISystemNewConnectionWizardPage;
|
||||
import org.eclipse.rse.core.model.ISystemRegistry;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
||||
import org.eclipse.rse.files.ui.actions.SystemFileUpdateFilterAction;
|
||||
import org.eclipse.rse.files.ui.actions.SystemNewFileAction;
|
||||
|
@ -37,6 +36,7 @@ import org.eclipse.rse.files.ui.actions.SystemNewFolderAction;
|
|||
import org.eclipse.rse.files.ui.resources.SystemIFileProperties;
|
||||
import org.eclipse.rse.files.ui.resources.SystemRemoteEditManager;
|
||||
import org.eclipse.rse.files.ui.wizards.SystemFileNewConnectionWizardPage;
|
||||
import org.eclipse.rse.model.ISystemRegistryUI;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystemConfiguration;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
import org.eclipse.rse.ui.actions.SystemPasteFromClipboardAction;
|
||||
|
@ -135,7 +135,7 @@ public class RemoteFileSubSystemConfigurationAdapter extends SubSystemConfigurat
|
|||
// FIXME - can't do this here anymore
|
||||
//_additionalActions.add(new SystemCommandAction(shell, true));
|
||||
|
||||
ISystemRegistry registry = RSEUIPlugin.getTheSystemRegistry();
|
||||
ISystemRegistryUI registry = RSEUIPlugin.getTheSystemRegistry();
|
||||
Clipboard clipboard = registry.getSystemClipboard();
|
||||
_additionalActions.add(new SystemPasteFromClipboardAction(shell, clipboard));
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ import org.eclipse.rse.files.ui.resources.SystemIFileProperties;
|
|||
import org.eclipse.rse.files.ui.resources.SystemRemoteEditManager;
|
||||
import org.eclipse.rse.files.ui.resources.UniversalFileTransferUtility;
|
||||
import org.eclipse.rse.filters.SystemFilterReference;
|
||||
import org.eclipse.rse.model.ISystemRegistryUI;
|
||||
import org.eclipse.rse.model.ISystemResourceChangeEvents;
|
||||
import org.eclipse.rse.model.SystemRegistry;
|
||||
import org.eclipse.rse.model.SystemRemoteResourceSet;
|
||||
|
@ -411,7 +412,7 @@ public class SystemViewRemoteFileAdapter
|
|||
//ISubSystem subsys = firstFile.getParentRemoteFileSubSystem();
|
||||
|
||||
// DKM - clipboard based copy actions
|
||||
ISystemRegistry registry = RSEUIPlugin.getTheSystemRegistry();
|
||||
ISystemRegistryUI registry = RSEUIPlugin.getTheSystemRegistry();
|
||||
Clipboard clipboard = registry.getSystemClipboard();
|
||||
|
||||
if (pasteClipboardAction == null)
|
||||
|
|
|
@ -27,9 +27,9 @@ import org.eclipse.jface.viewers.ISelectionChangedListener;
|
|||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.jface.viewers.TableLayout;
|
||||
import org.eclipse.rse.core.model.ISystemRegistry;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||
import org.eclipse.rse.internal.subsystems.shells.subsystems.RemoteOutput;
|
||||
import org.eclipse.rse.model.ISystemRegistryUI;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
import org.eclipse.rse.shells.ui.ShellResources;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
||||
|
@ -195,7 +195,7 @@ FocusListener
|
|||
_tabFolderPage.setLayout(gridLayout);
|
||||
createControl(_tabFolderPage);
|
||||
|
||||
ISystemRegistry registry = RSEUIPlugin.getTheSystemRegistry();
|
||||
ISystemRegistryUI registry = RSEUIPlugin.getTheSystemRegistry();
|
||||
|
||||
// global actions
|
||||
Clipboard clipboard = registry.getSystemClipboard();
|
||||
|
|
|
@ -45,7 +45,6 @@ import org.eclipse.rse.core.model.ISystemRegistry;
|
|||
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
|
||||
import org.eclipse.rse.internal.model.SystemProfileManager;
|
||||
import org.eclipse.rse.internal.persistence.RSEPersistenceManager;
|
||||
import org.eclipse.rse.model.ISystemResourceChangeEvents;
|
||||
import org.eclipse.rse.model.SystemRegistry;
|
||||
import org.eclipse.rse.model.SystemResourceChangeEvent;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package org.eclipse.rse.ui.dialogs;
|
||||
import org.eclipse.rse.core.model.IHost;
|
||||
import org.eclipse.rse.core.model.ISystemRegistry;
|
||||
import org.eclipse.rse.model.ISystemRegistryUI;
|
||||
import org.eclipse.rse.ui.ISystemConnectionFormCaller;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
import org.eclipse.rse.ui.SystemConnectionForm;
|
||||
|
@ -120,7 +120,7 @@ public class SystemUpdateConnectionDialog extends SystemPromptDialog implements
|
|||
if (closeDialog)
|
||||
{
|
||||
IHost conn = (IHost)getInputObject();
|
||||
ISystemRegistry sr = RSEUIPlugin.getDefault().getSystemRegistry();
|
||||
ISystemRegistryUI sr = RSEUIPlugin.getDefault().getSystemRegistry();
|
||||
sr.updateHost( getShell(),conn,conn.getSystemType(),form.getConnectionName(),
|
||||
form.getHostName(), form.getConnectionDescription(),
|
||||
form.getDefaultUserId(), form.getUserIdLocation() );
|
||||
|
|
|
@ -18,8 +18,8 @@ package org.eclipse.rse.ui.propertypages;
|
|||
import org.eclipse.rse.core.IRSESystemType;
|
||||
import org.eclipse.rse.core.SystemBasePlugin;
|
||||
import org.eclipse.rse.core.model.IHost;
|
||||
import org.eclipse.rse.core.model.ISystemRegistry;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||
import org.eclipse.rse.model.ISystemRegistryUI;
|
||||
import org.eclipse.rse.ui.ISystemConnectionFormCaller;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
import org.eclipse.rse.ui.SystemConnectionForm;
|
||||
|
@ -89,7 +89,7 @@ public class SystemConnectionPropertyPage extends SystemBasePropertyPage
|
|||
if (okToClose)
|
||||
{
|
||||
IHost conn = (IHost)getElement();
|
||||
ISystemRegistry sr = RSEUIPlugin.getDefault().getSystemRegistry();
|
||||
ISystemRegistryUI sr = RSEUIPlugin.getDefault().getSystemRegistry();
|
||||
sr.updateHost( getShell(),conn,conn.getSystemType(),form.getConnectionName(),
|
||||
form.getHostName(), form.getConnectionDescription(),
|
||||
form.getDefaultUserId(), form.getUserIdLocation() );
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.eclipse.rse.core.SystemPreferencesManager;
|
|||
import org.eclipse.rse.core.model.IHost;
|
||||
import org.eclipse.rse.core.model.ISystemRegistry;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||
import org.eclipse.rse.model.ISystemRegistryUI;
|
||||
import org.eclipse.rse.ui.ISystemMessages;
|
||||
import org.eclipse.rse.ui.RSESystemTypeAdapter;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
|
@ -451,7 +452,7 @@ public class SystemViewConnectionAdapter
|
|||
//System.out.println("Inside resetPropertyValue in adapter");
|
||||
String property = (String)propertyObject;
|
||||
IHost conn = (IHost)propertySourceInput;
|
||||
ISystemRegistry sr = RSEUIPlugin.getDefault().getSystemRegistry();
|
||||
ISystemRegistryUI sr = RSEUIPlugin.getDefault().getSystemRegistry();
|
||||
|
||||
if (property.equals(P_DEFAULTUSERID))
|
||||
{
|
||||
|
@ -479,7 +480,7 @@ public class SystemViewConnectionAdapter
|
|||
//if (!data.getIsLocal())
|
||||
//whereToUpdate = USERID_LOCATION_DEFAULT_SYSTEMTYPE;
|
||||
String userId = data.getLocalValue(); // will be "" if !data.getIsLocal(), which results in wiping out local override
|
||||
ISystemRegistry sr = RSEUIPlugin.getDefault().getSystemRegistry();
|
||||
ISystemRegistryUI sr = RSEUIPlugin.getDefault().getSystemRegistry();
|
||||
sr.updateHost(null, conn, conn.getSystemType(), conn.getAliasName(),
|
||||
conn.getHostName(), conn.getDescription(), userId, whereToUpdate);
|
||||
}
|
||||
|
@ -491,7 +492,7 @@ public class SystemViewConnectionAdapter
|
|||
{
|
||||
String name = (String)property;
|
||||
IHost conn = (IHost)propertySourceInput;
|
||||
ISystemRegistry sr = RSEUIPlugin.getDefault().getSystemRegistry();
|
||||
ISystemRegistryUI sr = RSEUIPlugin.getDefault().getSystemRegistry();
|
||||
|
||||
if (name.equals(P_DEFAULTUSERID))
|
||||
{
|
||||
|
|
|
@ -30,8 +30,8 @@ import org.eclipse.jface.viewers.ISelectionChangedListener;
|
|||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.rse.core.model.ISystemContainer;
|
||||
import org.eclipse.rse.core.model.ISystemRegistry;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||
import org.eclipse.rse.model.ISystemRegistryUI;
|
||||
import org.eclipse.rse.model.ISystemResourceChangeEvents;
|
||||
import org.eclipse.rse.model.SystemRegistry;
|
||||
import org.eclipse.rse.model.SystemResourceChangeEvent;
|
||||
|
@ -255,7 +255,7 @@ FocusListener
|
|||
|
||||
|
||||
|
||||
ISystemRegistry registry = RSEUIPlugin.getTheSystemRegistry();
|
||||
ISystemRegistryUI registry = RSEUIPlugin.getTheSystemRegistry();
|
||||
|
||||
// global actions
|
||||
Clipboard clipboard = registry.getSystemClipboard();
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2006 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
|
||||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
* Contributors:
|
||||
* {Name} (company) - description of contribution.
|
||||
********************************************************************************/
|
||||
package org.eclipse.rse.model;
|
||||
|
||||
import org.eclipse.rse.core.model.IHost;
|
||||
import org.eclipse.rse.core.model.ISystemRegistry;
|
||||
import org.eclipse.swt.dnd.Clipboard;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
/**
|
||||
* Registry or front door for all remote system connections.
|
||||
*/
|
||||
public interface ISystemRegistryUI extends ISystemRegistry {
|
||||
|
||||
/**
|
||||
* Update an existing connection given the new information.
|
||||
* This method:
|
||||
* <ul>
|
||||
* <li>calls the setXXX methods on the given connection object, updating the information in it.
|
||||
* <li>save the connection's connection pool to disk
|
||||
* <li>fires an ISystemResourceChangeEvent event of type EVENT_CHANGE to all registered listeners
|
||||
* <li>if the systemtype or hostname is changed, calls disconnect on each associated subsystem.
|
||||
* We must do this because a hostname changes fundamentally affects the connection,
|
||||
* rendering any information currently displayed under
|
||||
* that connection obsolete. That is, the user will have to reconnect.
|
||||
* </ul>
|
||||
* <p>
|
||||
* @param conn SystemConnection to be updated
|
||||
* @param systemType system type matching one of the system type names defined via the
|
||||
* systemTypes extension point.
|
||||
* @param connectionName unique connection name.
|
||||
* @param hostName ip name of host.
|
||||
* @param description optional description of the connection. Can be null.
|
||||
* @param defaultUserIdLocation one of the constants in {@link org.eclipse.rse.core.ISystemUserIdConstants ISystemUserIdConstants}
|
||||
* that tells us where to set the user Id
|
||||
* @param defaultUserId userId to use as the default for the subsystems.
|
||||
*/
|
||||
public void updateHost(Shell shell, IHost conn, String systemType,
|
||||
String connectionName, String hostName,
|
||||
String description,String defaultUserId, int defaultUserIdLocation);
|
||||
|
||||
/**
|
||||
* Returns the clipboard used for copy actions
|
||||
*/
|
||||
public Clipboard getSystemClipboard();
|
||||
}
|
|
@ -98,7 +98,7 @@ import org.eclipse.ui.part.ResourceTransfer;
|
|||
/**
|
||||
* Registry for all connections.
|
||||
*/
|
||||
public class SystemRegistry implements ISystemRegistry, ISystemModelChangeEvents, ISystemViewInputProvider
|
||||
public class SystemRegistry implements ISystemRegistryUI, ISystemModelChangeEvents, ISystemViewInputProvider
|
||||
{
|
||||
|
||||
private static Exception lastException = null;
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.eclipse.rse.core.model.SystemSignonInformation;
|
|||
import org.eclipse.rse.core.subsystems.util.ISubSystemConfigurationAdapter;
|
||||
import org.eclipse.rse.logging.Logger;
|
||||
import org.eclipse.rse.logging.LoggerFactory;
|
||||
import org.eclipse.rse.model.ISystemRegistryUI;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
import org.eclipse.rse.ui.ISystemMessages;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
|
@ -637,7 +638,7 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
|
|||
} else { // it seems intuitive to update the connection object. defect 42709. Phil
|
||||
int whereToUpdate = USERID_LOCATION_CONNECTION;
|
||||
IHost conn = subsystem.getHost();
|
||||
ISystemRegistry sr = RSEUIPlugin.getDefault().getSystemRegistry();
|
||||
ISystemRegistryUI sr = RSEUIPlugin.getDefault().getSystemRegistry();
|
||||
sr.updateHost(null, conn, conn.getSystemType(), conn.getAliasName(), conn.getHostName(), conn.getDescription(), userId, whereToUpdate);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue