Exemplo n.º 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);
   }
 }
Exemplo n.º 2
0
 @Override
 public boolean equals(Object obj) {
   if (obj instanceof IEnvironment) {
     IEnvironment other = (IEnvironment) obj;
     return environmentId.equals(other.getId());
   }
   return false;
 }
Exemplo n.º 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);
     }
   }
 }
Exemplo n.º 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);
        }
      }
    }
Exemplo n.º 5
0
 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$
   }
 }
Exemplo n.º 6
0
 public String getSeparator() {
   initialize();
   return environment != null ? environment.getSeparator() : "/"; // $NON-NLS-1$
 }
Exemplo n.º 7
0
 public char getPathsSeparatorChar() {
   initialize();
   return environment != null ? environment.getPathsSeparatorChar() : ':';
 }
Exemplo n.º 8
0
 public String getName() {
   initialize();
   return environment != null ? environment.getName() : generateName();
 }
Exemplo n.º 9
0
 public IFileHandle getFile(URI locationURI) {
   initialize();
   return environment != null ? environment.getFile(locationURI) : null;
 }
Exemplo n.º 10
0
 public String getCanonicalPath(IPath path) {
   initialize();
   return environment != null ? environment.getCanonicalPath(path) : path.toString();
 }
Exemplo n.º 11
0
 public String convertPathToString(IPath path) {
   initialize();
   return environment != null ? environment.convertPathToString(path) : path.toString();
 }
Exemplo n.º 12
0
 public boolean connect() {
   initialize();
   return environment != null && environment.connect();
 }
Exemplo n.º 13
0
 public URI getLocationURI() {
   IEnvironment environment = getEnvironment();
   return environment.getURI(fPHPLocationGroup.getLocation());
 }
Exemplo n.º 14
0
 public Object getAdapter(@SuppressWarnings("unchecked") Class adapter) {
   initialize();
   return environment != null ? environment.getAdapter(adapter) : null;
 }
Exemplo n.º 15
0
 public boolean isLocal() {
   initialize();
   return environment != null ? environment.isLocal() : false;
 }
Exemplo n.º 16
0
 public boolean isConnected() {
   initialize();
   return environment != null ? environment.isConnected() : false;
 }
Exemplo n.º 17
0
 public URI getURI(IPath location) {
   initialize();
   return environment != null ? environment.getURI(location) : null;
 }