Commit ec5267be authored by Hernan Ponce de Leon's avatar Hernan Ponce de Leon
Browse files

[YELLOW] code reviewed

parent bf7ccf91
TestSuitEditorProposalProvider.java 00bddce627278c119fb3c115b3a7d8ac139d9bbd GREEN
TestSuiteEditingSupport.java 607b7b24d8f751c2e825513b7dd3619dd3758cd8 GREEN
TestSuiteEditor.java 4af9771fefa2af2d6ca35ca1599323ab26705c2a GREEN
TestSuiteEditor.java 53ad697385304286893d6283b21fe4f3970eeaf2 YELLOW
TestSuiteEditorBinding.java 3a79689e417935438e1ee9ac39b392e547abc565 GREEN
TestSuiteEditorWithErrorMarking.java 8549409167d7d59faa4f58a5d3f7d37f93bfa16d GREEN
TestSuiteLabelProvider.java 1ed3a69970badc471583827bff661f8ffc13497c GREEN
......
......@@ -24,11 +24,13 @@ import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.TreeViewerColumn;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
import org.fortiss.af3.component.model.Port;
import org.fortiss.af3.testing.model.TestCase;
......@@ -42,7 +44,6 @@ import org.fortiss.af3.testing.ui.action.RemoveTestCaseAction;
import org.fortiss.af3.testing.ui.action.RemoveTestStepAction;
import org.fortiss.tooling.base.ui.editor.TreeViewerEditorBase;
import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService;
import org.fortiss.tooling.kernel.ui.util.SelectionUtils;
/**
* Editor for {@link TestSuite}s. Displaying a test suite as a tree, consisting
......@@ -56,12 +57,13 @@ public class TestSuiteEditor extends TreeViewerEditorBase<TestSuite> {
@Override
protected void setupTreeViewer(final TreeViewer treeViewer) {
treeViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
treeViewer.getTree().setHeaderVisible(true);
treeViewer.getTree().setLinesVisible(true);
Tree tree = treeViewer.getTree();
tree.setHeaderVisible(true);
tree.setLinesVisible(true);
if(getEditedObject().getTestCases().size() == 1) {
treeViewer.setAutoExpandLevel(2);
}
new TreeColumn(treeViewer.getTree(), SWT.LEFT).setWidth(150);
new TreeColumn(tree, SWT.LEFT).setWidth(150);
int index = 0;
for(Port port : getEditedObject().getInputPorts()) {
......@@ -84,12 +86,12 @@ public class TestSuiteEditor extends TreeViewerEditorBase<TestSuite> {
@Override
public void menuAboutToShow(IMenuManager manager) {
TestCase selectedTestCase =
SelectionUtils.checkAndPickFirst(treeViewer.getSelection(), TestCase.class);
checkAndPickFirst(treeViewer.getSelection(), TestCase.class);
// if no test case was selected, check if a test step was
// selected and chose parent test case
ISelection selection = treeViewer.getSelection();
if(selectedTestCase == null) {
TestStep selectedTestStep =
checkAndPickFirst(treeViewer.getSelection(), TestStep.class);
TestStep selectedTestStep = checkAndPickFirst(selection, TestStep.class);
if(selectedTestStep == null) {
for(Action action : getAllowedActionsForEmptyTestSuite())
manager.add(action);
......@@ -100,8 +102,7 @@ public class TestSuiteEditor extends TreeViewerEditorBase<TestSuite> {
}
if(selectedTestCase != null) {
TestStep selectedTestStep =
checkAndPickFirst(treeViewer.getSelection(), TestStep.class);
TestStep selectedTestStep = checkAndPickFirst(selection, TestStep.class);
if(selectedTestStep == null) {
for(Action action : getAllowedActionsForEmptyTestSuite())
manager.add(action);
......@@ -119,8 +120,8 @@ public class TestSuiteEditor extends TreeViewerEditorBase<TestSuite> {
}
});
Menu menu = menuMgr.createContextMenu(treeViewer.getTree());
treeViewer.getTree().setMenu(menu);
Menu menu = menuMgr.createContextMenu(tree);
tree.setMenu(menu);
}
/** Sets up a column content. */
......
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