Commit 8e43a849 authored by Simon Barner's avatar Simon Barner
Browse files

Proper model element handlers and names in prototype providers

refs 3035
parent 5776d4d5
......@@ -34,12 +34,6 @@ public class LogicalArchitectureToPartitionArchitectureAllocationTableHandler
extends
NamedCommentedModelElementHandlerBase<LogicalArchitectureToPartitionArchitectureAllocationTable> {
/** {@inheritDoc} */
@Override
public String getName(LogicalArchitectureToPartitionArchitectureAllocationTable element) {
return "LogicalArchitecture To PartitionnArchitecture AllocationTable";
}
/** {@inheritDoc} */
@Override
public ImageDescriptor getIconImageDescriptor() {
......
......@@ -17,7 +17,8 @@ $Id$
+--------------------------------------------------------------------------*/
package org.fortiss.af3.partition.ui.handler;
import java.util.ArrayList;
import static java.util.Collections.unmodifiableList;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
......@@ -37,16 +38,8 @@ public class PartitionArchitectureHandler extends
/** {@inheritDoc} */
@Override
public String getName(PartitionArchitecture element) {
return "Partition Architecture";
}
/** {@inheritDoc} */
@Override
public List<EObject> getSubnodes(PartitionArchitecture element) {
List<EObject> results = new ArrayList<EObject>();
results.addAll(element.getPartitions());
return results;
public List<EObject> getSubnodes(PartitionArchitecture partitionArchitecture) {
return unmodifiableList(partitionArchitecture.getPartitions());
}
/** {@inheritDoc} */
......
......@@ -19,7 +19,7 @@ package org.fortiss.af3.partition.ui.handler;
import org.eclipse.jface.resource.ImageDescriptor;
import org.fortiss.af3.partition.model.PartitionChannel;
import org.fortiss.tooling.kernel.ui.extension.base.ModelElementHandlerBase;
import org.fortiss.tooling.kernel.ui.extension.base.NamedCommentedModelElementHandlerBase;
/**
*
......@@ -28,13 +28,8 @@ import org.fortiss.tooling.kernel.ui.extension.base.ModelElementHandlerBase;
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public class PartitionChannelHandler extends ModelElementHandlerBase<PartitionChannel> {
/** {@inheritDoc} */
@Override
public String getName(PartitionChannel partitionChannel) {
return "PartitionChannel";
}
public class PartitionChannelHandler extends
NamedCommentedModelElementHandlerBase<PartitionChannel> {
/** {@inheritDoc} */
@Override
......
......@@ -17,13 +17,14 @@ $Id$
+--------------------------------------------------------------------------*/
package org.fortiss.af3.partition.ui.handler;
import java.util.Collections;
import static java.util.Collections.unmodifiableList;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.resource.ImageDescriptor;
import org.fortiss.af3.partition.model.Partition;
import org.fortiss.tooling.kernel.ui.extension.base.ModelElementHandlerBase;
import org.fortiss.tooling.kernel.ui.extension.base.NamedCommentedModelElementHandlerBase;
/**
*
......@@ -32,13 +33,7 @@ import org.fortiss.tooling.kernel.ui.extension.base.ModelElementHandlerBase;
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public class PartitionHandler extends ModelElementHandlerBase<Partition> {
/** {@inheritDoc} */
@Override
public String getName(Partition element) {
return element.getName();
}
public class PartitionHandler extends NamedCommentedModelElementHandlerBase<Partition> {
/** {@inheritDoc} */
@Override
......@@ -48,7 +43,7 @@ public class PartitionHandler extends ModelElementHandlerBase<Partition> {
/** {@inheritDoc} */
@Override
public List<EObject> getConnectors(Partition element) {
return Collections.unmodifiableList(element.getConnectors());
public List<EObject> getConnectors(Partition partition) {
return unmodifiableList(partition.getConnectors());
}
}
......@@ -17,12 +17,14 @@ $Id$
+--------------------------------------------------------------------------*/
package org.fortiss.af3.partition.ui.handler;
import static java.util.Collections.unmodifiableList;
import static org.fortiss.af3.partition.ui.AF3PartitionUIActivator.getImageDescriptor;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.resource.ImageDescriptor;
import org.fortiss.af3.partition.model.PartitionInputPort;
import org.fortiss.af3.partition.ui.AF3PartitionUIActivator;
import org.fortiss.tooling.kernel.ui.extension.base.NamedCommentedModelElementHandlerBase;
/**
......@@ -38,21 +40,18 @@ public class PartitionInputPortHandler extends
/** {@inheritDoc} */
@Override
public ImageDescriptor getIconImageDescriptor() {
return AF3PartitionUIActivator.getImageDescriptor("icons/partition_inputport.png");
return getImageDescriptor("icons/partition_inputport.png");
}
/** {@inheritDoc} */
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public List<EObject> getIncomingConnections(PartitionInputPort element) {
return (List)element.getIncoming();
public List<EObject> getIncomingConnections(PartitionInputPort port) {
return unmodifiableList(port.getIncoming());
}
/** {@inheritDoc} */
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public List<EObject> getOutgoingConnections(PartitionInputPort element) {
return (List)element.getOutgoing();
public List<EObject> getOutgoingConnections(PartitionInputPort port) {
return unmodifiableList(port.getOutgoing());
}
}
......@@ -17,12 +17,14 @@ $Id$
+--------------------------------------------------------------------------*/
package org.fortiss.af3.partition.ui.handler;
import static java.util.Collections.unmodifiableList;
import static org.fortiss.af3.partition.ui.AF3PartitionUIActivator.getImageDescriptor;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.resource.ImageDescriptor;
import org.fortiss.af3.partition.model.PartitionOutputPort;
import org.fortiss.af3.partition.ui.AF3PartitionUIActivator;
import org.fortiss.tooling.kernel.ui.extension.base.NamedCommentedModelElementHandlerBase;
/**
......@@ -38,20 +40,18 @@ public class PartitionOutputPortHandler extends
/** {@inheritDoc} */
@Override
public ImageDescriptor getIconImageDescriptor() {
return AF3PartitionUIActivator.getImageDescriptor("icons/partition_outputport.png");
return getImageDescriptor("icons/partition_outputport.png");
}
/** {@inheritDoc} */
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public List<EObject> getIncomingConnections(PartitionOutputPort element) {
return (List)element.getIncoming();
return unmodifiableList(element.getIncoming());
}
/** {@inheritDoc} */
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public List<EObject> getOutgoingConnections(PartitionOutputPort element) {
return (List)element.getOutgoing();
return unmodifiableList(element.getOutgoing());
}
}
......@@ -42,14 +42,15 @@ public class PrototypeProvider extends PrototypeProviderBase {
/** {@inheritDoc} */
@Override
protected void registerPrototypes() {
registerPrimaryPrototype("PartitionArchitecture", createPartitionArchitecture(),
CATEGORY_PA);
registerPrimaryPrototype("Partition Architecture",
createPartitionArchitecture("Partition Architecture"), CATEGORY_PA);
registerPrototype("Partition", createPartition("Partition"), CATEGORY_PA);
registerPrototype("PartitionInputPort", createPartitionInputPort("Input"), CATEGORY_PA);
registerPrototype("PartitionOutputPort", createPartitionOutputPort("Output"), CATEGORY_PA);
registerPrototype("Partition InputPort", createPartitionInputPort("Input"), CATEGORY_PA);
registerPrototype("Partition OutputPort", createPartitionOutputPort("Output"), CATEGORY_PA);
registerPrimaryPrototype("LogicalArchitectureToPartitionArchitectureAllocationTable",
createLogicalArchitectureToPartitionArchitectureAllocationTable("La2Va"),
registerPrimaryPrototype(
"La \u2192 Pa", // La -> Pa
createLogicalArchitectureToPartitionArchitectureAllocationTable("La \u2192 Pa"),
org.fortiss.af3.allocation.ui.prototypes.PrototypeProvider.CATEGORY);
}
}
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2017 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.af3.partition.util;
import static org.fortiss.tooling.base.utils.LayoutModelElementFactory.createConnectionLayout;
import static org.fortiss.tooling.base.utils.LayoutModelElementFactory.createConnectorLayout;
import static org.fortiss.tooling.base.utils.LayoutModelElementFactory.createNodeElementLayout;
import org.fortiss.af3.partition.model.Partition;
import org.fortiss.af3.partition.model.PartitionArchitecture;
import org.fortiss.af3.partition.model.PartitionChannel;
......@@ -9,36 +30,55 @@ import org.fortiss.af3.partition.model.PartitionOutputPort;
import org.fortiss.af3.partition.model.ca2pa.Ca2PaFactory;
import org.fortiss.af3.partition.model.ca2pa.LogicalArchitectureToPartitionArchitectureAllocationTable;
import org.fortiss.tooling.base.model.element.IHierarchicElement;
import org.fortiss.tooling.base.utils.LayoutModelElementFactory;
/**
* Model element factory for partition architectures.
*
* @author zverlov
* @author barner
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 3DE1B38E61571CAB64AA30FD80843885
*/
public class PartitionModelElementFactory {
/** Creates a new {@link PartitionArchitecture} with the given {@code name}. */
public static PartitionArchitecture createPartitionArchitecture(String name) {
PartitionArchitecture partitionArchitecture =
PartitionFactory.eINSTANCE.createPartitionArchitecture();
partitionArchitecture.setName(name);
return partitionArchitecture;
}
/** Creates a new {@link Partition} with the given {@code name}. */
public static Partition createPartition(String name) {
Partition partition = PartitionFactory.eINSTANCE.createPartition();
partition.setName(name);
createNodeElementLayout(partition);
return partition;
}
public static PartitionArchitecture createPartitionArchitecture() {
return PartitionFactory.eINSTANCE.createPartitionArchitecture();
}
/** Creates a new {@link PartitionChannel} with the given {@code name}. */
public static PartitionChannel createPartitionChannel(String name) {
PartitionChannel pChan = PartitionFactory.eINSTANCE.createPartitionChannel();
pChan.setName(name);
LayoutModelElementFactory.createConnectionLayout(pChan);
createConnectionLayout(pChan);
return pChan;
}
/** Creates a new {@link PartitionInputPort} with the given {@code name}. */
public static PartitionInputPort createPartitionInputPort(String name) {
PartitionInputPort pInPort = PartitionFactory.eINSTANCE.createPartitionInputPort();
pInPort.setName(name);
createConnectorLayout(pInPort);
return pInPort;
}
/** Creates a new {@link PartitionOutputPort} with the given {@code name}. */
public static PartitionOutputPort createPartitionOutputPort(String name) {
PartitionOutputPort pOutPort = PartitionFactory.eINSTANCE.createPartitionOutputPort();
pOutPort.setName(name);
createConnectorLayout(pOutPort);
return pOutPort;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment