Search in sources :

Example 1 with DBPMessageType

use of org.jkiss.dbeaver.model.DBPMessageType in project dbeaver by dbeaver.

the class CoreApplicationActivator method start.

@Override
public void start(BundleContext context) throws Exception {
    super.start(context);
    // Set notifications handler
    DBeaverNotifications.setHandler(new DBeaverNotifications.NotificationHandler() {

        @Override
        public void sendNotification(DBPDataSource dataSource, String id, String text, DBPMessageType messageType, Runnable feedback) {
            NotificationUtils.sendNotification(dataSource, id, text, messageType, feedback);
        }

        @Override
        public void sendNotification(String id, String title, String text, DBPMessageType messageType, Runnable feedback) {
            NotificationUtils.sendNotification(id, title, text, messageType, feedback);
        }
    });
    // Add bundle load logger
    if (!Log.isQuietMode()) {
        context.registerService(EventHook.class, (event, contexts) -> {
            String message = null;
            Bundle bundle = event.getBundle();
            if (event.getType() == BundleEvent.STARTED) {
                if (bundle.getState() == Bundle.ACTIVE) {
                    message = "> Start " + getBundleName(bundle) + " [" + bundle.getSymbolicName() + " " + bundle.getVersion() + "]";
                }
            } else if (event.getType() == BundleEvent.STOPPING) {
                if (bundle.getState() != BundleEvent.STOPPING && bundle.getState() != BundleEvent.UNINSTALLED) {
                    message = "< Stop " + getBundleName(bundle) + " [" + bundle.getSymbolicName() + " " + bundle.getVersion() + "]";
                }
            }
            if (message != null) {
                System.err.println(message);
            }
        }, null);
    // context.addBundleListener(new BundleLoadListener());
    }
    plugin = this;
}
Also used : DBeaverNotifications(org.jkiss.dbeaver.runtime.DBeaverNotifications) Bundle(org.osgi.framework.Bundle) DBPDataSource(org.jkiss.dbeaver.model.DBPDataSource) DBPMessageType(org.jkiss.dbeaver.model.DBPMessageType)

Example 2 with DBPMessageType

use of org.jkiss.dbeaver.model.DBPMessageType in project dbeaver by serge-rider.

the class CoreApplicationActivator method start.

@Override
public void start(BundleContext context) throws Exception {
    super.start(context);
    // Set notifications handler
    DBeaverNotifications.setHandler(new DBeaverNotifications.NotificationHandler() {

        @Override
        public void sendNotification(DBPDataSource dataSource, String id, String text, DBPMessageType messageType, Runnable feedback) {
            NotificationUtils.sendNotification(dataSource, id, text, messageType, feedback);
        }

        @Override
        public void sendNotification(String id, String title, String text, DBPMessageType messageType, Runnable feedback) {
            NotificationUtils.sendNotification(id, title, text, messageType, feedback);
        }
    });
    // Add bundle load logger
    if (!Log.isQuietMode()) {
        context.registerService(EventHook.class, (event, contexts) -> {
            String message = null;
            Bundle bundle = event.getBundle();
            if (event.getType() == BundleEvent.STARTED) {
                if (bundle.getState() == Bundle.ACTIVE) {
                    message = "> Start " + getBundleName(bundle) + " [" + bundle.getSymbolicName() + " " + bundle.getVersion() + "]";
                }
            } else if (event.getType() == BundleEvent.STOPPING) {
                if (bundle.getState() != BundleEvent.STOPPING && bundle.getState() != BundleEvent.UNINSTALLED) {
                    message = "< Stop " + getBundleName(bundle) + " [" + bundle.getSymbolicName() + " " + bundle.getVersion() + "]";
                }
            }
            if (message != null) {
                System.err.println(message);
            }
        }, null);
    // context.addBundleListener(new BundleLoadListener());
    }
    plugin = this;
}
Also used : DBeaverNotifications(org.jkiss.dbeaver.runtime.DBeaverNotifications) Bundle(org.osgi.framework.Bundle) DBPDataSource(org.jkiss.dbeaver.model.DBPDataSource) DBPMessageType(org.jkiss.dbeaver.model.DBPMessageType)

Aggregations

DBPDataSource (org.jkiss.dbeaver.model.DBPDataSource)2 DBPMessageType (org.jkiss.dbeaver.model.DBPMessageType)2 DBeaverNotifications (org.jkiss.dbeaver.runtime.DBeaverNotifications)2 Bundle (org.osgi.framework.Bundle)2