01: /*
02: * Copyright 2006-2007 Pentaho Corporation. All rights reserved.
03: * This software was developed by Pentaho Corporation and is provided under the terms
04: * of the Mozilla Public License, Version 1.1, or any later version. You may not use
05: * this file except in compliance with the license. If you need a copy of the license,
06: * please go to http://www.mozilla.org/MPL/MPL-1.1.txt.
07: *
08: * Software distributed under the Mozilla Public License is distributed on an "AS IS"
09: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
10: * the license for the specific language governing your rights and limitations.
11: *
12: * Additional Contributor(s): Martin Schmid gridvision engineering GmbH
13: */
14: package org.pentaho.reportdesigner.crm.report.commands;
15:
16: import org.jetbrains.annotations.NotNull;
17: import org.pentaho.reportdesigner.crm.report.ReportDialog;
18: import org.pentaho.reportdesigner.lib.client.commands.AbstractCommand;
19: import org.pentaho.reportdesigner.lib.client.commands.CommandEvent;
20: import org.pentaho.reportdesigner.lib.client.commands.KeyStrokeUtil;
21: import org.pentaho.reportdesigner.lib.client.components.docking.ToolWindow;
22: import org.pentaho.reportdesigner.lib.client.i18n.TranslationManager;
23:
24: import javax.swing.*;
25:
26: /**
27: * User: Martin
28: * Date: 25.01.2006
29: * Time: 11:26:24
30: */
31: public class GoToToolWindowMessagesCommand extends AbstractCommand {
32:
33: public GoToToolWindowMessagesCommand() {
34: super ("GoToToolwindowMessagesCommand");
35: getTemplatePresentation().setText(
36: TranslationManager.getInstance().getTranslation("R",
37: "GoToToolwindowMessagesCommand.Text"));
38: getTemplatePresentation().setDescription(
39: TranslationManager.getInstance().getTranslation("R",
40: "GoToToolwindowMessagesCommand.Description"));
41: getTemplatePresentation().setMnemonic(
42: TranslationManager.getInstance().getMnemonic("R",
43: "GoToToolwindowMessagesCommand.Text"));
44: getTemplatePresentation().setDisplayedMnemonicIndex(
45: TranslationManager.getInstance()
46: .getDisplayedMnemonicIndex("R",
47: "GoToToolwindowMessagesCommand.Text"));
48:
49: getTemplatePresentation()
50: .setAccelerator(
51: KeyStrokeUtil
52: .getKeyStroke(TranslationManager
53: .getInstance()
54: .getTranslation("R",
55: "GoToToolwindowMessagesCommand.Accelerator")));
56: }
57:
58: public void update(@NotNull
59: CommandEvent event) {
60: ReportDialog reportDialog = (ReportDialog) event
61: .getPresentation().getCommandApplicationRoot();
62: event.getPresentation().setEnabled(
63: reportDialog.getReport() != null);
64: }
65:
66: public void execute(@NotNull
67: CommandEvent event) {
68: ReportDialog reportDialog = (ReportDialog) event
69: .getPresentation().getCommandApplicationRoot();
70: ToolWindow inspectionsToolWindow = reportDialog
71: .getInspectionsToolWindow();
72: if (inspectionsToolWindow != null) {
73: JComponent mainComponent = inspectionsToolWindow
74: .getCategory().getMainComponent();
75: if (mainComponent != null) {
76: mainComponent.requestFocusInWindow();
77: }
78: }
79: }
80: }
|