Bing,

All of your suggested modifications of my code are excellent, as are
your suggestions to add a reference to the active TaskFrame to the
WorkbenchContext via the internalFrameActivated callback.

I'll wait to see if Michael and Larry have any comments. If they do
not, I'll create patches of my code that reflect your suggestions and
will ask the other programmers to review them before I commit.

Thanks a lot for the help.

The Sunburned Surveyor

On Mon, Nov 3, 2008 at 8:57 PM, Bing Ran <[EMAIL PROTECTED]> wrote:
> The PlugInContext has a reference to the task and so does the TaskFrame. So
> can you do this to find out the FIRST TaskFrame containing the concerned
> task and never worry about the titles?
>
>        public TaskFrame getTaskFrameForActiveTask(PlugInContext 
> pluginContext) {
>                WorkbenchFrame frame = 
> workbenchContext.getWorkbench().getFrame();
>                JInternalFrame[] internalFrames = frame.getInternalFrames();
>                for (JInternalFrame internalFrame : internalFrames) {
>                        if (internalFrame instanceof TaskFrame) {
>                                TaskFrame taskFrame = (TaskFrame) 
> internalFrame;
>                                if 
> (pluginContext.getTask().equals(taskFrame.getTask())) {
>                                        return taskFrame;
>                                }
>                        }
>                }
>                return null;
>        }
>
>
> Another thought is to make the WorkbenchContext to have a TaskFrame to keep
> track of the last active TaskFrame.
>
> In the InternalFrameListener in the TaskFrame constructor, add
>
>                                
> workbenchContext.setLastActiveTaskFrame(TaskFrame.this);
>
> in the internalFrameActivated() callback, and
>                                workbenchContext.setLastActiveTaskFrame(null);
> in the internalFrameClosed() callback.
>
> Now the WorkbenchContext will always know what the last TaskFrame is and the
> other existing none-TaskFrame internal frames won't interfere with this.
>
> This may also help with the TaskFrame cloning issue.
>
>
>
> Bing
>
>
> --------------------------------------------------
> From: "Sunburned Surveyor" <[EMAIL PROTECTED]>
> Sent: Tuesday, November 04, 2008 6:12 AM
> To: "OpenJump develop and use" <jump-pilot-devel@lists.sourceforge.net>
> Subject: [JPP-Devel] Proposal for new method of WorkbenchContext class.
>
>> I'd like to propose the attached code be added as a method of the
>> WorkbenchContext class. I sometimes find myself with a need to access
>> the active TaskFrame for the Workbench, especially when I work on the
>> docking window integration. Perhaps others have found a need to do
>> this as well.
>>
>> At any rate, any time I start to copy and paste code I get a little
>> nervous. This is usually a sign that I need to make a utility method.
>>
>> If people think this change is a bad idea, I'll move the method to one
>> of my own OpenJUMP utility classes. If you have changes or
>> improvements to my implementation of the method, please let me know.
>> If there are no objections, I will commit a patch adding the method.
>>
>> The Sunburned Surveyor
>>
>
>
>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the
>> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>
>
>
>> _______________________________________________
>> Jump-pilot-devel mailing list
>> Jump-pilot-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to