Revision 33278 branches/v2_0_0_prep/extensions/org.gvsig.annotation.app/org.gvsig.annotation.app.extension/src/main/java/org/gvsig/annotation/app/extension/AnnotationExtension.java
AnnotationExtension.java | ||
---|---|---|
38 | 38 |
import org.gvsig.fmap.mapcontext.MapContext; |
39 | 39 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
40 | 40 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
41 |
import org.gvsig.tools.ToolsLocator; |
|
42 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
|
43 |
import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
|
41 | 44 |
import org.gvsig.tools.service.ServiceException; |
42 | 45 |
|
43 | 46 |
/** |
... | ... | |
47 | 50 |
* @version $Id$ |
48 | 51 |
*/ |
49 | 52 |
public class AnnotationExtension extends Extension { |
50 |
|
|
51 | 53 |
private AnnotationManager manager; |
52 | 54 |
private AnnotationSwingManager swingManager; |
53 | 55 |
|
54 | 56 |
public void initialize() { |
55 |
// Do nothing |
|
57 |
ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager(); |
|
58 |
ExtensionPoint ep = extensionPoints.add("AplicationPreferences", ""); |
|
59 |
|
|
60 |
ep.append("AnnotationPreferencesPage", "", new AnnotationPreferencesPage()); |
|
61 |
|
|
62 |
PluginServices.getIconTheme().registerDefault( |
|
63 |
"annotation-properties", |
|
64 |
AnnotationPreferencesPage.class.getClassLoader().getResource("images/AnnotationProperties.png") |
|
65 |
); |
|
56 | 66 |
} |
57 | 67 |
|
58 | 68 |
@Override |
... | ... | |
67 | 77 |
|
68 | 78 |
public void execute(String actionCommand) { |
69 | 79 |
org.gvsig.andami.ui.mdiManager.IWindow window = PluginServices.getMDIManager().getActiveWindow(); |
70 |
|
|
80 |
|
|
71 | 81 |
if (window instanceof DefaultViewPanel) { |
72 | 82 |
DefaultViewPanel viewPanel = (DefaultViewPanel) window; |
73 | 83 |
ViewDocument viewDocument = viewPanel.getModel(); |
74 | 84 |
MapContext mapContext = viewDocument.getMapContext(); |
75 | 85 |
FLayer[] actives = mapContext.getLayers().getActives(); |
76 |
|
|
86 |
|
|
77 | 87 |
FLyrVect fLyrVect = null; |
78 | 88 |
for (int i=0 ; i<actives.length ; i++){ |
79 | 89 |
if (actives[i] instanceof FLyrVect){ |
... | ... | |
81 | 91 |
break; |
82 | 92 |
} |
83 | 93 |
} |
84 |
|
|
94 |
|
|
85 | 95 |
if (fLyrVect == null){ |
86 | 96 |
return; |
87 | 97 |
} |
88 |
|
|
98 |
|
|
89 | 99 |
showAnnotation(manager, (FeatureStore)fLyrVect.getDataStore(), viewPanel); |
90 | 100 |
} |
91 | 101 |
} |
... | ... | |
95 | 105 |
AnnotationCreationService service = |
96 | 106 |
(AnnotationCreationService) manager.getAnnotationCreationService(featureStore); |
97 | 107 |
service.setAnnotationCreationFinishAction(new AddLayerFinishAction(defaultViewPanel)); |
98 |
|
|
108 |
|
|
99 | 109 |
JAnnotationCreationServicePanel panel = |
100 | 110 |
swingManager.createAnnotation(service); |
101 | 111 |
swingManager.getWindowManager().showWindow(panel, "Annotation", |
... | ... | |
129 | 139 |
} |
130 | 140 |
return false; |
131 | 141 |
} |
132 |
|
|
133 | 142 |
} |
Also available in: Unified diff