Commit 1adaee3d authored by Dongyue Mou's avatar Dongyue Mou
Browse files

changed functional specification to formal specification and cleaned code

refs 872
parent 4d2c9dcf
......@@ -3,5 +3,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test-src"/>
<classpathentry kind="output" path="build"/>
</classpath>
......@@ -12,7 +12,7 @@ Require-Bundle: org.fortiss.af3.state.ui;bundle-version="2.2.0";visibility:=reex
org.eclipse.core.databinding.property;bundle-version="1.4.0",
org.eclipse.jface.text;bundle-version="3.6.0",
org.eclipse.core.databinding.beans;bundle-version="1.2.100",
com.ibm.icu;bundle-version="4.4.2"
org.eclipse.swtbot.go;bundle-version="2.0.5";resolution:=optional
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.fortiss.af3.mira.ui.AF3MiraUIActivator
Export-Package: org.fortiss.af3.mira.ui,
......
......@@ -6,5 +6,6 @@ bin.includes = .,\
icons/,\
lib/
jars.compile.order = .
source.. = src/
source.. = src/,\
test-src/
output = build
......@@ -57,9 +57,9 @@
</modelElementClass>
</modelElementHandler>
<modelElementHandler
handler="org.fortiss.af3.mira.ui.handler.FunctionalSpecificationHandler">
handler="org.fortiss.af3.mira.ui.handler.FormalSpecificationHandler">
<modelElementClass
modelElementClass="org.fortiss.af3.mira.model.functional.FunctionalSpecification">
modelElementClass="org.fortiss.af3.mira.model.functional.FormalSpecification">
</modelElementClass>
</modelElementHandler>
</extension>
......
/*--------------------------------------------------------------------------+
$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $
| |
| Copyright 2012 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.mira.ui.action;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mira.model.functional.FunctionalSpecification;
import org.fortiss.af3.mira.utils.MiraModelElementFactory;
import org.fortiss.tooling.kernel.ui.service.IModelEditorBindingService;
import org.fortiss.tooling.kernel.utils.EcoreUtils;
/**
*
* @author wenwenchen
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating YELLOW Hash: A1417E5C1265F29B5DBCB0F5B3E03D42
*/
public class ChangeUseCaseToRequirement<T extends Requirement> implements Runnable {
/** subclass Instance to change */
private T t;
/** new Requirement called r */
private Requirement r = MiraModelElementFactory.createRequirement();
// private Switch<Requirement> s;
/** Create the command with the selected relation */
public ChangeUseCaseToRequirement(T t) {
this.t = t;
}
/** {@inheritDoc} */
@Override
public void run() {
r.setId(t.getId());
r.setName(t.getName());
r.setReqId(t.getReqId());
r.setDescription(t.getDescription());
r.setRationale(t.getRationale());
r.setAuthor(t.getAuthor());
r.setSources(t.getSources());
r.setStatus(t.getStatus());
r.setPriority(t.getPriority());
r.setTodo(t.getTodo());
r.setRationale(t.getRationale());
r.setComment(t.getComment());
r.setImages(t.getImages());
r.setReferencedBy(t.getReferencedBy());
r.setSpecifications(t.getSpecifications());
r.getConnectorsList().addAll(t.getConnectorsList());
r.getConnectionsList().addAll(t.getConnectionsList());
for(FunctionalSpecification c : EcoreUtils.pickInstanceOf(FunctionalSpecification.class,
t.getContainedElementsList())) {
r.getContainedElementsList().add(c);
}
t.getContainedElementsList().clear();
EcoreUtil.replace(t, r);
EcoreUtil.delete(t);
IModelEditorBindingService.INSTANCE.openInEditor(r);
}
}
......@@ -30,7 +30,7 @@ import org.fortiss.af3.mira.command.CreateRequirementSpecificationCommand;
import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mira.model.RequirementSpecification;
import org.fortiss.af3.mira.model.usecase.ScopeSpecification;
import org.fortiss.af3.mira.ui.dialog.SelectionDialogUtils;
import org.fortiss.af3.mira.ui.utils.SelectionDialogUtils;
import org.fortiss.af3.state.model.State;
import org.fortiss.tooling.kernel.service.ICommandStackService;
import org.fortiss.tooling.kernel.ui.extension.base.EObjectActionBase;
......@@ -42,7 +42,7 @@ import org.fortiss.tooling.kernel.ui.extension.base.EObjectActionBase;
* @author mou
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 22F5CCEDF3D72D196E016DB1666E4997
* @ConQAT.Rating YELLOW Hash: 1C1D71B0C0EE17DB2256D63820019058
*/
public class ConnectConditionToComponentAction extends EObjectActionBase<Requirement> {
......
......@@ -20,7 +20,7 @@ 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.dialog.SelectionDialogUtils.open;
import static org.fortiss.af3.mira.ui.utils.SelectionDialogUtils.open;
import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createScopeSpecification;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickFirstInstanceOf;
import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.getRootElement;
......@@ -40,7 +40,7 @@ import org.fortiss.tooling.kernel.ui.extension.base.EObjectActionBase;
* @author uden
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 4C56EBC3702FFA79C81ADE3991FDA67B
* @ConQAT.Rating YELLOW Hash: DB31EE6E5DB4984C8C6552A39F51AD97
*/
public final class ConnectScopeToComponentAction extends EObjectActionBase<UseCase> {
......
......@@ -30,7 +30,7 @@ import org.fortiss.af3.mira.command.CreateRequirementSpecificationCommand;
import org.fortiss.af3.mira.model.usecase.ScopeSpecification;
import org.fortiss.af3.mira.model.usecase.TriggerSpecification;
import org.fortiss.af3.mira.model.usecase.UseCase;
import org.fortiss.af3.mira.ui.dialog.SelectionDialogUtils;
import org.fortiss.af3.mira.ui.utils.SelectionDialogUtils;
import org.fortiss.tooling.kernel.service.ICommandStackService;
import org.fortiss.tooling.kernel.ui.extension.base.EObjectActionBase;
......@@ -40,7 +40,7 @@ import org.fortiss.tooling.kernel.ui.extension.base.EObjectActionBase;
* @author uden
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: DA1295A463C5EEAC4FD2657D3D302A92
* @ConQAT.Rating YELLOW Hash: FFB0CBF0FE2CDC37E27DB09179045BCE
*/
public final class ConnectTriggerToInputPortAction extends EObjectActionBase<UseCase> {
......
......@@ -17,7 +17,7 @@ $Id$
+--------------------------------------------------------------------------*/
package org.fortiss.af3.mira.ui.action;
import static org.fortiss.af3.mira.ui.dialog.SelectionDialogUtils.openInputPortsMultiSeclectDialog;
import static org.fortiss.af3.mira.ui.utils.SelectionDialogUtils.openInputPortsMultiSeclectDialog;
import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createInputSpecification;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickInstanceOf;
......@@ -36,7 +36,7 @@ import org.fortiss.af3.mira.model.usecase.UseCase;
* @author kisslinger
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: F31AE7883AE11CB699FABC7779927C23
* @ConQAT.Rating YELLOW Hash: 338D865B3CB2240CA312125F0EC59B1E
*/
public class ConnectUseCaseInputsToInputPortAction extends ConnectUseCaseToPortsActionBase {
......
......@@ -17,7 +17,7 @@ $Id$
+--------------------------------------------------------------------------*/
package org.fortiss.af3.mira.ui.action;
import static org.fortiss.af3.mira.ui.dialog.SelectionDialogUtils.openOutputPortsMultiSeclectDialog;
import static org.fortiss.af3.mira.ui.utils.SelectionDialogUtils.openOutputPortsMultiSeclectDialog;
import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createOutputSpecification;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickInstanceOf;
......@@ -37,7 +37,7 @@ import org.fortiss.af3.mira.model.usecase.UseCase;
* @author kisslinger
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: CD61E4A410D62EDCB16DF1685490336C
* @ConQAT.Rating YELLOW Hash: 9B3BE9B797E9DAC4A462B895F7E80F8C
*/
public class ConnectUseCaseOutputsToOutputPortAction extends ConnectUseCaseToPortsActionBase {
......
......@@ -41,12 +41,12 @@ import org.fortiss.tooling.kernel.ui.extension.base.EObjectActionBase;
* @author kisslinger
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: AC0E5006B6E162EA55B77F1636C39291
* @ConQAT.Rating YELLOW Hash: C8C2DD6CFCF6DEF5BFFFBE44F32C5A13
*/
public abstract class ConnectUseCaseToPortsActionBase extends EObjectActionBase<UseCase> {
/** the default shell */
final Shell shell;
protected final Shell shell;
/** Constructor. */
public ConnectUseCaseToPortsActionBase(UseCase editedObject, Shell shell) {
......@@ -58,8 +58,10 @@ public abstract class ConnectUseCaseToPortsActionBase extends EObjectActionBase<
/**
* opens a dialog to select ports and returns the selected ports as list
*
* @param scope Component from which ports can be selected
* @param selectionBefore Ports which should be shown as selected when the dialog is opened
* @param scope
* Component from which ports can be selected
* @param selectionBefore
* Ports which should be shown as selected when the dialog is opened
*/
protected abstract List<? extends Port> openDialog(Component scope, List<Port> selectionBefore);
......
......@@ -17,55 +17,68 @@ $Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $
+--------------------------------------------------------------------------*/
package org.fortiss.af3.mira.ui.action;
import org.eclipse.emf.ecore.util.EcoreUtil;
import static org.eclipse.emf.ecore.util.EcoreUtil.delete;
import static org.eclipse.emf.ecore.util.EcoreUtil.replace;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickInstanceOf;
import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mira.model.functional.FormalSpecification;
import org.fortiss.af3.mira.model.usecase.UseCase;
import org.fortiss.af3.mira.utils.MiraModelElementFactory;
import org.fortiss.tooling.kernel.ui.service.IModelEditorBindingService;
/**
* Command to change a {@link Requirement} to {@link UseCase}
*
* @author wenwenchen
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating YELLOW Hash: 67F19993132BBBDC399C572E896407D7
* @ConQAT.Rating YELLOW Hash: 8E28A42F1BF82200C2F7B229C9F16793
*/
public class ChangeRequirementToUseCase implements Runnable {
public class ConvertRequirementAction implements Runnable {
/** the selected relation */
private Requirement re;
/** the old requirement */
private Requirement oldReq;
/** a new Usecase called u */
private UseCase u = MiraModelElementFactory.createUseCase();
/** the new empty requirement */
private Requirement newReq;
/** Create the command with the selected relation */
public ChangeRequirementToUseCase(Requirement re) {
this.re = re;
/** Create the command with the selected requirement */
public ConvertRequirementAction(Requirement oldReq, Requirement newReq) {
this.oldReq = oldReq;
this.newReq = newReq;
}
/** {@inheritDoc} */
@Override
public void run() {
u.setId(re.getId());
u.setName(re.getName());
u.setReqId(re.getReqId());
u.setDescription(re.getDescription());
u.setRationale(re.getRationale());
u.setAuthor(re.getAuthor());
u.setSources(re.getSources());
u.setStatus(re.getStatus());
u.setPriority(re.getPriority());
u.setTodo(re.getTodo());
u.setRationale(re.getRationale());
u.setComment(re.getComment());
u.setImages(re.getImages());
u.setReferencedBy(re.getReferencedBy());
u.setSpecifications(re.getSpecifications());
u.getConnectionsList().addAll(re.getConnectionsList());
u.getConnectorsList().addAll(re.getConnectorsList());
u.getContainedElementsList().addAll(re.getContainedElementsList());
EcoreUtil.replace(re, u);
EcoreUtil.delete(re);
IModelEditorBindingService.INSTANCE.openInEditor(u);
IModelEditorBindingService.INSTANCE.closeEditors(oldReq);
newReq.setId(oldReq.getId());
newReq.setName(oldReq.getName());
newReq.setReqId(oldReq.getReqId());
newReq.setDescription(oldReq.getDescription());
newReq.setRationale(oldReq.getRationale());
newReq.setAuthor(oldReq.getAuthor());
newReq.setSources(oldReq.getSources());
newReq.setStatus(oldReq.getStatus());
newReq.setPriority(oldReq.getPriority());
newReq.setTodo(oldReq.getTodo());
newReq.setRationale(oldReq.getRationale());
newReq.setComment(oldReq.getComment());
newReq.getImagesList().addAll(oldReq.getImagesList());
newReq.getReferencedByList().addAll(oldReq.getReferencedByList());
newReq.getSpecificationsList().addAll(oldReq.getSpecificationsList());
newReq.getConnectionsList().addAll(oldReq.getConnectionsList());
newReq.getConnectorsList().addAll(oldReq.getConnectorsList());
newReq.getContainedElementsList().addAll(oldReq.getContainedElementsList());
newReq.getContainedElementsList().addAll(
pickInstanceOf(FormalSpecification.class, oldReq.getContainedElementsList()));
replace(oldReq, newReq);
delete(oldReq, true);
IModelEditorBindingService.INSTANCE.openInEditor(newReq);
}
}
......@@ -36,7 +36,7 @@ import org.fortiss.tooling.kernel.ui.extension.base.EObjectActionBase;
* @author kisslinger
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 5FED496052EE125CDC829CA1426BE5A6
* @ConQAT.Rating YELLOW Hash: 9DD4EF955AF3F349E500D2C854CB2E08
*/
public class ExportImagesAction extends EObjectActionBase<EObject> {
......@@ -70,11 +70,7 @@ public class ExportImagesAction extends EObjectActionBase<EObject> {
imageFolder.delete();
}
/**
* Export the images of one IImageContainer
*
* @param element
*/
/** Export the images of one IImageContainer */
private void exportImages(IImageContainer element) {
for(ImageItem imageItem : element.getImages()) {
try {
......
/*--------------------------------------------------------------------------+
$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $
| |
| Copyright 2012 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.mira.ui.dialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Shell;
/**
*
* @author wenwenchen
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating YELLOW Hash: B9EA4589C043EB4BBFF0E5BA70481B11
*/
public class ChangeWarningDialog {
/** */
private static Shell shell;
/**
* @return 1 YES 0 NO -1 Exit
*/
public static int dialog() {
MessageDialog dialog =
new MessageDialog(
shell,
"Warning",
null,
"Changing the requirements type deletes all information\n"
+ "that is not contained in the new requirements type! \nContinue?",
MessageDialog.ERROR, new String[] {"NO", "YES"}, 0);
int result = dialog.open();
return result;
}
}
......@@ -40,11 +40,13 @@ public class AnalysisComparator extends ViewerComparator {
private static final int DESCENDING = 1;
/** sorting direction */
// TODO considering use enumeration type to avoid magic number
private int direction = DESCENDING;
/** Constructor. */
public AnalysisComparator() {
this.propertyIndex = 0;
// TODO avoid magic operation
direction = 1 - DESCENDING;
}
......
......@@ -55,6 +55,34 @@ import org.fortiss.tooling.kernel.ui.service.IModelEditorBindingService;
*/
public class AnalysisEditor<T extends Analysis> extends FormsEditorBase<T> {
/** search filter */
private ViewerFilter searchFilter = new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
if(element instanceof Requirement) {
Requirement req = (Requirement)element;
// TODO (Moudy) use StringUtils.isEmpty(text) for clean conditions
if(filterText.getText() != null && filterText.getText().length() > 0) {
String filterString = filterText.getText().toLowerCase().trim();
if(("" + req.getReqId()).toLowerCase().contains(filterString)) {
return true;
} else if(MiraUtils.getDisplayNameFor(req).toLowerCase().contains(filterString)) {
return true;
} else if(req.getName() != null &&
req.getName().toLowerCase().contains(filterString)) {
return true;
} else if(req.getDescription() != null &&
req.getDescription().toLowerCase().contains(filterString)) {
return true;
}
} else
return true;
}
return false;
}
};
/** single line label grid data factory */
protected static GridDataFactory singleLineLabelFactory = GridDataFactory.swtDefaults()
.align(SWT.RIGHT, SWT.CENTER).grab(false, false);
......@@ -184,11 +212,6 @@ public class AnalysisEditor<T extends Analysis> extends FormsEditorBase<T> {
/**
* selection adapter for sorting columns
*
* @param treeViewer
* @param treeColumn
* @param index
* @return selection adapter
*/
private SelectionAdapter getSelectionAdapter(final TreeViewer treeViewer,
final TreeColumn treeColumn, final int index) {
......@@ -204,31 +227,4 @@ public class AnalysisEditor<T extends Analysis> extends FormsEditorBase<T> {
};
return selectionAdapter;
}
/** search filter */
ViewerFilter searchFilter = new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
if(element instanceof Requirement) {
Requirement req = (Requirement)element;
if(filterText.getText() != null && filterText.getText().length() > 0) {
String filterString = filterText.getText().toLowerCase().trim();
if(("" + req.getReqId()).toLowerCase().contains(filterString)) {
return true;
} else if(MiraUtils.getDisplayNameFor(req).toLowerCase().contains(filterString)) {
return true;
} else if(req.getName() != null &&
req.getName().toLowerCase().contains(filterString)) {
return true;
} else if(req.getDescription() != null &&
req.getDescription().toLowerCase().contains(filterString)) {
return true;
}
} else
return true;
}
return false;
}
};
}
......@@ -42,7 +42,7 @@ import org.fortiss.tooling.kernel.ui.presentation.ModelElementLabelProvider;
* @author mou
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 545D64202271DB23D9F3CDD3579ED44D
* @ConQAT.Rating YELLOW Hash: 74B071C55625F75123DE803C6F6DFBD9
*/
public class RelationTargetEditingSupport extends EditingSupport {
......
......@@ -28,6 +28,9 @@ import static org.fortiss.af3.mira.model.MiraPackage.Literals.REQUIREMENT__SOURC
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.editor.glossary.ScannerManager.getScanner;
import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createRequirement;
import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createUseCase;
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.IHIERARCHIC_ELEMENT__CONNECTIONS;
import static org.fortiss.tooling.kernel.model.FortissToolingKernelPackage.Literals.INAMED_COMMENTED_ELEMENT__COMMENT;
......@@ -40,6 +43,7 @@ import static org.fortiss.tooling.kernel.ui.util.ObservableUtils.observeValue;
import java.util.ArrayList;
import java.util.List;
import org.conqat.ide.commons.ui.dialog.MessageUtils;
import org.eclipse.core.databinding.UpdateListStrategy;
import org.eclipse.core.databinding.observable.ChangeEvent;
import org.eclipse.core.databinding.observable.IChangeListener;
......@@ -92,15 +96,13 @@ import org.fortiss.af3.mira.model.RequirementStatus;
import org.fortiss.af3.mira.model.glossary.Glossary;
import org.fortiss.af3.mira.model.usecase.UseCase;
import org.fortiss.af3.mira.relation.IRelationService;
import org.fortiss.af3.mira.ui.action.ChangeRequirementToUseCase;
import org.fortiss.af3.mira.ui.action.ChangeUseCaseToRequirement;
import org.fortiss.af3.mira.ui.action.ConvertRequirementAction;
import org.fortiss.af3.mira.ui.action.CreateGlossaryEntryAction;
import org.fortiss.af3.mira.ui.action.ExportReportAction;
import org.fortiss.af3.mira.ui.action.ExportReportSummarizationAction;
import org.fortiss.af3.mira.ui.action.ExportReqIFAction;
import org.fortiss.af3.mira.ui.action.ShowHierarchyAction;
import org.fortiss.af3.mira.ui.action.VerifyAction;
import org.fortiss.af3.mira.ui.dialog.ChangeWarningDialog;
import org.fortiss.af3.mira.ui.editor.glossary.GlossaryHighlightConfiguration;
import org.fortiss.af3.mira.ui.editor.glossary.ListToWordRuleUpdateStrategy;
import org.fortiss.af3.mira.ui.editor.glossary.ScannerManager;
......@@ -114,7 +116,7 @@ import org.fortiss.tooling.base.ui.editor.FormsEditorBase;