Skip navigation links
org.netbeans.api.intent 1.15

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.15