Altova XMLSpy 2025 Enterprise Edition 

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

 

 

01 /**

02    * Call-back from the XMLSpyControl.

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

11   }

12    /**

13    * Call-back from the XMLSpyControl.

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 XMLSpyContainer.xmlSpyDocument.getDocument().getFullName().equalsIgnoreCase( i_strFilePath );

21     } catch ( Exception e ) {

22       return false;

23     }

24   }

 

© 2018-2024 Altova GmbH