Permalink
Browse files

#4209 Charts bundle

  • Loading branch information...
serge-rider committed Feb 6, 2019
1 parent b9b8480 commit 99897e939d16b2a3c5a933bbec5af5cbfbf28602
@@ -69,7 +69,8 @@
<plugin id="com.vividsolutions.jts" download-size="0" install-size="0" version="0.0.0" unpack="false"/>

<!-- Charts -->
<plugin id="org.jkiss.dbeaver.ui.dashboard" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.jkiss.bundle.jfreechart" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.jkiss.dbeaver.ui.charts" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.jkiss.dbeaver.ui.dashboard" download-size="0" install-size="0" version="0.0.0" unpack="false"/>

</feature>
@@ -0,0 +1,24 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Vendor: DBeaver Corp
Bundle-Name: UI Charts widgets
Bundle-SymbolicName: org.jkiss.dbeaver.ui.charts;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Release-Date: 20190218
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.jkiss.dbeaver.ui.dashboard.internal.UIDashboardActivator
Bundle-ClassPath: .
Require-Bundle: org.eclipse.equinox.preferences,
org.eclipse.core.runtime,
org.eclipse.core.resources,
org.eclipse.core.runtime,
org.eclipse.core.expressions,
org.eclipse.jface.text,
org.eclipse.ui,
org.eclipse.ui.views,
org.jkiss.dbeaver.model,
org.jkiss.dbeaver.ui,
org.jkiss.bundle.jfreechart;visibility:=reexport
Export-Package: org.jkiss.dbeaver.ui.charts,
org.jkiss.dbeaver.ui.charts.internal
@@ -0,0 +1,4 @@
source.. = src/
output.. = target/classes/
bin.includes = .,\
META-INF/
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jkiss.dbeaver</groupId>
<artifactId>plugins</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<artifactId>org.jkiss.dbeaver.ui.charts</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
@@ -0,0 +1,86 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2019 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.ui.charts;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.*;
import org.jfree.chart.swt.ChartComposite;
import org.jkiss.dbeaver.ui.DBeaverIcons;
import org.jkiss.dbeaver.ui.UIIcon;

/**
* Dashboard chart composite
*/
public class BaseChartComposite extends ChartComposite {

public static final String CHART_CONFIG_COMMAND = "CHART_CONFIG";

public BaseChartComposite(Composite parent, int style, Point preferredSize) {
super(parent, style, null,
preferredSize.x, preferredSize.y,
30, 20,
10000, 10000,
true, false, true, true, true, true);
}

public Canvas getChartCanvas() {
Control[] children = getChildren();
return children.length == 0 ? null : (Canvas) children[0];
}

@Override
public void mouseDoubleClick(MouseEvent event) {
if (showChartConfigDialog()) {
forceRedraw();
}
}

@Override
protected Menu createPopupMenu(boolean properties, boolean save, boolean print, boolean zoom) {
Menu popupMenu = super.createPopupMenu(properties, save, print, zoom);

new MenuItem(popupMenu, SWT.SEPARATOR, 0);

MenuItem printItem = new MenuItem(popupMenu, SWT.PUSH, 0);
printItem.setText("Settings ...");
printItem.setImage(DBeaverIcons.getImage(UIIcon.CONFIGURATION));
printItem.setData(CHART_CONFIG_COMMAND);
printItem.addSelectionListener(this);

return popupMenu;
}

public void widgetSelected(SelectionEvent e) {
if (CHART_CONFIG_COMMAND.equals(((MenuItem) e.getSource()).getData())) {
if (showChartConfigDialog()) {
forceRedraw();
}
} else {
super.widgetSelected(e);
}

}

protected boolean showChartConfigDialog() {
return false;
}

}
@@ -0,0 +1,61 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2019 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.ui.charts.internal;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.jkiss.dbeaver.model.impl.preferences.BundlePreferenceStore;
import org.jkiss.dbeaver.model.preferences.DBPPreferenceStore;
import org.osgi.framework.BundleContext;

public class UIChartsActivator extends AbstractUIPlugin {

// The plug-in ID
public static final String PLUGIN_ID = "org.jkiss.dbeaver.ui.charts";

// The shared instance
private static UIChartsActivator plugin;
private DBPPreferenceStore preferences;

public UIChartsActivator() {
}

@Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
preferences = new BundlePreferenceStore(getBundle());
}

@Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}

public static UIChartsActivator getDefault() {
return plugin;
}

public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}

public DBPPreferenceStore getPreferences() {
return preferences;
}
}
@@ -0,0 +1,32 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2019 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.ui.charts.internal;

import org.eclipse.osgi.util.NLS;

public class UIChartsMessages extends NLS {
public static final String BUNDLE_NAME = "org.jkiss.dbeaver.ui.charts.internal.UIChartsMessages"; //$NON-NLS-1$


static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, UIChartsMessages.class);
}

private UIChartsMessages() {
}
}
@@ -20,9 +20,9 @@ Require-Bundle: org.eclipse.equinox.preferences,
org.eclipse.ui.views,
org.jkiss.dbeaver.model,
org.jkiss.dbeaver.ui,
org.jkiss.dbeaver.ui.charts,
org.jkiss.dbeaver.ui.editors.base,
org.jkiss.dbeaver.ui.navigator,
org.jkiss.bundle.jfreechart
org.jkiss.dbeaver.ui.navigator
Export-Package: org.jkiss.dbeaver.ui.dashboard.control,
org.jkiss.dbeaver.ui.dashboard.internal,
org.jkiss.dbeaver.ui.dashboard.model
@@ -84,10 +84,10 @@

<menuContribution allPopups="false" locationURI="toolbar:org.jkiss.dbeaver.ui.dashboardView">
<command commandId="org.jkiss.dbeaver.ui.dashboard.configure"/>
<separator visible="true"/>
<separator name="actions" visible="true"/>
<command commandId="org.jkiss.dbeaver.ui.dashboard.add"/>
<command commandId="org.jkiss.dbeaver.ui.dashboard.remove"/>
<separator visible="true"/>
<separator name="actions_ext" visible="true"/>
<command commandId="org.jkiss.dbeaver.ui.dashboard.reset"/>
<separator name="additions" visible="true"/>
</menuContribution>
@@ -20,9 +20,7 @@
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.jkiss.dbeaver.model.impl.preferences.BundlePreferenceStore;
import org.jkiss.dbeaver.model.preferences.DBPPreferenceStore;
import org.jkiss.dbeaver.runtime.DBeaverNotifications;
import org.jkiss.dbeaver.ui.dashboard.view.DashboardUpdateJob;
import org.jkiss.dbeaver.ui.notifications.NotificationUtils;
import org.osgi.framework.BundleContext;

public class UIDashboardActivator extends AbstractUIPlugin {
@@ -40,8 +38,6 @@ public UIDashboardActivator() {
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
// Set notifications handler
DBeaverNotifications.setHandler(NotificationUtils::sendNotification);
plugin = this;
preferences = new BundlePreferenceStore(getBundle());

@@ -20,8 +20,6 @@
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.jkiss.dbeaver.model.impl.preferences.BundlePreferenceStore;
import org.jkiss.dbeaver.model.preferences.DBPPreferenceStore;
import org.jkiss.dbeaver.runtime.DBeaverNotifications;
import org.jkiss.dbeaver.ui.notifications.NotificationUtils;
import org.osgi.framework.BundleContext;

public class UINavigatorActivator extends AbstractUIPlugin {
@@ -39,8 +37,6 @@ public UINavigatorActivator() {
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
// Set notifications handler
DBeaverNotifications.setHandler(NotificationUtils::sendNotification);
plugin = this;
preferences = new BundlePreferenceStore(getBundle());
}
@@ -18,8 +18,6 @@

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 {
@@ -36,8 +34,6 @@ public UIActivator() {
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
// Set notifications handler
DBeaverNotifications.setHandler(NotificationUtils::sendNotification);
plugin = this;
}

@@ -25,6 +25,7 @@
<module>org.jkiss.dbeaver.ui.editors.sql</module>
<module>org.jkiss.dbeaver.ui.editors.xml</module>
<module>org.jkiss.dbeaver.ui.navigator</module>
<module>org.jkiss.dbeaver.ui.charts</module>
<module>org.jkiss.dbeaver.ui.dashboard</module>

<module>org.jkiss.dbeaver.debug.core</module>

0 comments on commit 99897e9

Please sign in to comment.