Package org.vimplugin

Examples of org.vimplugin.VimServer


    // vim has a fileClosed event, but it is not implemented.
    if (event.equals("keyCommand") &&
        (argument = ve.getArgument(0)).startsWith("\"bufferEnter ")){
      String filePath = argument.substring(13, argument.length() - 1);
      filePath = filePath.substring(1, filePath.length() - 1);
      VimServer server = VimPlugin.getDefault()
        .getVimserver(ve.getConnection().getVimID());
      for (VimEditor veditor : server.getEditors()) {
        if (veditor.getBufferID() == ve.getBufferID() || server.isEmbedded()) {
          veditor.setTitleTo(filePath);
        }
      }
    }
  }
View Full Code Here


    // 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

  public void handleEvent(VimEvent ve) throws VimException {
    String event = ve.getEvent();

    if (event.equals("disconnect") || event.equals("killed")) {
      VimPlugin plugin = VimPlugin.getDefault();
      VimServer server = plugin.getVimserver(ve.getConnection().getVimID());

      for (final VimEditor veditor : server.getEditors()) {
        if (veditor != null) {
          if (event.equals("disconnect") ||
              veditor.getBufferID() == ve.getBufferID())
          {
            veditor.forceDispose();
          }
        }
      }

      if (event.equals("disconnect") || server.getEditors().size() == 0){
        try {
          ve.getConnection().close();
        } catch (IOException e) {
          throw new VimException("could not close the vim connection", e);
        }

        plugin.stopVimServer(server.getID());
      }
    }
  }
View Full Code Here

    }

    VimPlugin plugin = VimPlugin.getDefault();

    alreadyClosed = true;
    VimServer server = plugin.getVimserver(serverID);
    if (server != null){
      server.getEditors().remove(this);

      if (save && dirty) {
        server.getVc().command(bufferID, "save", "");
        dirty = false;
        firePropertyChange(PROP_DIRTY);
      }

      if (server.getEditors().size() > 0) {
        server.getVc().command(bufferID, "close", "");
        String gvim = VimPlugin.getDefault().getPreferenceStore().getString(
            PreferenceConstants.P_GVIM);
        String[] args = new String[5];
        args[0] = gvim;
        args[1] = "--servername";
        args[2] = String.valueOf(server.getID());
        args[3] = "--remote-send";
        args[4] = "<esc>:redraw!<cr>";
        try{
          CommandExecutor.execute(args, 1000);
        }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) {
          message(plugin.getMessage("server.stop.failed"), e);
        }
View Full Code Here

  public void handleEvent(VimEvent ve) throws VimException {
    String event = ve.getEvent();
    if (event.equals("fileOpened") == true) {
      String filePath = ve.getArgument(0);
      filePath = filePath.substring(1, filePath.length() - 1);
      VimServer server = VimPlugin.getDefault()
        .getVimserver(ve.getConnection().getVimID());
      for (VimEditor veditor : server.getEditors()) {
        if (veditor.getBufferID() == ve.getBufferID() || !server.isExternalTabbed()) {
          veditor.setTitleTo(filePath);
        }
      }
    }
  }
View Full Code Here

    // 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

    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

Related Classes of org.vimplugin.VimServer

Copyright © 2018 www.massapicom. 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.