]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/ContributionViewpointFactory.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.browsing.ui.graph.impl / src / org / simantics / browsing / ui / graph / impl / ContributionViewpointFactory.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.graph.impl;
13
14 import java.util.Collection;
15
16 import org.simantics.browsing.ui.NodeContext;
17 import org.simantics.browsing.ui.PrimitiveQueryUpdater;
18 import org.simantics.browsing.ui.BuiltinKeys.ViewpointKey;
19 import org.simantics.browsing.ui.content.Viewpoint;
20 import org.simantics.browsing.ui.content.ViewpointContributionFactory;
21 import org.simantics.browsing.ui.content.ViewpointFactory;
22
23 public class ContributionViewpointFactory implements ViewpointFactory {
24
25     final private String name;
26     final private Collection<ViewpointContributionFactory> contributions;
27     
28     public ContributionViewpointFactory(String name, Collection<ViewpointContributionFactory> contributions) {
29         this.name = name;
30         this.contributions = contributions;
31     }
32     
33     @Override
34     public Viewpoint create(PrimitiveQueryUpdater updater,
35             NodeContext context, ViewpointKey key) {
36
37         assert(updater != null);
38         assert(context != null);
39
40         return new ContributionViewpoint(contributions);
41         
42     }
43     
44     @Override
45     public String toString() {
46         return name;
47     }
48
49 }