Exemple #1
0
  public static synchronized Map<String, IJstType> getJstTypes() {

    if (s_jstTypes != null) {
      return s_jstTypes;
    }

    Map<String, IJstType> jstTypes = new HashMap<String, IJstType>();
    try {
      Class<?> anchorClass = TestDataHelper.class;
      String jstFilename = TEST_DATA_JAR;
      InputStream fio = ResourceUtil.getMandatoryResourceAsStream(anchorClass, jstFilename);
      List<IJstType> deserialize = JstTypeSerializer.getInstance().deserialize(fio);
      for (IJstType t : deserialize) {
        jstTypes.put(t.getName(), t);
      }
      s_jstTypes = jstTypes;
      return jstTypes;
    } catch (RuntimeException e) {
      e.printStackTrace(); // KEEPME
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    return jstTypes;
  }
Exemple #2
0
  public void loadTypesFinished() {

    try {

      final NullProgressMonitor monitor = new NullProgressMonitor();
      isConsistent = false;
      reconcile(true, null, monitor);

      // added by [email protected]
      // this logic is to find the dependents types of the saving jst type
      // and update their validations result accordingly
      try {
        if (jstType != null
            && jstType.getPackage() != null
            && jstType.getPackage().getGroupName() != null
            && jstType.getName() != null) {
          final List<IJstType> dependents =
              mgr.getTypeSpace()
                  .getAllDependents(
                      new TypeName(jstType.getPackage().getGroupName(), jstType.getName()));
          if (dependents != null) {
            final List<ISourceModule> selectedSourceModules = new LinkedList<ISourceModule>();
            final StandardScriptBuilder scriptBuild = new StandardScriptBuilder();
            final ScriptProject scriptProject =
                CodeassistUtils.getScriptProject(jstType.getPackage().getGroupName());
            VjoSourceHelper.getAllSourceModulesFromJst(
                selectedSourceModules, dependents, scriptProject);
            if (selectedSourceModules.size() > 0) {
              scriptBuild.initialize(scriptProject);
              scriptBuild.buildModelElements(
                  scriptProject, selectedSourceModules, new SubProgressMonitor(monitor, 1), 1);
            }
          }
        }
      } catch (Exception e) {
        DLTKCore.error(e.toString(), e);
      } finally {
        monitor.done();
      }

    } catch (CoreException e) {
      DLTKCore.error(e.toString(), e);
    }
  }
Exemple #3
0
  public void printTypes(PrintStream p) {
    p.println("ref types in cache");
    for (IJstType t : m_refTypes.values()) {
      p.println(t.getName());
    }
    p.println("types in cache");
    for (IJstType t : m_types.values()) {
      p.println(t.getName());
    }

    p.println("types in temp");
    for (IJstType t : m_temp) {
      p.println(t.getName());
    }

    p.println("type in lib");
    for (IJstLib lib : m_lib.values()) {

      for (JstType t : lib.getAllTypes(true)) {
        p.println(t.getName());
      }
    }
  }
 @Override
 protected String getName(IJstType type) {
   return type.getName();
 }