1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.browsing.ui.common.processors;
14 import java.util.Collection;
15 import java.util.Collections;
18 import org.simantics.browsing.ui.BuiltinKeys;
19 import org.simantics.browsing.ui.NodeContext;
20 import org.simantics.browsing.ui.NodeQueryManager;
21 import org.simantics.browsing.ui.PrimitiveQueryUpdater;
22 import org.simantics.browsing.ui.BuiltinKeys.LabelerKey;
23 import org.simantics.browsing.ui.GraphExplorer.ModificationContext;
24 import org.simantics.browsing.ui.NodeContext.QueryKey;
25 import org.simantics.browsing.ui.content.Labeler;
26 import org.simantics.browsing.ui.content.LabelerFactory;
28 public class DefaultLabelerFactoriesProcessor extends AbstractNodeQueryProcessor<Collection<LabelerFactory>> {
33 public QueryKey<Collection<LabelerFactory>> getIdentifier() {
34 return BuiltinKeys.LABELER_FACTORIES;
38 public Collection<LabelerFactory> query(NodeQueryManager manager, NodeContext context) {
39 return Collections.singleton((LabelerFactory) new LabelerFactory() {
41 public Labeler create(PrimitiveQueryUpdater updater, final NodeContext context, LabelerKey key) {
43 if (++koss % 1000 == 0)
44 System.out.println("Produced " + koss + " labels");
46 return new Labeler() {
48 public Map<String, String> getLabels() {
49 return Collections.singletonMap("single", context.getConstant(BuiltinKeys.INPUT).toString());
52 public Map<String, String> getRuntimeLabels() {
53 return Collections.emptyMap();
56 public int getCategory() {
60 public Modifier getModifier(ModificationContext modificationContext, String key) {
64 public void setListener(LabelerListener listener) {
65 // Intentionally blank, cannot implement listening.
73 public String toString() {
74 return "LabelerFactoriesProcessor";