[ 
https://issues.apache.org/jira/browse/GERONIMODEVTOOLS-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12595264#action_12595264
 ] 

tkirby edited comment on GERONIMODEVTOOLS-342 at 5/8/08 7:31 AM:
--------------------------------------------------------------------

Thanks, BJ.  That works for me!

I am wondering about this code:

{code}
public void widgetSelected(SelectionEvent e) {
                                           int sel = combo.getSelectionIndex();
                                           IVMInstall vmInstall = null;
                                           if (sel > 0)
                                               vmInstall = (IVMInstall) 
installedJREs.get(sel - 1);
                                           
getRuntimeDelegate().setVMInstall(vmInstall);
                                           validate();
                                       }
{code}

I know you did not originally write the code, but don't our coding conventions 
say to use {} for if statements?

My real question is, do we want to set the vm to null if there is no selection?

I thus propose:
{code}
public void widgetSelected(SelectionEvent e) {
                                           int sel = combo.getSelectionIndex();
                                           IVMInstall vmInstall = null;
                                           if (sel > 0) {
                                               vmInstall = (IVMInstall) 
installedJREs.get(sel - 1);
                                               
getRuntimeDelegate().setVMInstall(vmInstall);
                                               validate();
                                           }
                                       }
{code}
Possibly the validate could happen unconditionally.

Thoughts?

      was (Author: tkirby):
    Thanks, BJ.  That works for me!

I am wondering about this code:

{code:java}
public void widgetSelected(SelectionEvent e) {
                                           int sel = combo.getSelectionIndex();
                                           IVMInstall vmInstall = null;
                                           if (sel > 0)
                                               vmInstall = (IVMInstall) 
installedJREs.get(sel - 1);
                                           
getRuntimeDelegate().setVMInstall(vmInstall);
                                           validate();
                                       }
{code:java}

I know you did not originally write the code, but don't our coding conventions 
say to use {} for if statements?

My real question is, do we want to set the vm to null if there is no selection?

I thus propose:
{code:java}
public void widgetSelected(SelectionEvent e) {
                                           int sel = combo.getSelectionIndex();
                                           IVMInstall vmInstall = null;
                                           if (sel > 0) {
                                               vmInstall = (IVMInstall) 
installedJREs.get(sel - 1);
                                               
getRuntimeDelegate().setVMInstall(vmInstall);
                                               validate();
                                           }
                                       }
{code:java}
Possibly the validate could happen unconditionally.

Thoughts?
  
> Setting the JRE on the Edit Server Runtime panel usually fails
> --------------------------------------------------------------
>
>                 Key: GERONIMODEVTOOLS-342
>                 URL: 
> https://issues.apache.org/jira/browse/GERONIMODEVTOOLS-342
>             Project: Geronimo-Devtools
>          Issue Type: Bug
>          Components: eclipse-plugin
>    Affects Versions: 2.1.0
>            Reporter: Ted Kirby
>            Assignee: B.J. Reed
>            Priority: Minor
>             Fix For: 2.1.1
>
>         Attachments: GERONIMODEVTOOLS-342.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to