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

added compositors and prototype registration to kernel

parent 89fbe578
No related branches found
No related tags found
No related merge requests found
Showing
with 503 additions and 11 deletions
......@@ -9,9 +9,11 @@ Require-Bundle: org.eclipse.ui;visibility:=reexport,
org.eclipse.core.runtime;visibility:=reexport,
org.eclipse.emf.ecore;bundle-version="2.6.1";visibility:=reexport,
org.unicase.metamodel;bundle-version="0.0.1";visibility:=reexport,
org.unicase.ecp.model;bundle-version="0.0.1";visibility:=reexport,
org.conqat.ide.commons;bundle-version="2.7.0";visibility:=reexport,
org.conqat.ide.commons.ui;bundle-version="2.7.0";visibility:=reexport
org.conqat.ide.commons.ui;bundle-version="2.7.0";visibility:=reexport,
org.unicase.workspace;bundle-version="1.0.0",
org.unicase.ecp.model;bundle-version="1.0.0",
org.unicase.ecpemfstorebridge;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Export-Package: org.fortiss.tooling.kernel,
......
org.fortiss.tooling.kernel/trunk/icons/project.png

416 B | W: | H:

org.fortiss.tooling.kernel/trunk/icons/project.png

1.22 KiB | W: | H:

org.fortiss.tooling.kernel/trunk/icons/project.png
org.fortiss.tooling.kernel/trunk/icons/project.png
org.fortiss.tooling.kernel/trunk/icons/project.png
org.fortiss.tooling.kernel/trunk/icons/project.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -2,6 +2,8 @@
<?eclipse version="3.4"?>
<plugin>
<extension-point id="modelElementHandler" name="Model Element Handler" schema="schema/modelElementHandler.exsd"/>
<extension-point id="modelPrototypeProvider" name="Model Prototype Provider" schema="schema/modelPrototypeProvider.exsd"/>
<extension-point id="modelElementCompositor" name="Model Element Compositor" schema="schema/modelElementCompositor.exsd"/>
<extension
point="org.eclipse.ui.views">
<view
......@@ -22,9 +24,16 @@
<extension
point="org.fortiss.tooling.kernel.modelElementHandler">
<modelElementHandler
handler="org.fortiss.tooling.kernel.internal.handler.ECPProjectModelElementHandler"
modelElementClass="org.unicase.ecp.model.workSpaceModel.ECPProject">
handler="org.fortiss.tooling.kernel.internal.handler.EMFStoreECPProjectModelElementHandler"
modelElementClass="org.unicase.ecpemfstorebridge.EMFStoreECPProject">
</modelElementHandler>
</extension>
<extension
point="org.fortiss.tooling.kernel.modelElementCompositor">
<modelElementCompositor
compositor="org.fortiss.tooling.kernel.internal.compose.EMFStoreECPProjectCompositor"
modelElementClass="org.unicase.ecpemfstorebridge.EMFStoreECPProject">
</modelElementCompositor>
</extension>
</plugin>
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.fortiss.tooling.kernel" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="org.fortiss.tooling.kernel" id="modelElementCompositor" name="Model Element Compositor"/>
</appinfo>
<documentation>
Registers a compositor for model elements.
</documentation>
</annotation>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<sequence>
<element ref="modelElementCompositor" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="modelElementCompositor">
<complexType>
<attribute name="modelElementClass" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute kind="java" basedOn=":org.eclipse.emf.ecore.EObject"/>
</appinfo>
</annotation>
</attribute>
<attribute name="compositor" type="string" use="required">
<annotation>
<documentation>
The model element compositor.
</documentation>
<appinfo>
<meta.attribute kind="java" basedOn=":org.fortiss.tooling.kernel.interfaces.ICompositor"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appinfo>
<meta.section type="since"/>
</appinfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="examples"/>
</appinfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="apiinfo"/>
</appinfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="implementation"/>
</appinfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
</schema>
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.fortiss.tooling.kernel" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="org.fortiss.tooling.kernel" id="modelPrototypeProvider" name="Model Prototype Provider"/>
</appinfo>
<documentation>
Registers model element prototype providers.
</documentation>
</annotation>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<sequence>
<element ref="modelPrototypeProvider" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="modelPrototypeProvider">
<complexType>
<attribute name="provider" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute kind="java" basedOn=":org.fortiss.tooling.kernel.interfaces.IPrototypeProvider"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appinfo>
<meta.section type="since"/>
</appinfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="examples"/>
</appinfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="apiinfo"/>
</appinfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="implementation"/>
</appinfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
</schema>
/*--------------------------------------------------------------------------+
$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.base;
import java.util.ArrayList;
import java.util.List;
import org.conqat.lib.commons.collections.CollectionUtils;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.kernel.interfaces.IPrototypeProvider;
/**
* Base implementation for {@link IPrototypeProvider}s.
*
* @author hoelzlf
* @author $Author$
* @version $Rev$
* @levd.rating RED Rev:
*/
public abstract class PrototypeProviderBase implements IPrototypeProvider {
/** Stores the registered prototypes. */
private final List<Prototype> prototypes = new ArrayList<Prototype>();
/** Constructor. */
public PrototypeProviderBase() {
registerPrototypes();
}
/** Registers all prototypes. Sub-classes must override. */
protected abstract void registerPrototypes();
/** Registers the given {@link EObject} with the given name. */
protected final void registerPrototype(String name, EObject prototype) {
prototypes.add(new Prototype(name, prototype));
}
/** {@inheritDoc} */
@Override
public List<Prototype> getPrototypes() {
return CollectionUtils.asUnmodifiable(prototypes);
}
}
/*--------------------------------------------------------------------------+
$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.interfaces;
/**
* An {@link ICompositionContext} provides additional information like drop
* point positions to an {@link ICompositor}.
*
* @author hoelzlf
* @author $Author$
* @version $Rev$
* @levd.rating RED Rev:
*/
public interface ICompositionContext {
// this is just a marker interface
}
/*--------------------------------------------------------------------------+
$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.interfaces;
import org.eclipse.emf.ecore.EObject;
/**
* Interface for compositors, i.e. classes which know how to compose
* {@link EObject}s.
*
* @author hoelzlf
* @author $Author$
* @version $Rev$
* @levd.rating RED Rev:
*/
public interface ICompositor<T extends EObject> {
/**
* Returns whether the given container may include the given contained
* object.
*/
boolean canCompose(T container, EObject contained,
ICompositionContext context);
/**
* Asks the compositor to insert the contained object into the container.
* The contained object may be modified (i.e. renamed, etc.) if necessary.
* This method returns a boolean, since user-interaction during compose
* might cancel the command.
*/
boolean compose(T container, EObject contained, ICompositionContext context);
}
/*--------------------------------------------------------------------------+
$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.interfaces;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
/**
* An {@link IPrototypeProvider} offers preconfigured {@link EObject}s to be
* displayed in the model element view.
*
* @author hoelzlf
* @author $Author$
* @version $Rev$
* @levd.rating RED Rev:
*/
public interface IPrototypeProvider {
/** Returns the prototypes provided by this provider. */
List<Prototype> getPrototypes();
/**
* Prototypes consist of a generic description and preconfigured
* {@link EObject}.
*/
public static final class Prototype {
/** The generic prototype name. */
private final String name;
/** the preconfigure {@link EObject}. */
private final EObject prototype;
/** Constructor. */
public Prototype(String name, EObject prototype) {
this.name = name;
this.prototype = prototype;
}
/** Returns the name. */
public String getName() {
return name;
}
/** Returns the prototype instance (NOT a copy!). */
public EObject getPrototype() {
return prototype;
}
/**
* Returns a copy of the prototype. This method is potentially
* expensive.
*/
public EObject getPrototypeCopy() {
return EcoreUtil.copy(prototype);
}
}
}
/*--------------------------------------------------------------------------+
$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.compose;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.kernel.interfaces.ICompositionContext;
import org.fortiss.tooling.kernel.interfaces.ICompositor;
import org.fortiss.tooling.kernel.model.IProjectRootElement;
import org.unicase.ecpemfstorebridge.EMFStoreECPProject;
/**
* {@link ICompositor} implementation for the {@link IProjectRootElement}s.
*
* @author hoelzlf
* @author $Author$
* @version $Rev$
* @levd.rating RED Rev:
*/
public final class EMFStoreECPProjectCompositor implements
ICompositor<EMFStoreECPProject> {
/** {@inheritDoc} */
@Override
public boolean canCompose(EMFStoreECPProject container, EObject contained,
ICompositionContext context) {
return contained instanceof IProjectRootElement;
}
/** {@inheritDoc} */
@Override
public boolean compose(EMFStoreECPProject container, EObject contained,
ICompositionContext context) {
container.addModelElementToRoot(contained);
return true;
}
}
......@@ -27,6 +27,8 @@ import org.fortiss.tooling.kernel.base.ModelElementHandlerBase;
import org.fortiss.tooling.kernel.interfaces.IModelElementHandler;
import org.fortiss.tooling.kernel.model.IProjectRootElement;
import org.unicase.ecp.model.workSpaceModel.ECPProject;
import org.unicase.ecpemfstorebridge.EMFStoreECPProject;
import org.unicase.workspace.ProjectSpace;
/**
* {@link IModelElementHandler} for {@link ECPProject}s.
......@@ -36,19 +38,25 @@ import org.unicase.ecp.model.workSpaceModel.ECPProject;
* @version $Rev$
* @levd.rating RED Rev:
*/
public final class ECPProjectModelElementHandler extends
ModelElementHandlerBase<ECPProject> {
public final class EMFStoreECPProjectModelElementHandler extends
ModelElementHandlerBase<EMFStoreECPProject> {
/** {@inheritDoc} */
@Override
public String getName(ECPProject element) {
return "Project";
public String getName(EMFStoreECPProject element) {
ProjectSpace projectSpace = (ProjectSpace) element.getRootObject();
String projectName = projectSpace.getProjectName();
String baseRevision = " @"
+ projectSpace.getBaseVersion().getIdentifier();
String username = projectSpace.getUsersession().getUsername();
return projectName + baseRevision + " (" + username + ")";
}
/** {@inheritDoc} */
@Override
public String getDescription(ECPProject element) {
return "EMFStore Project";
public String getDescription(EMFStoreECPProject element) {
ProjectSpace projectSpace = (ProjectSpace) element.getRootObject();
return projectSpace.getProjectDescription();
}
/** {@inheritDoc} */
......@@ -59,7 +67,7 @@ public final class ECPProjectModelElementHandler extends
/** {@inheritDoc} */
@Override
public List<EObject> getSubnodes(ECPProject element) {
public List<EObject> getSubnodes(EMFStoreECPProject element) {
List<EObject> projectRootElements = new ArrayList<EObject>();
for (EObject pContent : element.eContents()) {
if (pContent instanceof IProjectRootElement) {
......
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