01: package org.netbeans.modules.etl.ui.view.graph.actions;
02:
03: import java.awt.event.ActionEvent;
04: import java.awt.event.InputEvent;
05: import java.net.URL;
06: import javax.swing.Action;
07: import javax.swing.ImageIcon;
08:
09: import javax.swing.KeyStroke;
10: import org.axiondb.ExternalConnectionProvider;
11: import org.netbeans.modules.etl.ui.DataObjectProvider;
12: import org.netbeans.modules.etl.ui.view.ETLCollaborationTopPanel;
13: import org.netbeans.modules.sql.framework.ui.graph.actions.GraphAction;
14: import org.netbeans.modules.sql.framework.ui.utils.AxionExternalConnectionProvider;
15: import net.java.hulp.i18n.Logger;
16: import org.netbeans.modules.etl.logger.Localizer;
17: import org.netbeans.modules.etl.logger.LogUtil;
18:
19: public final class TestRunAction extends GraphAction {
20:
21: private static final URL runIconUrl = TestRunAction.class
22: .getResource("/org/netbeans/modules/sql/framework/ui/resources/images/runCollaboration.png");
23: private static transient final Logger mLogger = LogUtil
24: .getLogger(TestRunAction.class.getName());
25: private static transient final Localizer mLoc = Localizer.get();
26:
27: public TestRunAction() {
28: //action name
29: String nbBundle1 = mLoc.t("PRSR001: Run");
30: this .putValue(Action.NAME, Localizer.parse(nbBundle1));
31:
32: //action
33: this .putValue(Action.SMALL_ICON, new ImageIcon(runIconUrl));
34:
35: //action tooltip
36: String nbBundle2 = mLoc
37: .t("PRSR001: Run Collaboration (Cntl-N)");
38: this .putValue(Action.SHORT_DESCRIPTION, Localizer
39: .parse(nbBundle2));
40:
41: // Acceleratot Cntl-N
42: this .putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(
43: 'N', InputEvent.CTRL_MASK));
44: }
45:
46: public void actionPerformed(ActionEvent ev) {
47: ETLCollaborationTopPanel topComp = null;
48: try {
49: topComp = DataObjectProvider.getProvider()
50: .getActiveDataObject().getETLEditorTopPanel();
51: Thread.currentThread().getContextClassLoader().loadClass(
52: AxionExternalConnectionProvider.class.getName());
53: } catch (Exception ex) {
54: mLogger.errorNoloc(mLoc.t(
55: "PRSR026: Error loading class:{0}",
56: TestRunAction.class.getName()), ex);
57: }
58: System
59: .setProperty(
60: ExternalConnectionProvider.EXTERNAL_CONNECTION_PROVIDER_PROPERTY_NAME,
61: AxionExternalConnectionProvider.class.getName());
62:
63: if (topComp != null) {
64: topComp.run();
65: }
66: }
67: }
|