Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added changelistener for updating the Databases view. It's done with …

…my interpretation of the white board pattern.
  • Loading branch information...
commit cb0a9c46d4d08e4200bcc96d5d1fe74aa2024d55 1 parent 3e077ac
Jonathan Alvarsson jonalv authored
8 plugins/net.bioclipse.databases/src/net/bioclipse/databases/Activator.java
View
@@ -14,6 +14,8 @@
// The shared instance
private static Activator plugin;
+ private BundleContext bundleContext;
+
/**
* The constructor
*/
@@ -27,6 +29,7 @@ public Activator() {
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
+ bundleContext = context;
}
/*
@@ -47,4 +50,9 @@ public static Activator getDefault() {
return plugin;
}
+ public void publishDatabasesChangeEvent(IDatabasehangeListener l) {
+ bundleContext.registerService( IDatabasehangeListener.class.getName(),
+ l,
+ null );
+ }
}
11 plugins/net.bioclipse.databases/src/net/bioclipse/databases/DatabasesNavigator.java
View
@@ -18,10 +18,19 @@
* @author jonalv
*
*/
-public class DatabasesNavigator extends CommonNavigator {
+public class DatabasesNavigator extends CommonNavigator
+ implements IDatabasehangeListener {
+ public DatabasesNavigator() {
+ Activator.getDefault().publishDatabasesChangeEvent( this );
+ }
+
@Override
protected IAdaptable getInitialInput() {
return new DatabasesRoot();
}
+
+ public void fireRefresh() {
+ getCommonViewer().refresh();
+ }
}
21 plugins/net.bioclipse.databases/src/net/bioclipse/databases/IDatabasehangeListener.java
View
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Jonathan Alvarsson <jonalv@users.sourceforge.net>
+ *
+ * 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
+ * www.eclipse.orgÑepl-v10.html <http://www.eclipse.org/legal/epl-v10.html>
+ *
+ * Contact: http://www.bioclipse.net/
+ ******************************************************************************/
+package net.bioclipse.databases;
+
+
+/**
+ * @author jonalv
+ *
+ */
+public interface IDatabasehangeListener {
+
+ public void fireRefresh();
+}
Please sign in to comment.
Something went wrong with that request. Please try again.