]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.charts/src/org/simantics/charts/editor/ChartPreferencesAction.java
Added Chart Preferences action to time series chart editor context menu
[simantics/platform.git] / bundles / org.simantics.charts / src / org / simantics / charts / editor / ChartPreferencesAction.java
1 package org.simantics.charts.editor;
2
3 import org.eclipse.jface.action.Action;
4 import org.eclipse.jface.preference.PreferenceDialog;
5 import org.eclipse.jface.window.IShellProvider;
6 import org.eclipse.ui.dialogs.PreferencesUtil;
7
8 /**
9  * @author Tuukka Lehtonen
10  */
11 public class ChartPreferencesAction extends Action {
12
13         private static final String CHART_DEFAULTS_PREF_PAGE_ID = "org.simantics.charts.defaults"; //$NON-NLS-1$
14         private static final String CHART_PREF_PAGE_ID = "org.simantics.charts.pref"; //$NON-NLS-1$
15         private static final String CSV_PREF_PAGE_ID = "org.simantics.modeling.csv.preferences"; //$NON-NLS-1$ 
16
17         private IShellProvider shell;
18
19         public ChartPreferencesAction(IShellProvider shell) {
20                 super(Messages.ChartPreferencesAction_ChartPreferences);
21                 this.shell = shell;
22         }
23
24         @Override
25         public void run() {
26                 PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(
27                                 shell.getShell(),
28                                 CHART_PREF_PAGE_ID,
29                                 new String[] {
30                                                 CHART_PREF_PAGE_ID,
31                                                 CHART_DEFAULTS_PREF_PAGE_ID,
32                                                 CSV_PREF_PAGE_ID
33                                 },
34                                 null);
35                 dialog.open();
36         }
37
38 }