Skip to content
Snippets Groups Projects
Commit e1ac9e9e authored by Florian Hölzl's avatar Florian Hölzl
Browse files

improved kernel implementation documentation (package.html and javadoc)

parent 0f845352
No related branches found
No related tags found
No related merge requests found
Showing
with 172 additions and 88 deletions
...@@ -18,7 +18,6 @@ $Id$ ...@@ -18,7 +18,6 @@ $Id$
package org.fortiss.tooling.kernel; package org.fortiss.tooling.kernel;
import org.eclipse.core.runtime.Plugin; import org.eclipse.core.runtime.Plugin;
import org.fortiss.tooling.kernel.internal.ServiceManager;
import org.osgi.framework.BundleContext; import org.osgi.framework.BundleContext;
/** /**
...@@ -42,15 +41,11 @@ public class ToolingKernelActivator extends Plugin { ...@@ -42,15 +41,11 @@ public class ToolingKernelActivator extends Plugin {
public void start(BundleContext context) throws Exception { public void start(BundleContext context) throws Exception {
super.start(context); super.start(context);
plugin = this; plugin = this;
ServiceManager.start();
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public void stop(BundleContext context) throws Exception { public void stop(BundleContext context) throws Exception {
ServiceManager.stop();
plugin = null; plugin = null;
super.stop(context); super.stop(context);
} }
......
...@@ -28,7 +28,7 @@ import org.eclipse.core.runtime.IStatus; ...@@ -28,7 +28,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.kernel.ToolingKernelActivator; import org.fortiss.tooling.kernel.ToolingKernelActivator;
import org.fortiss.tooling.kernel.interfaces.IEObjectAware2; import org.fortiss.tooling.kernel.interfaces.IEObjectAware2;
import org.fortiss.tooling.kernel.internal.ConnectionCompositorService; import org.fortiss.tooling.kernel.internal.ElementCompositorService;
import org.fortiss.tooling.kernel.util.ExtensionPointUtils; import org.fortiss.tooling.kernel.util.ExtensionPointUtils;
import org.fortiss.tooling.kernel.util.LoggingUtils; import org.fortiss.tooling.kernel.util.LoggingUtils;
import org.osgi.framework.Bundle; import org.osgi.framework.Bundle;
...@@ -56,16 +56,19 @@ import org.osgi.framework.Bundle; ...@@ -56,16 +56,19 @@ import org.osgi.framework.Bundle;
* class configuration element, * class configuration element,
* <LI>{@link #getModelElementClassAttribute()} to provide a element class * <LI>{@link #getModelElementClassAttribute()} to provide a element class
* attribute. * attribute.
* <LI> {@link #requiresUniqueHandler()} should return true if each combination
* of source and target class must not have more than one handler. The default
* is <code>false</code>.
* </UL> * </UL>
* *
* An example implementation of a service based on this class is given by * An example implementation of a service based on this class is given by
* {@link ConnectionCompositorService}. The corresponding extension point schema * {@link ElementCompositorService}. The corresponding extension point schema is
* is defined in <code>schema/modelElementConnectionCompositor.exsd</code>. * defined in <code>schema/modelElementConnectionCompositor.exsd</code>.
* *
* @author hoelzlf * @author hoelzlf
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: 5A12CD400F90CECAC6B1246227D363AB * @ConQAT.Rating YELLOW Hash: F0465236EB7C877F0FCFC79200E6D5D4
*/ */
public abstract class EObjectAware2ServiceBase<T extends IEObjectAware2<? extends EObject, ? extends EObject>> { public abstract class EObjectAware2ServiceBase<T extends IEObjectAware2<? extends EObject, ? extends EObject>> {
......
...@@ -28,18 +28,44 @@ import org.eclipse.core.runtime.IStatus; ...@@ -28,18 +28,44 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.kernel.ToolingKernelActivator; import org.fortiss.tooling.kernel.ToolingKernelActivator;
import org.fortiss.tooling.kernel.interfaces.IEObjectAware; import org.fortiss.tooling.kernel.interfaces.IEObjectAware;
import org.fortiss.tooling.kernel.internal.ConnectionCompositorService;
import org.fortiss.tooling.kernel.util.ExtensionPointUtils; import org.fortiss.tooling.kernel.util.ExtensionPointUtils;
import org.fortiss.tooling.kernel.util.LoggingUtils; import org.fortiss.tooling.kernel.util.LoggingUtils;
import org.osgi.framework.Bundle; import org.osgi.framework.Bundle;
/** /**
* Service base implementation, which supports handler registration with * Service base implementation, which supports handler registration with set of
* {@link EObject} relation. * {@link EObject} classes.
*
* <p>
* Sub-classes must implement:
* <UL>
* <LI>{@link #getExtensionPointName()} to provide the extension point ID,
* <LI>{@link #getConfigurationElementName()} to provide the configuration
* element ID,
* <LI>{@link #getHandlerClassAttribute()} to provide the attribute of the
* handler class.
* </UL>
*
* <p>
* Sub-classes may override:
* <UL>
* <LI>{@link #getModelElementClassConfigurationElement()} to provide a element
* class configuration element,
* <LI>{@link #getModelElementClassAttribute()} to provide a element class
* attribute.
* <LI> {@link #requiresUniqueHandler()} should return true if each EObject class
* must not have more than one handler. The default is <code>false</code>.
* </UL>
*
* An example implementation of a service based on this class is given by
* {@link ConnectionCompositorService}. The corresponding extension point schema
* is defined in <code>schema/modelElementConnectionCompositor.exsd</code>.
* *
* @author hoelzlf * @author hoelzlf
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: 8A8E5E88AC4F8FE9D3213D12B500F959 * @ConQAT.Rating YELLOW Hash: 16AFF48B6ABB235CCA6CBF3DF421B790
*/ */
public abstract class EObjectAwareServiceBase<T extends IEObjectAware<? extends EObject>> { public abstract class EObjectAwareServiceBase<T extends IEObjectAware<? extends EObject>> {
......
...@@ -28,10 +28,14 @@ import org.fortiss.tooling.kernel.services.IPrototypeService.Prototype; ...@@ -28,10 +28,14 @@ import org.fortiss.tooling.kernel.services.IPrototypeService.Prototype;
/** /**
* Base implementation for {@link IPrototypeProvider}s. * Base implementation for {@link IPrototypeProvider}s.
* *
* <p>
* Sub-classes must implement {@link #registerPrototypes()} to register specific
* prototypes using {@link #registerPrototype(String, EObject)}.
*
* @author hoelzlf * @author hoelzlf
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: 4C38BD776A6B323C540FB8EE8118A5C0 * @ConQAT.Rating YELLOW Hash: 8D5C4798D30B81D34FA49DDCCB466B04
*/ */
public abstract class PrototypeProviderBase implements IPrototypeProvider { public abstract class PrototypeProviderBase implements IPrototypeProvider {
...@@ -53,7 +57,7 @@ public abstract class PrototypeProviderBase implements IPrototypeProvider { ...@@ -53,7 +57,7 @@ public abstract class PrototypeProviderBase implements IPrototypeProvider {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public List<Prototype> getPrototypes() { public final List<Prototype> getPrototypes() {
return CollectionUtils.asUnmodifiable(prototypes); return CollectionUtils.asUnmodifiable(prototypes);
} }
} }
<!-- <!--
$Id$ $Id$
@version $Rev$ @version $Rev$
@ConQAT.Rating YELLOW Hash: 38DFC9CFE459B4DF2425410CB9B3B693 @ConQAT.Rating YELLOW Hash: 129D9CDCB9A71D926BE644DDAD6C9E4F
--> -->
<body> <body>
Abstract base implementations for the kernel extensions. Abstract base implementations for the kernel extensions. Classes in this package are used by the kernel to implement its services.
These classes my also be interesting for implementing plugability in higher layers of the tool architecture.
</body> </body>
...@@ -29,7 +29,7 @@ package org.fortiss.tooling.kernel.interfaces; ...@@ -29,7 +29,7 @@ package org.fortiss.tooling.kernel.interfaces;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: BE7A6E2BC307F4A6894607896C09D3E8 * @ConQAT.Rating YELLOW Hash: 2D904303FDBDC14572DBE392859603DA
*/ */
public interface IConnectionCompositionContext { public interface IConnectionCompositionContext {
// this is just a marker interface // this is just a marker interface
......
...@@ -20,13 +20,32 @@ package org.fortiss.tooling.kernel.interfaces; ...@@ -20,13 +20,32 @@ package org.fortiss.tooling.kernel.interfaces;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
/** /**
* Interface for connectors, i.e. classes which connect model elements. This may * Interface for connection compositors, i.e. classes which connect and
* either be a direct connection or by using an additional connection element. * disconnect model elements. This may either be a direct connection or by using
* an additional connection element.
*
* <P>
* A typical example is the creation and removal of an edge in a graph editor.
* The connection compositor links two nodes of the graph and aggregates the
* edge with the graph as its parent element.
*
* @param <P>
* the meta-model class of the parent elements handled by this
* compositor.
* @param <S>
* the meta-model class of source model elements handled by this
* compositor.
* @param <T>
* the meta-model class of target model elements handled by this
* compositor.
*
*
*
* *
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: 3AF8EF4B6F61B768A17A63A6FF51CB2B * @ConQAT.Rating YELLOW Hash: 2F4A9CC044F6A4AFE964D9DE293D8D7F
*/ */
public interface IConnectionCompositor<P extends EObject, S extends EObject, T extends EObject> public interface IConnectionCompositor<P extends EObject, S extends EObject, T extends EObject>
extends IEObjectAware2<S, T> { extends IEObjectAware2<S, T> {
......
...@@ -22,19 +22,24 @@ import org.eclipse.emf.ecore.EObject; ...@@ -22,19 +22,24 @@ import org.eclipse.emf.ecore.EObject;
/** /**
* Interface for constraint checker implementations. * Interface for constraint checker implementations.
* *
*
* @param <C>
* the meta-model class of model elements handled by the constraint
* checker.
*
* @author hoelzlf * @author hoelzlf
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: B26440F1029C58D8B881C889F3D87A95 * @ConQAT.Rating YELLOW Hash: 07CD5EB76EC82EC5882F24D76633F0C9
*/ */
public interface IConstraintChecker { public interface IConstraintChecker<C extends EObject> extends IEObjectAware<C> {
/** /**
* Determines whether the constraint checker is applicable to the given * Determines whether the constraint checker is applicable to the given
* model element. * model element.
*/ */
boolean isApplicable(EObject modelElement); boolean isApplicable(C modelElement);
/** Applies the constraint checker to the given model element. */ /** Applies the constraint checker to the given model element. */
IConstraintViolation apply(EObject modelElement); IConstraintViolation apply(C modelElement);
} }
...@@ -19,13 +19,14 @@ package org.fortiss.tooling.kernel.interfaces; ...@@ -19,13 +19,14 @@ package org.fortiss.tooling.kernel.interfaces;
/** /**
* This interface describes a constraint violation produced by some constraint * This interface describes a constraint violation produced by some constraint
* checker. A constraint violation has a severity, an explanation and possibly a * checker. A constraint violation has a severity of type {@link ESeverity}, an
* quick fix. * explanation of type String and possibly a quick fix handler of type
* {@link IQuickFixHandler}.
* *
* @author hoelzlf * @author hoelzlf
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: BAED4776E8F47E7A6D42A7D38A68FAA6 * @ConQAT.Rating YELLOW Hash: 0506883B3019B9D1DC5AC6C0AB2F35FB
*/ */
public interface IConstraintViolation { public interface IConstraintViolation {
......
...@@ -19,16 +19,24 @@ package org.fortiss.tooling.kernel.interfaces; ...@@ -19,16 +19,24 @@ package org.fortiss.tooling.kernel.interfaces;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.kernel.base.EObjectAwareServiceBase; import org.fortiss.tooling.kernel.base.EObjectAwareServiceBase;
import org.fortiss.tooling.kernel.internal.ElementCompositorService;
import org.fortiss.tooling.kernel.services.IElementCompositorService;
/** /**
* Abstract interface for {@link EObjectAwareServiceBase} base implementation. * Abstract interface for {@link EObjectAwareServiceBase} base implementation. A
* plugable extension to the kernel may be parameterized by one meta-model
* class, e.g., a constraint checker extension handles a specific type of model
* elements. If the extending handler's interface extends the current interface,
* {@link EObjectAwareServiceBase} can be used to ease the extension mechanism.
* *
* @TODO: a typical use is ... * <P>
* Refer to {@link IElementCompositor}, {@link IElementCompositorService} and
* {@link ElementCompositorService} for an example implementation.
* *
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating RED Hash: F294FE5853AE7D182770C201886531CC * @ConQAT.Rating YELLOW Hash: 1350775A3DAA216F6112520F525628EE
*/ */
public interface IEObjectAware<T extends EObject> { public interface IEObjectAware<T extends EObject> {
// nothing specific is need here // nothing specific is need here
......
...@@ -19,14 +19,25 @@ package org.fortiss.tooling.kernel.interfaces; ...@@ -19,14 +19,25 @@ package org.fortiss.tooling.kernel.interfaces;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.kernel.base.EObjectAware2ServiceBase; import org.fortiss.tooling.kernel.base.EObjectAware2ServiceBase;
import org.fortiss.tooling.kernel.internal.ConnectionCompositorService;
import org.fortiss.tooling.kernel.services.IConnectionCompositorService;
/** /**
* Abstract interface for {@link EObjectAware2ServiceBase} base implementation. * Abstract interface for {@link EObjectAware2ServiceBase} base implementation.
* A plugable extension to the kernel may be parameterized by two meta-model
* class, e.g., a reference creation extension handles a specific source and
* target type of model elements. If the extending handler's interface extends
* the current interface, {@link EObjectAware2ServiceBase} can be used to ease
* the extension mechanism.
*
* <P>
* Refer to {@link IConnectionCompositor}, {@link IConnectionCompositorService}
* and {@link ConnectionCompositorService} for an example implementation.
* *
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: 4DE0035200083916ADDF730A929074BF * @ConQAT.Rating YELLOW Hash: 317229BCCC2DA7C69C78E957F5A87BE8
*/ */
public interface IEObjectAware2<S extends EObject, T extends EObject> extends public interface IEObjectAware2<S extends EObject, T extends EObject> extends
IEObjectAware<T> { IEObjectAware<T> {
......
...@@ -22,13 +22,15 @@ import org.fortiss.tooling.kernel.internal.storage.eclipse.EclipseResourceStorag ...@@ -22,13 +22,15 @@ import org.fortiss.tooling.kernel.internal.storage.eclipse.EclipseResourceStorag
/** /**
* Extension interface for the {@link EclipseResourceStorageProvider} mechanism. * Extension interface for the {@link EclipseResourceStorageProvider} mechanism.
* * The persistency storage provider, which uses Eclipse resources, does not know
* @TODO: do we really need this interface? * which files should be considered model files. Therefore, a concrete product
* built above the kernel is required to decide whether the file provided with
* {@link #isStorageLocation(IFile)} should be considered.
* *
* @author hoelzlf * @author hoelzlf
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: F2CBF6F78C114C5AE2676C85403E4488 * @ConQAT.Rating YELLOW Hash: 21EF3B37635B8DDA74E646259CD52166
*/ */
public interface IEclipseResourceStorageLocationProvider { public interface IEclipseResourceStorageLocationProvider {
......
...@@ -29,7 +29,7 @@ package org.fortiss.tooling.kernel.interfaces; ...@@ -29,7 +29,7 @@ package org.fortiss.tooling.kernel.interfaces;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating RED Hash: D85BD49FE3F70C2C4AF5B5B9250C0863 * @ConQAT.Rating YELLOW Hash: 4C3F8D3097CB3379B1AA27B6A0BC05DE
*/ */
public interface IElementCompositionContext { public interface IElementCompositionContext {
// this is just a marker interface // this is just a marker interface
......
...@@ -24,17 +24,25 @@ import org.fortiss.tooling.kernel.services.IPrototypeService.Prototype; ...@@ -24,17 +24,25 @@ import org.fortiss.tooling.kernel.services.IPrototypeService.Prototype;
* Interface for compositors, i.e. classes which know how to compose and * Interface for compositors, i.e. classes which know how to compose and
* decompose {@link EObject}s. * decompose {@link EObject}s.
* *
* <P>
* A typical example is the adding and removal of a node in a graph editor. The
* compositor adds the node to the graph as a child element.
*
*
* @param <C>
* the meta-model class of the container element handled by this
* compositor.
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: 75F650B0058B591BE903CC45C0AB9876 * @ConQAT.Rating YELLOW Hash: 4073D9D3263D0123CD583E9636EE101D
*/ */
public interface IElementCompositor<T extends EObject> extends IEObjectAware<T> { public interface IElementCompositor<C extends EObject> extends IEObjectAware<C> {
/** /**
* Returns whether the given container may include the given contained * Returns whether the given container may include the given contained
* object. * object.
*/ */
boolean canCompose(T container, EObject contained, boolean canCompose(C container, EObject contained,
IElementCompositionContext context); IElementCompositionContext context);
/** /**
...@@ -52,14 +60,14 @@ public interface IElementCompositor<T extends EObject> extends IEObjectAware<T> ...@@ -52,14 +60,14 @@ public interface IElementCompositor<T extends EObject> extends IEObjectAware<T>
* This method returns a boolean, since user-interaction during compose * This method returns a boolean, since user-interaction during compose
* might cancel the command. * might cancel the command.
*/ */
boolean compose(T container, EObject contained, boolean compose(C container, EObject contained,
IElementCompositionContext context); IElementCompositionContext context);
/** /**
* Returns whether the given contained element may be removed from the given * Returns whether the given contained element may be removed from the given
* container element. * container element.
*/ */
boolean canDecompose(T container, EObject contained, boolean canDecompose(C container, EObject contained,
IElementCompositionContext context); IElementCompositionContext context);
/** /**
...@@ -67,6 +75,6 @@ public interface IElementCompositor<T extends EObject> extends IEObjectAware<T> ...@@ -67,6 +75,6 @@ public interface IElementCompositor<T extends EObject> extends IEObjectAware<T>
* This method returns a boolean, since user-interaction during compose * This method returns a boolean, since user-interaction during compose
* might cancel the command. * might cancel the command.
*/ */
boolean decompose(T container, EObject contained, boolean decompose(C container, EObject contained,
IElementCompositionContext context); IElementCompositionContext context);
} }
...@@ -23,13 +23,15 @@ import org.eclipse.emf.ecore.EObject; ...@@ -23,13 +23,15 @@ import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.kernel.services.IPrototypeService.Prototype; import org.fortiss.tooling.kernel.services.IPrototypeService.Prototype;
/** /**
* An {@link IPrototypeProvider} offers preconfigured {@link EObject}s to be * An {@link IPrototypeProvider} offers pre-configured {@link EObject}s.
* displayed in the model element view. *
* A typical exmaple of a prototype is a model element, which also carries some
* initial default layout information.
* *
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: 97B6B05838E85861C71D22CF74CB73F9 * @ConQAT.Rating YELLOW Hash: 1160E8FBB539CAEA58CB178AF41E5ED2
*/ */
public interface IPrototypeProvider { public interface IPrototypeProvider {
......
...@@ -20,12 +20,17 @@ package org.fortiss.tooling.kernel.interfaces; ...@@ -20,12 +20,17 @@ package org.fortiss.tooling.kernel.interfaces;
import java.util.List; import java.util.List;
/** /**
* An {@link IStorageProvider} implements a storage mechanism for EMF models. * An {@link IStorageProvider} implements a storage mechanism for EMF models. A
* storage provider must deliver an {@link ITopLevelElementContext} for each
* model under his supervision. It may rely on other parts of the Eclipse
* workbench like the Team feature or EMFStore providing remote storage
* capability. After the context was provided to the kernel it invokes the
* methods of the context to execute commands, save, an so on.
* *
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: 5047804CCEDB2448C6CE4886394F756B * @ConQAT.Rating YELLOW Hash: 94E6ACB100AAF673434E0A0F9B548357
*/ */
public interface IStorageProvider { public interface IStorageProvider {
......
...@@ -26,12 +26,14 @@ import org.eclipse.emf.ecore.EObject; ...@@ -26,12 +26,14 @@ import org.eclipse.emf.ecore.EObject;
/** /**
* Interface for accessing top-level elements provided by * Interface for accessing top-level elements provided by
* {@link IStorageProvider}s. * {@link IStorageProvider}s. The context supports the typical methods like
* running commands, listening to the command stack, undo and redo, a dirty
* state and a save mechanism.
* *
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: 95B275B63B2E2FC389D1F8339E2325C9 * @ConQAT.Rating YELLOW Hash: DBEB1B9EEF064F64EA76CFFCAB2E8C39
*/ */
public interface ITopLevelElementContext { public interface ITopLevelElementContext {
......
...@@ -31,7 +31,7 @@ import org.fortiss.tooling.kernel.services.IConnectionCompositorService; ...@@ -31,7 +31,7 @@ import org.fortiss.tooling.kernel.services.IConnectionCompositorService;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: E4E7A3B42928271F17D36BABCB6BEF58 * @ConQAT.Rating YELLOW Hash: E03DE566919A836263949B2899453A61
*/ */
public class ConnectionCompositorService public class ConnectionCompositorService
extends extends
...@@ -51,15 +51,32 @@ public class ConnectionCompositorService ...@@ -51,15 +51,32 @@ public class ConnectionCompositorService
@Override @Override
public boolean canConnect(EObject source, EObject destination, public boolean canConnect(EObject source, EObject destination,
EObject connection, IConnectionCompositionContext context) { EObject connection, IConnectionCompositionContext context) {
return findWorkingConnector(source, destination, connection, context) != null; return findWorkingConnector(source, destination, connection, true,
context) != null;
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public void connect(EObject source, EObject destination, public boolean connect(EObject source, EObject destination,
EObject connection, IConnectionCompositionContext context) { EObject connection, IConnectionCompositionContext context) {
findWorkingConnector(source, destination, connection, context).connect( return findWorkingConnector(source, destination, connection, true,
source, destination, connection, context); context).connect(source, destination, connection, context);
}
/** {@inheritDoc} */
@Override
public boolean canDecompose(EObject source, EObject destination,
EObject connection, IConnectionCompositionContext context) {
return findWorkingConnector(source, destination, connection, false,
context) != null;
}
/** {@inheritDoc} */
@Override
public boolean decompose(EObject source, EObject destination,
EObject connection, IConnectionCompositionContext context) {
return findWorkingConnector(source, destination, connection, true,
context).connect(source, destination, connection, context);
} }
/** /**
...@@ -68,14 +85,21 @@ public class ConnectionCompositorService ...@@ -68,14 +85,21 @@ public class ConnectionCompositorService
*/ */
private IConnectionCompositor<EObject, EObject, EObject> findWorkingConnector( private IConnectionCompositor<EObject, EObject, EObject> findWorkingConnector(
EObject source, EObject target, EObject connection, EObject source, EObject target, EObject connection,
IConnectionCompositionContext context) { boolean connect, IConnectionCompositionContext context) {
List<IConnectionCompositor<EObject, EObject, EObject>> list = getRegisteredHandlers( List<IConnectionCompositor<EObject, EObject, EObject>> list = getRegisteredHandlers(
source.getClass(), target.getClass()); source.getClass(), target.getClass());
if (list == null) { if (list == null) {
return null; return null;
} }
for (IConnectionCompositor<EObject, EObject, EObject> connector : list) { for (IConnectionCompositor<EObject, EObject, EObject> connector : list) {
if (connector.canConnect(source, target, connection, context)) { if (connect
&& connector
.canConnect(source, target, connection, context)) {
return connector;
}
if (!connect
&& connector.canDisconnect(source, target, connection,
context)) {
return connector; return connector;
} }
} }
......
...@@ -32,7 +32,7 @@ import org.fortiss.tooling.kernel.services.IPrototypeService.Prototype; ...@@ -32,7 +32,7 @@ import org.fortiss.tooling.kernel.services.IPrototypeService.Prototype;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: 1AB8E5D4937CE2C77649035548CA11DF * @ConQAT.Rating YELLOW Hash: E27B124C6AC4A10B7A8C04949A8BFF86
*/ */
public final class ElementCompositorService extends public final class ElementCompositorService extends
EObjectAwareServiceBase<IElementCompositor<EObject>> implements EObjectAwareServiceBase<IElementCompositor<EObject>> implements
......
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2011 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.kernel.internal;
import org.fortiss.tooling.kernel.services.ILibraryService;
/**
* This class implements the {@link ILibraryService} interface.
*
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash: 4C56A513C7537064088F1E85847745E8
*/
public class LibraryService implements ILibraryService {
// TODO (FH): implement
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment