1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
\r
3 * in Industry THTH ry.
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.browsing.ui.graph.impl.contribution;
\r
14 import org.simantics.browsing.ui.BuiltinKeys.ImageDecoratorKey;
\r
15 import org.simantics.browsing.ui.NodeContext;
\r
16 import org.simantics.browsing.ui.PrimitiveQueryUpdater;
\r
17 import org.simantics.browsing.ui.content.ImageDecorator;
\r
18 import org.simantics.db.AsyncReadGraph;
\r
19 import org.simantics.db.procedure.Listener;
\r
20 import org.simantics.db.procedure.Procedure;
\r
21 import org.simantics.utils.ui.ErrorLogger;
\r
24 * Implement {@link #children(AsyncReadGraph)} and
\r
25 * {@link #hasChildren(AsyncReadGraph)}.
\r
27 * @author Tuukka Lehtonen
\r
29 abstract public class ImageDecoratorContributionImpl extends FinalImageDecoratorContributionImpl {
\r
31 public ImageDecoratorContributionImpl(PrimitiveQueryUpdater updater, NodeContext context, ImageDecoratorKey key) {
\r
32 super(updater, context, key);
\r
36 protected Procedure<ImageDecorator> createProcedure() {
\r
38 return new Listener<ImageDecorator>() {
\r
40 boolean executed = false;
\r
41 boolean disposed = false;
\r
44 public void execute(ImageDecorator result) {
\r
45 replaceResult(result);
\r
50 public boolean isDisposed() {
\r
52 if(disposed) return true;
\r
54 if((updater.isDisposed() || !updater.isShown(context)) && executed) {
\r
65 public void exception(Throwable t) {
\r
66 ErrorLogger.defaultLogError(
\r
67 "ImageDecoratorContributionImpl.imageQuery failed, see exception for details.", t);
\r