]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.browsing.ui.common/src/org/simantics/browsing/ui/common/contributor/ComparableContributorImpl.java
6c9ed5756455e3e26a87c1e063aba7305a925dbf
[simantics/platform.git] / bundles / org.simantics.browsing.ui.common / src / org / simantics / browsing / ui / common / contributor / ComparableContributorImpl.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
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
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.browsing.ui.common.contributor;
13
14 import org.simantics.browsing.ui.Tester;
15 import org.simantics.browsing.ui.content.ComparableContextFactory;
16 import org.simantics.browsing.ui.content.Contributor;
17 import org.simantics.utils.ReflectionUtils;
18
19 /**
20  * @author Tuukka Lehtonen
21  *
22  * @param <T> input object types to use this comparable contributor for
23  */
24 public abstract class ComparableContributorImpl<T> implements Contributor<ComparableContextFactory> {
25
26     private final Class<?> clazz;
27
28     public ComparableContributorImpl() {
29         this.clazz = ReflectionUtils.getSingleParameterType(getClass());
30     }
31
32     public ComparableContributorImpl(Class<?> clazz) {
33         this.clazz = clazz;
34     }
35
36     @Override
37     public Tester getNodeContextTester() {
38         return null;
39     }
40
41     @Override
42     public Class<?> getInputClass() {
43         return clazz;
44     }
45
46     @Override
47     public abstract ComparableContextFactory getFactory();
48
49 }