this.tree = tree;
this.editorComponent = null;
if (userObject instanceof ValueGem) {
ValueGem valueGem = (ValueGem)userObject;
Gem connectedGem = valueGem.getOutputPart().getConnectedGem();
int connectedInputNum = valueGem.isConnected() ? valueGem.getOutputPart().getConnection().getDestination().getInputNum() : -1;
QualifiedName entityName = null;
if (connectedGem instanceof FunctionalAgentGem) {
entityName = ((FunctionalAgentGem)connectedGem).getName();
}
ValueEditorDirector ved = tableTopExplorer.getValueEditorDirector();
ValueEditor valueEditor = ved.getRootValueEditor(
tableTopExplorer.getValueEditorHierarchyManager(),
valueGem.getValueNode(),
entityName,
connectedInputNum,
connectedGem == null ? null : tableTopExplorer.getMetadataRunner(connectedGem));
setupEditorComponentForValueGem(valueEditor, valueGem);
setupValueEditor(node, valueEditor);
} else if (userObject instanceof Gem.PartInput) {
Gem.PartInput input = (Gem.PartInput)userObject;
Gem gem = input.getGem();
QualifiedName entityName = null;
if (gem instanceof FunctionalAgentGem) {
entityName = ((FunctionalAgentGem)gem).getName();
}
ValueEditorDirector ved = tableTopExplorer.getValueEditorDirector();
ValueEditor valueEditor = ved.getRootValueEditor(
tableTopExplorer.getValueEditorHierarchyManager(),
input.getType(),
entityName,
input.getInputNum(),
tableTopExplorer.getMetadataRunner(gem));
setupEditorComponentForPartInput(valueEditor, input);
setupValueEditor(node, valueEditor);
} else if (userObject instanceof CodeGem || userObject instanceof CollectorGem) {
final Gem editedGem = (Gem)userObject;
final ExplorerGemNameEditor nameEditor = explorerOwner.getGemNameEditor(editedGem);
editorComponent = nameEditor.getComponent();
// Add a focus listener to commit the changes when the field loses focus.