Skip to content

Package: InternalProject

InternalProject

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011 Eike Stepper (Berlin, Germany) and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Eike Stepper - initial API and implementation
13: *******************************************************************************/
14: package org.eclipse.emf.ecp.spi.core;
15:
16: import java.util.Collection;
17: import java.util.Iterator;
18: import java.util.Set;
19:
20: import org.eclipse.emf.ecore.EClass;
21: import org.eclipse.emf.ecore.EObject;
22: import org.eclipse.emf.ecore.EPackage;
23: import org.eclipse.emf.ecore.EReference;
24: import org.eclipse.emf.ecp.core.ECPProject;
25: import org.eclipse.emf.ecp.core.util.ECPProjectAware;
26: import org.eclipse.emf.ecp.internal.core.util.PropertiesStore.StorableElement;
27: import org.eclipse.emf.ecp.spi.core.InternalProvider.LifecycleEvent;
28:
29: /**
30: * @author Eike Stepper
31: * @author Eugen Neufeld
32: * @noextend This interface is not intended to be extended by clients.
33: * @noimplement This interface is not intended to be implemented by clients.
34: * @since 1.1
35: */
36: public interface InternalProject extends ECPProject, ECPProjectAware, StorableElement, Cloneable {
37:
38:         /**
39:          * This method returns the repository this project is shared on.
40:          *
41:          * @return the repository of this project or null if not shared
42:          */
43:         @Override
44:         InternalRepository getRepository();
45:
46:         /**
47:          * This method returns the provider of this project.
48:          *
49:          * @return the provider of this project
50:          */
51:         @Override
52:         InternalProvider getProvider();
53:
54:         /**
55:          * This method returns the provider specific data of this project.
56:          *
57:          * @return the provider specific data of this project
58:          */
59:         Object getProviderSpecificData();
60:
61:         /**
62:          * This method sets the provider specific data of this project.
63:          *
64:          * @param data the provider specific data of this project
65:          */
66:         void setProviderSpecificData(Object data);
67:
68:         /**
69:          * This method is a callback for the provider to notify the project about changes.
70:          *
71:          * @param objects the objects that have changed
72:          * @param structural if the changes where structural (e.g. delete)
73:          */
74:         void notifyObjectsChanged(Collection<Object> objects, boolean structural);
75:
76:         /**
77:          * This method undisposes the project based on a repository.
78:          *
79:          * @param repository the repository
80:          */
81:         void undispose(InternalRepository repository);
82:
83:         /**
84:          * This method is used to notify the provider about a {@link LifecycleEvent} of this project.
85:          *
86:          * @param event to pass to the provider
87:          */
88:         void notifyProvider(LifecycleEvent event);
89:
90:         /**
91:          * This method clones a project.
92:          *
93:          * @param name the name of the project to create
94:          * @return the cloned project
95:          */
96:         InternalProject clone(String name);
97:
98:         /**
99:          * Saves the properties, such as visible packages or the name of the project into the workspace.
100:          *
101:          * @deprecated As of 1.1 properties are saved automatically when they're changed.
102:          */
103:         @Deprecated
104:         void saveProperties();
105:
106:         /**
107:          * Get all possible {@link EObject}s from the provider to which a reference can be added from a certain
108:          * {@link EObject} based
109:          * on the type of the {@link EReference}.
110:          *
111:          * @param eObject
112:          * - the {@link EObject} for which the reference should be set.
113:          * @param eReference
114:          * - the {@link EReference} to be set.
115:          * @return {@link Iterator} over all {@link EObject} that can be added as a reference
116:          */
117:         Iterator<EObject> getReferenceCandidates(EObject eObject, EReference eReference);
118:
119:         /**
120:          * This method checks whether the provided object is the model root of the project.
121:          *
122:          * @param object the object to check
123:          * @return true if the object is the root of the model of this project, false otherwise
124:          */
125:         boolean isModelRoot(Object object);
126:
127:         /**
128:          * Returns a collection of {@link EPackage}s which are not supported by the provider. EObjects from these packages
129:          * cannot be created within the project.
130:          *
131:          * @return {@link Collection} of unsupported {@link EPackage}s
132:          */
133:         Set<EPackage> getUnsupportedEPackages();
134:
135:         /**
136:          * Set the visible {@link EPackage}s. New model elements can only be created from {@link EPackage}s contained in
137:          * the visiblePackages and the {@link #setVisibleEClasses(Set)}.
138:          *
139:          * @param visiblePackages the {@link EPackage}s to be visible
140:          */
141:         void setVisiblePackages(Set<EPackage> visiblePackages);
142:
143:         /**
144:          * Get the currently visible {@link EPackage}s. If no filter is set, then all {@link EPackage}s supported by the
145:          * provider are returned.
146:          *
147:          * @return {@link Set} of {@link EPackage}s that should be available, or all supported EPackages
148:          */
149:         Set<EPackage> getVisiblePackages();
150:
151:         /**
152:          * Get the currently visible {@link EClass}es. If no visible {@link EClass}es are set, then an empty {@link Set} is
153:          * returned.
154:          *
155:          * @return {@link Set} of {@link EClass}es that should be available, or empty.
156:          */
157:         Set<EClass> getVisibleEClasses();
158:
159:         /**
160:          * Set the visible {@link EClass}es.
161:          *
162:          * @param visibleEClasses the classes that should be available
163:          */
164:         void setVisibleEClasses(Set<EClass> visibleEClasses);
165:
166:         /**
167:          * Check whether a project contains an Object.
168:          *
169:          * @param object the object to check for containment
170:          * @return true if the object is in the project, false otherwise
171:          */
172:         boolean contains(Object object);
173: }