Bug 190195 - cannot enable "new Connection" prompt in system view
Summary: cannot enable "new Connection" prompt in system view
Status: RESOLVED FIXED
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 2.0   Edit
Assignee: Martin Oberhuber CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-31 08:48 EDT by Tobias Schwarz CLA
Modified: 2008-08-13 13:20 EDT (History)
4 users (show)

See Also:
dmcknigh: review+


Attachments
Patch fixing the issue (4.22 KB, patch)
2007-05-31 12:01 EDT, Martin Oberhuber CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Schwarz CLA 2007-05-31 08:48:43 EDT
Build ID: Eclipse3.3 RSE2.0rc1

Steps To Reproduce:
1. enable the "show new connection in system view" preference
2. the new connection prompt will not get visible in the system view


More information:
to me it looks like the UI/NonUI splitting of the system registry caused this problem.
in get/hasChildren of SystemViewRootInputAdapter the new conenction prompt is only added when the provider is a ISystemRegistry.
in fact, when debugging this code, the provider that is used is always a ISystemRegistryUI.
changing this interface to ISystemRegistryUI re-enables the new connection prompt.
Comment 1 Martin Oberhuber CLA 2007-05-31 10:13:54 EDT
Yes, I think you're right. Doing a text search for
  "instanceof ISystemRegistry"
gives 11 matches that potentially need to be changed into
  "instanceof ISystemRegistryUI"
because the RegistryUI is now the input provider.

I think that in the longer term, I'd like to move the ISystemViewInputProvider into non-UI but in order to do this, the getShell()/setShell(), getViewer()/setViewer() methods need to be removed from the ISystemViewInputProvider.

In the shorter term, I guess we'll need to change the instanceof expressions as mentioned.
Comment 2 Martin Oberhuber CLA 2007-05-31 12:01:52 EDT
Created attachment 69541 [details]
Patch fixing the issue

Attached patch should fix the issue.

I do not think that all occurrences of "instanceof ISystemRegistry" need to be changed, because events are typically fired with the ISystemRegistry as parent and NOT the ISystemRegistryUI.
Due to the splitting, there is some confusion between the input provider and the event parent. Actually, some bugs might be buried here because of checks like
   if (inputProvider == event.getParent())
because since the SystemRegistryUI vs. SystemRegistry split, these are not necessarily the same any more.

Therefore, I think the safest fix would be to get rid of the getShell() / getViewer() methods in ISystemViewInputProvider, and make the SystemRegistry the input provider again.

Until this is done, please review the patch to fix the immediate issue.
Comment 3 Martin Oberhuber CLA 2007-05-31 12:20:30 EDT
With respect to getting rid of ISystemViewInputProvider.setShell() etc, I found this:

    // DY:  Defect 44544, shell was not being set for Test dialogs, when they
    // tried to connect there was not shell for the password prompt
    // and an error message (expand failed) occured.
    inputProvider.setShell(getShell());

    inputProvider.setViewer(this); // just in case. Added by Phil in V5.0
    inputProvider.setShell(getShell()); // just in case. Added by Phil

Dave's -- do you remember what this was for? If we cannot get rid fo the getShell() / getViewer() methods on the input provider, one option would be changing the signature to pass and return java.lang.Object such that the ISystemViewInputProvider can be moved to Core and SystemRegistry can implement it (rather than SystemRegistryUI).

Which would, as I've mentioned before, be the safest fix for this category of potential problems.
Comment 4 David McKnight CLA 2007-05-31 12:22:05 EDT
Yeah, the split of the registries to ISystemRegistry and ISystemRegistryUI has caused a few regressions already.  I approve the fix for the immediate issue.
Comment 5 David McKnight CLA 2007-05-31 12:24:19 EDT
I don't remember why these were used.  I know historically there was a lot of code that wanted a Shell to be used for getting runnable contexts and such.  I think this is problemmatic and it would be good to get rid of stuff like that if we can.
Comment 6 Martin Oberhuber CLA 2007-05-31 12:36:16 EDT
Patch committed,
[190195] Cannot enable new connection prompt in system view

Filed bug #190271 for tracking the move of ISystemViewInputProvider to Core.
Comment 7 Martin Oberhuber CLA 2008-08-13 13:20:22 EDT
[target cleanup] 2.0 RC2 was the original target milestone for this bug