Package com.google.code.vimsztool.server

Source Code of com.google.code.vimsztool.server.SzjdeLocateSourceCommand

package com.google.code.vimsztool.server;

import java.util.Set;

import com.google.code.vimsztool.compiler.CompilerContext;
import com.google.code.vimsztool.omni.ClassInfo;
import com.google.code.vimsztool.omni.ClassMetaInfoManager;

public class SzjdeLocateSourceCommand extends SzjdeCommand {

  public String execute() {
    String classPathXml = params.get(SzjdeConstants.PARAM_CLASSPATHXML);
    String className = params.get(SzjdeConstants.PARAM_CLASS_NAME);
    String sourceType = params.get(SzjdeConstants.PARAM_SOURCE_TYPE);
    CompilerContext cc = getCompilerContext(classPathXml);
    ClassMetaInfoManager cmm = cc.getClassMetaInfoManager();

    if (sourceType != null && sourceType.equals("impl")) {
      ClassInfo classInfo = cmm.getMetaInfo(className);
      if (classInfo != null) {
        Set<String> subNames = classInfo.getSubNames();
        if (subNames.size() == 1) {
          className = subNames.toArray(new String[]{})[0];
        }
      }
    }
    String sourcePath = cc.findSourceClass(className);
    if (sourcePath.equals("None")) return sourcePath;
   
    StringBuilder sb = new StringBuilder();
    sb.append(sourcePath).append("\n");
    if (className.indexOf(".") > -1) {
      sb.append(className.substring(className.lastIndexOf(".")+1));
    else {
      sb.append(className);
    }
    return sb.toString();
  }

}
TOP

Related Classes of com.google.code.vimsztool.server.SzjdeLocateSourceCommand

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.