Examples of ItemRegistry


Examples of org.openhab.core.items.ItemRegistry

  @Override
  public void complete_ItemRef(EObject model, RuleCall ruleCall,
      ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
    super.complete_ItemRef(model, ruleCall, context, acceptor);

    ItemRegistry registry = (ItemRegistry) UIActivator.itemRegistryTracker.getService();
    if(registry!=null) {
      for(Item item : registry.getItems(context.getPrefix() + "*")) {
        ICompletionProposal completionProposal = createCompletionProposal(item.getName(), context);
        acceptor.accept(completionProposal);
      }
    }
  }
View Full Code Here

Examples of org.openhab.core.items.ItemRegistry

    context.assignValue(QualifiedName.create(variable.getName()), value);
    return value;
  }

  protected Item getItem(String itemName) {
    ItemRegistry itemRegistry = itemRegistryProvider.get();
    try {
      return itemRegistry.getItem(itemName);
    } catch (ItemNotFoundException e) {
      return null;
    }
  }
View Full Code Here

Examples of org.openhab.core.items.ItemRegistry

   *
   * @param itemName the name of the item to send the command to
   * @param commandString the command to send
   */
  static public Object sendCommand(String itemName, String commandString) {
    ItemRegistry registry = (ItemRegistry) ScriptActivator.itemRegistryTracker.getService();
    EventPublisher publisher = (EventPublisher) ScriptActivator.eventPublisherTracker.getService();
    if(publisher!=null && registry!=null) {
      try {
        Item item = registry.getItem(itemName);
        Command command = TypeParser.parseCommand(item.getAcceptedCommandTypes(), commandString);
        publisher.sendCommand(itemName, command);
      } catch (ItemNotFoundException e) {
        logger.warn("Item '" + itemName + "' does not exist.");
      }
View Full Code Here

Examples of org.openhab.core.items.ItemRegistry

   *
   * @param itemName the name of the item to send the status update for
   * @param stateAsString the new state of the item
   */
  static public Object postUpdate(String itemName, String stateString) {
    ItemRegistry registry = (ItemRegistry) ScriptActivator.itemRegistryTracker.getService();
    EventPublisher publisher = (EventPublisher) ScriptActivator.eventPublisherTracker.getService();
    if(publisher!=null && registry!=null) {
      try {
        Item item = registry.getItem(itemName);
        State state = TypeParser.parseState(item.getAcceptedDataTypes(), stateString);
        publisher.postUpdate(itemName, state);
      } catch (ItemNotFoundException e) {
        logger.warn("Item '" + itemName + "' does not exist.");
      }
View Full Code Here

Examples of org.openhab.core.items.ItemRegistry

*
*/
@Singleton
public class ItemRegistryProvider implements Provider<ItemRegistry> {
  public ItemRegistry get() {
    ItemRegistry itemRegistry = (ItemRegistry) ScriptActivator.itemRegistryTracker.getService();
    return itemRegistry;
  }
View Full Code Here

Examples of org.openhab.core.items.ItemRegistry

  @Override
  public void completeGroupConfig_Group(EObject model, Assignment assignment,
      ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
    super.completeGroupConfig_Group(model, assignment, context, acceptor);

    ItemRegistry registry = (ItemRegistry) UIActivator.itemRegistryTracker.getService();
    if(registry!=null) {
      for(Item item : registry.getItems(context.getPrefix() + "*")) {
        if(item instanceof GroupItem) {
          ICompletionProposal completionProposal = createCompletionProposal(item.getName(), context);
          acceptor.accept(completionProposal);
        }
      }
View Full Code Here

Examples of org.openhab.core.items.ItemRegistry

  }
 
  @Override
  public void completeItemConfig_Item(EObject model, Assignment assignment,
      ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
    ItemRegistry registry = (ItemRegistry) UIActivator.itemRegistryTracker.getService();
    if(registry!=null) {
      for(Item item : registry.getItems(context.getPrefix() + "*")) {
        ICompletionProposal completionProposal = createCompletionProposal(item.getName(), context);
        acceptor.accept(completionProposal);
      }
    }
  }
View Full Code Here

Examples of org.openhab.core.items.ItemRegistry

  @Override
  public void completeModelItem_Groups(EObject model, Assignment assignment,
      ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
    super.completeModelItem_Groups(model, assignment, context, acceptor);

    ItemRegistry registry = (ItemRegistry) UIActivator.itemRegistryTracker.getService();
    if(registry!=null) {
      for(Item item : registry.getItems(context.getPrefix() + "*")) {
        if(item instanceof GroupItem) {
          ICompletionProposal completionProposal = createCompletionProposal(item.getName(), context);
          acceptor.accept(completionProposal);
        }
      }
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.