/******************************************************************************* * Copyright (c) 2007, 2010 Association for Decentralized Information Management * in Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation *******************************************************************************/ package org.simantics.browsing.ui.common.processors; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import org.simantics.browsing.ui.BuiltinKeys; import org.simantics.browsing.ui.NodeContext; import org.simantics.browsing.ui.NodeContext.QueryKey; import org.simantics.browsing.ui.NodeQueryManager; import org.simantics.browsing.ui.Tester; import org.simantics.browsing.ui.common.EvaluatorData; import org.simantics.browsing.ui.common.EvaluatorData.Evaluator; import org.simantics.browsing.ui.common.EvaluatorData.EvaluatorTree; import org.simantics.browsing.ui.common.Preference; import org.simantics.utils.datastructures.collections.CollectionUtils; /** * A base class for query processors that resolve a set of suitable factory * classes of a kind for a given INodeContext. * *
* The purpose of this class is to generically implement a basic logic for
* resolving available factories (viewpoint/labeler/labeldecorator/comparator)
* any given input. The implementation works based on an
* EvaluatorData
instance that is specified externally.The logic is
* as follows:
*
Evaluator
s from the externally specified
* EvaluatorData (see {@link EvaluatorData#get(Object)}).Evaluator
:
* EvaluatorTree
structure returned by
* {@link #getEvaluatorTree(Evaluator)} while checking at each node whether the
* {@link Tester} returned by {@link EvaluatorTree#getTester()} returns
* true
. If true
is returned, the factories at this
* node ({@link EvaluatorTree#getAcceptedFactories()}) are added to the result
* and all children ({@link EvaluatorTree#getChildren()}) are recursively
* walked. Otherwise if false
is returned, the walking of the
* subtree will end.* This class intended for sub-classing, please implement these methods: *
getEvaluatorTree(Evaluator)
- return the appropriate
* EvaluatorTree
of the specified Evaluator