]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.project/src/org/simantics/project/internal/ProjectFeatureExtension.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.project / src / org / simantics / project / internal / ProjectFeatureExtension.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.project.internal;
13
14 import java.util.Collection;
15 import java.util.Collections;
16
17 import org.eclipse.core.runtime.CoreException;
18 import org.eclipse.core.runtime.IConfigurationElement;
19 import org.simantics.project.features.IProjectFeature;
20 import org.simantics.project.features.registry.GroupReference;
21 import org.simantics.project.features.registry.IProjectFeatureExtension;
22 import org.simantics.project.features.registry.InjectedDependency;
23 import org.simantics.project.features.registry.ProjectFeatureReference;
24
25 /**
26  * @author Tuukka Lehtonen
27  */
28 class ProjectFeatureExtension implements IProjectFeatureExtension {
29
30     // For access to createExecutableExtension(String).
31     private final IConfigurationElement configurationElement;
32
33     private final String id;
34     private final String label;
35     private final String description;
36     private final boolean published;
37
38     private final Collection<ProjectFeatureReference> requires;
39     private final Collection<GroupReference> installGroups;
40     private final Collection<InjectedDependency> injections;
41
42     public ProjectFeatureExtension(IConfigurationElement ce, String id, String label, String description,
43             boolean published, Collection<ProjectFeatureReference> requires, Collection<InjectedDependency> injections,
44             Collection<GroupReference> installGroups) {
45         this.configurationElement = ce;
46         this.id = id;
47         this.label = label;
48         this.description = description;
49         this.published = published;
50         this.requires = Collections.unmodifiableCollection(requires);
51         this.injections = Collections.unmodifiableCollection(injections);
52         this.installGroups = Collections.unmodifiableCollection(installGroups);
53     }
54
55     @Override
56     public String getId() {
57         return id;
58     }
59
60     @Override
61     public String getLabel() {
62         return label;
63     }
64
65     @Override
66     public String getDescription() {
67         return description;
68     }
69
70     @Override
71     public boolean isPublished() {
72         return published;
73     }
74
75     @Override
76     public Collection<ProjectFeatureReference> requires() {
77         return requires;
78     }
79
80     public Collection<InjectedDependency> injections() {
81         return injections;
82     }
83
84     @Override
85     public Collection<GroupReference> installGroups() {
86         return installGroups;
87     }
88
89     @Override
90     public IProjectFeature newInstance() throws CoreException {
91         return (IProjectFeature) configurationElement.createExecutableExtension("class");
92     }
93
94     @Override
95     public String toString() {
96         return super.toString() + " [id=" + id + ", label=" + label + ", description=" + description + ", published=" + published + ", requires=" + requires + ", injections=" + injections + ", usedWithGroups=" + installGroups + "]";
97     }
98
99 }