Altova StyleVision 2024 Enterprise Edition

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

 

 

01   /**

02    * Call-back from the StyleVisionControl.

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( StyleVisionContainer.styleVisionControl.queryStatus( pair.getKey() ) > 2 );

11   }

12

13   /**

14    * Call-back from the StyleVisionControl.

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

16    */

17   @Override

18   public boolean onIsActiveEditor( String i_strFilePath ) throws AutomationException

19   {

20     try {

21       return StyleVisionContainer.styleVisionDocument.getDocument().getFullName().equalsIgnoreCase( i_strFilePath );

22     } catch ( Exception e ) {

23       return false;

24     }

25   }

 

© 2017-2023 Altova GmbH