Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 142997 Details for
Bug 284086
[plug-in registry] give user information, that he is now connected
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
adds inforamtion about connection status
connection_status_patch.txt (text/plain), 13.54 KB, created by
Wojciech Galanciak
on 2009-07-30 08:47:11 EDT
(
hide
)
Description:
adds inforamtion about connection status
Filename:
MIME Type:
Creator:
Wojciech Galanciak
Created:
2009-07-30 08:47:11 EDT
Size:
13.54 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.runtime.rosgi.rs >Index: src/org/eclipse/pde/internal/runtime/registry/rosgi/RosgiRegistryHost.java >=================================================================== >RCS file: /cvsroot/eclipse/pde-incubator/osgimonitoring/plugins/org.eclipse.pde.runtime.rosgi.rs/src/org/eclipse/pde/internal/runtime/registry/rosgi/RosgiRegistryHost.java,v >retrieving revision 1.2 >diff -u -r1.2 RosgiRegistryHost.java >--- src/org/eclipse/pde/internal/runtime/registry/rosgi/RosgiRegistryHost.java 21 Jul 2009 06:25:53 -0000 1.2 >+++ src/org/eclipse/pde/internal/runtime/registry/rosgi/RosgiRegistryHost.java 30 Jul 2009 12:43:31 -0000 >@@ -10,6 +10,7 @@ > import org.eclipse.ecf.remoteservice.IRemoteServiceReference; > import org.eclipse.pde.runtime.core.model.BackendChangeListener; > import org.eclipse.pde.runtime.core.model.LocalRegistryBackend; >+import org.eclipse.pde.runtime.core.model.RegistryBackend; > import org.eclipse.pde.runtime.rosgi.rs.Activator; > import org.osgi.framework.BundleContext; > import org.osgi.util.tracker.ServiceTracker; >@@ -118,4 +119,8 @@ > public void setClientURI(String uri) { > this.clientURI = uri; > } >+ >+ public RegistryBackend getRegistryBackend(){ >+ return backend; >+ } > } >Index: src/org/eclipse/pde/internal/runtime/registry/rosgi/IRosgiRegistryHost.java >=================================================================== >RCS file: /cvsroot/eclipse/pde-incubator/osgimonitoring/plugins/org.eclipse.pde.runtime.rosgi.rs/src/org/eclipse/pde/internal/runtime/registry/rosgi/IRosgiRegistryHost.java,v >retrieving revision 1.2 >diff -u -r1.2 IRosgiRegistryHost.java >--- src/org/eclipse/pde/internal/runtime/registry/rosgi/IRosgiRegistryHost.java 21 Jul 2009 06:25:53 -0000 1.2 >+++ src/org/eclipse/pde/internal/runtime/registry/rosgi/IRosgiRegistryHost.java 30 Jul 2009 12:43:31 -0000 >@@ -1,5 +1,7 @@ > package org.eclipse.pde.internal.runtime.registry.rosgi; > >+import org.eclipse.pde.runtime.core.model.RegistryBackend; >+ > public interface IRosgiRegistryHost { > > public boolean connectRemoteBackendChangeListener(); >@@ -21,4 +23,6 @@ > public void disconnect(); > > public void setClientURI(String uri); >+ >+ public RegistryBackend getRegistryBackend(); > } >Index: src/org/eclipse/pde/internal/runtime/registry/rosgi/RosgiRegistryBackend.java >=================================================================== >RCS file: /cvsroot/eclipse/pde-incubator/osgimonitoring/plugins/org.eclipse.pde.runtime.rosgi.rs/src/org/eclipse/pde/internal/runtime/registry/rosgi/RosgiRegistryBackend.java,v >retrieving revision 1.2 >diff -u -r1.2 RosgiRegistryBackend.java >--- src/org/eclipse/pde/internal/runtime/registry/rosgi/RosgiRegistryBackend.java 21 Jul 2009 06:25:53 -0000 1.2 >+++ src/org/eclipse/pde/internal/runtime/registry/rosgi/RosgiRegistryBackend.java 30 Jul 2009 12:43:31 -0000 >@@ -4,7 +4,8 @@ > > import org.eclipse.core.runtime.Assert; > import org.eclipse.core.runtime.IProgressMonitor; >-import org.eclipse.core.runtime.content.IContentTypeManager.ISelectionPolicy; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; > import org.eclipse.ecf.core.IContainer; > import org.eclipse.ecf.core.IContainerManager; > import org.eclipse.ecf.core.identity.IDFactory; >@@ -20,10 +21,8 @@ > import org.osgi.util.tracker.ServiceTracker; > > import ch.ethz.iks.r_osgi.RemoteOSGiService; >-import ch.ethz.iks.r_osgi.Remoting; > > public class RosgiRegistryBackend implements RegistryBackend { >- private static final String DEFAULT_PORT = "9278"; > private static final String DEFAULT_PROTOCOL = "r-osgi://"; > private static final String DEFAULT_CONTAINER_TYPE = "ecf.r_osgi.peer"; > >@@ -35,7 +34,10 @@ > > private String serverURI; > >+ private String status = "not connected"; >+ > public boolean connect(IProgressMonitor monitor) { >+ status = "connecting with " + serverURI; > try { > IContainerManager containerManager = getContainerManagerService(); > container = containerManager.getContainerFactory().createContainer(DEFAULT_CONTAINER_TYPE); >@@ -65,12 +67,15 @@ > } > > if (remoteRosgiHost.connectRemoteBackendChangeListener() == false) { >- throw new Exception("Unable to connect with server"); >+ throw new Exception("Unable to connect with a server"); > } >+ status = "connected with " + serverURI; > return true; > > } catch (Exception e) { >+ Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e)); > disconnect(); >+ status = "cannot connect with " + serverURI; > return false; > } > } >@@ -124,17 +129,14 @@ > container.disconnect(); > container = null; > } >+ status = "disconnected"; > } > > private boolean registerBackendListener() { > IRemoteServiceContainerAdapter containerAdapter = >- (IRemoteServiceContainerAdapter) container.getAdapter(IRemoteServiceContainerAdapter.class); >- >+ (IRemoteServiceContainerAdapter) container.getAdapter(IRemoteServiceContainerAdapter.class); > remoteBackendChangeListenerService = containerAdapter.registerRemoteService( >- new String[] { BackendChangeListener.class.getName() }, backendChangeListener, null); >- >- System.out.println("BackendChangeListener RemoteService registered"); >- >+ new String[] { BackendChangeListener.class.getName() }, backendChangeListener, null); > return true; > } > >@@ -150,4 +152,8 @@ > public void setURI(String uri) { > this.serverURI = uri; > } >+ >+ public String getStatus() { >+ return status + " - "; >+ } > } >Index: src/org/eclipse/pde/runtime/rosgi/rs/Activator.java >=================================================================== >RCS file: /cvsroot/eclipse/pde-incubator/osgimonitoring/plugins/org.eclipse.pde.runtime.rosgi.rs/src/org/eclipse/pde/runtime/rosgi/rs/Activator.java,v >retrieving revision 1.1 >diff -u -r1.1 Activator.java >--- src/org/eclipse/pde/runtime/rosgi/rs/Activator.java 17 Jul 2009 10:26:57 -0000 1.1 >+++ src/org/eclipse/pde/runtime/rosgi/rs/Activator.java 30 Jul 2009 12:43:31 -0000 >@@ -1,6 +1,8 @@ > package org.eclipse.pde.runtime.rosgi.rs; > >+import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Plugin; >+import org.eclipse.core.runtime.Status; > import org.eclipse.ecf.core.ContainerCreateException; > import org.eclipse.ecf.core.IContainer; > import org.eclipse.ecf.core.IContainerManager; >@@ -9,8 +11,11 @@ > import org.eclipse.pde.internal.runtime.registry.rosgi.IRosgiRegistryHost; > import org.eclipse.pde.internal.runtime.registry.rosgi.RosgiRegistryHost; > import org.osgi.framework.BundleContext; >+import org.osgi.framework.ServiceReference; > import org.osgi.util.tracker.ServiceTracker; > >+import ch.ethz.iks.r_osgi.RemoteOSGiService; >+ > public class Activator extends Plugin { > > private RosgiRegistryHost host; >@@ -38,15 +43,16 @@ > try { > container = containerManager.getContainerFactory().createContainer("ecf.r_osgi.peer"); > } catch (ContainerCreateException e) { >- // TODO Auto-generated catch block >- e.printStackTrace(); >+ getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, e.getMessage(), e)); > } > IRemoteServiceContainerAdapter containerAdapter = (IRemoteServiceContainerAdapter) container > .getAdapter(IRemoteServiceContainerAdapter.class); > serviceRegistration = containerAdapter.registerRemoteService( > new String[] { IRosgiRegistryHost.class.getName() }, host, null); > >- System.out.println("IRosgiRegistryHost RemoteService registered"); >+ ServiceReference rosgiReference = Activator.getDefault().getBundleContext().getServiceReference("ch.ethz.iks.r_osgi.RemoteOSGiService"); >+ RemoteOSGiService rosgi = (RemoteOSGiService) Activator.getDefault().getBundleContext().getService(rosgiReference); >+ getLog().log(new Status(IStatus.INFO, PLUGIN_ID, "org.eclipse.pde.runtime.core is listening on r-osgi protocol, port " + rosgi.getListeningPort("r-osgi"))); > return true; > } > >@@ -88,4 +94,7 @@ > return container; > } > >+ public IRosgiRegistryHost getHost(){ >+ return host; >+ } > } >#P org.eclipse.pde.runtime.core >Index: src/org/eclipse/pde/runtime/core/model/RegistryBackend.java >=================================================================== >RCS file: /cvsroot/eclipse/pde-incubator/osgimonitoring/plugins/org.eclipse.pde.runtime.core/src/org/eclipse/pde/runtime/core/model/RegistryBackend.java,v >retrieving revision 1.2 >diff -u -r1.2 RegistryBackend.java >--- src/org/eclipse/pde/runtime/core/model/RegistryBackend.java 28 Jul 2009 06:29:42 -0000 1.2 >+++ src/org/eclipse/pde/runtime/core/model/RegistryBackend.java 30 Jul 2009 12:43:33 -0000 >@@ -37,4 +37,6 @@ > > public void setURI(String uri); > >+ public String getStatus(); >+ > } >\ No newline at end of file >Index: src/org/eclipse/pde/runtime/core/model/RegistryModel.java >=================================================================== >RCS file: /cvsroot/eclipse/pde-incubator/osgimonitoring/plugins/org.eclipse.pde.runtime.core/src/org/eclipse/pde/runtime/core/model/RegistryModel.java,v >retrieving revision 1.1 >diff -u -r1.1 RegistryModel.java >--- src/org/eclipse/pde/runtime/core/model/RegistryModel.java 17 Jul 2009 10:09:20 -0000 1.1 >+++ src/org/eclipse/pde/runtime/core/model/RegistryModel.java 30 Jul 2009 12:43:33 -0000 >@@ -196,6 +196,10 @@ > return this.backendListener; > } > >+ public String getBackendStatus() { >+ return backend.getStatus(); >+ } >+ > protected void addFragment(Bundle fragment) { > Set hostFragments = (Set) fragments.get(fragment.getFragmentHost()); > if (hostFragments == null) { >Index: src/org/eclipse/pde/runtime/core/model/LocalRegistryBackend.java >=================================================================== >RCS file: /cvsroot/eclipse/pde-incubator/osgimonitoring/plugins/org.eclipse.pde.runtime.core/src/org/eclipse/pde/runtime/core/model/LocalRegistryBackend.java,v >retrieving revision 1.2 >diff -u -r1.2 LocalRegistryBackend.java >--- src/org/eclipse/pde/runtime/core/model/LocalRegistryBackend.java 28 Jul 2009 06:29:42 -0000 1.2 >+++ src/org/eclipse/pde/runtime/core/model/LocalRegistryBackend.java 30 Jul 2009 12:43:33 -0000 >@@ -510,4 +510,8 @@ > public void setURI(String uri) { > //in this backend it does nothing > } >+ >+ public String getStatus() { >+ return ""; //$NON-NLS-1$ >+ } > } >#P org.eclipse.pde.runtime >Index: src/org/eclipse/pde/internal/runtime/pderuntimeresources.properties >=================================================================== >RCS file: /cvsroot/eclipse/pde-incubator/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/pderuntimeresources.properties,v >retrieving revision 1.2 >diff -u -r1.2 pderuntimeresources.properties >--- src/org/eclipse/pde/internal/runtime/pderuntimeresources.properties 21 Jul 2009 06:26:21 -0000 1.2 >+++ src/org/eclipse/pde/internal/runtime/pderuntimeresources.properties 30 Jul 2009 12:43:34 -0000 >@@ -14,7 +14,7 @@ > # > > RegistryView_connectAction_label=Connect >-RegistryView_enterURL=Enter URL: >+RegistryView_enterURL=This dialog allows you to monitoring and managing remote OSGi application. Enter URL: > ActiveFormEditorSection_Active_Form_Page=Active Form Page > ActiveMenuSection_0=The active contribution item identifier: > ActiveMenuSection_1=The active action set identifier: >Index: src/org/eclipse/pde/internal/runtime/registry/RegistryBrowser.java >=================================================================== >RCS file: /cvsroot/eclipse/pde-incubator/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/RegistryBrowser.java,v >retrieving revision 1.4 >diff -u -r1.4 RegistryBrowser.java >--- src/org/eclipse/pde/internal/runtime/registry/RegistryBrowser.java 21 Jul 2009 06:26:20 -0000 1.4 >+++ src/org/eclipse/pde/internal/runtime/registry/RegistryBrowser.java 30 Jul 2009 12:43:34 -0000 >@@ -171,6 +171,12 @@ > public IStatus run(IProgressMonitor monitor) { > model.connect(monitor, true); > initializeModelJob = null; >+ fTreeViewer.getControl().getDisplay().asyncExec(new Runnable() { >+ >+ public void run() { >+ updateTitle(); >+ } >+ }); > return monitor.isCanceled() ? Status.CANCEL_STATUS : Status.OK_STATUS; > } > }; >@@ -369,18 +375,18 @@ > private void makeActions() { > fConnectAction = new Action(PDERuntimeMessages.RegistryView_connectAction_label) { > public void run() { >- InputDialog cd = new InputDialog(Display.getCurrent().getActiveShell(), PDERuntimeMessages.RegistryView_connectAction_label, PDERuntimeMessages.RegistryView_enterURL, new String(), new IInputValidator() { >+ InputDialog cd = new InputDialog(Display.getCurrent().getActiveShell(), PDERuntimeMessages.RegistryView_connectAction_label, PDERuntimeMessages.RegistryView_enterURL, "r-osgi://localhost:9278", new IInputValidator() { //$NON-NLS-1$ > >- public String isValid(String url) { >- try { >- // check if it's possible to instantiate given url >- new URI(url); >- } catch (URISyntaxException e) { >- return e.getMessage(); >- } >- return null; >- } >- }); >+ public String isValid(String url) { >+ try { >+ // check if it's possible to instantiate given url >+ new URI(url); >+ } catch (URISyntaxException e) { >+ return e.getMessage(); >+ } >+ return null; >+ } >+ }); > if (cd.open() == Window.OK) { > model.disconnect(); > initializeModel(cd.getValue()); >@@ -534,7 +540,7 @@ > } > > public void updateTitle() { >- setContentDescription(getTitleSummary()); >+ setContentDescription(model.getBackendStatus() + getTitleSummary()); > } > > protected Tree getUndisposedTree() {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 284086
:
142997
|
143015
|
143119
|
143683