svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / contextMenu / actions / CopyDocumentContextMenuAction.java @ 9532
History | View | Annotate | Download (1.5 KB)
1 |
package com.iver.cit.gvsig.project.documents.contextMenu.actions; |
---|---|
2 |
|
3 |
import java.awt.Component; |
4 |
|
5 |
import javax.swing.JOptionPane; |
6 |
|
7 |
import com.iver.andami.PluginServices; |
8 |
import com.iver.cit.gvsig.ProjectExtension; |
9 |
import com.iver.cit.gvsig.project.Project; |
10 |
import com.iver.cit.gvsig.project.documents.ProjectDocument; |
11 |
import com.iver.cit.gvsig.project.documents.exceptions.SaveException; |
12 |
|
13 |
public class CopyDocumentContextMenuAction extends |
14 |
AbstractClipboardDocumentContextMenuAction { |
15 |
|
16 |
public int getOrder() { |
17 |
return 0; |
18 |
} |
19 |
|
20 |
public boolean isVisible(ProjectDocument item, |
21 |
ProjectDocument[] selectedItems) {
|
22 |
return true; |
23 |
} |
24 |
|
25 |
public boolean isEnabled(ProjectDocument item, |
26 |
ProjectDocument[] selectedItems) {
|
27 |
return selectedItems.length > 0; |
28 |
} |
29 |
|
30 |
public void execute(ProjectDocument item, ProjectDocument[] selectedItems) { |
31 |
ProjectExtension projectExtension = (ProjectExtension)PluginServices.getExtension(ProjectExtension.class); |
32 |
Project project = projectExtension.getProject(); |
33 |
String data;
|
34 |
try {
|
35 |
data = project.exportToXML(selectedItems); |
36 |
} catch (SaveException e) {
|
37 |
JOptionPane.showMessageDialog(
|
38 |
(Component)PluginServices.getMainFrame(),
|
39 |
"<html>"+PluginServices.getText(this,"No_ha_sido_posible_realizar_la_operacion")+"</html>",//Mensaje |
40 |
PluginServices.getText(this,"copiar"),//titulo |
41 |
JOptionPane.ERROR_MESSAGE
|
42 |
); |
43 |
return;
|
44 |
} |
45 |
PluginServices.putInClipboard(data); |
46 |
project.setModified(true);
|
47 |
} |
48 |
|
49 |
public String getText() { |
50 |
return PluginServices.getText(this, "copiar"); |
51 |
} |
52 |
|
53 |
} |