gvsig-vectorediting / org.gvsig.vectorediting / trunk / org.gvsig.vectorediting / org.gvsig.vectorediting.app / org.gvsig.vectorediting.app.mainplugin / src / main / java / org / gvsig / vectorediting / app / mainplugin / extensions / EditingExtension.java @ 23
History | View | Annotate | Download (1.28 KB)
1 |
/*
|
---|---|
2 |
* Copyright 2014 DiSiD Technologies S.L.L. All rights reserved.
|
3 |
*
|
4 |
* Project : DiSiD org.gvsig.vectorediting.app.mainplugin
|
5 |
* SVN Id : $Id$
|
6 |
*/
|
7 |
package org.gvsig.vectorediting.app.mainplugin.extensions; |
8 |
|
9 |
import org.gvsig.app.project.documents.view.gui.DefaultViewPanel; |
10 |
import org.gvsig.fmap.dal.exception.DataException; |
11 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
12 |
import org.gvsig.vectorediting.app.mainplugin.BaseEditingServiceExtension; |
13 |
|
14 |
public class EditingExtension extends BaseEditingServiceExtension { |
15 |
|
16 |
/**
|
17 |
*
|
18 |
*/
|
19 |
private static final long serialVersionUID = -5586086889681840048L; |
20 |
|
21 |
public void execute(String arg0) { |
22 |
|
23 |
DefaultViewPanel vista = getActiveView(); |
24 |
|
25 |
if (vista != null) { |
26 |
FLyrVect layer = getActiveLayer(vista); |
27 |
|
28 |
if (canBeEdited(layer)) {
|
29 |
try {
|
30 |
manager.beginEdition(layer, vista); |
31 |
} |
32 |
catch (DataException e) {
|
33 |
// TODO Auto-generated catch block
|
34 |
e.printStackTrace(); |
35 |
} |
36 |
} |
37 |
|
38 |
} |
39 |
} |
40 |
|
41 |
public void initialize() {} |
42 |
|
43 |
public boolean isEnabled() { |
44 |
DefaultViewPanel vista = getActiveView(); |
45 |
FLyrVect activeLayer = getActiveLayer(vista); |
46 |
|
47 |
return (canBeEdited(activeLayer) ? true : false); |
48 |
|
49 |
} |
50 |
|
51 |
public boolean isVisible() { |
52 |
return true; |
53 |
} |
54 |
|
55 |
} |