Commit e29feb50 authored by Sabine Teufl's avatar Sabine Teufl
Browse files

Reworked External Relations to requirements

refs 645
parent 9fe4e530
......@@ -20,55 +20,48 @@ package org.fortiss.af3.mira.ui.action;
import static org.eclipse.jface.dialogs.MessageDialog.openError;
import static org.eclipse.ui.plugin.AbstractUIPlugin.imageDescriptorFromPlugin;
import static org.fortiss.af3.mira.ui.AF3MiraUIActivator.PLUGIN_ID;
import static org.fortiss.af3.mira.ui.utils.SelectionDialogUtils.open;
import static org.fortiss.af3.mira.ui.utils.SelectionDialogUtils.openComponentsMultiSelectDialog;
import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createExternalRelationSpecification;
import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.getRootElement;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.widgets.Shell;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.model.ComponentArchitecture;
import org.fortiss.af3.mira.command.CreateRequirementSpecificationCommand;
import org.fortiss.af3.mira.command.CreateExternalRelationRequirementSpecificationCommand;
import org.fortiss.af3.mira.command.DeleteRequirementSpecificationCommand;
import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mira.model.ExternalRelation;
import org.fortiss.af3.mira.model.ExternalRelationSpecification;
import org.fortiss.af3.mira.model.RequirementSpecification;
import org.fortiss.af3.mira.model.usecase.ScopeSpecification;
import org.fortiss.af3.mira.utils.MiraModelElementFactory;
import org.fortiss.tooling.kernel.service.ICommandStackService;
import org.fortiss.tooling.kernel.ui.extension.base.EObjectActionBase;
/**
* Action to connect scope to a component by using {@link ScopeSpecification}
* Action to connect an external relation to a component by using
* {@link ExternalRelationSpecification}
*
* @author uden
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: 42B4C4C943072E1429DE978D485BFA1B
*/
public final class ConnectRequirementExternalRelationsToComponentAction extends
EObjectActionBase<Requirement> {
public final class ConnectExternalRelationToComponentAction extends
EObjectActionBase<ExternalRelation> {
/** The default shell */
private final Shell shell;
/** Constructor. */
public ConnectRequirementExternalRelationsToComponentAction(Requirement editedObject,
Shell shell) {
super("ConnectRequirementToComponent", imageDescriptorFromPlugin(PLUGIN_ID,
public ConnectExternalRelationToComponentAction(ExternalRelation editedObject, Shell shell) {
super("ConnectExternalRelationToComponent", imageDescriptorFromPlugin(PLUGIN_ID,
"icons/sample.png"));
setTarget(editedObject);
this.shell = shell;
}
/**
* returns the relevant specifications already attached to the requirement in order to
* pre-select the corresponding ports in the dialog
*/
protected List<? extends RequirementSpecification> getSpecificationsBefore() {
return getTarget().getExternalRelationSpecification();
}
/** creates a new {@link RequirementSpecification} of the correct type */
protected List<? extends Component> openDialog(ComponentArchitecture arch,
List<Component> selectionBefore) {
......@@ -89,29 +82,25 @@ public final class ConnectRequirementExternalRelationsToComponentAction extends
return;
}
List<Component> selectionBefore = new ArrayList<Component>();
List<? extends RequirementSpecification> specificationsBefore = getSpecificationsBefore();
for(RequirementSpecification spec : specificationsBefore)
selectionBefore.add((Component)spec.getSpecificationOf());
Component selected = null;
ExternalRelationSpecification spec = getTarget().getTargetSpecification();
if(spec != null && spec.getSpecificationOf() instanceof Component) {
selected = (Component)spec.getSpecificationOf();
}
final Component component = open(shell.getShell(), arch, selected);
if(component == null || component == selected) {
return;
}
List<? extends Component> selectedComponentsAfter = openDialog(arch, selectionBefore);
if(selectedComponentsAfter != null) {
// remove elements no longer contained
for(RequirementSpecification spec : specificationsBefore) {
if(!selectedComponentsAfter.contains(spec.getSpecificationOf())) {
if(spec != null) {
ICommandStackService.INSTANCE.runAsCommand(spec.getSpecificationOf(),
new DeleteRequirementSpecificationCommand(spec));
}
}
// add elements not contained before
for(Component component : selectedComponentsAfter) {
if(!selectionBefore.contains(component)) {
ICommandStackService.INSTANCE.runAsCommand(component,
new CreateRequirementSpecificationCommand(getTarget(), component,
createSpecification(), false));
}
}
}
new CreateExternalRelationRequirementSpecificationCommand(getTarget(), component,
MiraModelElementFactory.createExternalRelationSpecification("", ""), true));
}
}
......@@ -43,7 +43,7 @@ import org.fortiss.tooling.kernel.ui.extension.base.EObjectActionBase;
* @version $Rev$
* @ConQAT.Rating GREEN Hash: E6441A10B4F73CC45BABE3DE0AFA041A
*/
public class ConnectConditionToComponentAction extends EObjectActionBase<UseCase> {
public class ConnectUseCaseConditionToComponentAction extends EObjectActionBase<UseCase> {
/** the shell for the action */
private final Shell shell;
......@@ -52,7 +52,7 @@ public class ConnectConditionToComponentAction extends EObjectActionBase<UseCase
private final EClass specClass;
/** Constructor. */
public ConnectConditionToComponentAction(UseCase editedObject, Shell shell, EClass clazz) {
public ConnectUseCaseConditionToComponentAction(UseCase editedObject, Shell shell, EClass clazz) {
super("ConnectConditionToComponent", imageDescriptorFromPlugin(PLUGIN_ID,
"icons/sample.png"));
setTarget(editedObject);
......
......@@ -43,7 +43,7 @@ public class DeleteRequirementSpecificationAction extends EObjectActionBase<Requ
/** Constructor. */
public DeleteRequirementSpecificationAction(Requirement editedObject,
List<RequirementSpecification> specs) {
super("ConnectRequirementToPortsActionBase");
super("DeleteRequirementSpecificationActionBase");
setTarget(editedObject);
this.reqspecs = specs;
}
......
......@@ -18,11 +18,8 @@ $Id$
package org.fortiss.af3.mira.ui.editor;
import static org.conqat.ide.commons.ui.dialog.MessageUtils.confirm;
import static org.conqat.ide.commons.ui.selection.SelectionUtils.checkAndPickFirst;
import static org.eclipse.core.databinding.UpdateValueStrategy.POLICY_NEVER;
import static org.eclipse.emf.databinding.EMFObservables.observeList;
import static org.eclipse.jface.databinding.viewers.ViewersObservables.observeSinglePostSelection;
import static org.eclipse.ui.plugin.AbstractUIPlugin.imageDescriptorFromPlugin;
import static org.fortiss.af3.mira.model.MiraPackage.Literals.REQUIREMENT__AUTHOR;
import static org.fortiss.af3.mira.model.MiraPackage.Literals.REQUIREMENT__DESCRIPTION;
import static org.fortiss.af3.mira.model.MiraPackage.Literals.REQUIREMENT__PRIORITY;
......@@ -31,7 +28,6 @@ import static org.fortiss.af3.mira.model.MiraPackage.Literals.REQUIREMENT__REQ_I
import static org.fortiss.af3.mira.model.MiraPackage.Literals.REQUIREMENT__SOURCES;
import static org.fortiss.af3.mira.model.MiraPackage.Literals.REQUIREMENT__STATUS;
import static org.fortiss.af3.mira.model.MiraPackage.Literals.REQUIREMENT__TODO;
import static org.fortiss.af3.mira.ui.AF3MiraUIActivator.PLUGIN_ID;
import static org.fortiss.af3.mira.ui.editor.highlight.ScannerManager.getScanner;
import static org.fortiss.af3.mira.ui.utils.HighlightUtils.createSourceViewer;
import static org.fortiss.af3.mira.ui.utils.MiraLayoutUtils.multiLineInputBoundedLayout;
......@@ -44,7 +40,6 @@ import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createUseCase;
import static org.fortiss.af3.mira.utils.MiraUtils.getDisplayTypeFor;
import static org.fortiss.af3.mira.utils.MiraUtils.getRequirementInterface;
import static org.fortiss.tooling.base.model.element.ElementPackage.Literals.IHIERARCHIC_ELEMENT_CONTAINER__CONTAINED_ELEMENTS;
import static org.fortiss.tooling.base.model.element.ElementPackage.Literals.IMODEL_ELEMENT__REFERENCED_BY;
import static org.fortiss.tooling.kernel.model.FortissToolingKernelPackage.Literals.INAMED_COMMENTED_ELEMENT__COMMENT;
import static org.fortiss.tooling.kernel.model.FortissToolingKernelPackage.Literals.INAMED_ELEMENT__NAME;
import static org.fortiss.tooling.kernel.ui.util.DataBindingUtils.DECORATION_KEY;
......@@ -55,38 +50,24 @@ import static org.fortiss.tooling.kernel.ui.util.ObservableUtils.observeValue;
import java.util.ArrayList;
import java.util.List;
import org.conqat.ide.commons.ui.selection.SelectionUtils;
import org.eclipse.core.databinding.UpdateListStrategy;
import org.eclipse.core.databinding.observable.ChangeEvent;
import org.eclipse.core.databinding.observable.IChangeListener;
import org.eclipse.emf.databinding.EMFObservables;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
import org.eclipse.jface.fieldassist.ControlDecoration;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.text.source.SourceViewer;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
......@@ -98,29 +79,22 @@ import org.eclipse.ui.PartInitException;
import org.eclipse.ui.actions.TextStyledTextActionHandler;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.fortiss.af3.mira.model.Analysis;
import org.fortiss.af3.mira.model.ExternalRelationSpecification;
import org.fortiss.af3.mira.model.MiraPackage;
import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mira.model.RequirementPriority;
import org.fortiss.af3.mira.model.RequirementSpecification;
import org.fortiss.af3.mira.model.RequirementStatus;
import org.fortiss.af3.mira.model.glossary.Glossary;
import org.fortiss.af3.mira.model.requirementSource.RequirementSource;
import org.fortiss.af3.mira.model.usecase.UseCase;
import org.fortiss.af3.mira.ui.action.ConnectRequirementExternalRelationsToComponentAction;
import org.fortiss.af3.mira.ui.action.ConvertRequirementAction;
import org.fortiss.af3.mira.ui.action.DeleteRequirementSpecificationAction;
import org.fortiss.af3.mira.ui.action.ReviewAction;
import org.fortiss.af3.mira.ui.action.ShowHierarchyAction;
import org.fortiss.af3.mira.ui.editor.externalRelation.ExternalRelationSection;
import org.fortiss.af3.mira.ui.editor.highlight.ListToWordRuleUpdateStrategy;
import org.fortiss.af3.mira.ui.editor.highlight.ScannerManager;
import org.fortiss.af3.mira.ui.editor.images.ImageSection;
import org.fortiss.af3.mira.ui.editor.relation.RelationSection;
import org.fortiss.af3.mira.utils.MiraModelElementFactory;
import org.fortiss.tooling.base.ui.editor.FormsEditorBase;
import org.fortiss.tooling.kernel.ui.presentation.ModelElementLabelProvider;
import org.fortiss.tooling.kernel.ui.service.IActionService;
import org.fortiss.tooling.kernel.ui.service.IModelEditorBindingService;
/**
* Editor to edit a {@link Requirement}
......@@ -154,6 +128,9 @@ public class RequirementEditor<T extends Requirement> extends FormsEditorBase<T>
/** The relation section */
protected RelationSection relationSection;
/** The external relation section */
protected ExternalRelationSection externalRelationSection;
/**
* List of all sourceViewers on the form (needed to inform the on updates of
* glossary and requirement source)
......@@ -235,6 +212,10 @@ public class RequirementEditor<T extends Requirement> extends FormsEditorBase<T>
if(relationSection != null) {
relationSection.refreshTable();
}
// refresh external relation table
if(externalRelationSection != null) {
externalRelationSection.refreshTable();
}
super.registerGlobalActions(bars);
}
......@@ -467,87 +448,24 @@ public class RequirementEditor<T extends Requirement> extends FormsEditorBase<T>
/** Create other composites */
protected void createSectionsAfterGeneral() {
// start composite details
Composite detailComposite = createNewSection("Detail", "Detail information");
detailComposite.setLayout(new GridLayout(3, false));
createSectionExternalRelations(detailComposite);
}
/** create inputs part */
private void createSectionExternalRelations(final Composite detailComposite) {
Label inputsLabel =
toolkit.createLabel(detailComposite, "External Relation(s) ", SWT.READ_ONLY);
multiLineLabelFactory.applyTo(inputsLabel);
if(editedObject.getExternalRelations() == null) {
executeCommand(new Runnable() {
@Override
public void run() {
editedObject.setExternalRelations(MiraModelElementFactory
.createExternalRelations());
}
});
}
SourceViewer externalRelationsTextInput =
createSourceViewer(form, detailComposite, SWT.BORDER | SWT.V_SCROLL | SWT.WRAP |
SWT.MULTI, editedObject.getAnalysis());
registeredSourceViewers.add(externalRelationsTextInput);
multiLineControlList.add(externalRelationsTextInput.getControl());
bind(dbc, externalRelationsTextInput.getTextWidget(), editedObject.getExternalRelations(),
INAMED_ELEMENT__NAME);
Button changeexternalRelationsButton = toolkit.createButton(detailComposite, "", SWT.NONE);
changeexternalRelationsButton.setImage(imageDescriptorFromPlugin(PLUGIN_ID,
"/icons/inputPort.gif").createImage());
changeexternalRelationsButton.addSelectionListener(new SelectionAdapter() {
/** {@inheritDoc} */
@Override
public void widgetSelected(SelectionEvent e) {
new ConnectRequirementExternalRelationsToComponentAction(editedObject,
detailComposite.getShell()).run();
// for automatic resizing
detailComposite.getParent().layout();
detailComposite.getParent().getParent().layout();
form.reflow(true);
}
});
// line 2
toolkit.createLabel(detailComposite, "");
final TableViewer externalRelationsRefTable =
createSpecificationTable(detailComposite,
MiraPackage.Literals.EXTERNAL_RELATION_SPECIFICATION);
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, true)
.applyTo(externalRelationsRefTable.getControl());
externalRelationsRefTable.addDoubleClickListener(new IDoubleClickListener() {
/** {@inheritDoc} */
@Override
public void doubleClick(DoubleClickEvent event) {
ExternalRelationSpecification spec =
checkAndPickFirst(event.getSelection(), ExternalRelationSpecification.class);
if(spec == null)
return;
IModelEditorBindingService.INSTANCE.openInEditor(spec.getSpecificationOf()
.eContainer().eContainer());
}
});
toolkit.createLabel(detailComposite, "");
// do nothing
}
/** Create section relation */
protected void createSectionRelation() {
final Composite relationComposite =
createNewSection("Related Requirements", "Related requirements information");
final Composite relationComposite = createNewSection("Traces", "Trace information");
relationComposite.setLayout(new GridLayout(1, false));
toolkit.createLabel(relationComposite, "Traces within requirements");
relationSection =
new RelationSection(this, relationComposite, editedObject, toolkit, dbc, form,
registeredSourceViewers);
toolkit.createLabel(relationComposite, "Traces to architecture");
externalRelationSection =
new ExternalRelationSection(this, relationComposite, editedObject, toolkit, dbc,
form, registeredSourceViewers);
}
/** create comment section */
......@@ -588,55 +506,4 @@ public class RequirementEditor<T extends Requirement> extends FormsEditorBase<T>
new ListToWordRuleUpdateStrategy(analysis));
}
}
/** create a table to show the specification */
protected TableViewer createSpecificationTable(final Composite composite, final EClass filter) {
final TableViewer table = new TableViewer(composite, SWT.NONE);
toolkit.adapt(table.getTable());
ObservableListContentProvider content = new ObservableListContentProvider();
table.setContentProvider(content);
table.setLabelProvider(new ModelElementLabelProvider() {
/** {@inheritDoc} */
@Override
public String getText(Object element) {
if(element instanceof RequirementSpecification) {
return super.getText(((RequirementSpecification)element).getSpecificationOf());
}
return super.getText(element);
}
/** {@inheritDoc} */
@Override
public Image getImage(Object element) {
if(element instanceof RequirementSpecification) {
return super.getImage(((RequirementSpecification)element).getSpecificationOf());
}
return super.getImage(element);
}
});
table.getTable().addKeyListener(new KeyAdapter() {
/** {@inheritDoc} */
@Override
public void keyPressed(KeyEvent e) {
if(e.keyCode == SWT.DEL) {
new DeleteRequirementSpecificationAction(editedObject, SelectionUtils
.selectAll(table.getSelection(), RequirementSpecification.class)).run();
}
}
});
table.setInput(observeList(editedObject, IMODEL_ELEMENT__REFERENCED_BY));
table.setFilters(new ViewerFilter[] {new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parent, Object element) {
return filter.isInstance(element);
}
}});
return table;
}
}
......@@ -39,6 +39,7 @@ import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createInputs;
import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createOutputs;
import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createScope;
import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createTrigger;
import static org.fortiss.tooling.base.model.element.ElementPackage.Literals.IMODEL_ELEMENT__REFERENCED_BY;
import static org.fortiss.tooling.kernel.model.FortissToolingKernelPackage.Literals.INAMED_ELEMENT__NAME;
import static org.fortiss.tooling.kernel.ui.util.DataBindingUtils.bind;
......@@ -46,29 +47,38 @@ import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import org.conqat.ide.commons.ui.selection.SelectionUtils;
import org.conqat.lib.commons.string.StringUtils;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.map.IObservableMap;
import org.eclipse.core.databinding.observable.set.ListToSetAdapter;
import org.eclipse.core.databinding.observable.value.ComputedValue;
import org.eclipse.emf.databinding.EMFObservables;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.jface.databinding.swt.SWTObservables;
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.text.source.SourceViewer;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.fortiss.af3.mira.model.RequirementSpecification;
import org.fortiss.af3.mira.model.usecase.InputSpecification;
import org.fortiss.af3.mira.model.usecase.MinimumgaranteeSpecification;
import org.fortiss.af3.mira.model.usecase.OutputSpecification;
......@@ -78,11 +88,13 @@ import org.fortiss.af3.mira.model.usecase.SuccessgaranteeSpecification;
import org.fortiss.af3.mira.model.usecase.TriggerSpecification;
import org.fortiss.af3.mira.model.usecase.UseCase;
import org.fortiss.af3.mira.model.usecase.UsecasePackage;
import org.fortiss.af3.mira.ui.action.ConnectConditionToComponentAction;
import org.fortiss.af3.mira.ui.action.ConnectUseCaseScopeToComponentAction;
import org.fortiss.af3.mira.ui.action.ConnectUseCaseTriggerToInputPortAction;
import org.fortiss.af3.mira.ui.action.ConnectUseCaseConditionToComponentAction;
import org.fortiss.af3.mira.ui.action.ConnectUseCaseInputsToInputPortAction;
import org.fortiss.af3.mira.ui.action.ConnectUseCaseOutputsToOutputPortAction;
import org.fortiss.af3.mira.ui.action.ConnectUseCaseScopeToComponentAction;
import org.fortiss.af3.mira.ui.action.ConnectUseCaseTriggerToInputPortAction;
import org.fortiss.af3.mira.ui.action.DeleteRequirementSpecificationAction;
import org.fortiss.tooling.kernel.ui.presentation.ModelElementLabelProvider;
import org.fortiss.tooling.kernel.ui.service.IModelEditorBindingService;
/**
......@@ -192,8 +204,8 @@ public class UseCaseEditor extends RequirementEditor<UseCase> {
/** {@inheritDoc} */
@Override
public void widgetSelected(SelectionEvent e) {
new ConnectConditionToComponentAction(editedObject, detailComposite.getShell(),
SUCCESSGARANTEE_SPECIFICATION).run();
new ConnectUseCaseConditionToComponentAction(editedObject, detailComposite
.getShell(), SUCCESSGARANTEE_SPECIFICATION).run();
}
});
......@@ -250,8 +262,8 @@ public class UseCaseEditor extends RequirementEditor<UseCase> {
/** {@inheritDoc} */
@Override
public void widgetSelected(SelectionEvent e) {
new ConnectConditionToComponentAction(editedObject, detailComposite.getShell(),
MINIMUMGARANTEE_SPECIFICATION).run();
new ConnectUseCaseConditionToComponentAction(editedObject, detailComposite
.getShell(), MINIMUMGARANTEE_SPECIFICATION).run();
}
});
......@@ -309,8 +321,8 @@ public class UseCaseEditor extends RequirementEditor<UseCase> {
/** {@inheritDoc} */
@Override
public void widgetSelected(SelectionEvent e) {
new ConnectConditionToComponentAction(editedObject, detailComposite.getShell(),
PRECONDITION_SPECIFICATION).run();
new ConnectUseCaseConditionToComponentAction(editedObject, detailComposite
.getShell(), PRECONDITION_SPECIFICATION).run();
}
});
......@@ -366,7 +378,8 @@ public class UseCaseEditor extends RequirementEditor<UseCase> {
/** {@inheritDoc} */
@Override
public void widgetSelected(SelectionEvent e) {
new ConnectUseCaseTriggerToInputPortAction(editedObject, detailComposite.getShell()).run();
new ConnectUseCaseTriggerToInputPortAction(editedObject, detailComposite.getShell())
.run();
}
});
......@@ -485,7 +498,8 @@ public class UseCaseEditor extends RequirementEditor<UseCase> {
/** {@inheritDoc} */
@Override
public void widgetSelected(SelectionEvent e) {
new ConnectUseCaseScopeToComponentAction(editedObject, detailComposite.getShell()).run();
new ConnectUseCaseScopeToComponentAction(editedObject, detailComposite.getShell())
.run();
}
});
......@@ -637,4 +651,54 @@ public class UseCaseEditor extends RequirementEditor<UseCase> {
toolkit.createLabel(detailComposite, "");
}
/** create a table to show the specification */
private TableViewer createSpecificationTable(final Composite composite, final EClass filter) {
final TableViewer table = new TableViewer(composite, SWT.NONE);
toolkit.adapt(table.getTable());
ObservableListContentProvider content = new ObservableListContentProvider();
table.setContentProvider(content);
table.setLabelProvider(new ModelElementLabelProvider() {
/** {@inheritDoc} */
@Override
public String getText(Object element) {
if(element instanceof RequirementSpecification) {
return super.getText(((RequirementSpecification)element).getSpecificationOf());
}
return super.getText(element);
}
/** {@inheritDoc} */
@Override
public Image getImage(Object element) {
if(element instanceof RequirementSpecification) {
return super.getImage(((RequirementSpecification)element).getSpecificationOf());
}
return super.getImage(element);
}
});
table.getTable().addKeyListener(new KeyAdapter() {
/** {@inheritDoc} */
@Override
public void keyPressed(KeyEvent e) {