This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 210673

Summary: Add a method to remove item from refactoring context.
Product: editor Reporter: Ralph Ruijs <ralphbenjamin>
Component: RefactoringAssignee: Ralph Ruijs <ralphbenjamin>
Status: RESOLVED FIXED    
Severity: normal CC: jglick, ralphbenjamin
Priority: P3 Keywords: API, API_REVIEW_FAST
Version: 7.2   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: Changes
Related class
Updated patch

Description Ralph Ruijs 2012-04-04 08:40:35 UTC
Some refactoring implementations use the refactoring context to store information about the "environment" of the refactoring. A new method is needed to remove information from this context to be able to correctly refresh/reconfigure these refactorings.


The method is already in trunk, but should have been reviewed. Please review  attached patch and related class.


Thanks
Comment 1 Ralph Ruijs 2012-04-04 08:49:31 UTC
Created attachment 117793 [details]
Changes
Comment 2 Ralph Ruijs 2012-04-04 08:50:42 UTC
Created attachment 117794 [details]
Related class
Comment 3 Jesse Glick 2012-04-10 23:35:53 UTC
Context Javadoc should explain that it acts as a Map<Class,Object> keyed off the concrete implementation class of the "values", since is neither obvious nor consistent with either Set<Object> or AbstractLookup semantics.


add(...) could be simplified to:

Parameters.notNull("value", value);
remove(value.getClass());
instanceContent.add(value);
Comment 4 Ralph Ruijs 2012-04-11 13:11:10 UTC
Created attachment 118126 [details]
Updated patch

Updated the patch with Jesse's comments.


Will integrate tomorrow.
Comment 5 Jesse Glick 2012-04-11 13:43:58 UTC
BTW in Javadoc pay attention to the location of the summary sentence, boldfaced in the editor; currently it is I think

  Context contains "environment" in which the refactoring was invoked e.g.

which makes no sense. Also "Context acts as a..." looks like it is supposed to be a new paragraph but is not using <p> to indicate this. So you probably want something like

 /**
  * A context is the environment in which the refactoring was invoked.
  * For example, Java refactoring might add an instance of {@code ClasspathInfo}.
  * <p>The context acts as a {@code Map<Class,Object>} keyed off the concrete
  * implementation classes of the values.
Comment 6 Ralph Ruijs 2012-04-12 09:51:23 UTC
I updated the javadoc, thanks!

jet-main #8466634b6098