Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 284086 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/pde/internal/runtime/pderuntimeresources.properties (-1 / +3 lines)
Lines 13-20 Link Here
13
# PDE Runtime resources
13
# PDE Runtime resources
14
#
14
#
15
15
16
RegistryView_connectionError_message=Cannot establish connection with 
17
RegistryView_connectionError_title=Connection error
16
RegistryView_connectAction_label=Connect
18
RegistryView_connectAction_label=Connect
17
RegistryView_enterURL=Enter URL:
19
RegistryView_enterURL=This dialog allows you to monitoring and managing remote OSGi application. Enter URL:
18
ActiveFormEditorSection_Active_Form_Page=Active Form Page
20
ActiveFormEditorSection_Active_Form_Page=Active Form Page
19
ActiveMenuSection_0=The active contribution item identifier:
21
ActiveMenuSection_0=The active contribution item identifier:
20
ActiveMenuSection_1=The active action set identifier:
22
ActiveMenuSection_1=The active action set identifier:
(-)src/org/eclipse/pde/internal/runtime/PDERuntimeMessages.java (+2 lines)
Lines 27-32 Link Here
27
	public static String ActiveMenuSection_6;
27
	public static String ActiveMenuSection_6;
28
	public static String ActiveMenuSection_7;
28
	public static String ActiveMenuSection_7;
29
29
30
	public static String RegistryView_connectionError_message;
31
	public static String RegistryView_connectionError_title;
30
	public static String RegistryView_connectAction_label;
32
	public static String RegistryView_connectAction_label;
31
	public static String RegistryView_enterURL;
33
	public static String RegistryView_enterURL;
32
	public static String RegistryView_refresh_label;
34
	public static String RegistryView_refresh_label;
(-)src/org/eclipse/pde/internal/runtime/registry/RegistryBrowser.java (-13 / +32 lines)
Lines 169-175 Link Here
169
169
170
		initializeModelJob = new Job(PDERuntimeMessages.RegistryBrowser_InitializingView) {
170
		initializeModelJob = new Job(PDERuntimeMessages.RegistryBrowser_InitializingView) {
171
			public IStatus run(IProgressMonitor monitor) {
171
			public IStatus run(IProgressMonitor monitor) {
172
				model.connect(monitor, true);
172
				if (model.connect(monitor, true) == false) {
173
					fTreeViewer.getControl().getDisplay().asyncExec(new Runnable() {
174
						public void run() {
175
							MessageDialog.openInformation(getSite().getShell(), PDERuntimeMessages.RegistryView_connectionError_title, PDERuntimeMessages.RegistryView_connectionError_message + model.getURI());
176
							initializeModelJob = null;
177
							initializeModel("local:///"); //$NON-NLS-1$
178
						}
179
					});
180
					return Status.CANCEL_STATUS;
181
				}
173
				initializeModelJob = null;
182
				initializeModelJob = null;
174
				return monitor.isCanceled() ? Status.CANCEL_STATUS : Status.OK_STATUS;
183
				return monitor.isCanceled() ? Status.CANCEL_STATUS : Status.OK_STATUS;
175
			}
184
			}
Lines 369-386 Link Here
369
	private void makeActions() {
378
	private void makeActions() {
370
		fConnectAction = new Action(PDERuntimeMessages.RegistryView_connectAction_label) {
379
		fConnectAction = new Action(PDERuntimeMessages.RegistryView_connectAction_label) {
371
			public void run() {
380
			public void run() {
372
				InputDialog cd = new InputDialog(Display.getCurrent().getActiveShell(), PDERuntimeMessages.RegistryView_connectAction_label, PDERuntimeMessages.RegistryView_enterURL, new String(), new IInputValidator() {
381
				InputDialog cd = new InputDialog(Display.getCurrent().getActiveShell(), PDERuntimeMessages.RegistryView_connectAction_label, PDERuntimeMessages.RegistryView_enterURL, "r-osgi://localhost:9278", new IInputValidator() { //$NON-NLS-1$
373
382
374
					public String isValid(String url) {
383
							public String isValid(String url) {
375
						try {
384
								try {
376
							// check if it's possible to instantiate given url
385
									// check if it's possible to instantiate given url
377
							new URI(url);
386
									new URI(url);
378
						} catch (URISyntaxException e) {
387
								} catch (URISyntaxException e) {
379
							return e.getMessage();
388
									return e.getMessage();
380
						}
389
								}
381
						return null;
390
								return null;
382
					}
391
							}
383
				});
392
						});
384
				if (cd.open() == Window.OK) {
393
				if (cd.open() == Window.OK) {
385
					model.disconnect();
394
					model.disconnect();
386
					initializeModel(cd.getValue());
395
					initializeModel(cd.getValue());
Lines 534-540 Link Here
534
	}
543
	}
535
544
536
	public void updateTitle() {
545
	public void updateTitle() {
537
		setContentDescription(getTitleSummary());
546
		URI uri = null;
547
		try {
548
			uri = new URI(model.getURI());
549
		} catch (URISyntaxException e) {
550
			e.printStackTrace();
551
		}
552
		String uriString = ""; //$NON-NLS-1$
553
		if (!"local".equals(uri.getScheme()) && uri.getScheme() != null) //$NON-NLS-1$
554
			uriString = "[" + uri.toString() + "] "; //$NON-NLS-1$ //$NON-NLS-2$
555
556
		setContentDescription(uriString + getTitleSummary());
538
	}
557
	}
539
558
540
	protected Tree getUndisposedTree() {
559
	protected Tree getUndisposedTree() {
(-)src/org/eclipse/pde/internal/runtime/registry/rosgi/RosgiRegistryHost.java (+5 lines)
Lines 10-15 Link Here
10
import org.eclipse.ecf.remoteservice.IRemoteServiceReference;
10
import org.eclipse.ecf.remoteservice.IRemoteServiceReference;
11
import org.eclipse.pde.runtime.core.model.BackendChangeListener;
11
import org.eclipse.pde.runtime.core.model.BackendChangeListener;
12
import org.eclipse.pde.runtime.core.model.LocalRegistryBackend;
12
import org.eclipse.pde.runtime.core.model.LocalRegistryBackend;
13
import org.eclipse.pde.runtime.core.model.RegistryBackend;
13
import org.eclipse.pde.runtime.rosgi.rs.Activator;
14
import org.eclipse.pde.runtime.rosgi.rs.Activator;
14
import org.osgi.framework.BundleContext;
15
import org.osgi.framework.BundleContext;
15
import org.osgi.util.tracker.ServiceTracker;
16
import org.osgi.util.tracker.ServiceTracker;
Lines 118-121 Link Here
118
	public void setClientURI(String uri) {
119
	public void setClientURI(String uri) {
119
		this.clientURI = uri;
120
		this.clientURI = uri;
120
	}
121
	}
122
	
123
	public RegistryBackend getRegistryBackend(){
124
		return backend;
125
	}
121
}
126
}
(-)src/org/eclipse/pde/internal/runtime/registry/rosgi/IRosgiRegistryHost.java (+4 lines)
Lines 1-5 Link Here
1
package org.eclipse.pde.internal.runtime.registry.rosgi;
1
package org.eclipse.pde.internal.runtime.registry.rosgi;
2
2
3
import org.eclipse.pde.runtime.core.model.RegistryBackend;
4
3
public interface IRosgiRegistryHost {
5
public interface IRosgiRegistryHost {
4
	
6
	
5
	public boolean connectRemoteBackendChangeListener();
7
	public boolean connectRemoteBackendChangeListener();
Lines 21-24 Link Here
21
	public void disconnect();
23
	public void disconnect();
22
	
24
	
23
	public void setClientURI(String uri);
25
	public void setClientURI(String uri);
26
	
27
	public RegistryBackend getRegistryBackend();
24
}
28
}
(-)src/org/eclipse/pde/internal/runtime/registry/rosgi/RosgiRegistryBackend.java (-10 / +10 lines)
Lines 4-10 Link Here
4
4
5
import org.eclipse.core.runtime.Assert;
5
import org.eclipse.core.runtime.Assert;
6
import org.eclipse.core.runtime.IProgressMonitor;
6
import org.eclipse.core.runtime.IProgressMonitor;
7
import org.eclipse.core.runtime.content.IContentTypeManager.ISelectionPolicy;
7
import org.eclipse.core.runtime.IStatus;
8
import org.eclipse.core.runtime.Status;
8
import org.eclipse.ecf.core.IContainer;
9
import org.eclipse.ecf.core.IContainer;
9
import org.eclipse.ecf.core.IContainerManager;
10
import org.eclipse.ecf.core.IContainerManager;
10
import org.eclipse.ecf.core.identity.IDFactory;
11
import org.eclipse.ecf.core.identity.IDFactory;
Lines 20-29 Link Here
20
import org.osgi.util.tracker.ServiceTracker;
21
import org.osgi.util.tracker.ServiceTracker;
21
22
22
import ch.ethz.iks.r_osgi.RemoteOSGiService;
23
import ch.ethz.iks.r_osgi.RemoteOSGiService;
23
import ch.ethz.iks.r_osgi.Remoting;
24
24
25
public class RosgiRegistryBackend implements RegistryBackend {
25
public class RosgiRegistryBackend implements RegistryBackend {
26
	private static final String DEFAULT_PORT = "9278";
27
	private static final String DEFAULT_PROTOCOL = "r-osgi://";
26
	private static final String DEFAULT_PROTOCOL = "r-osgi://";
28
	private static final String DEFAULT_CONTAINER_TYPE = "ecf.r_osgi.peer";
27
	private static final String DEFAULT_CONTAINER_TYPE = "ecf.r_osgi.peer";
29
	
28
	
Lines 65-75 Link Here
65
			}
64
			}
66
			
65
			
67
			if (remoteRosgiHost.connectRemoteBackendChangeListener() == false) {
66
			if (remoteRosgiHost.connectRemoteBackendChangeListener() == false) {
68
				throw new Exception("Unable to connect with server");
67
				throw new Exception("Unable to connect with a server");
69
			}
68
			}
70
			return true;
69
			return true;
71
70
72
		} catch (Exception e) {
71
		} catch (Exception e) {
72
			Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e));
73
			disconnect();
73
			disconnect();
74
			return false;
74
			return false;
75
		}
75
		}
Lines 128-140 Link Here
128
128
129
	private boolean registerBackendListener() {
129
	private boolean registerBackendListener() {
130
		IRemoteServiceContainerAdapter containerAdapter = 
130
		IRemoteServiceContainerAdapter containerAdapter = 
131
			(IRemoteServiceContainerAdapter) container.getAdapter(IRemoteServiceContainerAdapter.class); 
131
			(IRemoteServiceContainerAdapter) container.getAdapter(IRemoteServiceContainerAdapter.class); 	
132
		
133
		remoteBackendChangeListenerService = containerAdapter.registerRemoteService(
132
		remoteBackendChangeListenerService = containerAdapter.registerRemoteService(
134
				new String[] { BackendChangeListener.class.getName() }, backendChangeListener, null);
133
				new String[] { BackendChangeListener.class.getName() }, backendChangeListener, null);		
135
		
136
		System.out.println("BackendChangeListener RemoteService registered");
137
		
138
		return true;
134
		return true;
139
	}
135
	}
140
	
136
	
Lines 150-153 Link Here
150
	public void setURI(String uri) {
146
	public void setURI(String uri) {
151
		this.serverURI = uri;
147
		this.serverURI = uri;
152
	}
148
	}
149
150
	public String getURI() {
151
		return serverURI;
152
	}
153
}
153
}
(-)src/org/eclipse/pde/runtime/rosgi/rs/Activator.java (-3 / +12 lines)
Lines 1-6 Link Here
1
package org.eclipse.pde.runtime.rosgi.rs;
1
package org.eclipse.pde.runtime.rosgi.rs;
2
2
3
import org.eclipse.core.runtime.IStatus;
3
import org.eclipse.core.runtime.Plugin;
4
import org.eclipse.core.runtime.Plugin;
5
import org.eclipse.core.runtime.Status;
4
import org.eclipse.ecf.core.ContainerCreateException;
6
import org.eclipse.ecf.core.ContainerCreateException;
5
import org.eclipse.ecf.core.IContainer;
7
import org.eclipse.ecf.core.IContainer;
6
import org.eclipse.ecf.core.IContainerManager;
8
import org.eclipse.ecf.core.IContainerManager;
Lines 9-16 Link Here
9
import org.eclipse.pde.internal.runtime.registry.rosgi.IRosgiRegistryHost;
11
import org.eclipse.pde.internal.runtime.registry.rosgi.IRosgiRegistryHost;
10
import org.eclipse.pde.internal.runtime.registry.rosgi.RosgiRegistryHost;
12
import org.eclipse.pde.internal.runtime.registry.rosgi.RosgiRegistryHost;
11
import org.osgi.framework.BundleContext;
13
import org.osgi.framework.BundleContext;
14
import org.osgi.framework.ServiceReference;
12
import org.osgi.util.tracker.ServiceTracker;
15
import org.osgi.util.tracker.ServiceTracker;
13
16
17
import ch.ethz.iks.r_osgi.RemoteOSGiService;
18
14
public class Activator extends Plugin {
19
public class Activator extends Plugin {
15
20
16
	private RosgiRegistryHost host;
21
	private RosgiRegistryHost host;
Lines 38-52 Link Here
38
		try {
43
		try {
39
			container = containerManager.getContainerFactory().createContainer("ecf.r_osgi.peer");
44
			container = containerManager.getContainerFactory().createContainer("ecf.r_osgi.peer");
40
		} catch (ContainerCreateException e) {
45
		} catch (ContainerCreateException e) {
41
			// TODO Auto-generated catch block
46
			getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, e.getMessage(), e));
42
			e.printStackTrace();
43
		}
47
		}
44
		IRemoteServiceContainerAdapter containerAdapter = (IRemoteServiceContainerAdapter) container
48
		IRemoteServiceContainerAdapter containerAdapter = (IRemoteServiceContainerAdapter) container
45
				.getAdapter(IRemoteServiceContainerAdapter.class); 
49
				.getAdapter(IRemoteServiceContainerAdapter.class); 
46
		serviceRegistration = containerAdapter.registerRemoteService(
50
		serviceRegistration = containerAdapter.registerRemoteService(
47
				new String[] { IRosgiRegistryHost.class.getName() }, host, null); 
51
				new String[] { IRosgiRegistryHost.class.getName() }, host, null); 
48
		
52
		
49
		System.out.println("IRosgiRegistryHost RemoteService registered");
53
		ServiceReference rosgiReference = Activator.getDefault().getBundleContext().getServiceReference("ch.ethz.iks.r_osgi.RemoteOSGiService");
54
		RemoteOSGiService rosgi = (RemoteOSGiService) Activator.getDefault().getBundleContext().getService(rosgiReference);
55
		getLog().log(new Status(IStatus.INFO, PLUGIN_ID, "org.eclipse.pde.runtime.core is listening on r-osgi protocol, port " + rosgi.getListeningPort("r-osgi")));
50
		return true;
56
		return true;
51
	}
57
	}
52
	
58
	
Lines 88-91 Link Here
88
		return container;
94
		return container;
89
	}
95
	}
90
96
97
	public IRosgiRegistryHost getHost(){
98
		return host;
99
	}
91
}
100
}
(-)src/org/eclipse/pde/runtime/core/model/RegistryBackend.java (+2 lines)
Lines 37-40 Link Here
37
37
38
	public void setURI(String uri);
38
	public void setURI(String uri);
39
39
40
	public String getURI();
41
40
}
42
}
(-)src/org/eclipse/pde/runtime/core/model/RegistryModel.java (+4 lines)
Lines 196-201 Link Here
196
		return this.backendListener;
196
		return this.backendListener;
197
	}
197
	}
198
198
199
	public String getURI() {
200
		return backend.getURI();
201
	}
202
199
	protected void addFragment(Bundle fragment) {
203
	protected void addFragment(Bundle fragment) {
200
		Set hostFragments = (Set) fragments.get(fragment.getFragmentHost());
204
		Set hostFragments = (Set) fragments.get(fragment.getFragmentHost());
201
		if (hostFragments == null) {
205
		if (hostFragments == null) {
(-)src/org/eclipse/pde/runtime/core/model/LocalRegistryBackend.java (+4 lines)
Lines 510-513 Link Here
510
	public void setURI(String uri) {
510
	public void setURI(String uri) {
511
		//in this backend it does nothing
511
		//in this backend it does nothing
512
	}
512
	}
513
514
	public String getURI() {
515
		return ""; //$NON-NLS-1$
516
	}
513
}
517
}

Return to bug 284086