/*
* Copyright Oct 18, 2010 John T. Langton
* email: jlangton at visitrend dot com
* www.visitrend.com
*
* License: GPLv2 or (at your option) any later GPL version
*
* This file is part of NDVis.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* There should be a copy of the GNU General Public License applied to
* NDVis in the file "NDVis-license" in the folder "license". If not, see
* <http://www.gnu.org/licenses/> or write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package com.visitrend.ndvis.preferences;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import com.visitrend.ndvis.preferences.spi.NDVisPreferences;
import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionReferences;
import org.openide.awt.ActionRegistration;
import org.openide.util.Lookup;
import org.openide.windows.WindowManager;
/**
*
* @author Diane Kramer - dkramer at visitrend dot com
*
*/
@ActionID(category = "NDVisMainActions", id = "com.visitrend.ndvis.actions.PreferencesAction")
@ActionRegistration(displayName = "Preferences")//TODO:Bug 196933, iconBase = "toolbarButtonGraphics/general/New16.gif")
@ActionReferences({
@ActionReference(path = "Menu/File")
})
public class PreferencesAction extends AbstractAction {
public PreferencesAction() {
super("Preferences");
}
public void actionPerformed(ActionEvent ae) {
PreferencesDialog dialog = PreferencesDialog.showDialog(WindowManager.getDefault().getMainWindow());
if (dialog.getExitValue() == PreferencesDialog.OK) {
NDVisPreferences prefs = Lookup.getDefault().lookup(NDVisPreferences.class);
prefs.setShowDBConnectPref(dialog.getShowDBConnect());
}
}
}