Ok.. .today I tried the patch provided by Mauricio but still no luck!
I registerd the MegeView in the Map Perspective and used the MergeView.ID as an argument to ApplicationGIS.getView().. ..but I always get to the NPE (to follow) when I try to grab it.
I feel I am not satisfying some basic requirement all of your suggestions are giving as met.
java.lang.NullPointerException
at eu.udig.tools.merge.MergeOperation$1.run(MergeOperation.java:50)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at net.refractions.udig.internal.ui.UDIGApplication.start(UDIGApplication.java:138)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
2012/6/22 Mauricio Pazos
<mauricio.pazos@xxxxxxxxx>
On Friday, June 22, 2012 03:54:53 PM Marco Foi wrote:
> Thanks to both of you, Mauricio and Andre but I had no luck with your
> snippets of code.
> I keep getting NullPointerException all over around.
Tip: It is better strategy print all the stack to get more useful information.
I mean
...
catch (Exception ex) {
ex.printStackTrace();
// System.out.print("Error: "+ex.toString());
}
...
I realized that the operation is using the MergeTool.ID to get the View. It
should be MergeView.ID. That is
public void run() {
try {
// = (MergeView) ApplicationGIS.getView(true, MergeTool.ID); << need a view
mergeView= (MergeView) ApplicationGIS.getView(true, MergeView.ID);
... I comment the following in order to try if the view is open.
//mergeView.addSourceFeatures(selectedFeatures);
//mergeView.display();
Additionaly the view shoud be register in a perspective so I add the
perspective extension:
<extension
point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
targetID="net.refractions.udig.ui.mapPerspective">
<viewShortcut
id="eu.udig.tools.merge.internal.view.MergeView">
</viewShortcut>
</perspectiveExtension>
</extension>
>
> Hoping to have brighter ideas next week.
>
> Marco
I have attached a patch with my hack
cheers
--
Mauricio Pazos