package org.safehaus.penrose.studio.connection.editor; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IPersistableElement; import org.eclipse.jface.resource.ImageDescriptor; import org.safehaus.penrose.studio.server.Server; /** * @author Endi S. Dewata */ public class ConnectionEditorInput implements IEditorInput { private Server server; private String partitionName; private String connectionName; public ConnectionEditorInput() { } public boolean exists() { return true; } public ImageDescriptor getImageDescriptor() { return null; } public String getName() { return partitionName+"."+connectionName; } public IPersistableElement getPersistable() { return null; } public String getToolTipText() { return getName(); } public Object getAdapter(Class aClass) { return null; } public int hashCode() { return (server == null ? 0 : server.hashCode()) + (partitionName == null ? 0 : partitionName.hashCode()) + (connectionName == null ? 0 : connectionName.hashCode()); } boolean equals(Object o1, Object o2) { if (o1 == null && o2 == null) return true; if (o1 != null) return o1.equals(o2); return o2.equals(o1); } public boolean equals(Object object) { if (this == object) return true; if (object == null) return false; if (object.getClass() != this.getClass()) return false; ConnectionEditorInput ei = (ConnectionEditorInput)object; if (!equals(server, ei.server)) return false; if (!equals(partitionName, ei.partitionName)) return false; if (!equals(connectionName, ei.connectionName)) return false; return true; } public String getPartitionName() { return partitionName; } public void setPartitionName(String partitionName) { this.partitionName = partitionName; } public Server getServer() { return server; } public void setServer(Server server) { this.server = server; } public String getConnectionName() { return connectionName; } public void setConnectionName(String connectionName) { this.connectionName = connectionName; } }