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