Examples of InputContext


Examples of co.cask.cdap.api.flow.flowlet.InputContext

  /**
   * Process the process result. This method never throws.
   */
  private void postProcess(ProcessMethodCallback callback, TransactionContext txContext,
                           InputDatum input, ProcessMethod.ProcessResult result) {
    InputContext inputContext = input.getInputContext();
    Throwable failureCause = null;
    FailureReason.Type failureType = FailureReason.Type.IO_ERROR;
    try {
      if (result.isSuccess()) {
        // If it is a retry input, force the dequeued entries into current transaction.
View Full Code Here

Examples of co.cask.tigon.api.flow.flowlet.InputContext

    this.queueName = queueName;
    // Memorize the transformed Iterable so that decoder would only invoked once for each event no matter
    // how many times iterator() is called. This is to save time as well as a need for the case where
    // metrics has been logged inside the decoder.
    this.events = result.isEmpty() ? ImmutableList.<T>of() : ImmutableList.copyOf(Iterables.transform(result, decoder));
    this.inputContext = new InputContext() {
      @Override
      public String getOrigin() {
        return queueName.getSimpleName();
      }
View Full Code Here

Examples of com.volantis.mcs.eclipse.ab.editors.xml.schema.InputContext

        prefix = docInfo.getNamespacePrefix(schema.getNamespaceURI());

        // If the document doesn't define a namespace prefix for the schema's
        // namespace URI, we can't do completions
        if (prefix != null) {
            InputContext ic = docInfo.getInputContext(documentOffset - 1);
           
            // If the document info could not determine an input context at
            // the specified location in the document, we can't do completions
            if (ic != null) {
                String elementName = localName(
                    ic.getContainingElementName(),
                    prefix);

                // If the local name derived from the input context containing
                // element is null, we can't do completions
                if (elementName != null) {
                    String matchName = ic.getMatchName();

                    if (!ic.isAttribute() &&
                        (matchName != null) &&
                        matchName.startsWith("/")) { //$NON-NLS-1$
                        // If the match name starts with "/" we are trying to
                        // complete the currently open element (so we must not
                        // be in attribute match mode)
                        matchName = localMatchName(matchName.substring(1),
                                                   ic.isAttribute(),
                                                   prefix);

                        if ("".equals(matchName) || //$NON-NLS-1$
                            elementName.startsWith(matchName)) {
                            // Propose closing the currently open element
                            proposals =
                                new ICompletionProposal[1];
                            String replace;
                            StringBuffer sb =
                                new StringBuffer(2 +
                                                 ic.getContainingElementName().
                                                 length());
                            sb.append('/').
                                append(ic.getContainingElementName()).
                                append('>');

                            replace = sb.toString();

                            proposals[0] =
                                new CompletionProposal(
                                    replace,
                                    documentOffset - ic.getMatchName().length(),
                                    ic.getMatchName().length(),
                                    replace.length(),
                                    null,
                                    elementName,
                                    null,
                                    null);
                        }
                    } else {
                        // We are trying to complete something other than the
                        // close element markup
                        ElementDefinition element =
                            schema.getElementDefinition(elementName);
                        matchName = localMatchName(matchName,
                                                   ic.isAttribute(),
                                                   prefix);

                        // If an element definition cannot be found for the
                        // containing element, or we can't derive a local match
                        // name from the input context we can't do completions
                        if ((element != null) && (matchName != null)) {
                            List options = new ArrayList();

                            if (ic.isAttribute()) {
                                List attributes =
                                    element.getAttributeDefinitions(matchName);
                                AttributeDefinition attribute;

                                for (int i = 0;
                                     i < attributes.size();
                                     i++) {
                                    attribute =
                                        (AttributeDefinition)attributes.get(i);

                                    options.add(attribute.getName());
                                }
                            } else {
                                List subElements =
                                    element.getSubElementNames(matchName);

                                options.addAll(subElements);
                            }

                            if (options.size() != 0) {
                                proposals =
                                    stringListToCompletionProposalArray(
                                        options,
                                        documentOffset -
                                        ic.getMatchName().length(),
                                        ic.getMatchName().length(),
                                        ic.isAttribute(),
                                        prefix);
                            }
                        }
                    }
                }
View Full Code Here

Examples of java.awt.im.InputContext

            return true;
        }
       
        boolean imported = false;
        if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
            InputContext ic = c.getInputContext();
            if (ic != null) {
                ic.endComposition();
            }
           
            try {
                java.util.List list = (List) t.getTransferData(DataFlavor.javaFileListFlavor);
                c.setText(((File) list.get(0)).getPath());
                imported = true;
            } catch (UnsupportedFlavorException ex) {
                //   ex.printStackTrace();
            } catch (IOException ex) {
                //   ex.printStackTrace();
            }
        }
       
        if (! imported) {
            DataFlavor importFlavor = getImportFlavor(t.getTransferDataFlavors(), c);
            if (importFlavor != null) {
                InputContext ic = c.getInputContext();
                if (ic != null) {
                    ic.endComposition();
                }
                try {
                    String text = (String) t.getTransferData(DataFlavor.stringFlavor);
                    Reader r = importFlavor.getReaderForText(t);
                    boolean useRead = false;
View Full Code Here

Examples of java.awt.im.InputContext

    }//GEN-LAST:event_jPanel1MouseMoved

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        try {
            //Runtime.getRuntime().exec("C:\\Program Files (x86)\\Google\\Google Input Tools\\GoogleInputHandler.exe");
            InputContext context=InputContext.getInstance();
            this.getInputContext().selectInputMethod(new Locale("si","LK"));
            System.out.println(context.getLocale());
        } catch (Exception ex) {
            Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jButton1ActionPerformed
View Full Code Here

Examples of java.awt.im.InputContext

     */
    private void removeNotifyInputContext() {
        if (!inputMethodsEnabled) {
            return;
        }
        InputContext ic = getInputContext();
        if (ic != null) {
            ic.removeNotify(this);
        }
    }
View Full Code Here

Examples of java.awt.im.InputContext

     * context.
     * @param e event to pass to InputContext.dispatchEvent()
     * @return true if event was consumed by IM, false otherwise
     */
    private boolean dispatchEventToIM(AWTEvent e) {
        InputContext ic = getInputContext();
        if (ic == null) {
            return false;
        }
        int id = e.getID();
        boolean isInputEvent = ((id >= KeyEvent.KEY_FIRST) && (id <= KeyEvent.KEY_LAST))
                || ((id >= MouseEvent.MOUSE_FIRST) && (id <= MouseEvent.MOUSE_LAST));
        if (((id >= FocusEvent.FOCUS_FIRST) && (id <= FocusEvent.FOCUS_LAST)) || isInputEvent) {
            ic.dispatchEvent(e);
        }
        return e.isConsumed();
    }
View Full Code Here

Examples of java.awt.im.InputContext

        redrawManager = new RedrawManager(this);
    }

    @Override
    void notifyInputMethod(Rectangle bounds) {
        InputContext ic = getInputContext();
        if (ic instanceof InputMethodContext) {
            ((InputMethodContext) ic).notifyClientWindowChange(bounds);
        }
    }
View Full Code Here

Examples of java.awt.im.InputContext

     */
    private void removeNotifyInputContext() {
        if (!inputMethodsEnabled) {
            return;
        }
        InputContext ic = getInputContext();
        if (ic != null) {
            ic.removeNotify(this);
        }
    }
View Full Code Here

Examples of java.awt.im.InputContext

     * context.
     * @param e event to pass to InputContext.dispatchEvent()
     * @return true if event was consumed by IM, false otherwise
     */
    private boolean dispatchEventToIM(AWTEvent e) {
        InputContext ic = getInputContext();
        if (ic == null) {
            return false;
        }
        int id = e.getID();
        boolean isInputEvent = ((id >= KeyEvent.KEY_FIRST) && (id <= KeyEvent.KEY_LAST))
                || ((id >= MouseEvent.MOUSE_FIRST) && (id <= MouseEvent.MOUSE_LAST));
        if (((id >= FocusEvent.FOCUS_FIRST) && (id <= FocusEvent.FOCUS_LAST)) || isInputEvent) {
            ic.dispatchEvent(e);
        }
        return e.isConsumed();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.