[ http://issues.apache.org/jira/browse/FOR-599?page=all ]
Ross Gardler closed FOR-599:
----------------------------
Resolution: Fixed
Assign To: Ross Gardler
Now have the NavigationView class to provide this (and other) common
functionality
> Refactoring of SelectionChanged events in Eclipse actions and popups
> --------------------------------------------------------------------
>
> Key: FOR-599
> URL: http://issues.apache.org/jira/browse/FOR-599
> Project: Forrest
> Type: Improvement
> Components: Tool: Eclipse config
> Versions: 0.8-dev
> Reporter: Ross Gardler
> Assignee: Ross Gardler
> Priority: Minor
>
> There are a large number of classes that use code very similar to this:
> public void selectionChanged(IAction action, ISelection selection) {
> // if (selection instanceof IStructuredSelection) {
> Object first = ((IStructuredSelection) selection).getFirstElement();
> IResource resource = (IResource) first;
> if (resource != null) {
> IProject newActiveProject = resource.getProject();
> if (newActiveProject != activeProject) {
> // TODO: only attempt to load config file if this is a Forrest
> // project
> activeProject = newActiveProject;
> projectName = activeProject.getProject().getName();
> xDocPath =
> (activeProject.getProject().getLocation().toString() +
> java.io.File.separator);
> }
> }
> }
> These calsses all keep track of the currently active project and loading a
> file that is to be worked with whenever the current selection changes.
> This is a performance bottleneck in the system. We have the same code
> executing multiple times in different objects and we have multiple copies of
> the active project and, in some cases, multiple copies of the file that is
> referenced.
> This code should be moved to some central class that tracks the acrive
> project for the whole plugin and provides a mechanism for accessing the
> various config files in use. This will result in only a single object
> executing the event hadling code and there being only one copy of the files
> to be edited.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira