-1

eclipse プラグインを開発しています。コンテキスト メニューを使用して、選択した javaproject のパッケージのみを取得したいと考えています。ハンドラーで使用する選択を取得し、それを mywizard ページに渡しました。選択をtreeviewersetinputとして設定できません。treeViewer.setInput(selection) を使用する場合。

ウィザードページでこのような選択をしました。

コードスニペット:

public void init(IStructuredSelection selection) 
    {
        Object firstElement = selection.getFirstElement();
        if (firstElement instanceof IJavaProject) {
            IJavaProject javaProject = (IJavaProject) firstElement;
            IFolder folder = javaProject.getProject().getFolder("src");
             srcFolder = javaProject
                    .getPackageFragmentRoot(folder);

                System.out.println(srcFolder.getPath().isRoot());

                    System.out.println(firstElement);
                    treeViewer.setInput(srcFolder);

        }
    }




**i am getting error as:**





  src
            <default> (...)
            com (...)
            com.hcl (not open)
            com.hcl.example (not open)
            com.hcl.example.menu (not open)
            com.hcl.example.menu.handlers (not open)

        !ENTRY org.eclipse.ui 4 0 2013-07-28 15:50:07.870
        !MESSAGE Unhandled event loop exception
        !STACK 0
        org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException
            at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
            at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:229)
            at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:210)
            at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:131)
            at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:171)
            at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:814)
            at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.handleWidgetSelection(HandledContributionItem.java:707)
            at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.access$7(HandledContributionItem.java:691)
            at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem$4.handleEvent(HandledContributionItem.java:630)
            at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
            at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
            at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
            at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
            at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1029)
            at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
            at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:923)
            at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
            at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
            at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
            at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
            at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
            at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
            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:353)
            at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
            at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
            at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
            at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
        Caused by: java.lang.NullPointerException
            at com.hcl.green.type.handler.GenerateGreenfieldLayer.init(GenerateGreenfieldLayer.java:333)
            at com.hcl.green.type.handler.GreenWizard.addPages(GreenWizard.java:53)
            at org.eclipse.jface.wizard.WizardDialog.createContents(WizardDialog.java:605)
            at org.eclipse.jface.window.Window.create(Window.java:431)
            at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1089)
            at org.eclipse.jface.window.Window.open(Window.java:790)
            at com.hcl.green.type.handler.GreenSelectionHandler.execute(GreenSelectionHandler.java:70)
            at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:290)
            at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:76)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
            ... 34 more

誰でも続行方法を教えてください。

4

1 に答える 1

-2

null行方不明のチェックのように見えます

com.hcl.green.type.handler.GenerateGreenfieldLayer.init(GenerateGreenfieldLayer.java:333)
于 2013-07-29T01:29:35.920 に答える