Skip navigation links
org.netbeans.api.intent 1.4.1

Package org.netbeans.spi.intent

SPI for Intent handlers.

See: Description

Package org.netbeans.spi.intent Description

SPI for Intent handlers.

Handling some type of Intents is as simple as registering a method using annotation IntentHandlerRegistration.

Currently two types of handling methods are supported:

See examples:

Basic handler:

   @IntentHandlerRegistration(
               displayName = "Show my item in MyEditor",
               position = 800,
               uriPattern = "myscheme://.*",
               actions = {Intent.ACTION_VIEW, Intent.ACTION_EDIT}
   )
   public static Object handleIntent(Intent intent) {
       SomeType result = parseAndPerformIntentSomehow(intent);
       return result;
   }
 

Handler that uses Result:

   @IntentHandlerRegistration(
               displayName = "Show my item in MyEditor",
               position = 800,
               uriPattern = "myscheme://.*",
               actions = "*"
   )
   public static void handleIntent(final Intent intent, final Result result) {
       EventQueue.invokeLater(new Runnable() {
           public void run() {
               try {
                   Object value = doSomethingInEDT(intent);
                   result.setResult(value);
               } catch (Exception e) {
                   result.setException(e);
               }
           }
       });
   }
 
Skip navigation links
org.netbeans.api.intent 1.4.1

Built on June 22 2019.  |   Copyright © 2017-2019 Apache Software Foundation. All Rights Reserved.