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.graph.impl.contribution;
14 import java.util.Collection;
16 import org.simantics.browsing.ui.NodeContext;
17 import org.simantics.browsing.ui.PrimitiveQueryUpdater;
18 import org.simantics.browsing.ui.BuiltinKeys.ViewpointContributionKey;
19 import org.simantics.db.AsyncReadGraph;
20 import org.simantics.db.procedure.Listener;
21 import org.simantics.db.procedure.Procedure;
22 import org.simantics.utils.ui.ErrorLogger;
25 * Implement {@link #children(AsyncReadGraph)} and {@link #hasChildren(AsyncReadGraph)}.
27 * @author Tuukka Lehtonen
29 abstract public class ViewpointContributionImpl extends FinalViewpointContributionImpl {
31 public ViewpointContributionImpl(PrimitiveQueryUpdater updater,
32 NodeContext context, ViewpointContributionKey key) {
33 super(updater, context, key);
37 protected Procedure<Collection<NodeContext>> createProcedure() {
39 return new Listener<Collection<NodeContext>>() {
42 public void execute(Collection<NodeContext> result) {
43 replaceChildrenResult(result);
47 public boolean isDisposed() {
48 return updater.isDisposed();
51 public void exception(Throwable t) {
52 ErrorLogger.defaultLogError("LazyContributionImpl.childQuery failed, see exception for details.", t);
56 public String toString() {
57 return "LazyContributionImpl[" + System.identityHashCode(ViewpointContributionImpl.this) + "].childProcedure";