@Override
 public Object[] getChildElements(Object element) {
   if (element == myTreeRoot) {
     return myGroups;
   }
   if (element instanceof ResourceGroup) {
     ResourceGroup group = (ResourceGroup) element;
     return group.getItems().toArray();
   }
   return ArrayUtil.EMPTY_OBJECT_ARRAY;
 }
 private void select(String type, String name) {
   for (ResourceGroup group : myGroups) {
     if (type.equalsIgnoreCase(group.getName())) {
       for (ResourceItem item : group.getItems()) {
         if (name.equals(item.toString())) {
           myTreeBuilder.select(item);
           return;
         }
       }
       return;
     }
   }
 }
  private ActionPopupMenu createNewResourcePopupMenu() {
    ActionManager actionManager = ActionManager.getInstance();
    DefaultActionGroup actionGroup = new DefaultActionGroup();

    ResourceGroup resourceGroup =
        getSelectedElement(myProjectPanel.myTreeBuilder, ResourceGroup.class);
    if (resourceGroup == null) {
      resourceGroup =
          getSelectedElement(myProjectPanel.myTreeBuilder, ResourceItem.class).getGroup();
    }

    if (AndroidResourceUtil.XML_FILE_RESOURCE_TYPES.contains(resourceGroup.getType())) {
      myNewResourceFileAction
          .getTemplatePresentation()
          .setText("New " + resourceGroup + " File...");
      myNewResourceFileAction
          .getTemplatePresentation()
          .putClientProperty(TYPE_KEY, resourceGroup.getType());
      actionGroup.add(myNewResourceFileAction);
    }
    if (AndroidResourceUtil.VALUE_RESOURCE_TYPES.contains(resourceGroup.getType())) {
      String title = "New " + resourceGroup + " Value...";
      if (resourceGroup.getType() == ResourceType.LAYOUT) {
        title = "New Layout Alias";
      }
      myNewResourceValueAction.getTemplatePresentation().setText(title);
      myNewResourceValueAction
          .getTemplatePresentation()
          .putClientProperty(TYPE_KEY, resourceGroup.getType());
      actionGroup.add(myNewResourceValueAction);
    }
    if (myTag != null && ResourceType.STYLE.equals(resourceGroup.getType())) {
      final boolean enabled =
          AndroidBaseLayoutRefactoringAction.getLayoutViewElement(myTag) != null
              && AndroidExtractStyleAction.doIsEnabled(myTag);
      myExtractStyleAction.getTemplatePresentation().setEnabled(enabled);
      actionGroup.add(myExtractStyleAction);
    }

    return actionManager.createActionPopupMenu(ActionPlaces.UNKNOWN, actionGroup);
  }
 public String getName() {
   return myGroup.getName() + "/" + myName;
 }