diff --git a/org.eclipse.swtchart.customcharts/src/org/eclipse/swtchart/customcharts/core/ChromatogramChart.java b/org.eclipse.swtchart.customcharts/src/org/eclipse/swtchart/customcharts/core/ChromatogramChart.java index a8123b59..4bc02304 100644 --- a/org.eclipse.swtchart.customcharts/src/org/eclipse/swtchart/customcharts/core/ChromatogramChart.java +++ b/org.eclipse.swtchart.customcharts/src/org/eclipse/swtchart/customcharts/core/ChromatogramChart.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2022 Lablicate GmbH. + * Copyright (c) 2017, 2023 Lablicate GmbH. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -28,6 +28,7 @@ import org.eclipse.swtchart.extensions.core.ISecondaryAxisSettings; import org.eclipse.swtchart.extensions.core.SecondaryAxisSettings; import org.eclipse.swtchart.extensions.linecharts.LineChart; +import org.eclipse.swtchart.extensions.menu.ResetChartHandler; public class ChromatogramChart extends LineChart { @@ -54,6 +55,8 @@ private void initialize() { chartSettings.setVerticalSliderVisible(true); chartSettings.getRangeRestriction().setZeroX(true); chartSettings.getRangeRestriction().setZeroY(true); + chartSettings.removeMenuEntry(chartSettings.getChartMenuEntryByClass(ResetChartHandler.class)); + chartSettings.addMenuEntry(new ResetChromatogramHandler()); // setPrimaryAxisSet(chartSettings); addSecondaryAxisSet(chartSettings); diff --git a/org.eclipse.swtchart.customcharts/src/org/eclipse/swtchart/customcharts/core/Messages.java b/org.eclipse.swtchart.customcharts/src/org/eclipse/swtchart/customcharts/core/Messages.java index 7f4153f7..17f991dc 100644 --- a/org.eclipse.swtchart.customcharts/src/org/eclipse/swtchart/customcharts/core/Messages.java +++ b/org.eclipse.swtchart.customcharts/src/org/eclipse/swtchart/customcharts/core/Messages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020 SWT Chart Project + * Copyright (c) 2020, 2023 SWT Chart Project * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -18,11 +18,13 @@ public class Messages { private static final String BUNDLE_NAME = "org.eclipse.swtchart.customcharts.core.messages"; //$NON-NLS-1$ + // private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); public static String INTENSITY = "INTENSITY"; public static String MINUTES = "MINUTES"; public static String RELATIVE_INTENSITY = "RELATIVE_INTENSITY"; public static String RETENTION_TIME = "RETENTION_TIME"; + public static String RESET_CHROMATOGRAM = "RESET_CHROMATOGRAM";; private Messages() { diff --git a/org.eclipse.swtchart.customcharts/src/org/eclipse/swtchart/customcharts/core/ResetChromatogramHandler.java b/org.eclipse.swtchart.customcharts/src/org/eclipse/swtchart/customcharts/core/ResetChromatogramHandler.java new file mode 100644 index 00000000..b80684c8 --- /dev/null +++ b/org.eclipse.swtchart.customcharts/src/org/eclipse/swtchart/customcharts/core/ResetChromatogramHandler.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2023 Lablicate GmbH. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Matthias Mailänder - initial API and implementation + *******************************************************************************/ +package org.eclipse.swtchart.customcharts.core; + +import org.eclipse.swtchart.extensions.menu.ResetChartHandler; + +public class ResetChromatogramHandler extends ResetChartHandler { + + @Override + public String getName() { + + return Messages.getString(Messages.RESET_CHROMATOGRAM); + } +} diff --git a/org.eclipse.swtchart.customcharts/src/org/eclipse/swtchart/customcharts/core/messages.properties b/org.eclipse.swtchart.customcharts/src/org/eclipse/swtchart/customcharts/core/messages.properties index 5c1104e8..c4aa9fd5 100644 --- a/org.eclipse.swtchart.customcharts/src/org/eclipse/swtchart/customcharts/core/messages.properties +++ b/org.eclipse.swtchart.customcharts/src/org/eclipse/swtchart/customcharts/core/messages.properties @@ -2,3 +2,4 @@ INTENSITY = Intensity MINUTES = Minutes RELATIVE_INTENSITY = Relative Intensity [%] RETENTION_TIME = Retention Time (milliseconds) +RESET_CHROMATOGRAM = Reset Chromatogram \ No newline at end of file diff --git a/org.eclipse.swtchart.customcharts/src/org/eclipse/swtchart/customcharts/core/messages_de.properties b/org.eclipse.swtchart.customcharts/src/org/eclipse/swtchart/customcharts/core/messages_de.properties index 8cfc8ae9..8758666c 100644 --- a/org.eclipse.swtchart.customcharts/src/org/eclipse/swtchart/customcharts/core/messages_de.properties +++ b/org.eclipse.swtchart.customcharts/src/org/eclipse/swtchart/customcharts/core/messages_de.properties @@ -2,3 +2,4 @@ INTENSITY = Intensit MINUTES = Minuten RELATIVE_INTENSITY = Relative Intensit�t [%] RETENTION_TIME = Retentionszeit (Milisekunden) +RESET_CHROMATOGRAM = Chromatogram zur�cksetzen \ No newline at end of file diff --git a/org.eclipse.swtchart.export.extended/src/org/eclipse/swtchart/export/extended/menu/vector/SVGExportHandler.java b/org.eclipse.swtchart.export.extended/src/org/eclipse/swtchart/export/extended/menu/vector/SVGExportHandler.java index 292cb89d..bd711408 100644 --- a/org.eclipse.swtchart.export.extended/src/org/eclipse/swtchart/export/extended/menu/vector/SVGExportHandler.java +++ b/org.eclipse.swtchart.export.extended/src/org/eclipse/swtchart/export/extended/menu/vector/SVGExportHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2021 Lablicate GmbH. + * Copyright (c) 2019, 2023 Lablicate GmbH. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -15,9 +15,11 @@ package org.eclipse.swtchart.export.extended.menu.vector; import java.io.FileOutputStream; +import java.io.IOException; import java.io.OutputStreamWriter; import java.io.Writer; import java.lang.reflect.InvocationTargetException; +import java.text.MessageFormat; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.dialogs.MessageDialog; @@ -37,7 +39,7 @@ public class SVGExportHandler extends AbstractSeriesExportHandler implements ISeriesExportConverter { private static final String FILE_EXTENSION = "*.svg"; //$NON-NLS-1$ - private static final String NAME = Messages.getString(Messages.SVG) + FILE_EXTENSION + ")"; //$NON-NLS-1$ + private static final String NAME = MessageFormat.format(Messages.getString(Messages.SVG), FILE_EXTENSION); private static final String TITLE = Messages.getString(Messages.SAVE_AS_SVG); @Override @@ -71,10 +73,9 @@ public void execute(Shell shell, ScrollableChart scrollableChart) { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - monitor.beginTask(Messages.getString(Messages.EXPORT_TO_SVG), IProgressMonitor.UNKNOWN); + monitor.beginTask(Messages.EXPORT_TO_SVG, IProgressMonitor.UNKNOWN); + try (Writer output = new OutputStreamWriter(new FileOutputStream(fileName), "UTF-8")) { //$NON-NLS-1$ boolean useCSS = true; - Writer output = new OutputStreamWriter(new FileOutputStream(fileName), "UTF-8"); //$NON-NLS-1$ SVGFactory svgFactory = new SVGFactory(); svgFactory.createSvg(baseChart, indexAxisX, indexAxisY); if(svgFactory.stream(output, useCSS)) { @@ -82,21 +83,22 @@ public void run(IProgressMonitor monitor) throws InvocationTargetException, Inte } else { MessageDialog.openInformation(fileDialog.getParent(), TITLE, MESSAGE_ERROR); } - } catch(Exception e) { + } catch(IOException e) { e.printStackTrace(); } finally { monitor.done(); } } }); - } catch(Exception e) { + } catch(InterruptedException e) { e.printStackTrace(); + Thread.currentThread().interrupt(); } } } - } catch(Exception e) { + } catch(InvocationTargetException e) { MessageDialog.openInformation(shell, TITLE, MESSAGE_ERROR); - e.printStackTrace(); + e.getCause().printStackTrace(); } } } diff --git a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/core/VectorExportSettingsDialog.java b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/core/VectorExportSettingsDialog.java index a93a814a..9dc620a7 100644 --- a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/core/VectorExportSettingsDialog.java +++ b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/core/VectorExportSettingsDialog.java @@ -58,7 +58,7 @@ public class VectorExportSettingsDialog extends TitleAreaDialog { * The use might modify the current settings. * Hence, cache the original settings. */ - private Map cachedSeriesSettings = new HashMap(); + private Map cachedSeriesSettings = new HashMap<>(); // private Combo comboScaleX; private Combo comboScaleY; diff --git a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/BMPExportHandler.java b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/BMPExportHandler.java index 144b8c89..a227bdc0 100644 --- a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/BMPExportHandler.java +++ b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/BMPExportHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2021 Lablicate GmbH. + * Copyright (c) 2017, 2023 Lablicate GmbH. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -13,12 +13,14 @@ *******************************************************************************/ package org.eclipse.swtchart.export.menu.bitmap; +import java.text.MessageFormat; + import org.eclipse.swt.SWT; public class BMPExportHandler extends AbstractBitmapExportHandler { private static final String FILE_EXTENSION = "*.bmp"; //$NON-NLS-1$ - public static final String NAME = Messages.getString(Messages.IMAGE) + FILE_EXTENSION + ")"; //$NON-NLS-1$ + public static final String NAME = MessageFormat.format(Messages.getString(Messages.IMAGE), FILE_EXTENSION); private static final String TITLE = Messages.getString(Messages.SAVE_AS_IMAGE); private static final String[] FILTER_EXTENSIONS = new String[]{"*.bmp"}; //$NON-NLS-1$ //$NON-NLS-2$ @@ -26,4 +28,4 @@ public BMPExportHandler() { super(NAME, TITLE, FILTER_EXTENSIONS, SWT.IMAGE_BMP); } -} \ No newline at end of file +} diff --git a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/ClipboardExportHandler.java b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/ClipboardExportHandler.java index 083b6f00..758baf80 100644 --- a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/ClipboardExportHandler.java +++ b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/ClipboardExportHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2022 Lablicate GmbH. + * Copyright (c) 2022, 2023 Lablicate GmbH. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -25,7 +25,7 @@ public class ClipboardExportHandler extends AbstractSeriesExportHandler implemen @Override public String getName() { - return "Copy Image to Clipboard"; + return Messages.getString(Messages.COPY_IMAGE_TO_CLIPBOARD); } @Override @@ -39,4 +39,4 @@ public void execute(Shell shell, ScrollableChart scrollableChart) { ImageClipboardSupport.transfer(shell.getDisplay(), scrollableChart.getBaseChart()); } -} \ No newline at end of file +} diff --git a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/JPGExportHandler.java b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/JPGExportHandler.java index e215c763..6e75d73d 100644 --- a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/JPGExportHandler.java +++ b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/JPGExportHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2021 Lablicate GmbH. + * Copyright (c) 2017, 2023 Lablicate GmbH. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -13,12 +13,14 @@ *******************************************************************************/ package org.eclipse.swtchart.export.menu.bitmap; +import java.text.MessageFormat; + import org.eclipse.swt.SWT; public class JPGExportHandler extends AbstractBitmapExportHandler { private static final String FILE_EXTENSION = "*.jpg"; //$NON-NLS-1$ - public static final String NAME = Messages.getString(Messages.IMAGE) + FILE_EXTENSION + ")"; //$NON-NLS-1$ + public static final String NAME = MessageFormat.format(Messages.getString(Messages.IMAGE), FILE_EXTENSION); private static final String TITLE = Messages.getString(Messages.SAVE_AS_IMAGE); private static final String[] FILTER_EXTENSIONS = new String[]{"*.jpeg", "*.jpg"}; //$NON-NLS-1$ //$NON-NLS-2$ @@ -26,4 +28,4 @@ public JPGExportHandler() { super(NAME, TITLE, FILTER_EXTENSIONS, SWT.IMAGE_JPEG); } -} \ No newline at end of file +} diff --git a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/Messages.java b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/Messages.java index fdf5aeaa..a16b7bfa 100644 --- a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/Messages.java +++ b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/Messages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020 SWT Chart Project + * Copyright (c) 2020, 2023 SWT Chart Project * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -10,7 +10,6 @@ * Contributors: * Frank Buloup - initial API and implementation *******************************************************************************/ - package org.eclipse.swtchart.export.menu.bitmap; import java.util.MissingResourceException; @@ -20,10 +19,11 @@ public class Messages { private static final String BUNDLE_NAME = "org.eclipse.swtchart.export.menu.bitmap.messages"; //$NON-NLS-1$ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); - + // public static final String IMAGE = "IMAGE"; public static final String SAVE_AS_IMAGE = "SAVE_AS_IMAGE"; - + public static final String COPY_IMAGE_TO_CLIPBOARD = "COPY_IMAGE_TO_CLIPBOARD"; + private Messages() { } diff --git a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/PNGExportHandler.java b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/PNGExportHandler.java index 43cb4621..b43e0d7e 100644 --- a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/PNGExportHandler.java +++ b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/PNGExportHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2021 Lablicate GmbH. + * Copyright (c) 2017, 2023 Lablicate GmbH. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,12 +12,14 @@ *******************************************************************************/ package org.eclipse.swtchart.export.menu.bitmap; +import java.text.MessageFormat; + import org.eclipse.swt.SWT; public class PNGExportHandler extends AbstractBitmapExportHandler { private static final String FILE_EXTENSION = "*.png"; //$NON-NLS-1$ - public static final String NAME = Messages.getString("IMAGE") + FILE_EXTENSION + ")"; //$NON-NLS-1$ //$NON-NLS-2$ + public static final String NAME = MessageFormat.format(Messages.getString(Messages.IMAGE), FILE_EXTENSION); private static final String TITLE = Messages.getString("SAVE_AS_IMAGE"); //$NON-NLS-1$ private static final String[] FILTER_EXTENSIONS = new String[]{"*.png"}; //$NON-NLS-1$ //$NON-NLS-2$ @@ -25,4 +27,4 @@ public PNGExportHandler() { super(NAME, TITLE, FILTER_EXTENSIONS, SWT.IMAGE_PNG); } -} \ No newline at end of file +} diff --git a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/messages.properties b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/messages.properties index 826289a0..ef315149 100644 --- a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/messages.properties +++ b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/messages.properties @@ -1,2 +1,3 @@ -IMAGE = Image ( +IMAGE = Image ({0}) SAVE_AS_IMAGE = Save As Image +COPY_IMAGE_TO_CLIPBOARD = Copy Image to Clipboard \ No newline at end of file diff --git a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/messages_de.properties b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/messages_de.properties new file mode 100644 index 00000000..f024ab82 --- /dev/null +++ b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/messages_de.properties @@ -0,0 +1,3 @@ +IMAGE = Bild ({0}) +SAVE_AS_IMAGE = Als Bild speichern +COPY_IMAGE_TO_CLIPBOARD = Bild in Zwischenablage kopieren \ No newline at end of file diff --git a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/messages_fr.properties b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/messages_fr.properties index 090b9c12..ce852212 100644 --- a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/messages_fr.properties +++ b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/bitmap/messages_fr.properties @@ -1,2 +1,2 @@ -IMAGE = Image ( +IMAGE = Image ({0}) SAVE_AS_IMAGE = Enregistrer en image diff --git a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/text/CSVExportHandler.java b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/text/CSVExportHandler.java index 163839b9..13cd31d5 100644 --- a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/text/CSVExportHandler.java +++ b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/text/CSVExportHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * * Copyright (c) 2017, 2022 Lablicate GmbH. + * * Copyright (c) 2017, 2023 Lablicate GmbH. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -13,6 +13,8 @@ *******************************************************************************/ package org.eclipse.swtchart.export.menu.text; +import java.text.MessageFormat; + import org.eclipse.swt.graphics.Image; import org.eclipse.swtchart.export.core.AbstractSeparatedValueHandler; import org.eclipse.swtchart.export.core.ISeriesExportConverter; @@ -21,7 +23,7 @@ public class CSVExportHandler extends AbstractSeparatedValueHandler implements ISeriesExportConverter { private static final String FILE_EXTENSION = "*.csv"; //$NON-NLS-1$ - public static final String NAME = Messages.getString(Messages.COMMA_SEPARATED_VALUES) + FILE_EXTENSION + ")"; //$NON-NLS-1$ + public static final String NAME = MessageFormat.format(Messages.getString(Messages.COMMA_SEPARATED_VALUES), FILE_EXTENSION); // private static final String TITLE = Messages.getString(Messages.SAVE_AS_COMMA_SEPARATED); private static final String DELIMITER = ","; //$NON-NLS-1$ diff --git a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/text/LaTeXTableExportHandler.java b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/text/LaTeXTableExportHandler.java index 55606f09..097a2e21 100644 --- a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/text/LaTeXTableExportHandler.java +++ b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/text/LaTeXTableExportHandler.java @@ -17,6 +17,7 @@ import java.io.FileNotFoundException; import java.io.PrintWriter; import java.text.DecimalFormat; +import java.text.MessageFormat; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.window.Window; @@ -40,7 +41,7 @@ public class LaTeXTableExportHandler extends AbstractSeriesExportHandler implements ISeriesExportConverter { private static final String FILE_EXTENSION = "*.tex"; //$NON-NLS-1$ - public static final String NAME = Messages.getString(Messages.LATEX_TABLE) + FILE_EXTENSION + ")"; //$NON-NLS-1$ + public static final String NAME = MessageFormat.format(Messages.getString(Messages.LATEX_TABLE), FILE_EXTENSION); // private static final String TITLE = Messages.getString(Messages.SAVE_AS_LATEX); private static final String TAB = "\t"; //$NON-NLS-1$ diff --git a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/text/RScriptExportHandler.java b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/text/RScriptExportHandler.java index 884bb743..684ace7d 100644 --- a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/text/RScriptExportHandler.java +++ b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/text/RScriptExportHandler.java @@ -16,6 +16,7 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; @@ -50,8 +51,8 @@ public class RScriptExportHandler extends AbstractSeriesExportHandler implements ISeriesExportConverter { - private static final String FILE_EXTENSION = Messages.getString(Messages.R_EXTENSION); - public static final String NAME = Messages.getString(Messages.IMAGE_R_SCRIPT) + FILE_EXTENSION + ")"; //$NON-NLS-1$ + private static final String FILE_EXTENSION = "*.R"; //$NON-NLS-1$ + public static final String NAME = MessageFormat.format(Messages.getString(Messages.IMAGE_R_SCRIPT), FILE_EXTENSION); // private static final String TITLE = Messages.getString(Messages.SAVE_AS_IMAGE_R_SCRIPT); // diff --git a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/text/TSVExportHandler.java b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/text/TSVExportHandler.java index a7e2910f..c06c0b6a 100644 --- a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/text/TSVExportHandler.java +++ b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/text/TSVExportHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2020 Lablicate GmbH. + * Copyright (c) 2017, 2023 Lablicate GmbH. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -13,13 +13,15 @@ *******************************************************************************/ package org.eclipse.swtchart.export.menu.text; +import java.text.MessageFormat; + import org.eclipse.swtchart.export.core.AbstractSeparatedValueHandler; import org.eclipse.swtchart.export.core.ISeriesExportConverter; public class TSVExportHandler extends AbstractSeparatedValueHandler implements ISeriesExportConverter { private static final String FILE_EXTENSION = "*.tsv"; //$NON-NLS-1$ - public static final String NAME = Messages.getString(Messages.TAB_SEPARATED_VALUES) + FILE_EXTENSION + ")"; //$NON-NLS-1$ + public static final String NAME = MessageFormat.format(Messages.getString(Messages.TAB_SEPARATED_VALUES), FILE_EXTENSION); // private static final String TITLE = Messages.getString(Messages.SAVE_AS_TAB_SEPARATED); // $NON-NLS-1$ private static final String DELIMITER = "\t"; //$NON-NLS-1$ diff --git a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/text/messages.properties b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/text/messages.properties index ff2107b1..501e695c 100644 --- a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/text/messages.properties +++ b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/text/messages.properties @@ -1,9 +1,8 @@ -COMMA_SEPARATED_VALUES = Comma Separated Values ( -IMAGE_R_SCRIPT = Image R-Script ( -LATEX_TABLE = LaTeX Table ( -R_EXTENSION = *.R +COMMA_SEPARATED_VALUES = Comma Separated Values ({0}) +IMAGE_R_SCRIPT = Image R-Script ({0}) +LATEX_TABLE = LaTeX Table ({0}) SAVE_AS_COMMA_SEPARATED = Save As Comma Separated Text SAVE_AS_IMAGE_R_SCRIPT = Save As R-Script Image SAVE_AS_LATEX = Save As LaTeX Table SAVE_AS_TAB_SEPARATED = Save As Tab Separated Text -TAB_SEPARATED_VALUES = Tab Separated Values ( +TAB_SEPARATED_VALUES = Tab Separated Values ({0}) diff --git a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/text/messages_fr.properties b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/text/messages_fr.properties index 7b6e062a..82d42c19 100644 --- a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/text/messages_fr.properties +++ b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/text/messages_fr.properties @@ -1,9 +1,8 @@ -COMMA_SEPARATED_VALUES = Valeur s�par�es par des virgules ( -IMAGE_R_SCRIPT = Image R-Script ( -LATEX_TABLE = Table LaTeX ( -R_EXTENSION = *.R +COMMA_SEPARATED_VALUES = Valeur s�par�es par des virgules ({0}) +IMAGE_R_SCRIPT = Image R-Script ({0}) +LATEX_TABLE = Table LaTeX ({0}) SAVE_AS_COMMA_SEPARATED = Enregistrer en texte s�parateur virgule SAVE_AS_IMAGE_R_SCRIPT = Enregistrer en image R-Script SAVE_AS_LATEX = Enregistrer en table LaTeX SAVE_AS_TAB_SEPARATED = Enregistrer en texte s�parateur tabulation -TAB_SEPARATED_VALUES = Valeur s�par�es par des tabulations ( +TAB_SEPARATED_VALUES = Valeur s�par�es par des tabulations ({0}) diff --git a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/vector/SVGExportHandler.java b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/vector/SVGExportHandler.java index 8335c874..af0c6ac4 100644 --- a/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/vector/SVGExportHandler.java +++ b/org.eclipse.swtchart.export/src/org/eclipse/swtchart/export/menu/vector/SVGExportHandler.java @@ -21,6 +21,7 @@ import java.io.PrintWriter; import java.lang.reflect.InvocationTargetException; import java.text.DecimalFormat; +import java.text.MessageFormat; import java.util.regex.Pattern; import org.eclipse.core.runtime.IProgressMonitor; @@ -58,7 +59,7 @@ public class SVGExportHandler extends AbstractSeriesExportHandler implements ISeriesExportConverter { private static final String FILE_EXTENSION = "*.svg"; //$NON-NLS-1$ - private static final String NAME = Messages.getString(Messages.SVG) + FILE_EXTENSION + ")"; //$NON-NLS-1$ + private static final String NAME = MessageFormat.format(Messages.getString(Messages.SVG), FILE_EXTENSION); private static final String TITLE = Messages.getString(Messages.SAVE_AS_SVG); // private static final String AXIS_X = "x"; //$NON-NLS-1$ @@ -179,17 +180,18 @@ public void run(IProgressMonitor monitor) throws InvocationTargetException, Inte } } }); - } catch(Exception e) { + } catch(InterruptedException e) { e.printStackTrace(); + Thread.currentThread().interrupt(); } } } // exportSettingsDialog.reset(); scrollableChart.updateLegend(); - } catch(Exception e) { - MessageDialog.openInformation(shell, TITLE, MESSAGE_ERROR); - e.printStackTrace(); + } catch(InvocationTargetException e) { + MessageDialog.openInformation(shell, TITLE, org.eclipse.swtchart.export.core.Messages.DATA_EXPORT_ERROR); + e.getCause().printStackTrace(); } } } diff --git a/org.eclipse.swtchart.extensions.examples/src/org/eclipse/swtchart/extensions/examples/menu/ResetXAxisHandler.java b/org.eclipse.swtchart.extensions.examples/src/org/eclipse/swtchart/extensions/examples/menu/ResetXAxisHandler.java index 8bbc4575..05888c2e 100644 --- a/org.eclipse.swtchart.extensions.examples/src/org/eclipse/swtchart/extensions/examples/menu/ResetXAxisHandler.java +++ b/org.eclipse.swtchart.extensions.examples/src/org/eclipse/swtchart/extensions/examples/menu/ResetXAxisHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2019 Lablicate GmbH. + * Copyright (c) 2017, 2023 Lablicate GmbH. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -17,6 +17,7 @@ import org.eclipse.swtchart.extensions.menu.AbstractChartMenuEntry; import org.eclipse.swtchart.extensions.menu.IChartMenuCategories; import org.eclipse.swtchart.extensions.menu.IChartMenuEntry; +import org.eclipse.swtchart.extensions.menu.Messages; public class ResetXAxisHandler extends AbstractChartMenuEntry implements IChartMenuEntry { @@ -29,7 +30,7 @@ public String getCategory() { @Override public String getName() { - return "Reset X-Axis"; + return Messages.getString(Messages.RESET_X_AXIS); } @Override diff --git a/org.eclipse.swtchart.extensions.examples/src/org/eclipse/swtchart/extensions/examples/menu/ResetYAxisHandler.java b/org.eclipse.swtchart.extensions.examples/src/org/eclipse/swtchart/extensions/examples/menu/ResetYAxisHandler.java index d3f07924..f7d01a2e 100644 --- a/org.eclipse.swtchart.extensions.examples/src/org/eclipse/swtchart/extensions/examples/menu/ResetYAxisHandler.java +++ b/org.eclipse.swtchart.extensions.examples/src/org/eclipse/swtchart/extensions/examples/menu/ResetYAxisHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2019 Lablicate GmbH. + * Copyright (c) 2017, 2023 Lablicate GmbH. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -17,6 +17,7 @@ import org.eclipse.swtchart.extensions.menu.AbstractChartMenuEntry; import org.eclipse.swtchart.extensions.menu.IChartMenuCategories; import org.eclipse.swtchart.extensions.menu.IChartMenuEntry; +import org.eclipse.swtchart.extensions.menu.Messages; public class ResetYAxisHandler extends AbstractChartMenuEntry implements IChartMenuEntry { @@ -29,7 +30,7 @@ public String getCategory() { @Override public String getName() { - return "Reset Y-Axis"; + return Messages.getString(Messages.RESET_Y_AXIS); } @Override diff --git a/org.eclipse.swtchart.extensions.examples/src/org/eclipse/swtchart/extensions/examples/menu/ZoomInHandler.java b/org.eclipse.swtchart.extensions.examples/src/org/eclipse/swtchart/extensions/examples/menu/ZoomInHandler.java index da08f7b9..af8bd6d3 100644 --- a/org.eclipse.swtchart.extensions.examples/src/org/eclipse/swtchart/extensions/examples/menu/ZoomInHandler.java +++ b/org.eclipse.swtchart.extensions.examples/src/org/eclipse/swtchart/extensions/examples/menu/ZoomInHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2019 Lablicate GmbH. + * Copyright (c) 2017, 2023 Lablicate GmbH. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -17,6 +17,7 @@ import org.eclipse.swtchart.extensions.menu.AbstractChartMenuEntry; import org.eclipse.swtchart.extensions.menu.IChartMenuCategories; import org.eclipse.swtchart.extensions.menu.IChartMenuEntry; +import org.eclipse.swtchart.extensions.menu.Messages; public class ZoomInHandler extends AbstractChartMenuEntry implements IChartMenuEntry { @@ -29,7 +30,7 @@ public String getCategory() { @Override public String getName() { - return "Zoom In"; + return Messages.getString(Messages.ZOOM_IN); } @Override diff --git a/org.eclipse.swtchart.extensions.examples/src/org/eclipse/swtchart/extensions/examples/menu/ZoomOutHandler.java b/org.eclipse.swtchart.extensions.examples/src/org/eclipse/swtchart/extensions/examples/menu/ZoomOutHandler.java index 0d04f362..49fba339 100644 --- a/org.eclipse.swtchart.extensions.examples/src/org/eclipse/swtchart/extensions/examples/menu/ZoomOutHandler.java +++ b/org.eclipse.swtchart.extensions.examples/src/org/eclipse/swtchart/extensions/examples/menu/ZoomOutHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2019 Lablicate GmbH. + * Copyright (c) 2017, 2023 Lablicate GmbH. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -17,6 +17,7 @@ import org.eclipse.swtchart.extensions.menu.AbstractChartMenuEntry; import org.eclipse.swtchart.extensions.menu.IChartMenuCategories; import org.eclipse.swtchart.extensions.menu.IChartMenuEntry; +import org.eclipse.swtchart.extensions.menu.Messages; public class ZoomOutHandler extends AbstractChartMenuEntry implements IChartMenuEntry { @@ -29,7 +30,7 @@ public String getCategory() { @Override public String getName() { - return "Zoom Out"; + return Messages.getString(Messages.ZOOM_OUT); } @Override diff --git a/org.eclipse.swtchart.extensions/.settings/org.eclipse.core.resources.prefs b/org.eclipse.swtchart.extensions/.settings/org.eclipse.core.resources.prefs index 801fab74..38e89ffe 100644 --- a/org.eclipse.swtchart.extensions/.settings/org.eclipse.core.resources.prefs +++ b/org.eclipse.swtchart.extensions/.settings/org.eclipse.core.resources.prefs @@ -1,2 +1,3 @@ eclipse.preferences.version=1 +encoding//src/org/eclipse/swtchart/extensions/menu/messages_de.properties=UTF-8 encoding/=utf8 diff --git a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/charts/ChartOptions.java b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/charts/ChartOptions.java index 944eeaec..5c85b14d 100644 --- a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/charts/ChartOptions.java +++ b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/charts/ChartOptions.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2022 Lablicate GmbH. + * Copyright (c) 2019, 2023 Lablicate GmbH. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -17,7 +17,7 @@ import org.eclipse.swtchart.IAxis.Position; import org.eclipse.swtchart.ILineSeries.PlotSymbolType; import org.eclipse.swtchart.LineStyle; -import org.eclipse.swtchart.extensions.linecharts.LineChart; +import org.eclipse.swtchart.extensions.linecharts.ICompressionSupport; public class ChartOptions { @@ -28,11 +28,12 @@ public class ChartOptions { }; // public static final String[][] COMPRESSION_TYPES = new String[][]{ // - {LineChart.COMPRESSION_EXTREME, LineChart.COMPRESSION_EXTREME}, // - {LineChart.COMPRESSION_HIGH, LineChart.COMPRESSION_HIGH}, // - {LineChart.COMPRESSION_MEDIUM, LineChart.COMPRESSION_MEDIUM}, // - {LineChart.COMPRESSION_LOW, LineChart.COMPRESSION_LOW}, {LineChart.COMPRESSION_AUTO, LineChart.COMPRESSION_AUTO}, // - {LineChart.COMPRESSION_NONE, LineChart.COMPRESSION_NONE} // + {ICompressionSupport.COMPRESSION_EXTREME, ICompressionSupport.COMPRESSION_EXTREME}, // + {ICompressionSupport.COMPRESSION_HIGH, ICompressionSupport.COMPRESSION_HIGH}, // + {ICompressionSupport.COMPRESSION_MEDIUM, ICompressionSupport.COMPRESSION_MEDIUM}, // + {ICompressionSupport.COMPRESSION_LOW, ICompressionSupport.COMPRESSION_LOW}, // + {ICompressionSupport.COMPRESSION_AUTO, ICompressionSupport.COMPRESSION_AUTO}, // + {ICompressionSupport.COMPRESSION_NONE, ICompressionSupport.COMPRESSION_NONE} // }; // public static final String[][] SYMBOL_TYPES = new String[][]{ // @@ -60,4 +61,8 @@ public class ChartOptions { {".", LineStyle.DOT.toString()}, // {Messages.getString(Messages.SOLID), LineStyle.SOLID.toString()} // }; + + private ChartOptions() { + + } } diff --git a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/core/AbstractExtendedChart.java b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/core/AbstractExtendedChart.java index 07fdabb6..21f2f138 100644 --- a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/core/AbstractExtendedChart.java +++ b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/core/AbstractExtendedChart.java @@ -60,14 +60,14 @@ public abstract class AbstractExtendedChart extends AbstractHandledChart impleme // private boolean isCircularSeries; // - private Map xAxisSettingsMap = new HashMap(); - private Map yAxisSettingsMap = new HashMap(); + private Map xAxisSettingsMap = new HashMap<>(); + private Map yAxisSettingsMap = new HashMap<>(); /* * The series settings map contains the settings that are currently used. * The reset map contains a copy of the initial series settings. */ - private Map seriesSettingsMap = new HashMap(); - private Map seriesSettingsMapReset = new HashMap(); + private Map seriesSettingsMap = new HashMap<>(); + private Map seriesSettingsMapReset = new HashMap<>(); public AbstractExtendedChart(Composite parent, int style) { diff --git a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/core/BaseChart.java b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/core/BaseChart.java index c320fcac..7f1c713c 100644 --- a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/core/BaseChart.java +++ b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/core/BaseChart.java @@ -493,11 +493,7 @@ public Set getSeriesIds() { public boolean isSeriesContained(String seriesId) { - if(getSeriesSet().getSeries(seriesId) == null) { - return false; - } else { - return true; - } + return getSeriesSet().getSeries(seriesId) != null; } @Override @@ -889,7 +885,7 @@ public List getDataShiftHistory(String selectedSeriesId) { if(dataShifts != null) { return Collections.unmodifiableList(dataShifts); } else { - return null; + return Collections.emptyList(); } } diff --git a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/core/ChartSettings.java b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/core/ChartSettings.java index 6b929176..64ef1145 100644 --- a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/core/ChartSettings.java +++ b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/core/ChartSettings.java @@ -118,7 +118,7 @@ public class ChartSettings implements IChartSettings { /* * The default font is only used if no font is set. */ - private final Font defaultFont = ResourceSupport.getFont("Tahoma", Resources.MEDIUM_FONT_SIZE, SWT.BOLD); //$NON-NLS-1$ + private final Font defaultFont = Resources.getFont("Tahoma", Resources.MEDIUM_FONT_SIZE, SWT.BOLD); //$NON-NLS-1$ public ChartSettings() { diff --git a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/menu/Messages.java b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/menu/Messages.java index 682cd717..0763ec6f 100644 --- a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/menu/Messages.java +++ b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/menu/Messages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020 SWT Chart Project + * Copyright (c) 2020, 2023 SWT Chart Project * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -10,7 +10,6 @@ * Contributors: * Frank Buloup - initial API and implementation *******************************************************************************/ - package org.eclipse.swtchart.extensions.menu; import java.util.MissingResourceException; @@ -20,7 +19,7 @@ public class Messages { private static final String BUNDLE_NAME = "org.eclipse.swtchart.extensions.menu.messages"; //$NON-NLS-1$ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); - + // public static String EXPORT_CHART_SELECTION = "EXPORT_CHART_SELECTION"; public static String RANGE_SELECTION = "RANGE_SELECTION"; public static String REDO_SELECTION = "REDO_SELECTION"; @@ -28,6 +27,11 @@ public class Messages { public static String RESET_SELECTED_SERIES = "RESET_SELECTED_SERIES"; public static String TOGGLE_VISIBILITY = "TOGGLE_VISIBILITY"; public static String UNDO_SELECTION = "UNDO_SELECTION"; + public static String RESET_X_AXIS = "RESET_X_AXIS"; + public static String RESET_Y_AXIS = "RESET_Y_AXIS"; + public static String SET_CHART_RANGE = "SET_CHART_RANGE"; + public static String ZOOM_IN = "ZOOM_IN"; + public static String ZOOM_OUT = "ZOOM_OUT"; private Messages() { diff --git a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/menu/SetRangeChartHandler.java b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/menu/SetRangeChartHandler.java index f9eb2b55..b20c9af0 100644 --- a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/menu/SetRangeChartHandler.java +++ b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/menu/SetRangeChartHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021, 2022 Lablicate GmbH. + * Copyright (c) 2021, 2023 Lablicate GmbH. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -39,7 +39,7 @@ public String getCategory() { @Override public String getName() { - return "Set Chart Range"; + return Messages.getString(Messages.SET_CHART_RANGE); } @Override diff --git a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/menu/messages.properties b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/menu/messages.properties index 61925546..d7aa3c16 100644 --- a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/menu/messages.properties +++ b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/menu/messages.properties @@ -5,3 +5,8 @@ RESET_CHART = Reset Chart RESET_SELECTED_SERIES = Reset Selected Series TOGGLE_VISIBILITY = Toggle Visibility UNDO_SELECTION = Undo Selection +RESET_X_AXIS = Reset X-Axis +RESET_Y_AXIS = Reset Y-Axis +SET_CHART_RANGE = Set Chart Range +ZOOM_IN = Zoom In +ZOOM_OUT = Zoom Out \ No newline at end of file diff --git a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/menu/messages_de.properties b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/menu/messages_de.properties index fc689894..d025d2ed 100644 --- a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/menu/messages_de.properties +++ b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/menu/messages_de.properties @@ -5,3 +5,8 @@ RESET_CHART = Diagramm zurücksetzen RESET_SELECTED_SERIES = Ausgewählte Serie zurücksetzen TOGGLE_VISIBILITY = Sichtbarkeit umschalten UNDO_SELECTION = Selektion rückgängig +RESET_X_AXIS = X-Achse zurücksetzen +RESET_Y_AXIS = Y-Achse zurücksetzen +SET_CHART_RANGE = Setze Darstellungsbereich +ZOOM_IN = Hineinzoomen +ZOOM_OUT = Rauszoomen diff --git a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/preferences/PreferenceSupport.java b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/preferences/PreferenceSupport.java index c419776c..a76e10de 100644 --- a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/preferences/PreferenceSupport.java +++ b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/preferences/PreferenceSupport.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2019 Lablicate GmbH. + * Copyright (c) 2017, 2023 Lablicate GmbH. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -83,4 +83,8 @@ public class PreferenceSupport { {Messages.getString(Messages.RELATIVE), RangeRestriction.ExtendType.RELATIVE.toString()}, {Messages.getString(Messages.ABSOLUTE), RangeRestriction.ExtendType.ABSOLUTE.toString()} }; + + private PreferenceSupport() { + + } } diff --git a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/properties/AxisPage.java b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/properties/AxisPage.java index 5a46139a..d174fe8a 100644 --- a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/properties/AxisPage.java +++ b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/properties/AxisPage.java @@ -322,9 +322,9 @@ public void apply() { axes[i].getTitle().setText(titleTexts[i]); FontData fontData = axes[i].getTitle().getFont().getFontData()[0]; fontData.setHeight(titleFontSizes[i]); - Font font = ResourceSupport.getFont(fontData); + Font font = Resources.getFont(fontData); axes[i].getTitle().setFont(font); - Color color = ResourceSupport.getColor(titleColors[i]); + Color color = Resources.getColor(titleColors[i]); axes[i].getTitle().setForeground(color); axes[i].setRange(new Range(minRanges[i], maxRanges[i])); axes[i].setPosition(positions[i]); diff --git a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/properties/AxisTickPage.java b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/properties/AxisTickPage.java index 3da61ac5..5858fdb1 100644 --- a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/properties/AxisTickPage.java +++ b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/properties/AxisTickPage.java @@ -188,9 +188,9 @@ public void apply() { axes[i].getTick().setVisible(visibilityStates[i]); FontData fontData = axes[i].getTick().getFont().getFontData()[0]; fontData.setHeight(fontSizes[i]); - Font font = ResourceSupport.getFont(fontData); + Font font = Resources.getFont(fontData); axes[i].getTick().setFont(font); - Color color = ResourceSupport.getColor(foregroundColors[i]); + Color color = Resources.getColor(foregroundColors[i]); axes[i].getTick().setForeground(color); } } diff --git a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/properties/ChartPage.java b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/properties/ChartPage.java index 4b92a205..cbc25abe 100644 --- a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/properties/ChartPage.java +++ b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/properties/ChartPage.java @@ -34,7 +34,6 @@ import org.eclipse.swtchart.ITitle; import org.eclipse.swtchart.Resources; import org.eclipse.swtchart.extensions.charts.InteractiveChart; -import org.eclipse.swtchart.extensions.core.ResourceSupport; /** * The chart property page on properties dialog. @@ -169,9 +168,9 @@ protected void setTitleControlsEnable(boolean enabled) { @Override public void apply() { - Color color = ResourceSupport.getColor(backgroundInPlotAreaButton.getColorValue()); + Color color = Resources.getColor(backgroundInPlotAreaButton.getColorValue()); chart.getPlotArea().setBackground(color); - color = ResourceSupport.getColor(backgroundButton.getColorValue()); + color = Resources.getColor(backgroundButton.getColorValue()); chart.setBackground(color); chart.setOrientation(orientationButton.getSelection() ? SWT.VERTICAL : SWT.HORIZONTAL); ITitle title = chart.getTitle(); @@ -179,9 +178,9 @@ public void apply() { title.setText(titleText.getText()); FontData fontData = title.getFont().getFontData()[0]; fontData.setHeight(fontSizeSpinner.getSelection()); - Font font = ResourceSupport.getFont(fontData); + Font font = Resources.getFont(fontData); title.setFont(font); - color = ResourceSupport.getColor(titleColorButton.getColorValue()); + color = Resources.getColor(titleColorButton.getColorValue()); title.setForeground(color); } diff --git a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/properties/GridPage.java b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/properties/GridPage.java index d97eb034..9f785ffc 100644 --- a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/properties/GridPage.java +++ b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/properties/GridPage.java @@ -30,8 +30,8 @@ import org.eclipse.swtchart.IAxis; import org.eclipse.swtchart.IAxis.Direction; import org.eclipse.swtchart.LineStyle; +import org.eclipse.swtchart.Resources; import org.eclipse.swtchart.extensions.charts.InteractiveChart; -import org.eclipse.swtchart.extensions.core.ResourceSupport; /** * The grid page on properties dialog. @@ -157,7 +157,7 @@ public void apply() { for(int i = 0; i < axes.length; i++) { axes[i].getGrid().setStyle(styles[i]); - Color color = ResourceSupport.getColor(foregroundColors[i]); + Color color = Resources.getColor(foregroundColors[i]); axes[i].getGrid().setForeground(color); } } diff --git a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/properties/LegendPage.java b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/properties/LegendPage.java index 11045682..779a23d2 100644 --- a/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/properties/LegendPage.java +++ b/org.eclipse.swtchart.extensions/src/org/eclipse/swtchart/extensions/properties/LegendPage.java @@ -32,7 +32,6 @@ import org.eclipse.swtchart.ILegend; import org.eclipse.swtchart.Resources; import org.eclipse.swtchart.extensions.charts.InteractiveChart; -import org.eclipse.swtchart.extensions.core.ResourceSupport; /** * The legend property page on properties dialog. @@ -148,12 +147,12 @@ protected void setControlsEnable(boolean enabled) { public void apply() { legend.setVisible(showLegendButton.getSelection()); - Color color = ResourceSupport.getColor(backgroundButton.getColorValue()); + Color color = Resources.getColor(backgroundButton.getColorValue()); legend.setBackground(color); - color = ResourceSupport.getColor(foregroundButton.getColorValue()); + color = Resources.getColor(foregroundButton.getColorValue()); legend.setForeground(color); FontData fontData = legend.getFont().getFontData()[0]; - Font font = ResourceSupport.getFont(fontData.getName(), fontSizeSpinner.getSelection(), fontData.getStyle()); + Font font = Resources.getFont(fontData.getName(), fontSizeSpinner.getSelection(), fontData.getStyle()); legend.setFont(font); } diff --git a/org.eclipse.swtchart.test/src/org/eclipse/swtchart/AxisTitleTest.java b/org.eclipse.swtchart.test/src/org/eclipse/swtchart/AxisTitleTest.java index 38f9d458..1db1f2b2 100755 --- a/org.eclipse.swtchart.test/src/org/eclipse/swtchart/AxisTitleTest.java +++ b/org.eclipse.swtchart.test/src/org/eclipse/swtchart/AxisTitleTest.java @@ -200,6 +200,7 @@ public void testFont() { fontData = yAxisTitle.getFont().getFontData()[0]; assertEquals(64, fontData.getHeight()); showChart(); + font.dispose(); // set tiny font size font = new Font(Display.getCurrent(), "Tahoma", 4, SWT.ITALIC); xAxisTitle.setFont(font); diff --git a/org.eclipse.swtchart.test/src/org/eclipse/swtchart/ChartTitleTest.java b/org.eclipse.swtchart.test/src/org/eclipse/swtchart/ChartTitleTest.java index f912db09..e9d61efc 100755 --- a/org.eclipse.swtchart.test/src/org/eclipse/swtchart/ChartTitleTest.java +++ b/org.eclipse.swtchart.test/src/org/eclipse/swtchart/ChartTitleTest.java @@ -45,7 +45,7 @@ public void setUp() { * Test for title text. */ @Test - public void testText() { + public void testText() { // set null title.setText(null); @@ -76,7 +76,7 @@ public void testText() { * Test for foreground. */ @Test - public void testForeground() { + public void testForeground() { // set null title.setForeground(null); @@ -107,7 +107,7 @@ public void testForeground() { * Test for title font. */ @Test - public void testFont() { + public void testFont() { // set null title.setFont(null); @@ -141,19 +141,21 @@ public void testFont() { fontData = font.getFontData()[0]; assertEquals(64, fontData.getHeight()); showChart(); + font.dispose(); // set tiny font size title.setFont(new Font(Display.getCurrent(), "Tahoma", 4, SWT.ITALIC)); font = title.getFont(); fontData = font.getFontData()[0]; assertEquals(4, fontData.getHeight()); showChart(); + font.dispose(); } /** * Test for title visibility. */ @Test - public void testVisibility() { + public void testVisibility() { // set visibility title.setText("foo"); diff --git a/org.eclipse.swtchart/src/org/eclipse/swtchart/internal/axis/Axis.java b/org.eclipse.swtchart/src/org/eclipse/swtchart/internal/axis/Axis.java index 5da1656c..c08218b8 100644 --- a/org.eclipse.swtchart/src/org/eclipse/swtchart/internal/axis/Axis.java +++ b/org.eclipse.swtchart/src/org/eclipse/swtchart/internal/axis/Axis.java @@ -116,7 +116,7 @@ public Axis(int id, Direction direction, Chart chart) { grid = new Grid(this); title = new AxisTitle(chart, SWT.NONE, this, direction); tick = new AxisTick(chart, this); - listeners = new ArrayList(); + listeners = new ArrayList<>(); // sets initial default values position = Position.Primary; min = DEFAULT_MIN; @@ -239,9 +239,7 @@ public boolean isIntegerDataPointAxis() { @Override public void setIntegerDataPointAxis(boolean integerDataPointAxis) { - if(this.integerDataPointAxis == integerDataPointAxis) { - return; - } else { + if(this.integerDataPointAxis != integerDataPointAxis) { this.integerDataPointAxis = integerDataPointAxis; if(integerDataPointAxis) { enableCategory(false); diff --git a/org.eclipse.swtchart/src/org/eclipse/swtchart/internal/axis/AxisSet.java b/org.eclipse.swtchart/src/org/eclipse/swtchart/internal/axis/AxisSet.java index a323c7de..38689837 100644 --- a/org.eclipse.swtchart/src/org/eclipse/swtchart/internal/axis/AxisSet.java +++ b/org.eclipse.swtchart/src/org/eclipse/swtchart/internal/axis/AxisSet.java @@ -49,8 +49,8 @@ public class AxisSet implements IAxisSet { public AxisSet(Chart chart) { this.chart = chart; - xAxisMap = new HashMap(); - yAxisMap = new HashMap(); + xAxisMap = new HashMap<>(); + yAxisMap = new HashMap<>(); // add default axes Axis xAxis = new Axis(0, Direction.X, chart); Axis yAxis = new Axis(0, Direction.Y, chart); @@ -165,7 +165,7 @@ public IAxis[] getYAxes() { @Override public IAxis[] getAxes() { - Collection axes = new ArrayList(); + Collection axes = new ArrayList<>(); axes.addAll(xAxisMap.values()); axes.addAll(yAxisMap.values()); return axes.toArray(new Axis[axes.size()]); diff --git a/org.eclipse.swtchart/src/org/eclipse/swtchart/internal/axis/AxisTickLabels.java b/org.eclipse.swtchart/src/org/eclipse/swtchart/internal/axis/AxisTickLabels.java index e910ddf0..bb0c1782 100644 --- a/org.eclipse.swtchart/src/org/eclipse/swtchart/internal/axis/AxisTickLabels.java +++ b/org.eclipse.swtchart/src/org/eclipse/swtchart/internal/axis/AxisTickLabels.java @@ -114,7 +114,7 @@ private void initializePossibleTickSteps() { final Integer[] dates = {1, 7, 14, 28}; final Integer[] months = {1, 2, 3, 4, 6, 11}; final Integer[] years = {1, 2, 5, 10, 20, 50, 100, 200, 500, 1000}; - possibleTickSteps = new HashMap(); + possibleTickSteps = new HashMap<>(); possibleTickSteps.put(Calendar.MILLISECOND, milliseconds); possibleTickSteps.put(Calendar.SECOND, seconds); possibleTickSteps.put(Calendar.MINUTE, minutes); diff --git a/org.eclipse.swtchart/src/org/eclipse/swtchart/internal/axis/messages.properties b/org.eclipse.swtchart/src/org/eclipse/swtchart/internal/axis/messages.properties index 9fbd5d01..351d0fa8 100644 --- a/org.eclipse.swtchart/src/org/eclipse/swtchart/internal/axis/messages.properties +++ b/org.eclipse.swtchart/src/org/eclipse/swtchart/internal/axis/messages.properties @@ -5,9 +5,7 @@ LENGTH_MUST_BE_POSITIVE = lengthInPixels must be positive value. MUST_BE_LESS_MAX = min must be less than max. SERIES_CONTAIN_INVALID_VALUES = Series contain zero or negative value. UNKNOWN_AXIS_POSITION = unknown axis position -X_AXIS = X axis X_AXIS = X Axis -Y_AXIS = Y axis Y_AXIS = Y Axis Y_AXIS_CANNOT_BE_CATEGORY = Y axis cannot be category axis. LOGARITHM_BASE_IS_INVALID = Logarithm base is invalid (must be positive and different from 1)