1 /*******************************************************************************
2 * Copyright (c) 2007, 2012 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.swt.widgets.impl;
14 import java.util.concurrent.CopyOnWriteArrayList;
16 import org.eclipse.jface.viewers.ISelection;
17 import org.eclipse.jface.viewers.StructuredSelection;
18 import org.simantics.Simantics;
19 import org.simantics.db.ReadGraph;
20 import org.simantics.db.Resource;
21 import org.simantics.db.management.ISessionContext;
23 public class WidgetSupportFactory {
25 public static WidgetSupport projectSupport() {
27 return new WidgetSupport() {
29 final private CopyOnWriteArrayList<Widget> widgets = new CopyOnWriteArrayList<Widget>();
32 public synchronized void register(Widget widget) {
37 public void update(Widget widget) {
38 throw new Error("Not implemented.");
42 public void update() {
43 throw new Error("Not implemented.");
47 public <T> T getInput() {
48 throw new Error("Not implemented.");
52 public void finish() {
53 Resource project = Simantics.peekProjectResource();
54 if(project == null) return;
55 ISelection input = new StructuredSelection(project);
56 fireInput(Simantics.getSessionContext(), input);
59 public void fireInput(ISessionContext context, Object input) {
60 for(Widget widget : widgets) widget.setInput(context, input);
64 public <T> T getParameter(String key) {
65 throw new Error("Not implemented.");
69 public void setParameter(String key, Object value) {
70 throw new Error("Not implemented.");
74 public <T> T getInput(ReadGraph graph) {
75 throw new Error("Not implemented.");