示例#1
0
  protected boolean buildStructure(
      OpenableElementInfo info, IProgressMonitor pm, Map newElements, IResource underlyingResource)
      throws ModelException {
    IInterpreterInstall install = null;
    try {
      install = ScriptRuntime.getInterpreterInstall(getScriptProject());
    } catch (CoreException e) {
      if (DLTKCore.DEBUG) {
        e.printStackTrace();
      }
      return false;
    }
    if (install == null) {
      return false;
    }
    List children = new ArrayList();

    TclPackageInfo packageInfo = TclPackagesManager.getPackageInfo(install, this.packageName, true);
    if (packageInfo != null) {
      children.add(new TclPackageElement(this, this.packageName, packageInfo.getVersion()));

      info.setChildren((IModelElement[]) children.toArray(new IModelElement[children.size()]));
    }
    return true;
  }
示例#2
0
  public long getTimeStamp() {
    // Check for package still pressent here or not.
    Set<String> reqs = new HashSet<String>();
    TclPackagesModelProvider.collectRealRequirements(getScriptProject(), reqs);
    IInterpreterInstall install =
        TclPackagesModelProvider.resolveInterpreterInstall(getScriptProject());
    if (install == null) {
      return 0;
    }

    long fetchTime = TclPackagesManager.getTclInterpreterFetchDate(install);
    List<TclPackageInfo> infos = TclPackagesManager.getPackageInfos(install, reqs, true);
    boolean found = false;
    for (TclPackageInfo packageName : infos) {
      if (packageName.getName().equals(this.packageName)) {
        found = true;
        break;
      }
    }
    if (!found) {
      return 0;
    }
    return currentPath.hashCode() * 17 + fetchTime;
  }