Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b9b8480
commit 99897e9
Showing
15 changed files
with
228 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source.. = src/ | ||
output.. = target/classes/ | ||
bin.includes = .,\ | ||
META-INF/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
86 changes: 86 additions & 0 deletions
86
plugins/org.jkiss.dbeaver.ui.charts/src/org/jkiss/dbeaver/ui/charts/BaseChartComposite.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
|
||
} |
61 changes: 61 additions & 0 deletions
61
...g.jkiss.dbeaver.ui.charts/src/org/jkiss/dbeaver/ui/charts/internal/UIChartsActivator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...rg.jkiss.dbeaver.ui.charts/src/org/jkiss/dbeaver/ui/charts/internal/UIChartsMessages.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() { | ||
} | ||
} |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters