DeleteScriptAction.patch
org.gvsig.toolbox.gui/src/main/java/es/unex/sextante/gui/cmd/DeleteScriptAction.java (copia locale) | ||
---|---|---|
1 |
package es.unex.sextante.gui.cmd; |
|
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 DeleteScriptAction |
|
11 |
implements |
|
12 |
IToolboxRightButtonAction { |
|
13 |
|
|
14 |
public boolean canBeExecutedOnAlgorithm(final GeoAlgorithm alg) { |
|
15 |
|
|
16 |
return alg instanceof ScriptAlgorithm; |
|
17 |
|
|
18 |
} |
|
19 |
|
|
20 |
public void execute(final GeoAlgorithm alg) { |
|
21 |
|
|
22 |
final ScriptAlgorithm script = (ScriptAlgorithm) alg; |
|
23 |
final File file = new File(script.getFilename()); |
|
24 |
file.delete(); |
|
25 |
SextanteGUI.updateAlgorithmProvider(ScriptAlgorithmProvider.class); |
|
26 |
SextanteGUI.getGUIFactory().updateToolbox(); |
|
27 |
|
|
28 |
} |
|
29 |
|
|
30 |
public String getDescription() { |
|
31 |
|
|
32 |
return Sextante.getText("Delete"); |
|
33 |
|
|
34 |
} |
|
35 |
|
|
36 |
} |
org.gvsig.toolbox.gui/src/main/java/es/unex/sextante/gui/cmd/ScriptAlgorithm.java (copia locale) | ||
---|---|---|
218 | 218 |
|
219 | 219 |
} |
220 | 220 |
|
221 |
|
|
222 |
public String getFilename() { |
|
223 |
|
|
224 |
return m_sDescriptionFile; |
|
225 |
|
|
226 |
} |
|
227 |
|
|
221 | 228 |
} |
org.gvsig.toolbox.gui/src/main/java/es/unex/sextante/gui/cmd/ScriptAlgorithmProvider.java (copia locale) | ||
---|---|---|
14 | 14 |
import es.unex.sextante.gui.core.SextanteGUI; |
15 | 15 |
import es.unex.sextante.gui.core.ToolboxAction; |
16 | 16 |
import es.unex.sextante.gui.help.HelpIO; |
17 |
import es.unex.sextante.gui.modeler.DeleteModelAction; |
|
17 | 18 |
import es.unex.sextante.gui.settings.Setting; |
18 | 19 |
import es.unex.sextante.gui.settings.SextanteScriptsSettings; |
19 | 20 |
|
... | ... | |
138 | 139 |
|
139 | 140 |
public IToolboxRightButtonAction[] getToolboxRightButtonActions() { |
140 | 141 |
|
141 |
return new IToolboxRightButtonAction[] { new EditScriptAction() }; |
|
142 |
return new IToolboxRightButtonAction[] { new EditScriptAction(), new DeleteScriptAction() };
|
|
142 | 143 |
|
143 | 144 |
} |
144 | 145 |
|