Skip navigation links
org.netbeans.api.intent 1.3

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

Built on November 20 2017.  |  Portions Copyright 1997-2017 Oracle. All rights reserved.