public code v1
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>flintstones.group</groupId>
|
||||
<artifactId>flintstones.bundles</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>flintstones.method.common.phase.unification.ui</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<name>[bundle] Ui</name>
|
||||
</project>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>flintstones.method.common.phase.unification.ui</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
<filteredResources>
|
||||
<filter>
|
||||
<id>1779484362654</id>
|
||||
<name></name>
|
||||
<type>30</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
||||
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
</filteredResources>
|
||||
</projectDescription>
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
||||
@@ -0,0 +1,30 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Ui
|
||||
Bundle-SymbolicName: flintstones.method.common.phase.unification.ui;singleton:=true
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Automatic-Module-Name: flintstones.method.common.unification.ui
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Require-Bundle: flintstones.method.common.phase.unification,
|
||||
flintstones.operator,
|
||||
flintstones.valuation.twoTuple,
|
||||
flintstones.entity.valuation,
|
||||
flintstones.model.valuation.service,
|
||||
flintstones.valuation.linguistic,
|
||||
flintstones.entity.problemelement,
|
||||
flintstones.valuation.unifiedValuation,
|
||||
flintstones.domain.fuzzyset.ui.dialog,
|
||||
org.eclipse.e4.core.contexts,
|
||||
org.eclipse.e4.core.di,
|
||||
flintstones.helper.ui,
|
||||
javax.inject,
|
||||
flintstones.entity.domain,
|
||||
flintstones.model.ui.service,
|
||||
flintstones.model.method.service,
|
||||
flintstones.entity.method.phase,
|
||||
flintstones.model.method.phase.service,
|
||||
flintstones.entity.method.phase.ui,
|
||||
org.eclipse.e4.core.services
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: flintstones.method.common.phase.unification.ui.messages,
|
||||
flintstones.method.common.phase.unification.ui.provider
|
||||
@@ -0,0 +1,5 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension
|
||||
point="flintstones.phasemethod.ui">
|
||||
<phasemethod_ui
|
||||
uid="flintstones.method.common.unification.ui.unification"
|
||||
implementation="flintstones.method.common.phase.unification.ui.UnificationUi"
|
||||
phasemethod="flintstones.method.common.unification.unification">
|
||||
</phasemethod_ui>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
+279
@@ -0,0 +1,279 @@
|
||||
package flintstones.method.common.phase.unification.ui;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
|
||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||
import org.eclipse.e4.core.services.nls.Translation;
|
||||
import org.eclipse.jface.viewers.ITreeViewerListener;
|
||||
import org.eclipse.jface.viewers.TreeExpansionEvent;
|
||||
import org.eclipse.jface.viewers.TreeViewer;
|
||||
import org.eclipse.jface.viewers.TreeViewerColumn;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Tree;
|
||||
import org.eclipse.swt.widgets.TreeColumn;
|
||||
|
||||
import flintstones.entity.method.phase.ui.PhaseMethodUI;
|
||||
import flintstones.method.common.phase.unification.UnificationPhase;
|
||||
import flintstones.method.common.phase.unification.ui.comparator.UnificationTreeViewerComparator;
|
||||
import flintstones.method.common.phase.unification.ui.messages.Messages;
|
||||
import flintstones.method.common.phase.unification.ui.provider.AlternativeColumnLabelProvider;
|
||||
import flintstones.method.common.phase.unification.ui.provider.CriterionColumnLabelProvider;
|
||||
import flintstones.method.common.phase.unification.ui.provider.DomainNameColumnLabelProvider;
|
||||
import flintstones.method.common.phase.unification.ui.provider.EvaluationColumnLabelProvider;
|
||||
import flintstones.method.common.phase.unification.ui.provider.ExpertColumnLabelProvider;
|
||||
import flintstones.method.common.phase.unification.ui.provider.UnificationTreeViewerContentProvider;
|
||||
import flintstones.method.common.phase.unification.ui.provider.UnifiedEvaluationColumnLabelProvider;
|
||||
import flintstones.model.ui.service.UiService;
|
||||
|
||||
public class UnificationUi extends PhaseMethodUI {
|
||||
|
||||
@Inject
|
||||
IEclipseContext context;
|
||||
|
||||
@Inject
|
||||
@Translation
|
||||
Messages messages;
|
||||
|
||||
public static final String ID = "flintstones.phasemethod.unification.ui.view.unification"; //$NON-NLS-1$
|
||||
|
||||
private Composite _parent;
|
||||
|
||||
private TreeViewer _treeViewer;
|
||||
private Tree _tree;
|
||||
|
||||
private Label domainLabel;
|
||||
//private Button costValuation;
|
||||
|
||||
private TreeViewerColumn _treeViewerExpertColumn;
|
||||
private TreeColumn _treeExpertColumn;
|
||||
private TreeViewerColumn _treeViewerAlternativeColumn;
|
||||
private TreeColumn _treeAlternativeColumn;
|
||||
private TreeViewerColumn _treeViewerCriterionColumn;
|
||||
private TreeColumn _treeCriterionColumn;
|
||||
private TreeViewerColumn _treeViewerDomainColumn;
|
||||
private TreeColumn _treeDomainColumn;
|
||||
private TreeViewerColumn _treeViewerEvaluationColumn;
|
||||
private TreeColumn _treeEvaluationColumn;
|
||||
private TreeViewerColumn _treeViewerUnifiedEvaluationColumn;
|
||||
private TreeColumn _treeUnifiedEvaluationColumn;
|
||||
UnificationPhase phaseMethod;
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
phaseMethod = (UnificationPhase) this.getModel();
|
||||
|
||||
createPartControl(this.baseComposite);
|
||||
phaseMethod.initDomain();
|
||||
compute(false);
|
||||
domainLabel.setText(phaseMethod.getUnificationDomain().formatDescriptionDomain());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
if(!phaseMethod.getUnificationDomain().equals(phaseMethod.getImportedDomain())) {
|
||||
phaseMethod.initDomain();
|
||||
domainLabel.setText(phaseMethod.getUnificationDomain().formatDescriptionDomain());
|
||||
//if(costValuation.getSelection()) {
|
||||
// compute(true);
|
||||
//} else {
|
||||
compute(false);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSkippable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeSkip() {
|
||||
}
|
||||
|
||||
private void compute(boolean changeCostValuations) {
|
||||
UnificationTreeViewerContentProvider provider = new UnificationTreeViewerContentProvider(phaseMethod.unify(changeCostValuations));
|
||||
ContextInjectionFactory.inject(provider, context);
|
||||
_treeViewer.setContentProvider(provider);
|
||||
_treeViewer.setInput(provider.getInput());
|
||||
packColumns();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isForwardEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void createPartControl(Composite base) {
|
||||
|
||||
_parent = base;
|
||||
|
||||
GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
|
||||
_parent.setLayoutData(gridData);
|
||||
GridLayout layout = new GridLayout(1, true);
|
||||
layout.horizontalSpacing = 15;
|
||||
layout.marginLeft = 20;
|
||||
layout.marginRight = 20;
|
||||
layout.marginBottom = 15;
|
||||
layout.marginTop = 20;
|
||||
_parent.setLayout(layout);
|
||||
|
||||
createEvaluationsTable();
|
||||
//createCheckBoxCostValuations();
|
||||
|
||||
domainLabel = new Label(_parent,0);
|
||||
UiService.setGridData(domainLabel, 0, 0, true, false);
|
||||
|
||||
}
|
||||
|
||||
private void createEvaluationsTable() {
|
||||
Composite container = new Composite(_parent, SWT.NONE);
|
||||
|
||||
GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
|
||||
gridData.verticalIndent = 0;
|
||||
container.setLayoutData(gridData);
|
||||
GridLayout gl_container = new GridLayout(1, false);
|
||||
gl_container.verticalSpacing = 0;
|
||||
gl_container.marginWidth = 0;
|
||||
gl_container.marginHeight = 0;
|
||||
gl_container.horizontalSpacing = 0;
|
||||
container.setLayout(gl_container);
|
||||
UiService.setGridData(container, 9, 9, true, true);
|
||||
|
||||
_treeViewer = new TreeViewer(container, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
|
||||
_treeViewer.setComparator(new UnificationTreeViewerComparator());
|
||||
_tree = _treeViewer.getTree();
|
||||
_tree.setHeaderVisible(true);
|
||||
_tree.setLinesVisible(true);
|
||||
_tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
|
||||
_treeViewer.addTreeListener(new ITreeViewerListener() {
|
||||
|
||||
@Override
|
||||
public void treeExpanded(TreeExpansionEvent event) {
|
||||
Display.getDefault()
|
||||
.asyncExec(new Runnable() {
|
||||
public void run() {
|
||||
if (_tree != null) {
|
||||
if (!_tree.isDisposed()) {
|
||||
for (TreeColumn column : _tree.getColumns()) {
|
||||
column.pack();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void treeCollapsed(TreeExpansionEvent event) {
|
||||
Display.getDefault()
|
||||
.asyncExec(new Runnable() {
|
||||
public void run() {
|
||||
if (_tree != null) {
|
||||
if (!_tree.isDisposed()) {
|
||||
for (TreeColumn column : _tree.getColumns()) {
|
||||
column.pack();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
_treeViewerUnifiedEvaluationColumn = new TreeViewerColumn(_treeViewer, SWT.NONE);
|
||||
_treeUnifiedEvaluationColumn = _treeViewerUnifiedEvaluationColumn.getColumn();
|
||||
_treeUnifiedEvaluationColumn.setWidth(125);
|
||||
_treeUnifiedEvaluationColumn.setText(messages.Unification_Unified);
|
||||
_treeUnifiedEvaluationColumn.setImage(UiService.getImage("valuation.png").createImage());
|
||||
_treeUnifiedEvaluationColumn.addSelectionListener(getSelectionAdapter(_treeEvaluationColumn, 5));
|
||||
_treeViewerUnifiedEvaluationColumn.setLabelProvider(new UnifiedEvaluationColumnLabelProvider());
|
||||
|
||||
_treeViewerExpertColumn = new TreeViewerColumn(_treeViewer, SWT.NONE);
|
||||
_treeExpertColumn = _treeViewerExpertColumn.getColumn();
|
||||
_treeExpertColumn.setWidth(125);
|
||||
_treeExpertColumn.setText(messages.Unification_Expert);
|
||||
|
||||
_treeExpertColumn.setImage(UiService.getImage("valuation.png").createImage());
|
||||
_treeExpertColumn.addSelectionListener(getSelectionAdapter(_treeExpertColumn, 0));
|
||||
_treeViewerExpertColumn.setLabelProvider(new ExpertColumnLabelProvider());
|
||||
|
||||
_treeViewerAlternativeColumn = new TreeViewerColumn(_treeViewer, SWT.NONE);
|
||||
_treeAlternativeColumn = _treeViewerAlternativeColumn.getColumn();
|
||||
_treeAlternativeColumn.setWidth(125);
|
||||
_treeAlternativeColumn.setText(messages.Unification_Alternative);
|
||||
_treeAlternativeColumn.setImage(UiService.getImage("alternative.png").createImage());
|
||||
_treeAlternativeColumn.addSelectionListener(getSelectionAdapter(_treeAlternativeColumn, 1));
|
||||
_treeViewerAlternativeColumn.setLabelProvider(new AlternativeColumnLabelProvider());
|
||||
|
||||
_treeViewerCriterionColumn = new TreeViewerColumn(_treeViewer, SWT.NONE);
|
||||
_treeCriterionColumn = _treeViewerCriterionColumn.getColumn();
|
||||
_treeCriterionColumn.setWidth(125);
|
||||
_treeCriterionColumn.setText(messages.Unification_Criterion);
|
||||
_treeCriterionColumn.setImage(UiService.getImage("criteria.png").createImage());
|
||||
_treeCriterionColumn.addSelectionListener(getSelectionAdapter(_treeCriterionColumn, 2));
|
||||
_treeViewerCriterionColumn.setLabelProvider(new CriterionColumnLabelProvider());
|
||||
|
||||
_treeViewerDomainColumn = new TreeViewerColumn(_treeViewer, SWT.NONE);
|
||||
_treeDomainColumn = _treeViewerDomainColumn.getColumn();
|
||||
_treeDomainColumn.setWidth(125);
|
||||
_treeDomainColumn.setText(messages.Unification_Source_domain);
|
||||
_treeDomainColumn.setImage(UiService.getImage("domain.png").createImage());
|
||||
_treeDomainColumn.addSelectionListener(getSelectionAdapter(_treeDomainColumn, 3));
|
||||
_treeViewerDomainColumn.setLabelProvider(new DomainNameColumnLabelProvider());
|
||||
|
||||
_treeViewerEvaluationColumn = new TreeViewerColumn(_treeViewer, SWT.NONE);
|
||||
_treeEvaluationColumn = _treeViewerEvaluationColumn.getColumn();
|
||||
_treeEvaluationColumn.setWidth(125);
|
||||
_treeEvaluationColumn.setText(messages.Unification_Evaluation);
|
||||
_treeEvaluationColumn.setImage(UiService.getImage("valuation.png").createImage());
|
||||
_treeEvaluationColumn.addSelectionListener(getSelectionAdapter(_treeEvaluationColumn, 4));
|
||||
_treeViewerEvaluationColumn.setLabelProvider(new EvaluationColumnLabelProvider());
|
||||
}
|
||||
|
||||
private SelectionAdapter getSelectionAdapter(final TreeColumn column, final int index) {
|
||||
|
||||
SelectionAdapter selectionAdapter = new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
UnificationTreeViewerComparator comparator = (UnificationTreeViewerComparator) _treeViewer.getComparator();
|
||||
comparator.setColumn(index);
|
||||
int dir = comparator.getDirection();
|
||||
_treeViewer.getTree().setSortDirection(dir);
|
||||
_treeViewer.getTree().setSortColumn(column);
|
||||
_treeViewer.refresh();
|
||||
}
|
||||
};
|
||||
return selectionAdapter;
|
||||
}
|
||||
|
||||
/*
|
||||
private void createCheckBoxCostValuations() {
|
||||
costValuation = new Button(_parent, SWT.CHECK);
|
||||
costValuation.setText("Transform cost evaluations");
|
||||
costValuation.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
if(costValuation.getSelection()) {
|
||||
compute(true);
|
||||
} else {
|
||||
compute(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}*/
|
||||
|
||||
private void packColumns() {
|
||||
for(TreeColumn tc: _treeViewer.getTree().getColumns()) {
|
||||
tc.pack();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
package flintstones.method.common.phase.unification.ui.comparator;
|
||||
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.jface.viewers.ViewerComparator;
|
||||
import org.eclipse.swt.SWT;
|
||||
|
||||
import flintstones.method.common.phase.unification.ui.provider.EvaluationColumnLabelProvider;
|
||||
|
||||
@SuppressWarnings("javadoc")
|
||||
public class UnificationTreeViewerComparator extends ViewerComparator {
|
||||
|
||||
private int _propertyIndex;
|
||||
private static final int DESCENDING = SWT.DOWN;
|
||||
private static final int ASCENDING = SWT.UP;
|
||||
private int direction = ASCENDING;
|
||||
|
||||
public UnificationTreeViewerComparator() {
|
||||
_propertyIndex = 0;
|
||||
direction = ASCENDING;
|
||||
}
|
||||
|
||||
public int getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
public void setColumn(int column) {
|
||||
if (column == _propertyIndex) {
|
||||
if (direction == DESCENDING) {
|
||||
direction = ASCENDING;
|
||||
} else {
|
||||
direction = DESCENDING;
|
||||
}
|
||||
} else {
|
||||
_propertyIndex = column;
|
||||
direction = ASCENDING;
|
||||
}
|
||||
}
|
||||
|
||||
public int compare(Object[] e1, Object[] e2, int pos) {
|
||||
|
||||
String text1;
|
||||
String text2;
|
||||
|
||||
int result;
|
||||
if (pos < 4) {
|
||||
result = ((String) e1[pos]).compareTo((String) e2[pos]);
|
||||
} else if (pos == 4) {
|
||||
result = compare(e1, e2, 5);
|
||||
} else if (pos == 5) {
|
||||
EvaluationColumnLabelProvider eclp = new EvaluationColumnLabelProvider();
|
||||
text1 = eclp.getText(e1);
|
||||
text2 = eclp.getText(e2);
|
||||
result = text1.compareTo(text2);
|
||||
} else {
|
||||
result = 0;
|
||||
}
|
||||
|
||||
if (result == 0) {
|
||||
if (pos == _propertyIndex) {
|
||||
if (pos != 0) {
|
||||
result = compare(e1, e2, 0);
|
||||
} else {
|
||||
if (pos < 5) {
|
||||
result = compare(e1, e2, pos + 1);
|
||||
}
|
||||
}
|
||||
} else if (pos < _propertyIndex) {
|
||||
if ((pos + 1) != _propertyIndex) {
|
||||
result = compare(e1, e2, pos + 1);
|
||||
} else {
|
||||
if (_propertyIndex < 5) {
|
||||
result = compare(e1, e2, pos + 2);
|
||||
}
|
||||
}
|
||||
} else if (pos > _propertyIndex) {
|
||||
if ((pos + 1) < 5) {
|
||||
result = compare(e1, e2, pos + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(Viewer viewer, Object e1, Object e2) {
|
||||
|
||||
int result;
|
||||
|
||||
if ((e1 instanceof Object[]) && (e2 instanceof Object[])) {
|
||||
Object[] evaluation1 = (Object[]) e1;
|
||||
Object[] evaluation2 = (Object[]) e2;
|
||||
result = compare(evaluation1, evaluation2, _propertyIndex);
|
||||
|
||||
if (direction == DESCENDING) {
|
||||
result = -result;
|
||||
}
|
||||
|
||||
} else {
|
||||
result = 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package flintstones.method.common.phase.unification.ui.messages;
|
||||
//This file has been auto-generated
|
||||
|
||||
import org.eclipse.e4.core.services.nls.Message;
|
||||
|
||||
@Message
|
||||
@SuppressWarnings("javadoc")
|
||||
public class Messages {
|
||||
|
||||
|
||||
public String Unification_Unified;
|
||||
public String Unification_Expert;
|
||||
public String Unification_Alternative;
|
||||
public String Unification_Criterion;
|
||||
public String Unification_Source_domain;
|
||||
public String Unification_Evaluation;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
|
||||
Unification_Alternative=Alternative
|
||||
Unification_Criterion=Criterion
|
||||
Unification_Evaluation=Evaluation
|
||||
Unification_Expert=Expert
|
||||
Unification_Save=Save
|
||||
Unification_Source_domain=Source domain
|
||||
Unification_Unification=Unification
|
||||
Unification_Unified=Unified
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
|
||||
Unification_Alternative=Alternativa
|
||||
Unification_Criterion=Criterio
|
||||
Unification_Evaluation=Valoración
|
||||
Unification_Expert=Experto
|
||||
Unification_Save=Guardar
|
||||
Unification_Source_domain=Dominio original
|
||||
Unification_Unification=Unificación
|
||||
Unification_Unified=Unificado
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package flintstones.method.common.phase.unification.ui.provider;
|
||||
|
||||
import org.eclipse.jface.viewers.ColumnLabelProvider;
|
||||
|
||||
public class AlternativeColumnLabelProvider extends ColumnLabelProvider {
|
||||
|
||||
@Override
|
||||
public String getText(Object element) {
|
||||
if (element instanceof Object[]) {
|
||||
return (String) ((Object[]) element)[1];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package flintstones.method.common.phase.unification.ui.provider;
|
||||
|
||||
import org.eclipse.jface.viewers.ColumnLabelProvider;
|
||||
|
||||
public class CriterionColumnLabelProvider extends ColumnLabelProvider {
|
||||
|
||||
@Override
|
||||
public String getText(Object element) {
|
||||
if (element instanceof Object[]) {
|
||||
return (String) ((Object[]) element)[2];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package flintstones.method.common.phase.unification.ui.provider;
|
||||
|
||||
import org.eclipse.jface.viewers.ColumnLabelProvider;
|
||||
|
||||
public class DomainNameColumnLabelProvider extends ColumnLabelProvider {
|
||||
|
||||
@Override
|
||||
public String getText(Object element) {
|
||||
return (String) ((Object[]) element)[3];
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package flintstones.method.common.phase.unification.ui.provider;
|
||||
|
||||
import org.eclipse.jface.viewers.ColumnLabelProvider;
|
||||
|
||||
import flintstones.entity.valuation.Valuation;
|
||||
|
||||
public class EvaluationColumnLabelProvider extends ColumnLabelProvider {
|
||||
|
||||
@Override
|
||||
public String getText(Object element) {
|
||||
if(element instanceof Object[]) {
|
||||
Valuation result = (Valuation) ((Object[]) element)[4];
|
||||
if(result != null) {
|
||||
return result.changeFormatValuationToString();
|
||||
}
|
||||
return "Messages.EvaluationColumnLabelProvider_Not_evaluate";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package flintstones.method.common.phase.unification.ui.provider;
|
||||
|
||||
import org.eclipse.jface.viewers.ColumnLabelProvider;
|
||||
|
||||
public class ExpertColumnLabelProvider extends ColumnLabelProvider {
|
||||
|
||||
@Override
|
||||
public String getText(Object element) {
|
||||
if (element instanceof Object[]) {
|
||||
return (String) ((Object[]) element)[0];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
|
||||
|
||||
package flintstones.method.common.phase.unification.ui.provider;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
|
||||
import flintstones.entity.domain.Domain;
|
||||
import flintstones.entity.problemelement.ProblemElementKey;
|
||||
import flintstones.entity.problemelement.entities.Alternative;
|
||||
import flintstones.entity.problemelement.entities.Criterion;
|
||||
import flintstones.entity.problemelement.entities.Expert;
|
||||
import flintstones.entity.valuation.Valuation;
|
||||
import flintstones.model.valuation.service.IValuationService;
|
||||
|
||||
@SuppressWarnings("javadoc")
|
||||
public class UnificationTreeViewerContentProvider implements ITreeContentProvider {
|
||||
|
||||
@Inject
|
||||
IValuationService valuationService;
|
||||
|
||||
private Map<ProblemElementKey, Valuation> twoTupleUnifiedValuations;
|
||||
|
||||
public UnificationTreeViewerContentProvider() {
|
||||
}
|
||||
|
||||
public UnificationTreeViewerContentProvider(Map<ProblemElementKey, Valuation> twoTupleUnifiedValuations) {
|
||||
this.twoTupleUnifiedValuations = twoTupleUnifiedValuations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {}
|
||||
|
||||
@Override
|
||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
|
||||
|
||||
@Override
|
||||
public Object[] getElements(Object inputElement) {
|
||||
return ((Object[][]) inputElement);
|
||||
}
|
||||
|
||||
public Object[][] getInput(){
|
||||
Map<ProblemElementKey, Valuation> valuations = valuationService.getAllKV();
|
||||
Object[][] information = new Object[valuations.size()][6];
|
||||
|
||||
Expert expert;
|
||||
Alternative alternative;
|
||||
Criterion criterion;
|
||||
Domain domain;
|
||||
Valuation valuation;
|
||||
|
||||
int i = 0;
|
||||
for(Entry<ProblemElementKey, Valuation> entry : valuations.entrySet() ) {
|
||||
|
||||
expert = entry.getKey().getExpert();
|
||||
alternative = entry.getKey().getAlternative();
|
||||
criterion = entry.getKey().getCriterion();
|
||||
valuation = entry.getValue();
|
||||
domain = entry.getValue().getDomain();
|
||||
|
||||
if( expert == null )
|
||||
throw new Error("expert null");
|
||||
|
||||
if( alternative == null )
|
||||
throw new Error("alternative null");
|
||||
|
||||
if( criterion == null )
|
||||
throw new Error("criterion null");
|
||||
|
||||
if( valuation == null )
|
||||
throw new Error("valuation null");
|
||||
|
||||
if( domain == null )
|
||||
throw new Error("domain null");
|
||||
|
||||
|
||||
information[i][0] = expert.getCanonicalName();
|
||||
information[i][1] = alternative.getName();
|
||||
information[i][2] = criterion.getCanonicalName();
|
||||
information[i][3] = domain.getName();
|
||||
information[i][4] = valuation;
|
||||
information[i][5] = twoTupleUnifiedValuations.get(entry.getKey());
|
||||
|
||||
i++;
|
||||
|
||||
}
|
||||
|
||||
return information;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getChildren(Object parentElement) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getParent(Object element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasChildren(Object element) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package flintstones.method.common.phase.unification.ui.provider;
|
||||
|
||||
import org.eclipse.jface.viewers.ColumnLabelProvider;
|
||||
|
||||
import flintstones.entity.valuation.Valuation;
|
||||
|
||||
public class UnifiedEvaluationColumnLabelProvider extends ColumnLabelProvider {
|
||||
|
||||
|
||||
@Override
|
||||
public String getText(Object element) {
|
||||
|
||||
if (element instanceof Object[]) {
|
||||
Valuation result = (Valuation) ((Object[]) element)[5];
|
||||
if (result != null) {
|
||||
Valuation valuation = (Valuation) result;
|
||||
return valuation.changeFormatValuationToString();
|
||||
} else {
|
||||
return "NA"; //$NON-NLS-1$
|
||||
}
|
||||
} else {
|
||||
return (String) element;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user