-/*******************************************************************************\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.selectionview;\r
-\r
-import java.util.Collection;\r
-import java.util.HashSet;\r
-import java.util.Set;\r
-\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.ui.IWorkbenchPartSite;\r
-import org.eclipse.ui.part.IPageSite;\r
-import org.simantics.browsing.ui.common.ErrorLogger;\r
-import org.simantics.browsing.ui.common.views.IFilterArea;\r
-import org.simantics.browsing.ui.common.views.IFilterAreaProvider;\r
-import org.simantics.db.ReadGraph;\r
-\r
-/**\r
- * @author Antti Villberg\r
- * \r
- * @see StandardPropertyPage\r
- */\r
-public class StandardProperties extends TabbedPropertyTable implements IFilterAreaProvider, IPropertyTab {\r
-\r
- /**\r
- * @param site\r
- * @param pageSite\r
- * @param parent\r
- * @param style\r
- * @param browseContexts the browse contexts to use for loading this\r
- * property table\r
- * @param selectionProcessors a fixed set of selection processors, may be\r
- * <code>null</code>\r
- */\r
- public StandardProperties(IWorkbenchPartSite site, IPageSite pageSite, Composite parent, int style,\r
- final Set<String> browseContexts, final Collection<SelectionProcessor<?, ?>> selectionProcessors) {\r
- super(site, pageSite, parent, style);\r
-\r
- final Set<SelectionProcessor<?, ?>> processors = new HashSet<SelectionProcessor<?, ?>>();\r
- if (selectionProcessors != null)\r
- processors.addAll(selectionProcessors);\r
-\r
- //System.out.println("StandardProperties with contexts: " + browseContexts);\r
- for (final SelectionProcessorBinding binding : SelectionProcessorBindingExtensionManager.getInstance().getBoundContributions(browseContexts)) {\r
- //System.out.println("found " + binding.getProcessor());\r
- processors.add(binding.getProcessor());\r
- }\r
-\r
- setSelectionProcessor(new SelectionProcessor<Object, ReadGraph>() {\r
-\r
- @SuppressWarnings({ "rawtypes", "unchecked" })\r
- @Override\r
- public Collection<?> process(final Object selection, ReadGraph graph) {\r
-\r
- HashSet<Object> l = new HashSet<Object>();\r
- for (SelectionProcessor p : processors) {\r
- Collection<?> c = p.process(selection, graph);\r
- if (c != null) {\r
- l.addAll(c);\r
- } else {\r
- ErrorLogger.defaultLogWarning("SelectionProcessor '" + p + "' invalidly returned null with selection '" + selection + "'", null);\r
- }\r
- }\r
-\r
- return l;\r
-\r
- }\r
-\r
- });\r
- }\r
-\r
- @Override\r
- public IFilterArea getFilterArea() {\r
- IPropertyTab active = getActiveTab();\r
- if (!(active instanceof IFilterAreaProvider))\r
- return null;\r
- return ((IFilterAreaProvider) active).getFilterArea();\r
- }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.selectionview;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.part.IPageSite;
+import org.simantics.browsing.ui.common.ErrorLogger;
+import org.simantics.browsing.ui.common.views.IFilterArea;
+import org.simantics.browsing.ui.common.views.IFilterAreaProvider;
+import org.simantics.db.ReadGraph;
+
+/**
+ * @author Antti Villberg
+ *
+ * @see StandardPropertyPage
+ */
+public class StandardProperties extends TabbedPropertyTable implements IFilterAreaProvider, IPropertyTab {
+
+ /**
+ * @param site
+ * @param pageSite
+ * @param parent
+ * @param style
+ * @param browseContexts the browse contexts to use for loading this
+ * property table
+ * @param selectionProcessors a fixed set of selection processors, may be
+ * <code>null</code>
+ */
+ public StandardProperties(IWorkbenchPartSite site, IPageSite pageSite, Composite parent, int style,
+ final Set<String> browseContexts, final Collection<SelectionProcessor<?, ?>> selectionProcessors) {
+ super(site, pageSite, parent, style);
+
+ final Set<SelectionProcessor<?, ?>> processors = new HashSet<SelectionProcessor<?, ?>>();
+ if (selectionProcessors != null)
+ processors.addAll(selectionProcessors);
+
+ //System.out.println("StandardProperties with contexts: " + browseContexts);
+ for (final SelectionProcessorBinding binding : SelectionProcessorBindingExtensionManager.getInstance().getBoundContributions(browseContexts)) {
+ //System.out.println("found " + binding.getProcessor());
+ processors.add(binding.getProcessor());
+ }
+
+ setSelectionProcessor(new SelectionProcessor<Object, ReadGraph>() {
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ public Collection<?> process(final Object selection, ReadGraph graph) {
+
+ HashSet<Object> l = new HashSet<Object>();
+ for (SelectionProcessor p : processors) {
+ Collection<?> c = p.process(selection, graph);
+ if (c != null) {
+ l.addAll(c);
+ } else {
+ ErrorLogger.defaultLogWarning("SelectionProcessor '" + p + "' invalidly returned null with selection '" + selection + "'", null);
+ }
+ }
+
+ return l;
+
+ }
+
+ });
+ }
+
+ @Override
+ public IFilterArea getFilterArea() {
+ IPropertyTab active = getActiveTab();
+ if (!(active instanceof IFilterAreaProvider))
+ return null;
+ return ((IFilterAreaProvider) active).getFilterArea();
+ }
+
+}