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.platform.debug;
14 import java.util.Collections;
18 import org.eclipse.swt.widgets.Composite;
19 import org.eclipse.ui.IViewPart;
20 import org.eclipse.ui.IWorkbenchPart;
21 import org.simantics.browsing.ui.GraphExplorer;
22 import org.simantics.browsing.ui.common.EvaluatorData;
23 import org.simantics.browsing.ui.graph.impl.Evaluators;
24 import org.simantics.browsing.ui.graph.impl.SessionContextInputSource;
25 import org.simantics.browsing.ui.platform.GraphExplorerView;
26 import org.simantics.browsing.ui.swt.DefaultSelectionDataResolver;
27 import org.simantics.browsing.ui.swt.GraphExplorerFactory;
28 import org.simantics.db.Session;
29 import org.simantics.db.management.ISessionContext;
30 import org.simantics.db.management.ISessionContextProvider;
31 import org.simantics.utils.ui.workbench.WorkbenchUtils;
33 public class BrowseDebuggerView extends GraphExplorerView {
35 final private Set<String> browseContexts = Collections.singleton("browseDebuggerView");
38 protected GraphExplorer createExplorerControl(Composite parent) {
39 return GraphExplorerFactory.getInstance()
40 .selectionDataResolver(new DefaultSelectionDataResolver())
44 public BrowseDebuggerView() {
46 setInputSource(new SessionContextInputSource() {
49 public Object get(ISessionContext ctx) {
51 Map<String, String> args = getViewArguments();
52 System.out.println("args=" + args);
54 IViewPart view = WorkbenchUtils.findView(args.get("view"));
55 System.out.println("view=" + view);
62 public IWorkbenchPart getProvider() {
63 Map<String, String> args = getViewArguments();
64 IViewPart view = WorkbenchUtils.findView(args.get("view"));
73 protected EvaluatorData createEvaluatorData(Session session) {
75 return Evaluators.load(session, browseContexts, resourceManager);
79 @SuppressWarnings({ "rawtypes" })
81 public Object getAdapter(Class adapter) {
83 // if(adapter == IPropertyPage.class) {
84 // return new UserPropertyPage(getSite(), this);
86 if(adapter == ISessionContextProvider.class) {
87 return getSessionContextProvider();
90 return super.getAdapter(adapter);