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 @ 44074

History | View | Annotate | Download (2.48 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

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

    
35
/**
36
 * Andami extension to register the ExportTo preferences panel.
37
 * 
38
 * @author gvSIG Team
39
 * @version $Id$
40
 */
41
public class ExportPreferencesExtension 
42
        extends Extension 
43
        implements IPreferenceExtension
44
    {
45

    
46
    @Override
47
    public void initialize() {
48
        ExportServiceManager manager = ExportLocator.getServiceManager();
49

    
50
        ExportPreferences preferences = new ExportPreferences();
51
        for (ExportServiceFactory factory : manager.getAllServiceFactories()) {
52
            if (preferences.exits(factory.getName())) {
53
                factory.setEnabled(preferences.isEnabled(factory.getName()));
54
            } else {
55
                factory.setEnabled(true);
56
                preferences.setEnabled(factory.getName(), true);
57
            }
58
        }
59
    }
60

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

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

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

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

    
81
}