/** @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);
   }
 }
 @Override
 public boolean equals(Object obj) {
   if (obj instanceof IEnvironment) {
     IEnvironment other = (IEnvironment) obj;
     return environmentId.equals(other.getId());
   }
   return false;
 }
 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);
     }
   }
 }
    public void changeControlPressed(DialogField field) {
      IEnvironment environment = getEnvironment();
      IEnvironmentUI environmentUI = (IEnvironmentUI) environment.getAdapter(IEnvironmentUI.class);
      if (environmentUI != null) {
        String selectedDirectory = environmentUI.selectFolder(getShell());

        if (selectedDirectory != null) {
          // fLocation.setText(selectedDirectory);
          DLTKUIPlugin.getDefault()
              .getDialogSettings()
              .put(DIALOGSTORE_LAST_EXTERNAL_LOC, selectedDirectory);
        }
      }
    }
 private void initialize() {
   if (environment == null) {
     environment = resolveEnvironment(environmentId);
     if (DEBUG)
       if (environment != null)
         System.out.println(
             getClass().getName()
                 + " - resolved "
                 + environmentId
                 + " to "
                 + environment.getClass().getSimpleName()); // $NON-NLS-1$ //$NON-NLS-2$
   }
 }
 public String getSeparator() {
   initialize();
   return environment != null ? environment.getSeparator() : "/"; // $NON-NLS-1$
 }
 public char getPathsSeparatorChar() {
   initialize();
   return environment != null ? environment.getPathsSeparatorChar() : ':';
 }
 public String getName() {
   initialize();
   return environment != null ? environment.getName() : generateName();
 }
 public IFileHandle getFile(URI locationURI) {
   initialize();
   return environment != null ? environment.getFile(locationURI) : null;
 }
 public String getCanonicalPath(IPath path) {
   initialize();
   return environment != null ? environment.getCanonicalPath(path) : path.toString();
 }
 public String convertPathToString(IPath path) {
   initialize();
   return environment != null ? environment.convertPathToString(path) : path.toString();
 }
 public boolean connect() {
   initialize();
   return environment != null && environment.connect();
 }
 public URI getLocationURI() {
   IEnvironment environment = getEnvironment();
   return environment.getURI(fPHPLocationGroup.getLocation());
 }
 public Object getAdapter(@SuppressWarnings("unchecked") Class adapter) {
   initialize();
   return environment != null ? environment.getAdapter(adapter) : null;
 }
 public boolean isLocal() {
   initialize();
   return environment != null ? environment.isLocal() : false;
 }
 public boolean isConnected() {
   initialize();
   return environment != null ? environment.isConnected() : false;
 }
 public URI getURI(IPath location) {
   initialize();
   return environment != null ? environment.getURI(location) : null;
 }