svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.daltransform.app / org.gvsig.daltransform.app.mainplugin / src / main / java / org / gvsig / daltransform / app / mainplugin / DataTransformExtension.java @ 43939
History | View | Annotate | Download (4.47 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 |
/*
|
25 |
* AUTHORS (In addition to CIT):
|
26 |
* 2009 {Iver T.I.} {Task}
|
27 |
*/
|
28 |
|
29 |
package org.gvsig.daltransform.app.mainplugin; |
30 |
|
31 |
|
32 |
import javax.swing.JOptionPane; |
33 |
|
34 |
import org.slf4j.Logger; |
35 |
import org.slf4j.LoggerFactory; |
36 |
|
37 |
import org.gvsig.andami.IconThemeHelper; |
38 |
import org.gvsig.andami.PluginServices; |
39 |
import org.gvsig.andami.plugins.Extension; |
40 |
import org.gvsig.app.ApplicationLocator; |
41 |
import org.gvsig.app.ApplicationManager; |
42 |
import org.gvsig.daltransform.DataTransformLocator; |
43 |
import org.gvsig.daltransform.DataTransformManager; |
44 |
import org.gvsig.daltransform.swing.JDialogDataTransformList; |
45 |
import org.gvsig.i18n.Messages; |
46 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
47 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
48 |
|
49 |
/**
|
50 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
51 |
*/
|
52 |
public class DataTransformExtension extends Extension { |
53 |
|
54 |
private static final Logger logger = |
55 |
LoggerFactory.getLogger(DataTransformExtension.class); |
56 |
|
57 |
/*
|
58 |
* (non-Javadoc)
|
59 |
*
|
60 |
* @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
|
61 |
*/
|
62 |
public void execute(String actionCommand) { |
63 |
ApplicationManager application = ApplicationLocator.getManager(); |
64 |
DataTransformManager manager = |
65 |
DataTransformLocator.getDataTransformManager(); |
66 |
|
67 |
if ("CREATE".equalsIgnoreCase(actionCommand)) { |
68 |
try {
|
69 |
PluginServices.getMDIManager().addWindow( |
70 |
manager.createWizard().getWindow()); |
71 |
|
72 |
} catch (Exception e) { |
73 |
|
74 |
logger.info("Error while creating data transform wizard", e);
|
75 |
ApplicationLocator.getManager().messageDialog( |
76 |
Messages.getText("transform_create_wizard_exception") +
|
77 |
": " + e.getMessage(),
|
78 |
Messages.getText("feature_transform"),
|
79 |
JOptionPane.ERROR_MESSAGE);
|
80 |
|
81 |
} |
82 |
} else
|
83 |
if ("VIEW".equalsIgnoreCase(actionCommand)) { |
84 |
|
85 |
// there is no layer loaded
|
86 |
if (application.getActiveDocument() == null) { |
87 |
JOptionPane.showMessageDialog(null, |
88 |
Messages.getText("not_featurestore_loaded"),
|
89 |
Messages.getText("view_transforms"),
|
90 |
JOptionPane.OK_OPTION + JOptionPane.WARNING_MESSAGE); |
91 |
return;
|
92 |
} |
93 |
|
94 |
JDialogDataTransformList dialog = |
95 |
manager.createJDialogDataTransformList(); |
96 |
|
97 |
|
98 |
WindowManager wm = ToolsSwingLocator.getWindowManager(); |
99 |
wm.showWindow( |
100 |
dialog, |
101 |
Messages.getText("view_transforms"),
|
102 |
WindowManager.MODE.WINDOW |
103 |
); |
104 |
} |
105 |
|
106 |
} |
107 |
|
108 |
/*
|
109 |
* (non-Javadoc)
|
110 |
*
|
111 |
* @see com.iver.andami.plugins.IExtension#initialize()
|
112 |
*/
|
113 |
public void initialize() { |
114 |
IconThemeHelper.registerIcon("feature-transform-tools", "feature-transform-wizard", this); |
115 |
} |
116 |
|
117 |
/*
|
118 |
* (non-Javadoc)
|
119 |
*
|
120 |
* @see com.iver.andami.plugins.Extension#postInitialize()
|
121 |
*/
|
122 |
@Override
|
123 |
public void postInitialize() { |
124 |
super.postInitialize();
|
125 |
} |
126 |
|
127 |
/*
|
128 |
* (non-Javadoc)
|
129 |
*
|
130 |
* @see com.iver.andami.plugins.IExtension#isEnabled()
|
131 |
*/
|
132 |
public boolean isEnabled() { |
133 |
return true; |
134 |
} |
135 |
|
136 |
/*
|
137 |
* (non-Javadoc)
|
138 |
*
|
139 |
* @see com.iver.andami.plugins.IExtension#isVisible()
|
140 |
*/
|
141 |
public boolean isVisible() { |
142 |
return true; |
143 |
} |
144 |
} |