/** @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;
 }
Example #3
0
 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);
     }
   }
 }
Example #4
0
    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;
 }
Example #10
0
 public String getCanonicalPath(IPath path) {
   initialize();
   return environment != null ? environment.getCanonicalPath(path) : path.toString();
 }
Example #11
0
 public String convertPathToString(IPath path) {
   initialize();
   return environment != null ? environment.convertPathToString(path) : path.toString();
 }
Example #12
0
 public boolean connect() {
   initialize();
   return environment != null && environment.connect();
 }
Example #13
0
 public URI getLocationURI() {
   IEnvironment environment = getEnvironment();
   return environment.getURI(fPHPLocationGroup.getLocation());
 }
Example #14
0
 public Object getAdapter(@SuppressWarnings("unchecked") Class adapter) {
   initialize();
   return environment != null ? environment.getAdapter(adapter) : null;
 }
Example #15
0
 public boolean isLocal() {
   initialize();
   return environment != null ? environment.isLocal() : false;
 }
Example #16
0
 public boolean isConnected() {
   initialize();
   return environment != null ? environment.isConnected() : false;
 }
Example #17
0
 public URI getURI(IPath location) {
   initialize();
   return environment != null ? environment.getURI(location) : null;
 }