Examples of VimConnection


Examples of org.vimplugin.VimConnection

    // workaround for not using buggy startDocumentListen support of vim's
    // netbeans protocol.
    if (event.equals("modified") ||
        (event.equals("keyCommand") && ve.getArgument(0).equals("\"modified\""))){
      VimPlugin plugin = VimPlugin.getDefault();
      VimConnection vc = ve.getConnection();
      VimServer server = vc != null ? plugin.getVimserver(vc.getVimID()) : null;
      if (server != null){
        for (VimEditor editor : server.getEditors()){
          if (editor != null && editor.getBufferID() == ve.getBufferID()){
            editor.setDirty(true);
          }
View Full Code Here

Examples of org.vimplugin.VimConnection

    if (filePath != null){
      editorGUI = new Canvas(parent, SWT.EMBEDDED);

      //create a vim instance
      VimConnection vc = createVim(projectPath, filePath, parent);

      viewer = new VimViewer(
          bufferID, vc, editorGUI != null ? editorGUI : parent, SWT.EMBEDDED);
      viewer.getTextWidget().setVisible(false);
      viewer.setDocument(document);
View Full Code Here

Examples of org.vimplugin.VimConnection

    //get bufferId
    bufferID = plugin.getNumberOfBuffers();
    plugin.setNumberOfBuffers(bufferID + 1);

    IStatus status = null;
    VimConnection vc = null;
    if (embedded) {
      try {
        vc = createEmbeddedVim(workingDir, filePath, editorGUI);
      } catch (Exception e) {
        embedded = false;
View Full Code Here

Examples of org.vimplugin.VimConnection

    VimPlugin plugin = VimPlugin.getDefault();
    boolean first = plugin.getVimserver(VimPlugin.DEFAULT_VIMSERVER_ID) == null;
    serverID = tabbed ? plugin.getDefaultVimServer() : plugin.createVimServer();
    plugin.getVimserver(serverID).start(workingDir, filePath, tabbed, first);

    VimConnection vc = plugin.getVimserver(serverID).getVc();
    vc.command(bufferID, "editFile", "\"" + filePath + "\"");

    if (documentListen){
      vc.command(bufferID, "startDocumentListen", "");
    }else{
      vc.command(bufferID, "stopDocumentListen", "");
    }
    return vc;
  }
View Full Code Here

Examples of org.vimplugin.VimConnection

    plugin.getVimserver(serverID).start(workingDir, wid);

    //int h = parent.getClientArea().height;
    //int w = parent.getClientArea().width;

    VimConnection vc = plugin.getVimserver(serverID).getVc();
    //vc.command(bufferID, "setLocAndSize", h + " " + w);
    vc.command(bufferID, "editFile", "\"" + filePath + "\"");
    if (documentListen){
      vc.command(bufferID, "startDocumentListen", "");
    }else{
      vc.command(bufferID, "stopDocumentListen", "");
    }
    return vc;
  }
View Full Code Here

Examples of org.vimplugin.VimConnection

        }catch(Exception e){
          logger.error("Error redrawing vim after file close.", e);
        }
      } else {
        try {
          VimConnection vc = server.getVc();
          if (vc != null){
            server.getVc().function(bufferID, "saveAndExit", "");
          }
          plugin.stopVimServer(serverID);
        } catch (IOException e) {
View Full Code Here

Examples of org.vimplugin.VimConnection

    if (embedded){
      parent.setFocus();
    }

    VimPlugin plugin = VimPlugin.getDefault();
    VimConnection conn = plugin.getVimserver(serverID).getVc();

    // get the current offset which "setDot" requires.
    //String offset = "0";
    try{
      String cursor = conn.function(bufferID, "getCursor", "");
      if (cursor == null){
        // the only case that i know of where this happens is if the file is
        // open somewhere else and gvim is prompting the user as to how to
        // proceed.  Exit now or the gvim prompt will be sent to the background.
        return;
      }
    }catch(IOException ioe){
      logger.error("Unable to get cursor position.", ioe);
    }
    // Brings the corresponding buffer to top
    //conn.command(bufferID, "setDot", offset);
    // Brings the vim editor window to top
    conn.command(bufferID, "raise", "");

    // to fully focus gvim, we need to simulate a mouse click.
    // Should this be optional, via a preference? There is the potential for
    // weirdness here.
    if (embedded && parent.getDisplay().getActiveShell() != null){
View Full Code Here

Examples of org.vimplugin.VimConnection

  {
    if(getEditorInput() != null){
      String oldFilePath = getFilePath(getEditorInput());
      String newFilePath = getFilePath(input);
      if (!oldFilePath.equals(newFilePath)){
        VimConnection vc = VimPlugin.getDefault()
          .getVimserver(serverID).getVc();

        if (input instanceof IFileEditorInput){
          IProject project = selectedFile.getProject();
          IPath path = project.getRawLocation();
          if(path == null){
            String name = project.getName();
            path = ResourcesPlugin.getWorkspace().getRoot().getRawLocation();
            path = path.append(name);
          }
          String projectPath = path.toPortableString();

          if (newFilePath.toLowerCase().indexOf(projectPath.toLowerCase()) != -1){
            newFilePath = newFilePath.substring(projectPath.length() + 1);
          }
        }

        if (isDirty()){
          vc.remotesend("<esc>:saveas! " + newFilePath.replace(" ", "\\ ") + "<cr>");
        }else{
          vc.command(bufferID, "editFile", "\"" + newFilePath + "\"");
        }
      }
    }

    super.doSetInput(input);
View Full Code Here

Examples of org.vimplugin.VimConnection

    // workaround eclim includes an autocommand which sends an equivalent
    // keyCommand.
    if (event.equals("unmodified") ||
        (event.equals("keyCommand") && ve.getArgument(0).equals("\"unmodified\""))){
      VimPlugin plugin = VimPlugin.getDefault();
      VimConnection vc = ve.getConnection();
      VimServer server = vc != null ? plugin.getVimserver(vc.getVimID()) : null;
      if (server != null){
        for (VimEditor editor : server.getEditors()){
          if (editor != null && editor.getBufferID() == ve.getBufferID()){
            editor.setDirty(false);
          }
View Full Code Here

Examples of org.vimplugin.VimConnection

    // vim has a fileClosed event, but it is not implemented.
    if (event.equals("keyCommand") &&
        (argument = ve.getArgument(0)).startsWith("\"fileClosed ")){
      IPath filePath = new Path(argument.substring(12, argument.length() - 1));
      VimPlugin plugin = VimPlugin.getDefault();
      VimConnection vc = ve.getConnection();
      VimServer server = plugin.getVimserver(vc.getVimID());
      for (VimEditor editor : server.getEditors()){
        IPath location = editor.getSelectedFile().getRawLocation();
        if (filePath.equals(location)){
          editor.forceDispose();
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.