--- /dev/null
+package org.simantics.charts.editor;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.jface.window.IShellProvider;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public class ChartPreferencesAction extends Action {
+
+ private static final String CHART_DEFAULTS_PREF_PAGE_ID = "org.simantics.charts.defaults"; //$NON-NLS-1$
+ private static final String CHART_PREF_PAGE_ID = "org.simantics.charts.pref"; //$NON-NLS-1$
+ private static final String CSV_PREF_PAGE_ID = "org.simantics.modeling.csv.preferences"; //$NON-NLS-1$
+
+ private IShellProvider shell;
+
+ public ChartPreferencesAction(IShellProvider shell) {
+ super(Messages.ChartPreferencesAction_ChartPreferences);
+ this.shell = shell;
+ }
+
+ @Override
+ public void run() {
+ PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(
+ shell.getShell(),
+ CHART_PREF_PAGE_ID,
+ new String[] {
+ CHART_PREF_PAGE_ID,
+ CHART_DEFAULTS_PREF_PAGE_ID,
+ CSV_PREF_PAGE_ID
+ },
+ null);
+ dialog.open();
+ }
+
+}
\ No newline at end of file
--- /dev/null
+package org.simantics.charts.editor;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.simantics.charts.editor.messages"; //$NON-NLS-1$
+ public static String ChartPreferencesAction_ChartPreferences;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
if (chartItem != null) {
manager.add(new HideItemsAction("Hide Item", true, Collections.singletonList(chartItem)));
manager.add(new Separator());
+ manager.add(new ChartPreferencesAction(getSite()));
+ manager.add(new Separator());
manager.add(new PropertiesAction("Item Properties", canvas, chartItem));
manager.add(new PropertiesAction("Chart Properties", canvas, chart));
}
manager.add(new SendCommandAction("Zoom to Fit Vertically", IMG_ZOOM_TO_FIT_VERT, cvsCtx, Commands.ZOOM_TO_FIT_VERT));
manager.add(new SendCommandAction("Autoscale Chart", IMG_AUTOSCALE, cvsCtx, Commands.AUTOSCALE));
manager.add(new Separator());
+ manager.add(new ChartPreferencesAction(getSite()));
+ manager.add(new Separator());
manager.add(new PropertiesAction("Chart Properties", canvas, chart));
}
}
--- /dev/null
+ChartPreferencesAction_ChartPreferences=Chart Preferences