Revision 39579
branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/EditionLocator.java | ||
---|---|---|
16 | 16 |
private static CADToolAdapter adapter=null; |
17 | 17 |
private static Map adapters=new HashMap(); |
18 | 18 |
|
19 |
/** |
|
20 |
* Gets the CADToolAdapter of the view where the layer is |
|
21 |
* contained or null if the layer is not found |
|
22 |
* in any view |
|
23 |
* |
|
24 |
* @param layer |
|
25 |
* @return |
|
26 |
*/ |
|
19 | 27 |
public static CADToolAdapter getCADToolAdapter(FLayer layer) { |
20 | 28 |
Project project = ProjectManager.getInstance().getCurrentProject(); |
21 | 29 |
List<Document> docs = project.getDocuments(); |
... | ... | |
36 | 44 |
return null; |
37 | 45 |
} |
38 | 46 |
|
47 |
/** |
|
48 |
* Gets the CADToolAdapter of the currently active view |
|
49 |
* or the CADToolAdapter of the view that was active more |
|
50 |
* recently (if there is not an active view) |
|
51 |
* or null if there never was an active view |
|
52 |
* |
|
53 |
* @return |
|
54 |
*/ |
|
39 | 55 |
public static CADToolAdapter getCADToolAdapter() { |
40 | 56 |
ViewDocument view = (ViewDocument) ProjectManager.getInstance().getCurrentProject().getActiveDocument(ViewDocument.class); |
41 | 57 |
if( view != null ) { |
... | ... | |
49 | 65 |
return adapter; |
50 | 66 |
} |
51 | 67 |
|
68 |
/** |
|
69 |
* |
|
70 |
* Gets the edition manager of the currently active view |
|
71 |
* or the edition manager of the view that was active more |
|
72 |
* recently (if there is not an active view) |
|
73 |
* or null if there never was an active view. |
|
74 |
* |
|
75 |
* @return |
|
76 |
*/ |
|
52 | 77 |
public static EditionManager getEditionManager() { |
53 | 78 |
CADToolAdapter cta=getCADToolAdapter(); |
54 |
return cta.getEditionManager(); |
|
79 |
if (cta == null) { |
|
80 |
return null; |
|
81 |
} else { |
|
82 |
return cta.getEditionManager(); |
|
83 |
} |
|
84 |
|
|
55 | 85 |
} |
56 | 86 |
} |
Also available in: Unified diff