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>
|
||||
+14
@@ -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.linguistic.unbalanced.phase.generatelh.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.linguistic.unbalanced.phase.generatelh.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>1779484362685</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
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Ui
|
||||
Bundle-SymbolicName: flintstones.method.linguistic.unbalanced.phase.generatelh.ui;singleton:=true
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Automatic-Module-Name: flintstones.method.unbalanced.phase.generatelh.ui
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Require-Bundle: org.eclipse.swt,
|
||||
javax.inject,
|
||||
flintstones.helper.ui,
|
||||
flintstones.domain.fuzzyset.unbalanced.ui.dialog,
|
||||
org.eclipse.wb.swt,
|
||||
flintstones.domain.fuzzyset.unbalanced,
|
||||
org.eclipse.e4.core.contexts,
|
||||
org.eclipse.e4.core.di,
|
||||
flintstones.domain.fuzzyset.unbalanced.ui.chart,
|
||||
flintstones.model.ui.service,
|
||||
flintstones.entity.method.phase,
|
||||
flintstones.entity.method.phase.ui
|
||||
Import-Package: flintstones.method.linguistic.unbalanced.phase.generatelh
|
||||
@@ -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.unbalanced.phase.generatelh.ui"
|
||||
implementation="flintstones.method.linguistic.unbalanced.phase.generatelh.ui.GenerateLinguisticHierarchyUI"
|
||||
phasemethod="flintstones.method.unbalanced.phase.generatelh">
|
||||
</phasemethod_ui>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
package flintstones.method.linguistic.unbalanced.phase.generatelh.ui;
|
||||
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
|
||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.ControlAdapter;
|
||||
import org.eclipse.swt.events.ControlEvent;
|
||||
import org.eclipse.swt.events.ControlListener;
|
||||
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.wb.swt.SWTResourceManager;
|
||||
|
||||
import flintstones.domain.fuzzyset.unbalanced.ui.chart.LHChart;
|
||||
import flintstones.entity.method.phase.ui.PhaseMethodUI;
|
||||
import flintstones.method.linguistic.unbalanced.phase.generatelh.GenerateLinguisticHierarchyModel;
|
||||
import flintstones.model.ui.service.UiService;
|
||||
|
||||
public class GenerateLinguisticHierarchyUI extends PhaseMethodUI {
|
||||
|
||||
|
||||
@Inject
|
||||
IEclipseContext context;
|
||||
|
||||
GenerateLinguisticHierarchyModel phaseModel;
|
||||
Composite parent;
|
||||
|
||||
// FS3
|
||||
private Composite _infoPanel;
|
||||
private Composite _chartPanel;
|
||||
private Label _lhLabel;
|
||||
private LHChart _chart;
|
||||
private int[] _lh;
|
||||
private ControlListener _controlListener;
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
phaseModel = (GenerateLinguisticHierarchyModel) this.getModel();
|
||||
createPartControl(this.getBaseComposite());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isForwardEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void createPartControl(Composite base) {
|
||||
parent = base;
|
||||
|
||||
UiService.setGridLayout(base, 1);
|
||||
UiService.setGridData(base, 9, 9, true, true);
|
||||
|
||||
Composite chartBase = new Composite(base, SWT.NONE);
|
||||
UiService.setGridLayout(chartBase, 1);
|
||||
UiService.setGridData(chartBase, 9, 9, true, true);
|
||||
|
||||
Display.getCurrent().syncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
createChart(chartBase);
|
||||
}
|
||||
});
|
||||
|
||||
activate();
|
||||
|
||||
}
|
||||
|
||||
private void createChart(Composite _parent) {
|
||||
|
||||
_infoPanel = new Composite(_parent, SWT.NONE);
|
||||
_infoPanel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
|
||||
_infoPanel.setLayout(new GridLayout(2, false));
|
||||
|
||||
Label lh = new Label(_infoPanel, SWT.NONE);
|
||||
lh.setFont(SWTResourceManager.getFont("Cantarell", 10, SWT.BOLD)); //$NON-NLS-1$
|
||||
lh.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1));
|
||||
lh.setText("LH"); //$NON-NLS-1$
|
||||
|
||||
_lhLabel = new Label(_infoPanel, SWT.NONE);
|
||||
_lhLabel.setFont(SWTResourceManager.getFont("Cantarell", 10, SWT.NONE)); //$NON-NLS-1$
|
||||
_lhLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
|
||||
_lhLabel.setText("Messages.GenerateLH_Empty_value");
|
||||
|
||||
_chartPanel = new Composite(_parent, SWT.BORDER);
|
||||
GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, true, 1, 1);
|
||||
_chartPanel.setLayoutData(gridData);
|
||||
}
|
||||
|
||||
|
||||
private void generateLH() {
|
||||
_lh = phaseModel.getUnifiedDomain().getLh();
|
||||
if(_lh != null) {
|
||||
StringBuilder description = new StringBuilder("["); //$NON-NLS-1$
|
||||
for(int i = 0; i < _lh.length; i++) {
|
||||
description.append(_lh[i]);
|
||||
if(i < (_lh.length - 1)) {
|
||||
description.append(", "); //$NON-NLS-1$
|
||||
} else {
|
||||
description.append("]"); //$NON-NLS-1$
|
||||
_lhLabel.setText(description.toString());
|
||||
}
|
||||
}
|
||||
|
||||
_chart = ContextInjectionFactory.make(LHChart.class, this.context);
|
||||
_chart.initLHChart(_lh, _chartPanel, _chartPanel.getSize().x, _chartPanel.getSize().y - 1);
|
||||
|
||||
if(_controlListener == null) {
|
||||
_controlListener = new ControlAdapter() {
|
||||
@Override
|
||||
public void controlResized(ControlEvent e) {
|
||||
_chart.dispose();
|
||||
generateLH();
|
||||
}
|
||||
};
|
||||
_chartPanel.addControlListener(_controlListener);
|
||||
}
|
||||
} else {
|
||||
if (_chart != null) {
|
||||
_chart.dispose();
|
||||
_chart = null;
|
||||
_lhLabel.setText("Messages.GenerateLH_Empty_value");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void activate() {
|
||||
if(_lh == null) {
|
||||
generateLH();
|
||||
_chartPanel.layout();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user