--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.browsing.ui.platform.debug;\r
+\r
+import java.util.Collections;\r
+import java.util.Map;\r
+import java.util.Set;\r
+\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.ui.IViewPart;\r
+import org.eclipse.ui.IWorkbenchPart;\r
+import org.simantics.browsing.ui.GraphExplorer;\r
+import org.simantics.browsing.ui.common.EvaluatorData;\r
+import org.simantics.browsing.ui.graph.impl.Evaluators;\r
+import org.simantics.browsing.ui.graph.impl.SessionContextInputSource;\r
+import org.simantics.browsing.ui.platform.GraphExplorerView;\r
+import org.simantics.browsing.ui.swt.DefaultSelectionDataResolver;\r
+import org.simantics.browsing.ui.swt.GraphExplorerFactory;\r
+import org.simantics.db.Session;\r
+import org.simantics.db.management.ISessionContext;\r
+import org.simantics.db.management.ISessionContextProvider;\r
+import org.simantics.utils.ui.workbench.WorkbenchUtils;\r
+\r
+public class BrowseDebuggerView extends GraphExplorerView {\r
+\r
+ final private Set<String> browseContexts = Collections.singleton("browseDebuggerView");\r
+\r
+ @Override\r
+ protected GraphExplorer createExplorerControl(Composite parent) {\r
+ return GraphExplorerFactory.getInstance()\r
+ .selectionDataResolver(new DefaultSelectionDataResolver())\r
+ .create(parent);\r
+ }\r
+\r
+ public BrowseDebuggerView() {\r
+\r
+ setInputSource(new SessionContextInputSource() {\r
+\r
+ @Override\r
+ public Object get(ISessionContext ctx) {\r
+\r
+ Map<String, String> args = getViewArguments();\r
+ System.out.println("args=" + args);\r
+\r
+ IViewPart view = WorkbenchUtils.findView(args.get("view"));\r
+ System.out.println("view=" + view);\r
+\r
+ return view;\r
+\r
+ }\r
+ \r
+ @Override\r
+ public IWorkbenchPart getProvider() {\r
+ Map<String, String> args = getViewArguments();\r
+ IViewPart view = WorkbenchUtils.findView(args.get("view"));\r
+ return view;\r
+ }\r
+\r
+ });\r
+\r
+ }\r
+\r
+ @Override\r
+ protected EvaluatorData createEvaluatorData(Session session) {\r
+\r
+ return Evaluators.load(session, browseContexts, resourceManager);\r
+\r
+ }\r
+\r
+ @SuppressWarnings({ "rawtypes" })\r
+ @Override\r
+ public Object getAdapter(Class adapter) {\r
+\r
+// if(adapter == IPropertyPage.class) {\r
+// return new UserPropertyPage(getSite(), this);\r
+// }\r
+ if(adapter == ISessionContextProvider.class) {\r
+ return getSessionContextProvider();\r
+ }\r
+\r
+ return super.getAdapter(adapter);\r
+\r
+ }\r
+\r
+}\r