Skip to main content
summaryrefslogtreecommitdiffstats
blob: bb1a86e286424d57351ee7fc477a4683ccad78db (plain) (blame)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package org.eclipse.ecf.twitter.client;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.ecf.core.ContainerCreateException;
import org.eclipse.ecf.core.ContainerFactory;
import org.eclipse.ecf.core.ContainerTypeDescription;
import org.eclipse.ecf.core.IContainer;
import org.eclipse.ecf.core.start.IECFStart;
import org.eclipse.ecf.provider.twitter.container.TwitterInstantiator;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog;

@SuppressWarnings("restriction")
public class Application implements IApplication, IECFStart, IStartApp {

	private IStatus status;
	
	IApplicationContext context;
	private final static String containerName = "ecf.twitter.client";
	private IContainer container;

	@Override
	public Object start(IApplicationContext context) throws Exception {
		this.context = context;
		IProgressMonitor pgm= (IProgressMonitor) new ProgressMonitorJobsDialog(
				Display.getDefault().getActiveShell());
		run( pgm );
		return MultiStatus.OK_STATUS;
	}

	@Override
	public void stop() {
		
	}

	public IContainer createClient() throws ContainerCreateException {
		return ContainerFactory.getDefault()
				.createContainer( new ContainerTypeDescription( 
						containerName, TwitterInstantiator.class.getName() , 
						"Trivial client/container for TwitterHub"));
	}

	protected static String getContainername() {
		return containerName;
	}

	@Override
	public IStatus run(IProgressMonitor monitor) {
		try {
			setContainer(this.createClient());
		} catch (ContainerCreateException e) {
			// TODO Auto-generated catch block
			try {
				throw new Exception();
			} catch (Exception e1) {
				// TODO Auto-generated catch block
				
			}
		}
		
		return MultiStatus.OK_STATUS;
	}

	public void setContainer(IContainer container) {
		this.container = container;
	}

	public IContainer getContainer() {
		return container;
	}


}

Back to the top