Commit e5bca5c5 authored by Johannes Eder's avatar Johannes Eder
Browse files

removed relation section

Issue-Ref: 3886
Issue-Url: https://af3-developer.fortiss.org/issues/3886

Signed-off-by: Johannes Eder's avatarJohannes Eder <eder@fortiss.org>
parent 74cb5c92
AnalysisEditor.java ab1f7a5ecbd1bea48d9bc14009f2f10123c17c43 GREEN
AnalysisEditor.java 8af36c33588b3a8ceff2fe713326d5f306c66280 YELLOW
DateToStringConverter.java c969b068ea1dfd77b7153dd8937dca2e4b5630b7 GREEN
OtherEditor.java e13c57c58cc848c90bd3d3a75470f874dfffc8f5 RED
RequirementEditor.java 74ab37b7f37696f70a761ce3d8008a4bf10089fb RED
RequirementsContainerEditor.java 849211b697048e34b72364548e3c10213494718e GREEN
RequirementsPackageEditor.java 8bc993fb55747e1799af477f0a720543924c596b GREEN
......
......@@ -36,7 +36,6 @@ 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.ui.editor.overview.OverviewEditorBase;
import org.fortiss.af3.mira.ui.editor.relation.RelationSection;
import org.fortiss.tooling.kernel.model.INamedCommentedElement;
import org.fortiss.tooling.kernel.ui.service.IActionService;
......@@ -50,9 +49,6 @@ public class AnalysisEditor extends OverviewEditorBase<Analysis> {
/** The text in the filter bar. */
protected Text filterTextTraces;
/** The relation section. */
protected RelationSection relationSection;
/** Minimum size of multi line input grid. */
protected int multiLineMinYSize = 50;
......@@ -116,10 +112,6 @@ public class AnalysisEditor extends OverviewEditorBase<Analysis> {
resizeMultiLineControl(c, multiLineMinYSize);
c.addFocusListener(multiLineControlResizeListener);
}
// Refresh relation table.
if(relationSection != null) {
relationSection.refreshTable();
}
}
/**
......
/*-------------------------------------------------------------------------+
| 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.af3.mira.ui.editor.relation;
import org.conqat.lib.commons.string.StringUtils;
import org.eclipse.core.databinding.validation.IValidator;
import org.eclipse.jface.dialogs.IInputValidator;
import org.fortiss.af3.mira.model.Analysis;
import org.fortiss.af3.mira.model.relations.RequirementRelationStatus;
/**
* {@link IValidator} for {@link String} used as status.
*
* @author teufl
*/
public class RequirementRelationStatusNameValidator implements IInputValidator {
/** Stores the analysis node. */
private Analysis analysis;
/** Constructor */
public RequirementRelationStatusNameValidator(Analysis analysis) {
this.analysis = analysis;
}
/** {@inheritDoc} */
@Override
public String isValid(String value) {
String s = value.trim();
if(StringUtils.isEmpty(s) || s.equals("<new status>")) {
return "The name may not be empty!";
}
for(RequirementRelationStatus status : analysis.getRequirementRelationStatus()) {
if(status.getName().equals(s)) {
return s + " exists already!";
}
}
return null;
}
}
/*-------------------------------------------------------------------------+
| Copyright 2013 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.editor.relation;
import static org.eclipse.emf.ecore.util.EcoreUtil.delete;
import static org.eclipse.jface.dialogs.MessageDialog.openError;
import static org.eclipse.jface.dialogs.MessageDialog.openInformation;
import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createRequirementRelationStatus;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Shell;
import org.fortiss.af3.mira.model.Analysis;
import org.fortiss.af3.mira.model.RequirementRelation;
import org.fortiss.af3.mira.model.relations.RequirementRelationStatus;
import org.fortiss.tooling.base.ui.dialog.IDialogEditSupport;
import org.fortiss.tooling.kernel.service.ICommandStackService;
/**
*
* @author wenwenchen
*/
public class RequirementRelationStatusSelectDialogEditSupport implements IDialogEditSupport {
/** The parent shell. */
private Shell shell;
/**
* The analysis which contains the edited {@link RequirementRelationStatus} and
* {@link RequirementRelation}
*/
private Analysis analysis;
/** Constructor. */
public RequirementRelationStatusSelectDialogEditSupport(Shell shell, Analysis analysis) {
this.shell = shell;
this.analysis = analysis;
}
/** {@inheritDoc} */
@Override
public Object createElement(Object selected) {
if(!canCreateElement(selected)) {
openInformation(shell, "Can not create new relation status here",
"Please select the analysis node to create a new relation status:");
return null;
}
final InputDialog input = new InputDialog(shell, "Create a relation status",
"Please type a new name for the new relation status", "<new status>",
new RequirementRelationStatusNameValidator(analysis));
if(Window.OK != input.open() || input.getValue().isEmpty() ||
input.getValue().equals("<new status>")) {
openError(shell, "Unavailable name", "A none-name status can not be created!");
return null;
}
final RequirementRelationStatus status = createRequirementRelationStatus(input.getValue());
ICommandStackService.getInstance().runAsCommand(analysis, new Runnable() {
@Override
public void run() {
analysis.getRequirementRelationStatus().add(status);
}
});
return status;
}
/** {@inheritDoc} */
@Override
public boolean deleteElement(final Object selected) {
if(!canDeleteElement(selected)) {
MessageDialog.openInformation(shell, "Can not be deleted",
"Requirement analysis node and the first 3 default relation status can not be deleted!");
return false;
}
if(selected instanceof RequirementRelationStatus) {
ICommandStackService.getInstance().runAsCommand(analysis, new Runnable() {
@Override
public void run() {
analysis.getRequirementRelationStatus().remove(selected);
delete((RequirementRelationStatus)selected);
}
});
return true;
}
return false;
}
/** {@inheritDoc} */
@Override
public void editElement(final Object selected) {
if(!canEditElement(selected)) {
openInformation(shell, "Can not be edited",
"Requirement analysis node and the first 3 default relation status can not be edited");
return;
}
if(selected instanceof RequirementRelationStatus) {
final InputDialog input = new InputDialog(shell, "Edit the relation status",
"Please type a new name for the new relation status",
((RequirementRelationStatus)selected).getName(),
new RequirementRelationStatusNameValidator(analysis));
if(Window.OK != input.open()) {
return;
}
if(input.getValue().isEmpty() || input.getValue().equals("<new status>")) {
openError(shell, "Unavailable name", "A none-name status is not legal!");
return;
}
ICommandStackService.getInstance().runAsCommand(analysis, new Runnable() {
@Override
public void run() {
((RequirementRelationStatus)selected).setName(input.getValue());
}
});
}
}
/** {@inheritDoc} */
@Override
public boolean canCreateElement(Object selected) {
return selected instanceof RequirementRelationStatus || selected.equals(analysis);
}
/** {@inheritDoc} */
@Override
public boolean canDeleteElement(Object selected) {
return analysis.getRequirementRelationStatus().indexOf(selected) > 2;
}
/** {@inheritDoc} */
@Override
public boolean canEditElement(Object selected) {
return analysis.getRequirementRelationStatus().indexOf(selected) > 2;
}
}
......@@ -6,7 +6,7 @@ MiraLayoutUtils.java 0ed0d5731be847edb8454acc27de691ac3ee28e9 GREEN
ReqSelectionDialog.java e5655f4f6167d0253ca7946b2cdec2d654d50bb1 GREEN
RequirementDocumentFileUtils.java fd3af811c69760ba37f43419c05a284615f3326f GREEN
RequirementUtils.java 613db98fcfa7424a0916030b2b5aef99077cf810 RED
SelectionDialogUtils.java 0ee58fbee13206f4c4864fe306a0052bb7ac219b YELLOW
SelectionDialogUtils.java ed5c8f4f66f866922fbdbe0fc35b2063806b4e82 YELLOW
TableColumnUtils.java 275171744a4a7dd571ad1eb07800cfc600a37138 GREEN
TableRowIndexMap.java 8931bcb57f36079ae780def18592d7bde4c8be5e GREEN
TableRowSelectionButtonMap.java 5a93b0684cd67351f097368cce81819159867735 GREEN
......@@ -39,10 +39,8 @@ import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mira.model.RequirementRelation;
import org.fortiss.af3.mira.model.RequirementsContainer;
import org.fortiss.af3.mira.model.RequirementsPackage;
import org.fortiss.af3.mira.model.relations.RequirementRelationStatus;
import org.fortiss.af3.mira.ui.dialog.ElementTreeDoubleMultiSelectDialog;
import org.fortiss.af3.mira.ui.dialog.ElementTreeMultiSelectEditableDialog;
import org.fortiss.af3.mira.ui.editor.relation.RequirementRelationStatusSelectDialogEditSupport;
import org.fortiss.tooling.base.model.element.IHierarchicElement;
import org.fortiss.tooling.base.model.element.IModelElement;
import org.fortiss.tooling.base.ui.dialog.ElementTreeSingleSelectDialog;
......@@ -59,56 +57,6 @@ import org.fortiss.tooling.kernel.ui.presentation.ModelElementLabelProvider;
public class SelectionDialogUtils {
/**
* Open the {@link RequirementRelation} dialog and return a requirement relation status.
*
* @param shell
* The parent shell.
* @param analysis
* The requirement analysis.
* @param status
* The old requirement relation status.
* @return The actually selected branch step or null if nothing is selected.
*/
public static RequirementRelationStatus openRequirementRelationStatusSingleSelectDialog(
Shell shell, Analysis analysis, RequirementRelationStatus status) {
List<Analysis> root = Arrays.asList(analysis);
ElementTreeSingleSelectDialog dialog = new ElementTreeSingleSelectDialog(shell, root,
status, requirementRelationStatusContentProvider(root),
new ModelElementLabelProvider(),
new RequirementRelationStatusSelectDialogEditSupport(shell, analysis)) {
/** {@inheritDoc} */
@Override
public boolean acceptElement(Object element) {
return element instanceof RequirementRelationStatus;
}
};
if(Window.OK == dialog.open() &&
dialog.getSelectedElement() instanceof RequirementRelationStatus) {
return (RequirementRelationStatus)dialog.getSelectedElement();
}
return null;
}
/**
* Create a {@link ModelElementTreeContentProvider} for requirement relation status selection.
*/
private static ModelElementTreeContentProvider
requirementRelationStatusContentProvider(List<Analysis> root) {
return new ModelElementTreeContentProvider(root) {
/** {@inheritDoc} */
@Override
public List<? extends EObject> getChildren(EObject parent) {
if(parent instanceof Analysis) {
return ((Analysis)parent).getRequirementRelationStatus();
}
return Collections.emptyList();
}
};
}
/**
* Create a {@link ModelElementTreeContentProvider} for all containing {@link Requirement}s,
* {@link RequirementsContainer}s, and {@link RequirementsPackage}s.
......
Markdown is supported
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