Revision 283 org.gvsig.toolbox/trunk/org.gvsig.toolbox/org.gvsig.toolbox.gui/src/main/java/es/unex/sextante/gui/modeler/DeleteModelAction.java
DeleteModelAction.java | ||
---|---|---|
1 |
package es.unex.sextante.gui.modeler; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
|
|
5 |
import es.unex.sextante.core.GeoAlgorithm; |
|
6 |
import es.unex.sextante.core.Sextante; |
|
7 |
import es.unex.sextante.gui.core.IToolboxRightButtonAction; |
|
8 |
import es.unex.sextante.gui.core.SextanteGUI; |
|
9 |
|
|
10 |
public class DeleteModelAction |
|
11 |
implements |
|
12 |
IToolboxRightButtonAction { |
|
13 |
|
|
14 |
public boolean canBeExecutedOnAlgorithm(final GeoAlgorithm alg) { |
|
15 |
|
|
16 |
return alg instanceof ModelAlgorithm; |
|
17 |
|
|
18 |
} |
|
19 |
|
|
20 |
|
|
21 |
public void execute(final GeoAlgorithm alg) { |
|
22 |
|
|
23 |
final ModelAlgorithm model = (ModelAlgorithm) alg; |
|
24 |
final File file = new File(model.getFilename()); |
|
25 |
file.delete(); |
|
26 |
SextanteGUI.updateAlgorithmProvider(ModelerAlgorithmProvider.class); |
|
27 |
SextanteGUI.getGUIFactory().updateToolbox(); |
|
28 |
//fillTree(m_sLastSearchString, m_bLastSearchIncludedHelpFiles); |
|
29 |
//collapseAll(); |
|
30 |
|
|
31 |
|
|
32 |
} |
|
33 |
|
|
34 |
|
|
35 |
public String getDescription() { |
|
36 |
|
|
37 |
return Sextante.getText("Delete"); |
|
38 |
|
|
39 |
} |
|
40 |
|
|
41 |
} |
|
1 |
package es.unex.sextante.gui.modeler; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
|
|
5 |
import javax.swing.JOptionPane; |
|
6 |
|
|
7 |
import es.unex.sextante.core.GeoAlgorithm; |
|
8 |
import es.unex.sextante.core.Sextante; |
|
9 |
import es.unex.sextante.gui.core.IToolboxRightButtonAction; |
|
10 |
import es.unex.sextante.gui.core.SextanteGUI; |
|
11 |
|
|
12 |
public class DeleteModelAction |
|
13 |
implements |
|
14 |
IToolboxRightButtonAction { |
|
15 |
|
|
16 |
public boolean canBeExecutedOnAlgorithm(final GeoAlgorithm alg) { |
|
17 |
|
|
18 |
return alg instanceof ModelAlgorithm; |
|
19 |
|
|
20 |
} |
|
21 |
|
|
22 |
|
|
23 |
public void execute(final GeoAlgorithm alg) { |
|
24 |
|
|
25 |
int deleteModelResult = JOptionPane.showConfirmDialog(null, Sextante.getText("are_you_sure_to_delete_the_selected_model"), Sextante.getText("Warning"), JOptionPane.YES_NO_OPTION); |
|
26 |
if (deleteModelResult == JOptionPane.YES_OPTION) { |
|
27 |
final ModelAlgorithm model = (ModelAlgorithm) alg; |
|
28 |
final File file = new File(model.getFilename()); |
|
29 |
file.delete(); |
|
30 |
SextanteGUI.updateAlgorithmProvider(ModelerAlgorithmProvider.class); |
|
31 |
SextanteGUI.getGUIFactory().updateToolbox(); |
|
32 |
} |
|
33 |
|
|
34 |
} |
|
35 |
|
|
36 |
|
|
37 |
public String getDescription() { |
|
38 |
|
|
39 |
return Sextante.getText("Delete"); |
|
40 |
|
|
41 |
} |
|
42 |
|
|
43 |
} |
Also available in: Unified diff