1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/****************************************************************************
* Copyright (c) 2004 Composent, Inc. 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
*
* Contributors:
* Composent, Inc. - initial API and implementation
*****************************************************************************/
package org.eclipse.ecf.internal.example.collab.start;
import java.util.Collection;
import java.util.Iterator;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.ecf.core.start.IECFStart;
import org.eclipse.ecf.internal.example.collab.ClientPlugin;
import org.eclipse.ecf.internal.example.collab.CollabClient;
import org.eclipse.ecf.internal.example.collab.Messages;
public class CollabStart implements IECFStart {
Discovery discovery = null;
public IStatus run(IProgressMonitor monitor) {
try {
AccountStart as = new AccountStart();
as.loadConnectionDetailsFromPreferenceStore();
Collection c = as.getConnectionDetails();
for (Iterator i = c.iterator(); i.hasNext();) {
startConnection((ConnectionDetails) i.next());
}
} catch (Exception e) {
return new Status(IStatus.ERROR, ClientPlugin.PLUGIN_ID, 200,
Messages.CollabStart_EXCEPTION_STARTING_CONNECTION, e);
}
return new Status(IStatus.OK, ClientPlugin.PLUGIN_ID, 100, Messages.CollabStart_STATUS_OK_MESSAGE, null);
}
private void startConnection(ConnectionDetails details) throws Exception {
CollabClient client = new CollabClient();
// ClientPlugin.log("ECF: Autostarting
// containerType="+details.getContainerType()+",uri="+details.getTargetURI()+",nickname="+details.getNickname());
client.createAndConnectClient(details.getContainerType(), details
.getTargetURI(), details.getNickname(), details.getPassword(),
ResourcesPlugin.getWorkspace().getRoot());
}
}
|