X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.selectionview%2Fsrc%2Forg%2Fsimantics%2Fselectionview%2FStandardProperties.java;fp=bundles%2Forg.simantics.selectionview%2Fsrc%2Forg%2Fsimantics%2Fselectionview%2FStandardProperties.java;h=792ba2f4236bd5c49a5b48992d4a7818f4fd786a;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=82fdcfcdc93485426ae68143e6e0ff96157fae95;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.selectionview/src/org/simantics/selectionview/StandardProperties.java b/bundles/org.simantics.selectionview/src/org/simantics/selectionview/StandardProperties.java index 82fdcfcdc..792ba2f42 100644 --- a/bundles/org.simantics.selectionview/src/org/simantics/selectionview/StandardProperties.java +++ b/bundles/org.simantics.selectionview/src/org/simantics/selectionview/StandardProperties.java @@ -1,88 +1,88 @@ -/******************************************************************************* - * 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 - * null - */ - public StandardProperties(IWorkbenchPartSite site, IPageSite pageSite, Composite parent, int style, - final Set browseContexts, final Collection> selectionProcessors) { - super(site, pageSite, parent, style); - - final Set> processors = new HashSet>(); - 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() { - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public Collection process(final Object selection, ReadGraph graph) { - - HashSet l = new HashSet(); - 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(); - } - -} +/******************************************************************************* + * 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 + * null + */ + public StandardProperties(IWorkbenchPartSite site, IPageSite pageSite, Composite parent, int style, + final Set browseContexts, final Collection> selectionProcessors) { + super(site, pageSite, parent, style); + + final Set> processors = new HashSet>(); + 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() { + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + public Collection process(final Object selection, ReadGraph graph) { + + HashSet l = new HashSet(); + 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(); + } + +}