Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • af3/kernel
  • diewald/kernel
2 results
Show changes
......@@ -33,10 +33,21 @@ import org.fortiss.tooling.kernel.service.IPrototypeService;
* @author hoelzl
*/
public interface IPrototypeProvider {
/** Returns the prototypes provided by this provider. */
List<Prototype> getPrototypes();
/** Returns the categories of prototypes. */
List<PrototypeCategory> getCategories();
/**
* Returns a unique ID for the given {@link Prototype} or {@code null} if the prototype does not
* stem from this provider.
*/
String getUniqueID(Prototype prototype);
/**
* Returns the {@link Prototype} for the given unique ID or {@code null} if the unique ID does
* not correspond to any prototype of this provider.
*/
Prototype getPrototypeByID(String id);
}
ConstraintBases.java 93b4743cc1f5e2677635e644663ba934ef7f7f4e GREEN
ConstraintCheckerBase.java 92de33f1a3071dc6d66a55d8c10f5d5cc967a4fc GREEN
ConstraintViolationBase.java ec66973ab2183623f0cd4a85c59c886dddad6cf6 GREEN
DialogMessage.java 8420640e999e4fb15fa644333e5d71e1d16c2559 GREEN
ElementCompositorBase.java 7a445e5adde11878fe0515baca8b915287149b28 GREEN
MultiViolationConstraintCheckerBase.java 30886a94c99cf8948f64401b1db821abe06e1e6c GREEN
PrototypeProviderBase.java ebcd1794c3798b9899a620b01fd5aa0402129423 GREEN
RemoveDeprecatedArtifactsMigrationProviderBase.java 4a1b676223b7ec53259a26d1a671b11ff2f911e2 GREEN
PrototypeProviderBase.java b433cffcaf020987c84df8c127dac871e0fd8fb9 GREEN
TransformationContextChainBase.java 1ef37880ab275778c563928e80ba378fec964cb6 GREEN
TransformationProviderBase.java 9e91100cc1f2c8fbd8d41af55aedfea34e02ff71 GREEN
......@@ -15,12 +15,13 @@
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.kernel.extension.base;
import static org.conqat.lib.commons.collections.CollectionUtils.asUnmodifiable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.conqat.lib.commons.collections.CollectionUtils;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.kernel.extension.IPrototypeProvider;
import org.fortiss.tooling.kernel.extension.data.Prototype;
......@@ -76,7 +77,7 @@ public abstract class PrototypeProviderBase implements IPrototypeProvider {
/** {@inheritDoc} */
@Override
public final List<Prototype> getPrototypes() {
return CollectionUtils.asUnmodifiable(prototypes);
return asUnmodifiable(prototypes);
}
/** Registers the element with the given category. */
......@@ -111,4 +112,33 @@ public abstract class PrototypeProviderBase implements IPrototypeProvider {
result.addAll(categories.values());
return result;
}
/** {@inheritDoc} */
@Override
public final String getUniqueID(Prototype prototype) {
if(!prototypes.contains(prototype)) {
return null;
}
return this.getClass().getName() + '/' + prototype.getName();
}
/** {@inheritDoc} */
@Override
public final Prototype getPrototypeByID(String id) {
String cname = this.getClass().getName();
if(!id.startsWith(cname)) {
return null;
}
id = id.substring(cname.length());
if(!id.startsWith("/")) {
return null;
}
id = id.substring(1);
for(Prototype p : prototypes) {
if(p.getName().equals(id)) {
return p;
}
}
return null;
}
}
......@@ -8,7 +8,7 @@ LibraryService.java d22671ba820466062852c15873698adf28960d94 GREEN
LoggingService.java da784259f7b456b54bf75c41ec268f64919ce78d GREEN
MigrationService.java 2f800eac9793aa736089a802bbfc2c4c1c09770d GREEN
PersistencyService.java 103eef642c038ef63fa49b743d803aaa3fea2724 GREEN
PrototypeService.java 18c3db05ab11f189a9711bf241c3c7f35c954a9e GREEN
PrototypeService.java cf8e6fa96ba9c2f65b24400054ed68e93238a975 GREEN
ToolingKernelInternal.java f6e7114825748683c7f1d040b41ab854a6c4d79b GREEN
TransformationService.java 3cdb86fe920158f93cd9466c6ef9697b2dd8ca7f GREEN
TutorialService.java 675d3f365ce062869f86baa3779d50687674bda0 GREEN
......@@ -162,6 +162,30 @@ public class PrototypeService implements IPrototypeService, IIntrospectiveKernel
return result;
}
/** {@inheritDoc} */
@Override
public String getUniquePrototypeID(Prototype prototype) {
for(IPrototypeProvider prov : prototypeProviderList) {
String uid = prov.getUniqueID(prototype);
if(uid != null) {
return uid;
}
}
return null;
}
/** {@inheritDoc} */
@Override
public Prototype getPrototypeByUniqueID(String id) {
for(IPrototypeProvider prov : prototypeProviderList) {
Prototype proto = prov.getPrototypeByID(id);
if(proto != null) {
return proto;
}
}
return null;
}
/** {@inheritDoc} */
@Override
public List<Prototype> getComposablePrototypes(Class<? extends EObject> modelElementType) {
......
ICommandStackService.java 678dcd1a6ab435ed0870fa2a9ec48ce47f25a187 GREEN
IConnectionCompositorService.java 0cdf4568b2cd3e95ea195df90a84699eff36442b GREEN
IConstraintCheckerService.java 291e53297aaea213e07e78f63350938ee2c7b155 GREEN
IConstraintService.java d55c3e25b8cef7e2f7c555adec7ff31e28449370 GREEN
IEclipseResourceStorageService.java b1155ca15cd9474d4d533d6cb2725e8a22040ec9 GREEN
IElementCompositorService.java acd462ec15f3bcc247b544b46ceebee971fe1408 GREEN
IKernelIntrospectionSystemService.java 7005c3acb4c6f978729d93279c595765e94e38eb GREEN
......@@ -9,6 +8,6 @@ ILibraryService.java e1e2ec72b1db892478ed20c7fbb7dcf94472a1cd GREEN
ILoggingService.java 1ee9723af5a79299249e8db345e8419f814ff6d1 GREEN
IMigrationService.java 7cfa6268b97f0c38c838905791e065655c6d6a04 GREEN
IPersistencyService.java 2b2eeb329e3040e75f4352d9c374855583e27538 GREEN
IPrototypeService.java 47f5ab07c17d5da704860378a49493fa83b3e20b GREEN
IPrototypeService.java d2b66742bea8bd6d394157985def6f8ea39c8d20 GREEN
ITransformationService.java 71f175e94d7257713cb14c8148de5a309b03788a GREEN
ITutorialService.java 22a490516e38536203b1edd32711b615b77a4728 GREEN
......@@ -24,6 +24,8 @@ import org.fortiss.tooling.kernel.extension.data.Prototype;
import org.fortiss.tooling.kernel.extension.data.PrototypeCategory;
import org.fortiss.tooling.kernel.internal.PrototypeService;
import javafx.scene.input.DataFormat;
/**
* The prototype service provides registration and access to model element
* prototypes. It distinguishes between two types of prototypes. Primary
......@@ -37,6 +39,10 @@ import org.fortiss.tooling.kernel.internal.PrototypeService;
* @author hoelzl
*/
public interface IPrototypeService {
/** The DataFormat used to transfer prototypes via drag-and-drop. */
public static final DataFormat PROTOTYPE_DATA_FORMAT =
new DataFormat(IPrototypeService.class.getName());
/** Returns the service instance. */
public static IPrototypeService getInstance() {
return PrototypeService.getInstance();
......@@ -51,6 +57,15 @@ public interface IPrototypeService {
/** Returns the list of primary prototypes registered any provider. */
UnmodifiableList<Prototype> getPrimaryPrototypes();
/** Returns a unique ID for the given {@link Prototype}. */
String getUniquePrototypeID(Prototype prototype);
/**
* Returns the {@link Prototype} for the given unique ID or {@code null} if the unique ID does
* not correspond to any prototype of any provider.
*/
Prototype getPrototypeByUniqueID(String id);
/**
* Returns the list of all prototypes composable with the given model
* element class.
......