From 9ce856d824ac7ef27892b9fa3f3174f54dba9c98 Mon Sep 17 00:00:00 2001 From: serge-rider Date: Sat, 7 Apr 2018 21:00:04 +0300 Subject: [PATCH] #3278 Model refactoring (move to headles bundle). Reconnect notification config. --- plugins/org.jkiss.dbeaver.core/plugin.xml | 26 --------- .../datasource/DataSourceCommitHandler.java | 2 +- .../DataSourceInvalidateHandler.java | 2 +- .../datasource/DataSourceRollbackHandler.java | 4 +- .../META-INF/MANIFEST.MF | 1 + .../runtime}/DBeaverNotifications.java | 30 ++++++++-- .../dbeaver/runtime/jobs/InvalidateJob.java | 24 +++++++- .../org.jkiss.dbeaver.ui/META-INF/MANIFEST.MF | 3 + plugins/org.jkiss.dbeaver.ui/plugin.xml | 26 +++++++++ .../org/jkiss/dbeaver/bundle/UIActivator.java | 57 +++++++++++++++++++ 10 files changed, 136 insertions(+), 39 deletions(-) rename plugins/{org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui => org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/runtime}/DBeaverNotifications.java (58%) create mode 100644 plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/bundle/UIActivator.java diff --git a/plugins/org.jkiss.dbeaver.core/plugin.xml b/plugins/org.jkiss.dbeaver.core/plugin.xml index 50f79d8977..465fbe32f8 100644 --- a/plugins/org.jkiss.dbeaver.core/plugin.xml +++ b/plugins/org.jkiss.dbeaver.core/plugin.xml @@ -3758,32 +3758,6 @@ - - - - - - - - - - This event is triggered when transaction was committed. - - - - - - This event is triggered when transaction was rolled back. - - - - - - This event is triggered when connection was automatically reconnected. - - - - + + + + + + + + + This event is triggered when transaction was committed. + + + + + + This event is triggered when transaction was rolled back. + + + + + + This event is triggered when connection was automatically reconnected. + + + + diff --git a/plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/bundle/UIActivator.java b/plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/bundle/UIActivator.java new file mode 100644 index 0000000000..ab18306702 --- /dev/null +++ b/plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/bundle/UIActivator.java @@ -0,0 +1,57 @@ +/* + * DBeaver - Universal Database Manager + * Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jkiss.dbeaver.bundle; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.jkiss.dbeaver.runtime.DBeaverNotifications; +import org.jkiss.dbeaver.ui.notifications.NotificationUtils; +import org.osgi.framework.BundleContext; + +public class UIActivator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.jkiss.dbeaver.ui"; + + // The shared instance + private static UIActivator plugin; + + public UIActivator() { + } + + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + // Set notifications handler + DBeaverNotifications.setHandler(NotificationUtils::sendNotification); + plugin = this; + } + + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + public static UIActivator getDefault() { + return plugin; + } + + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} -- GitLab