root / branches / v2_0_0_prep / applications / appgvSIG / src / org / gvsig / app / project / documents / actions / PasteDocumentAction.java @ 31496
History | View | Annotate | Download (1.48 KB)
1 |
package org.gvsig.app.project.documents.actions; |
---|---|
2 |
|
3 |
import java.util.List; |
4 |
|
5 |
import org.gvsig.andami.PluginServices; |
6 |
import org.gvsig.app.project.Project; |
7 |
import org.gvsig.app.project.ProjectManager; |
8 |
import org.gvsig.app.project.documents.AbstractDocumentAction; |
9 |
import org.gvsig.app.project.documents.Document; |
10 |
import org.gvsig.app.project.documents.gui.ProjectWindow; |
11 |
|
12 |
|
13 |
public class PasteDocumentAction extends AbstractDocumentAction { |
14 |
|
15 |
|
16 |
public PasteDocumentAction() {
|
17 |
super("paste"); |
18 |
this.order = 0; |
19 |
this.title =PluginServices.getText(this, "pegar"); |
20 |
this.group = ProjectManager.getInstance().addDocumentActionGroup("ClipboardActions", "Clipboard actions", null, 0); |
21 |
} |
22 |
|
23 |
public void execute(Document document, List<Document> documents) { |
24 |
String data = PluginServices.getFromClipboard();
|
25 |
if (data == null) { |
26 |
return;
|
27 |
} |
28 |
ProjectWindow window = ProjectManager.getInstance().getCurrentProjectWindow(); |
29 |
Project project = window.getProject(); |
30 |
project.importDocuments( |
31 |
data, |
32 |
window.getDocumentSelected() |
33 |
); |
34 |
} |
35 |
|
36 |
public boolean isAvailable(Document document, List<Document> documents) { |
37 |
String data = PluginServices.getFromClipboard();
|
38 |
if (data == null) { |
39 |
return false; |
40 |
} |
41 |
ProjectWindow window = ProjectManager.getInstance().getCurrentProjectWindow(); |
42 |
Project project = window.getProject(); |
43 |
return project.canImportDocuments(
|
44 |
data, |
45 |
window.getDocumentSelected() |
46 |
); |
47 |
} |
48 |
|
49 |
public boolean isVisible(Document document, List<Document> documents) { |
50 |
return true; |
51 |
} |
52 |
|
53 |
|
54 |
} |