/** @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 IPath getBufferPath() { IEnvironment environment = EnvironmentManager.getEnvironment(this); if (environment != null) { return EnvironmentPathUtils.getFullPath(environment, getStorage().getFullPath()); } else { return getStorage().getFullPath(); } }
private void closeEditor(IWorkbenchPage page, IEditorPart editor) { IModelElement modelElement = EditorUtility.getEditorInputModelElement(editor, false); if (modelElement != null) { IEnvironment environment = EnvironmentManager.getEnvironment(modelElement); if (environment != null && !environment.isLocal()) { page.closeEditor(editor, false); } } }