コード例 #1
0
 /** @since 2.0 */
 @Override
 public void delete(boolean force, IProgressMonitor monitor) {
   // Remove correction for this module from all places.
   final IScriptProject scriptProject = getScriptProject();
   final IEnvironment environment = EnvironmentManager.getEnvironment(scriptProject);
   TclProjectInfo project = TclPackagesManager.getTclProject(scriptProject.getElementName());
   EList<TclModuleInfo> modules = project.getModules();
   String path = environment.convertPathToString(getFullPath()).toString();
   for (TclModuleInfo tclModuleInfo : modules) {
     EList<UserCorrection> corrections = tclModuleInfo.getSourceCorrections();
     EList<TclSourceEntry> sourced = tclModuleInfo.getSourced();
     EList<UserCorrection> sourceCorrections = tclModuleInfo.getSourceCorrections();
     for (TclSourceEntry tclSourceEntry : sourced) {
       String value = tclSourceEntry.getValue();
       if (value.contains("$") && value.equals(getOriginalName())) {
         for (UserCorrection userCorrection : sourceCorrections) {
           if (userCorrection.getOriginalValue().equals(value)) {
             userCorrection.getUserValue().remove(path);
           }
         }
       }
     }
   }
   TclPackagesManager.save();
   // Do delta refresh
   try {
     ModelManager.getModelManager()
         .getDeltaProcessor()
         .checkExternalChanges(
             new IModelElement[] {getScriptProject()}, new NullProgressMonitor());
   } catch (ModelException e) {
     DLTKCore.error("Failed to call for model update:", e);
   }
 }
コード例 #2
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;
  }
コード例 #3
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;
  }