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

usability of generic opt page

parent 700ba108
......@@ -22,6 +22,7 @@ import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ISelectionChangedListener;
......@@ -37,6 +38,7 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.ui.IPropertyListener;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.utils.ComponentArchitectureUtils;
import org.fortiss.af3.deployment.ui.editor.INamedColumnLabelProvider;
import org.fortiss.af3.exploration.dsl_v2.model.arithmetic.ArithmeticFactory;
import org.fortiss.af3.exploration.dsl_v2.model.arithmetic.ArithmeticLiteral;
......@@ -60,6 +62,7 @@ import org.fortiss.af3.exploration.smt.model.SMTObjective;
import org.fortiss.af3.exploration.smt.util.Z3ModelElementFactory;
import org.fortiss.af3.exploration.ui.perspective.IDSEPerspectiveManager;
import org.fortiss.af3.exploration.ui.util.DSLPatternArchitectureContentProvider;
import org.fortiss.af3.platform.model.ExecutionUnit;
import org.fortiss.af3.platform.model.PlatformArchitecture;
import org.fortiss.af3.task.model.Task;
import org.fortiss.tooling.base.annotation.AnnotationEntry;
......@@ -76,7 +79,7 @@ import org.fortiss.tooling.kernel.utils.UniqueIDUtils;
* @author zverlov
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 50EA8304F1B63A660F859EA7E61AAAFA
* @ConQAT.Rating YELLOW Hash: 2609F9B58C73CDEBF4FFB9F7ABAC9D3B
*/
public class HardwareOptimizationPatternCompositeBackend extends
HardwareOptimizationPatternCompositeGUI implements IPropertyListener {
......@@ -135,12 +138,48 @@ public class HardwareOptimizationPatternCompositeBackend extends
updateCombosAndTrees();
preSelectBinder();
IDSEPerspectiveManager.INSTANCE.addListener(this);
// make sure that button is broad enough
btnSelectAll.setText("select all");
btnSelectAll_1.setText("select all");
btnSelectAll.addSelectionListener(new SelectAllAdapter(treeViewerSet1Selection));
btnSelectAll_1.addSelectionListener(new SelectAllAdapter(treeViewerSet2Selection));
}
/** {@link SelectionAdapter} for selection of all tree items. */
private class SelectAllAdapter extends SelectionAdapter {
/** true, if select all button was pushed. */
private boolean isSelected = false;
/** The {@link TreeViewer} to select all items. */
private TreeViewer treeViewer;
/** Constructor. */
public SelectAllAdapter(TreeViewer treeViewer) {
this.treeViewer = treeViewer;
}
/** {@inheritDoc} */
@Override
public void widgetSelected(SelectionEvent e) {
org.eclipse.swt.widgets.Button source = (org.eclipse.swt.widgets.Button)e.getSource();
if(!isSelected) {
treeViewer.expandAll();
treeViewer.getTree().selectAll();
isSelected = true;
source.setText("deselect all");
} else {
treeViewer.getTree().deselectAll();
treeViewer.expandToLevel(0);
isSelected = false;
source.setText("select all");
}
}
}
/** Preselects a binder. */
public void preSelectBinder() {
comboOperation.select(0);
System.out.print(comboOperation.getSelectionIndex());
}
/** Init the operation {@link HashMap}. */
......@@ -258,8 +297,14 @@ public class HardwareOptimizationPatternCompositeBackend extends
btnAdd.setEnabled(false);
return;
}
treeViewerSet1Selection.setInput(platformArchitecture);
treeViewerSet1Selection.setInput(platformArchitecture.getContainedElements().stream()
.filter(e -> e instanceof ExecutionUnit).collect(Collectors.toList()));
treeViewerSet2Selection.setInput(component);
annotationEntriesOfSet1 =
IAnnotationValueService.getInstance().getAnnotationEntry(
platformArchitecture.getContainedElements().stream().findAny().get());
listViewerSetProperty.setInput(annotationEntriesOfSet1.getSpecificationsList());
}
/**
......@@ -379,6 +424,10 @@ public class HardwareOptimizationPatternCompositeBackend extends
hwcs.setSuperSetReference(dse.getDseSuperSet().getECUSuperSet());
List<Task> tasks = new ArrayList<>();
for(Object m : selectedSet2.toList()) {
if(!ComponentArchitectureUtils.isAtomicComponent((Component)m)) {
// ignore hierarchic components as there are no referring tasks
continue;
}
Task task = IDSEPerspectiveManager.INSTANCE.getReferringTask_ADAPTER((Component)m);
tasks.add(task);
}
......
......@@ -37,7 +37,7 @@ import org.eclipse.wb.swt.SWTResourceManager;
* @author zverlov
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: DA6A945D74C5FB3996F3D3674396A8E3
* @ConQAT.Rating YELLOW Hash: CBC24B75AFF9C5155D62E98249AA3D0B
*/
@SuppressWarnings("javadoc")
public class HardwareOptimizationPatternCompositeGUI extends Composite {
......@@ -50,6 +50,8 @@ public class HardwareOptimizationPatternCompositeGUI extends Composite {
protected Label lblHwcproperty;
protected Label lblObjectivePreview;
protected TreeViewer treeViewerSet2Selection;
protected Button btnSelectAll_1;
protected Button btnSelectAll;
/** Constructor. */
public HardwareOptimizationPatternCompositeGUI(Composite parent, int style) {
......@@ -107,6 +109,19 @@ public class HardwareOptimizationPatternCompositeGUI extends Composite {
gd_treeSet2Selection.heightHint = 173;
treeSet2Selection.setLayoutData(gd_treeSet2Selection);
btnSelectAll = new Button(compositeSetSelection, SWT.NONE);
GridData gd_btnSelectAll = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_btnSelectAll.widthHint = 141;
btnSelectAll.setLayoutData(gd_btnSelectAll);
btnSelectAll.setText("select all");
new Label(compositeSetSelection, SWT.NONE);
btnSelectAll_1 = new Button(compositeSetSelection, SWT.NONE);
GridData gd_btnSelectAll_1 = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_btnSelectAll_1.widthHint = 141;
btnSelectAll_1.setLayoutData(gd_btnSelectAll_1);
btnSelectAll_1.setText("select all");
Composite compositePreview = new Composite(this, SWT.NONE);
compositePreview.setLayout(new GridLayout(2, false));
compositePreview.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
......
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