Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 337208 - refactoring performance - creation of temp projects questionable
Summary: refactoring performance - creation of temp projects questionable
Status: CLOSED DUPLICATE of bug 336580
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: m2e (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-15 08:18 EST by Milos Kleint CLA
Modified: 2021-04-19 13:25 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Milos Kleint CLA 2011-02-15 08:18:00 EST
the current infrastructure for refactoring seems to create temporary projects (copying existing pom files) for the purpose of creating a Change without modifying the original file.
Comment 1 Milos Kleint CLA 2011-02-15 08:43:02 EST
the whole infrastructure can be replaced by something along these lines (on condition of leaving the EMF models behind and using the PomEdits infrastructure:

 

 public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
    CompositeChange res = new CompositeChange(getName());
    IStructuredModel model = null;
    try {
      model = StructuredModelManager.getModelManager().getModelForRead(file);
      IDocument document = model.getStructuredDocument();
      IStructuredModel tempModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(
          "org.eclipse.m2e.core.pomFile");
      tempModel.getStructuredDocument().setText(StructuredModelManager.getModelManager(), document.get());
      IDocument tempDocument = tempModel.getStructuredDocument();
      performOnDOMDocument(new OperationTuple((IDOMModel) tempModel, new Operation() {
        public void process(Document document) {
          //TODO 
      }));

      ChangeCreator chc = new ChangeCreator(file, document, tempDocument, getName());
      res.add(chc.createChange());
    } catch(Exception exc) {
      LOG.error("", exc);
    } finally {
      if(model != null) {
        model.releaseFromRead();
      }
    }
    return res;
  }
Comment 2 Matthew Piggott CLA 2011-02-15 13:28:57 EST
This should be fixed for the Exclude refactoring by the patch in bug 336580
Comment 3 Igor Fedorenko CLA 2013-09-28 22:38:12 EDT
as per last comment

*** This bug has been marked as a duplicate of bug 336580 ***
Comment 4 Denis Roy CLA 2021-04-19 13:25:39 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/