Topic
5 replies Latest Post - ‏2013-10-24T06:08:26Z by tmparker
RavikanthChavali
RavikanthChavali
11 Posts
ACCEPTED ANSWER

Pinned topic Can we dynamically set the HATS view name through a variable value?

‏2013-10-15T23:33:19Z |

I am using RDz integrated with HATS RCP to access ISPF panels. Currently, the HATS view name is set in the plugin.xml <extension point="org.eclipse.ui.views"> <view name="My View">

I would like to dynamically set the view name before the HATS RCP runs the HATS macro, 3270 transformation, and launches the tool in an eclipse view.

Could we set the name of view based on the menu item or a variable value that is passed into the HATS RCP?

Thank you!

Ravikanth Chavali

Updated on 2013-10-15T23:40:14Z at 2013-10-15T23:40:14Z by RavikanthChavali
  • tmparker
    tmparker
    518 Posts
    ACCEPTED ANSWER

    Re: Can we dynamically set the HATS view name through a variable value?

    ‏2013-10-22T04:22:15Z  in response to RavikanthChavali

    Hi Ravikanth,

    The view name can only be set by using the setPartName method of the ViewPart class.  However, this can only be done during the init method or else it will not allow the value to be changed.  So with that said, I found that this is possible to be done in a HATS RCP app in one way.  You have to do it from the MainView class in the project.  If you open that file there is nothing more than a constructor for the class by default.  What you need to do is override the init method and add a call to setPartName after the super.init call.  You must do it after because the HATS code already calls setPartName in the init so we have to call it second or our new name would get overwritten.

    Here is the code I added to my MainView.java file:

    @Override
        public void init(IViewSite viewSite) throws PartInitException {
            super.init(viewSite);
            super.setPartName("My View Name");
        }

    Thanks
    Tim

    • RavikanthChavali
      RavikanthChavali
      11 Posts
      ACCEPTED ANSWER

      Re: Can we dynamically set the HATS view name through a variable value?

      ‏2013-10-22T05:17:10Z  in response to tmparker

      Thank you, Tim! That helps.

      But In the above example the view is again hard coded in the method call. 
                                                                             
      I would like to set the name based on the value of a hats global variable that is passed to the HATS RCP through a menu manager.        
                                                                             
      For example, I have defined a hats global variable "hatsgv_AppTool=ToolName" I am passing this variable to the HATS RCP through the below command, I would like to use the value of this variable to set the view name.                                                                          
                                                                             
      <command cmd="HATSRCP=hatspluginname hatsgv_userid hatsgv_password hatsgv_vtmInp=xxx hatsgv_exeCmd=zzz                            
      hatsgv_appTool=ToolName"/>

      Except for the hatsgv_appTool global variable the rest are consumed bythe Prompt action to insert a user-supplied or variable value into a field on 3270 transformation.                                          
                                                                             
      I would like to a similar thing but instead of setting the field value, I would like to use it to set the ViewName.

      Thank you!

      Ravikanth Chavali

      Updated on 2013-10-22T05:19:17Z at 2013-10-22T05:19:17Z by RavikanthChavali
      • tmparker
        tmparker
        518 Posts
        ACCEPTED ANSWER

        Re: Can we dynamically set the HATS view name through a variable value?

        ‏2013-10-22T16:21:39Z  in response to RavikanthChavali

        What I showed is just an example and that's why it was a hard coded string. However, this is the only time and place you can set it. We don't control this behavior. This is how eclipse rich client works. There is nothing I can do to change that. Sorry.

        Thanks
        Tim
         

        • RavikanthChavali
          RavikanthChavali
          11 Posts
          ACCEPTED ANSWER

          Re: Can we dynamically set the HATS view name through a variable value?

          ‏2013-10-22T21:50:31Z  in response to tmparker

          I guess I wasn't clear on my question, I am fine with setting the view name inside this method; I wanted to ask if we could retrieve the name from a global variable that is passed thru the menu manager and use that variable value within this method.

          Updated on 2013-10-22T21:51:21Z at 2013-10-22T21:51:21Z by RavikanthChavali
          • tmparker
            tmparker
            518 Posts
            ACCEPTED ANSWER

            Re: Can we dynamically set the HATS view name through a variable value?

            ‏2013-10-24T06:08:26Z  in response to RavikanthChavali

            I don't think there is a way to read a global variable because the MainView is a GUI element and it is processed before the HATS session ever runs.  If you add a print out in MainView you will see that it shows before the Start event for HATS ever executes.  I can't see a way to access global variables before the HATS runtime is really active.  Technically we wouldn't have even processed the global variables that were passed in until the session objects are created to store the variables.