Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / main / java / org / gvsig / app / extension / TranslationsPackageExtension.java @ 41284

History | View | Annotate | Download (3.03 KB)

1 40558 jjdelcerro
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 41280 jjdelcerro
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 40558 jjdelcerro
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 41280 jjdelcerro
 * MA 02110-1301, USA.
20 40558 jjdelcerro
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24 40435 jjdelcerro
package org.gvsig.app.extension;
25
26 41280 jjdelcerro
import java.io.File;
27
import org.cresques.Messages;
28 40435 jjdelcerro
import org.gvsig.andami.PluginsLocator;
29 41280 jjdelcerro
import org.gvsig.andami.PluginsManager;
30
import org.gvsig.andami.installer.packagebuilder.BasePackageWizard;
31
import org.gvsig.andami.installer.translations.TranslationsInstallerFactory;
32 40435 jjdelcerro
import org.gvsig.andami.plugins.Extension;
33 41280 jjdelcerro
import org.gvsig.app.ApplicationLocator;
34
import org.gvsig.app.ApplicationManager;
35
import org.gvsig.tools.swing.api.windowmanager.WindowManager;
36 40435 jjdelcerro
import org.slf4j.Logger;
37
import org.slf4j.LoggerFactory;
38
39 41280 jjdelcerro
public class TranslationsPackageExtension extends Extension {
40 40435 jjdelcerro
41 41280 jjdelcerro
    private static Logger logger = LoggerFactory
42
            .getLogger(TranslationsPackageExtension.class);
43 40435 jjdelcerro
44 41280 jjdelcerro
    public void initialize() {
45
        // Do nothing
46
    }
47 40435 jjdelcerro
48 41280 jjdelcerro
    public void postInitialize() {
49
        super.postInitialize();
50
    }
51 40435 jjdelcerro
52 41280 jjdelcerro
    public void execute(String actionCommand) {
53
        if ( "tools-devel-translations-package".equalsIgnoreCase(actionCommand) ) {
54
            ApplicationManager application = ApplicationLocator.getManager();
55
            application.getUIManager().showWindow(
56
                    new TranslationsPackageWizard(),
57
                    application.translate("_Translations_package"),
58
                    WindowManager.MODE.WINDOW
59
            );
60
        }
61
    }
62 40435 jjdelcerro
63 41280 jjdelcerro
    public boolean isEnabled() {
64
        return true;
65
    }
66 40435 jjdelcerro
67 41280 jjdelcerro
    public boolean isVisible() {
68
        return true;
69
    }
70 40435 jjdelcerro
71 41280 jjdelcerro
    private class TranslationsPackageWizard extends BasePackageWizard {
72
73
        private static final long serialVersionUID = 9205891710214122265L;
74
75
        TranslationsPackageWizard() {
76
            super(TranslationsInstallerFactory.PROVIDER_NAME);
77
        }
78
79
        @Override
80
        protected void initOptionPanels() {
81
            PluginsManager pluginsManager = PluginsLocator.getManager();
82
            this.addSelectFolderToPackagingOption(Messages.getText("_Seleccione_la_carpeta_en_la_que_se_encuentran_las_traducciones_a_empaquetar"));
83
            super.addDefaultOptionPanels();
84
            this.setFolderToPackaging(new File(pluginsManager.getApplicationFolder(), "i18n"));
85
        }
86
87
    }
88 40435 jjdelcerro
}