/** @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); } }
public String convertPathToString(IPath path) { initialize(); return environment != null ? environment.convertPathToString(path) : path.toString(); }