Altova MapForce 2023 Enterprise Edition

The code listing below shows how a UI-Update event handler can be created.

 

 

01 /**

02    * Call-back from the MapForceControl.

03    * Called to enable/disable commands

04    */

05   @Override

06   public void onUpdateCmdUI() throws AutomationException

07   {

08     // A command should be enabled if the result of queryStatus contains the Supported (1) and Enabled (2) flags

09     for ( java.util.Map.Entry<Integer, MenuItem> pair : menuMap.entrySet() )

10       pair.getValue().setEnabled( MapForceContainer.mapForceControl.queryStatus( pair.getKey() ) > 2 );

11   }

12 /**

13    * Call-back from the MapForceControl.

14    * Usually called while enabling/disabling commands due to UI updates

15    */

16   @Override

17   public boolean onIsActiveEditor( String i_strFilePath ) throws AutomationException

18   {

19     try {

20       return MapForceContainer.mapForceDocument.getDocument().getFullName().equalsIgnoreCase( i_strFilePath );

21     } catch ( Exception e ) {

22       return false;

23     }

24   }

© 2017-2023 Altova GmbH