Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.exportto.app / org.gvsig.exportto.app.mainplugin / src / main / java / org / gvsig / export / app / extension / ExportPreferencesExtension.java @ 43926

History | View | Annotate | Download (2.52 KB)

1
/**
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
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * 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
 * MA  02110-1301, USA.
20
 *
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
package org.gvsig.export.app.extension;
25

    
26
import java.util.Set;
27

    
28
import org.gvsig.andami.plugins.Extension;
29
import org.gvsig.andami.preferences.IPreference;
30
import org.gvsig.andami.preferences.IPreferenceExtension;
31
import org.gvsig.export.ExportLocator;
32
import org.gvsig.export.app.extension.preferences.ExportPreferencesPage;
33
import org.gvsig.export.spi.ExportServiceFactory;
34
import org.gvsig.export.spi.ExportServiceManager;
35
import org.gvsig.tools.dynobject.DynObject;
36

    
37
/**
38
 * Andami extension to register the ExportTo preferences panel.
39
 * 
40
 * @author gvSIG Team
41
 * @version $Id$
42
 */
43
public class ExportPreferencesExtension 
44
        extends Extension 
45
        implements IPreferenceExtension
46
    {
47
    public static final String PREFERENCE_ENABLED_SERVICES = "enabledProviders";
48

    
49
    @Override
50
    public void initialize() {
51
        ExportServiceManager manager = ExportLocator.getServiceManager();
52

    
53
        DynObject preferences = this.getPlugin().getPluginProperties();
54
        Set<String> enableds = (Set<String>) preferences.getDynValue(PREFERENCE_ENABLED_SERVICES);
55
        for (ExportServiceFactory factory : manager.getAllServiceFactories()) {
56
            factory.setEnabled(enableds.contains(factory.getName()));
57
        }
58
    }
59

    
60
    @Override
61
    public void execute(String actionCommand) {
62
        // Nothing to do
63
    }
64

    
65
    @Override
66
    public boolean isEnabled() {
67
        return true;
68
    }
69

    
70
    @Override
71
    public boolean isVisible() {
72
        return false;
73
    }
74

    
75
    @Override
76
    public IPreference[] getPreferencesPages() {
77
        return new IPreference[] { new ExportPreferencesPage() };
78
    }
79

    
80
}