public void tabSelected(TabItem item) {
    List<TabMapEntry> collection = spoon.delegates.tabs.getTabs();

    // See which core objects to show
    //
    for (TabMapEntry entry : collection) {
      if (item.equals(entry.getTabItem())) {
        // TabItemInterface itemInterface = entry.getObject();

        //
        // Another way to implement this may be to keep track of the
        // state of the core object tree in method
        // addCoreObjectsToTree()
        //
        if (entry.getObject() instanceof TransGraph || entry.getObject() instanceof JobGraph) {
          EngineMetaInterface meta = entry.getObject().getMeta();
          if (meta != null) {
            meta.setInternalKettleVariables();
          }
          if (spoon.getCoreObjectsState() != SpoonInterface.STATE_CORE_OBJECTS_SPOON) {
            spoon.refreshCoreObjects();
          }
        }
      }
    }

    // Also refresh the tree
    spoon.refreshTree();
    spoon.enableMenus();
  }
  public void tabSelected(TabItem item) {
    ArrayList<TabMapEntry> collection = new ArrayList<TabMapEntry>(tabMap);

    // See which core objects to show
    //
    for (TabMapEntry entry : collection) {
      boolean isTrans = (entry.getObject() instanceof TransGraph);

      if (item.equals(entry.getTabItem())) {
        if (isTrans || entry.getObject() instanceof JobGraph) {
          EngineMetaInterface meta = entry.getObject().getMeta();
          if (meta != null) {
            meta.setInternalKettleVariables();
          }
          if (spoon.getCoreObjectsState() != SpoonInterface.STATE_CORE_OBJECTS_SPOON) {
            spoon.refreshCoreObjects();
          }
        }

        if (entry.getObject() instanceof JobGraph) {
          ((JobGraph) entry.getObject()).setFocus();
        } else if (entry.getObject() instanceof TransGraph) {
          ((TransGraph) entry.getObject()).setFocus();
        }

        break;
      }
    }

    // Also refresh the tree
    spoon.refreshTree();
    spoon.setShellText(); // calls also enableMenus() and markTabsChanged()
  }