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.debug;
15:
16: import org.jetbrains.annotations.NonNls;
17: import org.jetbrains.annotations.NotNull;
18: import org.pentaho.reportdesigner.crm.report.util.TranslationUtil;
19: import org.pentaho.reportdesigner.lib.client.commands.AbstractCommand;
20: import org.pentaho.reportdesigner.lib.client.commands.CommandEvent;
21: import org.pentaho.reportdesigner.lib.client.commands.KeyStrokeUtil;
22: import org.pentaho.reportdesigner.lib.client.i18n.TranslationManager;
23: import org.pentaho.reportdesigner.lib.client.util.UncaughtExcpetionsModel;
24:
25: import java.util.Arrays;
26: import java.util.List;
27: import java.util.Locale;
28: import java.util.logging.Level;
29: import java.util.logging.Logger;
30:
31: /**
32: * User: Martin
33: * Date: 20.02.2006
34: * Time: 19:30:01
35: */
36: public class FindTranslationsCommand extends AbstractCommand {
37:
38: @NotNull
39: @NonNls
40: private static final Logger LOG = Logger
41: .getLogger(FindTranslationsCommand.class.getName());
42:
43: public FindTranslationsCommand() {
44: super ("FindTranslationsCommand");
45: getTemplatePresentation().setText(
46: TranslationManager.getInstance().getTranslation("R",
47: "FindTranslationsCommand.Text"));
48: getTemplatePresentation().setDescription(
49: TranslationManager.getInstance().getTranslation("R",
50: "FindTranslationsCommand.Description"));
51: getTemplatePresentation().setMnemonic(
52: TranslationManager.getInstance().getMnemonic("R",
53: "FindTranslationsCommand.Text"));
54: getTemplatePresentation().setDisplayedMnemonicIndex(
55: TranslationManager.getInstance()
56: .getDisplayedMnemonicIndex("R",
57: "FindTranslationsCommand.Text"));
58:
59: getTemplatePresentation()
60: .setAccelerator(
61: KeyStrokeUtil
62: .getKeyStroke(TranslationManager
63: .getInstance()
64: .getTranslation("R",
65: "FindTranslationsCommand.Accelerator")));
66: }
67:
68: public void update(@NotNull
69: CommandEvent event) {
70: event.getPresentation().setEnabled(true);
71: }
72:
73: public void execute(@NotNull
74: CommandEvent event) {
75: try {
76: List<Locale> locales = TranslationUtil.findLocales();
77: if (LOG.isLoggable(Level.FINE))
78: LOG.log(Level.FINE,
79: "FindTranslationsCommand.execute locales = "
80: + Arrays.asList(locales));
81: } catch (Throwable e) {
82: UncaughtExcpetionsModel.getInstance().addException(e);
83: }
84: }
85:
86: }
|