svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.geodb.app / org.gvsig.geodb.app.mainplugin / src / main / java / org / gvsig / geodb / ExtDB_Spatial.java @ 45160
History | View | Annotate | Download (4.18 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 modify it under
|
7 |
* the terms of the GNU General Public License as published by the Free Software
|
8 |
* Foundation; either version 3 of the License, or (at your option) any later
|
9 |
* version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
13 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
14 |
* details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License along with
|
17 |
* this program; if not, write to the Free Software Foundation, Inc., 51
|
18 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
19 |
*
|
20 |
* For any additional information, do not hesitate to contact us at info AT
|
21 |
* gvsig.com, or visit our website www.gvsig.com.
|
22 |
*/
|
23 |
package org.gvsig.geodb; |
24 |
|
25 |
import java.util.ArrayList; |
26 |
import java.util.HashMap; |
27 |
import java.util.List; |
28 |
import java.util.Map; |
29 |
import org.gvsig.andami.IconThemeHelper; |
30 |
import org.gvsig.andami.PluginsLocator; |
31 |
import org.gvsig.andami.PluginsManager; |
32 |
import org.gvsig.andami.plugins.Extension; |
33 |
import org.gvsig.andami.preferences.IPreference; |
34 |
import org.gvsig.andami.preferences.IPreferenceExtension; |
35 |
import org.gvsig.app.ApplicationLocator; |
36 |
import org.gvsig.app.extension.AddLayer; |
37 |
import org.gvsig.fmap.dal.DALLocator; |
38 |
import org.gvsig.fmap.dal.DataManager; |
39 |
import org.gvsig.tools.dynobject.DynObject; |
40 |
import org.gvsig.fmap.dal.DataServerExplorerPool; |
41 |
import static org.gvsig.geodb.WizardDBVectorial.LAYERS_SCALE_VISIBILITY_PARAMETER; |
42 |
import org.gvsig.geodb.preferences.layersVisibility.LayersVisibilityReminderPage; |
43 |
import org.gvsig.geodb.vectorialdb.visibility.LayerScaleVisibility; |
44 |
|
45 |
/**
|
46 |
* This extension adds the export-to-oracle button.
|
47 |
*
|
48 |
* @author jldominguez
|
49 |
*
|
50 |
*/
|
51 |
public class ExtDB_Spatial extends Extension implements IPreferenceExtension{ |
52 |
|
53 |
@Override
|
54 |
public void initialize() { |
55 |
IconThemeHelper.registerIcon("geodb", "geodb-connection-add", this); |
56 |
IconThemeHelper.registerIcon("geodb", "geodb-advanced-properties", this); |
57 |
IconThemeHelper.registerIcon("geodb", "geodb-get-view-extent", this); |
58 |
|
59 |
LayerScaleVisibility.selfRegister(); |
60 |
|
61 |
DataManager dataManager = DALLocator.getDataManager(); |
62 |
PluginsManager manager = PluginsLocator.getManager(); |
63 |
DynObject pluginProperties = manager.getPlugin(ExtDB_Spatial.class).getPluginProperties(); |
64 |
if( pluginProperties.getDynValue("explorersPool")==null ) { |
65 |
pluginProperties.setDynValue("explorersPool", dataManager.getDataServerExplorerPool());
|
66 |
} else {
|
67 |
dataManager.setDataServerExplorerPool((DataServerExplorerPool)pluginProperties.getDynValue("explorersPool"));
|
68 |
} |
69 |
|
70 |
HashMap<Object, Object> layersScaleVisibility = new HashMap<>(); |
71 |
Map<String, LayerScaleVisibility> tmp = (Map) pluginProperties.getDynValue(LAYERS_SCALE_VISIBILITY_PARAMETER); |
72 |
if(tmp != null){ |
73 |
layersScaleVisibility.putAll(tmp); |
74 |
} |
75 |
pluginProperties.setDynValue(LAYERS_SCALE_VISIBILITY_PARAMETER, layersScaleVisibility); |
76 |
|
77 |
IconThemeHelper.registerIcon("preferences", "layers-visibility-remember-preferences", this); |
78 |
} |
79 |
|
80 |
@Override
|
81 |
public void execute(String actionCommand) { |
82 |
//do nothing
|
83 |
} |
84 |
|
85 |
@Override
|
86 |
public boolean isEnabled() { |
87 |
return isVisible();
|
88 |
} |
89 |
|
90 |
@Override
|
91 |
public boolean isVisible() { |
92 |
return false; |
93 |
} |
94 |
|
95 |
@Override
|
96 |
public void postInitialize() { |
97 |
super.postInitialize();
|
98 |
|
99 |
// ApplicationLocator.getManager().registerAddTableWizard("DB","DB Tables", WizardDB.class);
|
100 |
// AddLayer.addWizard(WizardVectorialDB.class);
|
101 |
|
102 |
ApplicationLocator.getManager().registerAddTableWizard("DB","DB Tables", WizardDBTabular.class); |
103 |
AddLayer.addWizard(WizardDBVectorial.class); |
104 |
|
105 |
} |
106 |
|
107 |
@Override
|
108 |
public IPreference[] getPreferencesPages() { |
109 |
List<IPreference> prefs = new ArrayList<>(); |
110 |
prefs.add(new LayersVisibilityReminderPage());
|
111 |
|
112 |
return prefs.toArray(new IPreference[prefs.size()]); |
113 |
} |
114 |
|
115 |
|
116 |
} |