Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[udig-devel] Fixing merge tool with operation: ViewPart howto?

With the explicit intent of both informing the dev community and asking for help, I am reporting my activities within the GSoC project.

I decided to add an operation to the eu.udig.tools.merge to allow for merging features selected with the core selection tools (suggested by Jody https://jira.codehaus.org/browse/UDIG-1921 ).

The workflow is:
- the users adds a layer
- the users selects a number of features of his interest using "Box selection" or "Feature selection" core tools
- the users right-clicks on the layer -> operation -> "Merge selected" (the newly added operation!)
- the selected features are "passed" to the MergeView (available in the eu.merge.tools.merge.internal.view): the view that ultimately calls the methods to process geometries.

The workflow (should) proceed as before, using the MergeView features to eventually remove features and select text attributes of the output merged feature.


THE PROBLEM

How can a ViewPart be opened in uDig by code? (MergeView extends ViewPart)
I can retrieve selected features but I found no way to open the view (to use its addSourceFeatures() method)
It seems that since the operation I created is not in the UI-therad (or something like that), a pretty basic code line such:

MergeView view = (MergeView) ApplicationGIS.getView(true, MergeView.ID);

fails with a NullPointerException, caused by a Display.getCurrent() returning null in a private method down inside ApplicationGIS.

Any hint?

Marco


Back to the top