1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
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
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.project.internal;
14 import java.util.Collection;
15 import java.util.Collections;
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;
26 * @author Tuukka Lehtonen
28 class ProjectFeatureExtension implements IProjectFeatureExtension {
30 // For access to createExecutableExtension(String).
31 private final IConfigurationElement configurationElement;
33 private final String id;
34 private final String label;
35 private final String description;
36 private final boolean published;
38 private final Collection<ProjectFeatureReference> requires;
39 private final Collection<GroupReference> installGroups;
40 private final Collection<InjectedDependency> injections;
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;
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);
56 public String getId() {
61 public String getLabel() {
66 public String getDescription() {
71 public boolean isPublished() {
76 public Collection<ProjectFeatureReference> requires() {
80 public Collection<InjectedDependency> injections() {
85 public Collection<GroupReference> installGroups() {
90 public IProjectFeature newInstance() throws CoreException {
91 return (IProjectFeature) configurationElement.createExecutableExtension("class");
95 public String toString() {
96 return super.toString() + " [id=" + id + ", label=" + label + ", description=" + description + ", published=" + published + ", requires=" + requires + ", injections=" + injections + ", usedWithGroups=" + installGroups + "]";