Menu

Program hang when opening vimplugin editor

General
kristi
2008-05-02
2013-06-03
  • kristi

    kristi - 2008-05-02

    I can't open the vimplugin editor.  Eclipse freezes when I try to open a file using the vimplugin editor. 

    The installation seemed to go fine.  I used the eclipse update helper thing with http://vimplugin.sf.net/update.  I restarted eclipse and I see the vimplugin settings in the preferences.  The plugin seems to be registered in the PDE plugin registry.  I get two errors, "Category org.eeedit.view.category not found for view org.vimplugin.views.CommandView.  This view added to 'Other' category.", though these don't seem to be fatal, as I can open the VIM Command View from the "Snow View=>Other" menu.

    I am using Fedora core 8 and the Fedora eclipse-platform package (installed via yum, ver 3.3.0). 

    Errors when running eclipse from command line:
    java.lang.IllegalArgumentException: Attempt to get long field "org.eclipse.swt.widgets.Composite.embeddedHandle" with illegal data type conversion to int
            at sun.reflect.UnsafeFieldAccessorImpl.newGetIllegalArgumentException(UnsafeFieldAccessorImpl.java:64)
            at sun.reflect.UnsafeFieldAccessorImpl.newGetIntIllegalArgumentException(UnsafeFieldAccessorImpl.java:129)
            at sun.reflect.UnsafeLongFieldAccessorImpl.getInt(UnsafeLongFieldAccessorImpl.java:56)
            at java.lang.reflect.Field.getInt(Field.java:517)
            at org.vimplugin.utils.WidHandler.getWID(WidHandler.java:68)
            at org.vimplugin.editors.AbstractVimEditor.createEmbeddedVim(AbstractVimEditor.java:151)
            at org.vimplugin.editors.AbstractVimEditor.createVim(AbstractVimEditor.java:130)
            at org.vimplugin.editors.AbstractVimEditor.createPartControl(AbstractVimEditor.java:109)
            at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:661)
            at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:426)
            at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:592)
            at org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:263)
            at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2721)
            at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2633)
            at org.eclipse.ui.internal.WorkbenchPage.access$12(WorkbenchPage.java:2625)
            at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2577)
            at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
            at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2572)
            at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2556)
            at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2539)
            at org.eclipse.ui.ide.IDE.openEditorOnFileStore(IDE.java:1090)
            at org.eclipse.ui.internal.ide.actions.OpenLocalFileAction.run(OpenLocalFileAction.java:105)
            at org.eclipse.ui.internal.ide.actions.OpenLocalFileAction.run(OpenLocalFileAction.java:75)
            at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:256)
            at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:229)
            at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:545)
            at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490)
            at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:402)
            at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
            at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1101)
            at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3319)
            at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2971)
            at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
            at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
            at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
            at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
            at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
            at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
            at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
            at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
            at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
            at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
            at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
            at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
            at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:623)
            at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:504)
            at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443)
            at org.eclipse.equinox.launcher.Main.run(Main.java:1169)
            at org.eclipse.equinox.launcher.Main.main(Main.java:1144)
    Trying to start vim
    Server started and listening
    Started vim

     
    • kristi

      kristi - 2008-05-05

      So, I've fixed this.  The WidHandler needs to return the parent.embeddedHandler in the getWid() function.  I also made the wid a long so it works with 64 bit systems, and added a sleep while the VimConnection is waiting to connect to the vim server.  Without the sleep, eclipse gets stuck waiting for the connection and hangs.  I will submit a patch to the devel list.

      Code:
      src/org.vimplugin.utils/WidHandler.java snippet
          public static long getWID(Composite parent) {
              Class<?> c = parent.getClass();
              Field f = null;
             
              try {
                  if( Platform.getOS().equals(Platform.OS_LINUX) ) {           
                      //f = c.getField(linuxWID);
                      // the class reflection doesn't work on linux
                      // return the embeddedHandle
                      return parent.embeddedHandle;
                  }
      ...

      src/org.vimplugin/VimServer.java snippet
          public void start(String... args) {
              if (vc != null && vc.isServerRunning())
                  return;

              //setup VimConnection and start server thread
              vc = new VimConnection(ID);
              t = new Thread(vc);
              t.setDaemon(true);
              t.start();

              // starting gvim with Netbeans interface
              try {
                  System.out.println("Trying to start vim");
                  p = new ProcessBuilder(args).start();
                  System.out.println("Started vim");
              } catch (IOException e) {
                  e.printStackTrace();
              }

              // Waits until server starts.. vim should return startupDone
              while (!vc.isServerRunning()) {
                  // sleep so that we don't have a messy cpu-hogging infinite loop here
                  Long stoptime = 2000L; //2 Seconds
                  System.out.println("Waiting to connect to vim server…");
                  try {
                  Thread.sleep(stoptime);
                  } catch (InterruptedException e) {
                      e.printStackTrace();
                  }
              }
          }

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.