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.application.perspective.method.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.application.perspective.method.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>1779484362529</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,29 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Ui
|
||||
Bundle-SymbolicName: flintstones.application.perspective.method.ui;singleton:=true
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Require-Bundle: org.eclipse.e4.ui.model.workbench,
|
||||
org.eclipse.swt,
|
||||
javax.inject,
|
||||
flintstones.helper.ui,
|
||||
org.eclipse.e4.core.contexts,
|
||||
org.eclipse.e4.core.di,
|
||||
org.eclipse.e4.core.services,
|
||||
flintstones.application.constants,
|
||||
org.eclipse.e4.ui.di,
|
||||
flintstones.model.ui.service,
|
||||
flintstones.helper.html,
|
||||
flintstones.helper.faq,
|
||||
org.eclipse.osgi,
|
||||
javax.annotation,
|
||||
flintstones.application,
|
||||
flintstones.entity.method,
|
||||
flintstones.model.method.service,
|
||||
org.eclipse.e4.ui.workbench,
|
||||
org.eclipse.osgi.services,
|
||||
flintstones.helper.debug,
|
||||
org.lorissecuro.ui,
|
||||
flintstones.application.perspective.rating.ui
|
||||
Automatic-Module-Name: flintstones.application.perspective.method.ui
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||
@@ -0,0 +1,6 @@
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
fragment.e4xmi,\
|
||||
plugin.xml
|
||||
source.. = src/
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="ASCII"?>
|
||||
<fragment:ModelFragments xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:advanced="http://www.eclipse.org/ui/2010/UIModel/application/ui/advanced" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/ui/basic" xmlns:fragment="http://www.eclipse.org/ui/2010/UIModel/fragment" xmi:id="_91FccBpJEemS7pXQkq3Anw">
|
||||
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_91FccRpJEemS7pXQkq3Anw" featurename="children" parentElementId="flintstones.application.perspectivestack.modes">
|
||||
<elements xsi:type="advanced:Perspective" xmi:id="_91FcchpJEemS7pXQkq3Anw" elementId="flintstones.application.perspective.method" label="Method">
|
||||
<children xsi:type="basic:PartSashContainer" xmi:id="_yIvUoBpKEemS7pXQkq3Anw" elementId="flintstones.application.perspective.method.ui.partsashcontainer.0" horizontal="true">
|
||||
<children xsi:type="basic:Part" xmi:id="_ymzwsBpKEemS7pXQkq3Anw" elementId="flintstones.application.perspective.method.ui.part.a" contributionURI="bundleclass://flintstones.application.perspective.method.ui/flintstones.application.perspective.method.ui.MethodSelectionPart" label="a"/>
|
||||
<children xsi:type="basic:Part" xmi:id="_y-1PIBpKEemS7pXQkq3Anw" elementId="flintstones.application.perspective.method.ui.part.methodInformation" visible="false" containerData="6500" contributionURI="bundleclass://flintstones.application.perspective.method.ui/flintstones.application.perspective.method.ui.MethodInformationPart" label="Method Information"/>
|
||||
</children>
|
||||
</elements>
|
||||
</fragments>
|
||||
</fragment:ModelFragments>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plugin>
|
||||
|
||||
<extension
|
||||
id="flintstones.application.perspective.method.ui.fragment"
|
||||
point="org.eclipse.e4.workbench.model">
|
||||
<fragment
|
||||
uri="fragment.e4xmi">
|
||||
</fragment>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
+230
@@ -0,0 +1,230 @@
|
||||
package flintstones.application.perspective.method.ui;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
|
||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||
import org.eclipse.e4.core.di.annotations.Optional;
|
||||
import org.eclipse.e4.core.services.events.IEventBroker;
|
||||
import org.eclipse.e4.core.services.nls.Translation;
|
||||
import org.eclipse.e4.ui.di.UIEventTopic;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.MouseAdapter;
|
||||
import org.eclipse.swt.events.MouseEvent;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.osgi.framework.FrameworkUtil;
|
||||
|
||||
import flintstones.application.constants.ApplicationContants;
|
||||
import flintstones.application.constants.FrameworkConstants;
|
||||
import flintstones.entity.method.Method;
|
||||
import flintstones.helper.debug.DH;
|
||||
import flintstones.helper.faq.FaqHelper;
|
||||
import flintstones.helper.faq.interfaces.IMarkdownFAQ;
|
||||
import flintstones.helper.html.HtmlMarkdown;
|
||||
import flintstones.helper.html.table.HtmlTextTable;
|
||||
import flintstones.helper.ui.components.ActionButton;
|
||||
import flintstones.model.ui.service.UiService;
|
||||
import flintstones.application.handlers.PerspectiveSwitcher;
|
||||
import flintstones.application.perspective.method.ui.messages.Messages;
|
||||
import flintstones.application.perspective.rating.ui.dialogs.Algorithm;
|
||||
|
||||
public class MethodInformationPart {
|
||||
|
||||
@Inject
|
||||
IEclipseContext context;
|
||||
|
||||
@Inject
|
||||
IEventBroker broker;
|
||||
|
||||
@Inject
|
||||
@Translation
|
||||
Messages messages;
|
||||
|
||||
@Inject
|
||||
MPart part;
|
||||
|
||||
// Draw
|
||||
Label title;
|
||||
|
||||
Composite markdownBase;
|
||||
|
||||
Composite tableBase;
|
||||
HtmlTextTable validationTable;
|
||||
|
||||
// Button loadMethodButton;
|
||||
ActionButton loadMethodButton;
|
||||
|
||||
//Execution algorithm
|
||||
Algorithm algorithm;
|
||||
|
||||
// Data
|
||||
Method lastMethod;
|
||||
|
||||
@PostConstruct
|
||||
public void init(Composite parent) {
|
||||
|
||||
UiService.setGridLayout(parent, 1);
|
||||
UiService.setGridData(parent, 9, 9, true, true);
|
||||
|
||||
title = new Label(parent,0);
|
||||
UiService.setFont(title, UiService.FONT_BIG_TITLE);
|
||||
UiService.setGridData(title, 9, -1, true, false);
|
||||
|
||||
markdownBase = new Composite(parent, SWT.BORDER);
|
||||
UiService.setGridLayout(markdownBase, 1);
|
||||
GridData gd = UiService.setGridData(markdownBase, 9, 9, true, true);
|
||||
gd.heightHint = 150;
|
||||
|
||||
Label validationLabel = new Label(parent,0);
|
||||
validationLabel.setText(messages.MethodInformationPart_Execution_conditions);
|
||||
UiService.setFont(validationLabel, UiService.FONT_SECTION_TITLE);
|
||||
gd = UiService.setGridData(validationLabel, 9, -1, true, false);
|
||||
gd.verticalIndent = 5;
|
||||
|
||||
tableBase = new Composite(parent, 0);
|
||||
UiService.setGridLayout(tableBase, 1);
|
||||
UiService.setGridData(tableBase, 9, 9, true, false);
|
||||
|
||||
loadMethodButton = new ActionButton(parent,0, 20);
|
||||
loadMethodButton.setText(messages.MethodInformationPart_Start);
|
||||
loadMethodButton.getButton().addMouseListener(new MouseAdapter() {
|
||||
|
||||
@Override
|
||||
public void mouseUp(MouseEvent e) {
|
||||
// 1.Change to the phase, it loads empty
|
||||
ContextInjectionFactory.make(PerspectiveSwitcher.class, context).changePerspective(ApplicationContants.MPerspective_Phase);
|
||||
// 2.Send the method
|
||||
broker.send(FrameworkConstants.TOPIC_METHOD_LOAD, lastMethod);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// UiService.setFontSize(loadMethodButton, 20);
|
||||
// UiService.setBackgroundColor(loadMethodButton, UiService.COLOR_MAIN);
|
||||
// UiService.setFontFamily(loadMethodButton, "Helvetica"); //$NON-NLS-1$
|
||||
UiService.setGridData(loadMethodButton.getButton(), 9, -1, true, false);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void setEnabledLoadButton(boolean enabled) {
|
||||
loadMethodButton.setEnabled(enabled);
|
||||
// if(enabled)
|
||||
// UiService.setBackgroundColor(loadMethodButton, UiService.COLOR_MAIN);
|
||||
// else
|
||||
// UiService.setBackgroundColor(loadMethodButton, UiService.getColor(255));
|
||||
}
|
||||
|
||||
private void draw(Method method) {
|
||||
|
||||
// Information
|
||||
title.setText(method.getName());
|
||||
setEnabledLoadButton(method.canBeExecuted());
|
||||
|
||||
if(method instanceof IMarkdownFAQ) {
|
||||
|
||||
FaqHelper faq = ContextInjectionFactory.make(FaqHelper.class, context);
|
||||
String content = faq.getMarkdownFile(method);
|
||||
|
||||
HtmlMarkdown markdownViewer = new HtmlMarkdown(markdownBase);
|
||||
markdownViewer.setFile(content,FrameworkUtil.getBundle(method.getClass()));
|
||||
markdownViewer.render();
|
||||
|
||||
} else {
|
||||
HtmlMarkdown markdownViewer = new HtmlMarkdown(markdownBase);
|
||||
markdownViewer.setFile(messages.MethodInformationPart_No_available_information,FrameworkUtil.getBundle(method.getClass()));
|
||||
markdownViewer.render();
|
||||
}
|
||||
|
||||
// Validation
|
||||
if(algorithm == null)
|
||||
algorithm = ContextInjectionFactory.make(Algorithm.class, context);
|
||||
else
|
||||
removeAlgorithm();
|
||||
|
||||
algorithm.clearStatements();
|
||||
algorithm.addStatement(method.getExecutionStatement());
|
||||
algorithm.drawAlgorithm(tableBase);
|
||||
|
||||
tableBase.layout();
|
||||
|
||||
/*String[] failedValidation = method.getFailedExecuteConditions();
|
||||
String[] successValiation = method.getPassedExecuteConditions();
|
||||
|
||||
String[] headers = new String[] {messages.MethodInformationPart_Message, messages.MethodInformationPart_Type};
|
||||
String[][] content = new String[failedValidation.length + successValiation.length][ 2 ];
|
||||
|
||||
int row = 0;
|
||||
for(String text : failedValidation) {
|
||||
content[row][0] = text;
|
||||
content[row][1] = "Error"; //$NON-NLS-1$
|
||||
row++;
|
||||
}
|
||||
|
||||
for(String text : successValiation) {
|
||||
content[row][0] = text;
|
||||
content[row][1] = messages.MethodInformationPart_Success;
|
||||
row++;
|
||||
}
|
||||
|
||||
if(failedValidation.length != 0 || successValiation.length != 0 ) {
|
||||
HtmlTextTable table = new HtmlTextTable(tableBase, content, headers);
|
||||
table.render();
|
||||
}*/
|
||||
|
||||
|
||||
lastMethod = method;
|
||||
|
||||
part.setVisible(true);
|
||||
|
||||
}
|
||||
|
||||
private void removeAlgorithm() {
|
||||
for(Control child: tableBase.getChildren())
|
||||
child.dispose();
|
||||
}
|
||||
|
||||
private void hide() {
|
||||
part.setVisible(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscribe.
|
||||
*
|
||||
* @param event the event
|
||||
*/
|
||||
@Inject
|
||||
@Optional
|
||||
private void subscribe(@UIEventTopic(FrameworkConstants.TOPIC_SELECTION_METHOD) Method m) {
|
||||
if( m != null )
|
||||
draw(m);
|
||||
else {
|
||||
hide();
|
||||
DH.out("refresh", "Ocultando MethodInformation");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Optional
|
||||
private void subscribeSelectionAlt(@UIEventTopic(FrameworkConstants.TOPIC_FRAMEWORK_ALLTOPICS) Object o) {
|
||||
hide();
|
||||
DH.out("refresh", "Ocultando MethodInformation");
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Optional
|
||||
private void subscribeSelectionValuation(@UIEventTopic(FrameworkConstants.TOPIC_VALUATION_ALLTOPICS) Object o) {
|
||||
hide();
|
||||
DH.out("refresh", "Ocultando MethodInformation");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
package flintstones.application.perspective.method.ui;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
|
||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||
import org.eclipse.e4.core.di.annotations.Optional;
|
||||
import org.eclipse.e4.core.services.events.IEventBroker;
|
||||
import org.eclipse.e4.core.services.nls.ILocaleChangeService;
|
||||
import org.eclipse.e4.core.services.nls.Translation;
|
||||
import org.eclipse.e4.ui.di.UIEventTopic;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
import org.eclipse.jface.viewers.AbstractTreeViewer;
|
||||
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider;
|
||||
import org.eclipse.jface.viewers.TreeViewer;
|
||||
import org.eclipse.jface.viewers.TreeViewerColumn;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.ControlAdapter;
|
||||
import org.eclipse.swt.events.ControlEvent;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Tree;
|
||||
import org.eclipse.swt.widgets.TreeItem;
|
||||
|
||||
import flintstones.application.constants.FrameworkConstants;
|
||||
import flintstones.application.perspective.method.ui.messages.Messages;
|
||||
import flintstones.application.perspective.method.ui.provider.CategorizedMethodContentProvider;
|
||||
import flintstones.application.perspective.method.ui.provider.CategorizedMethodLabelProvider;
|
||||
import flintstones.entity.method.Method;
|
||||
import flintstones.helper.debug.DH;
|
||||
import flintstones.model.method.service.IMethodService;
|
||||
|
||||
public class MethodSelectionPart {
|
||||
|
||||
@Inject
|
||||
IEclipseContext context;
|
||||
|
||||
@Inject
|
||||
IMethodService methodService;
|
||||
|
||||
@Inject
|
||||
EPartService partService;
|
||||
|
||||
@Inject
|
||||
IEventBroker broker;
|
||||
|
||||
@Inject
|
||||
@Translation
|
||||
Messages messages;
|
||||
|
||||
private TreeViewer viewer;
|
||||
|
||||
@PostConstruct
|
||||
public void init(Composite parent) {
|
||||
|
||||
CategorizedMethodLabelProvider labelProvider = ContextInjectionFactory
|
||||
.make(CategorizedMethodLabelProvider.class, context);
|
||||
CategorizedMethodContentProvider contentProvider = ContextInjectionFactory
|
||||
.make(CategorizedMethodContentProvider.class, context);
|
||||
|
||||
viewer = new TreeViewer(parent, SWT.NO_SCROLL);
|
||||
viewer.setContentProvider(contentProvider);
|
||||
|
||||
TreeViewerColumn mainColumn = new TreeViewerColumn(viewer, SWT.NONE);
|
||||
mainColumn.getColumn().setText(messages.MethodSelectionPart_Methods); // $NON-NLS-1$
|
||||
mainColumn.getColumn().setWidth(300);
|
||||
mainColumn.setLabelProvider(new DelegatingStyledCellLabelProvider(labelProvider));
|
||||
|
||||
viewer.getTree().setHeaderVisible(true);
|
||||
viewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
|
||||
|
||||
String[] arr = methodService.getAllCategories();
|
||||
viewer.setInput(arr);
|
||||
|
||||
parent.addControlListener(new ControlAdapter() {
|
||||
@Override
|
||||
public void controlResized(ControlEvent e) {
|
||||
Composite composite = (Composite) e.widget;
|
||||
int width = composite.getBounds().width;
|
||||
mainColumn.getColumn().setWidth(width);
|
||||
}
|
||||
});
|
||||
|
||||
Tree tree = (Tree) viewer.getControl();
|
||||
tree.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
TreeItem item = (TreeItem) e.item;
|
||||
if (item.getData() instanceof Method) {
|
||||
Method m = (Method) item.getData();
|
||||
broker.send(FrameworkConstants.TOPIC_SELECTION_METHOD, m);
|
||||
} else {
|
||||
broker.send(FrameworkConstants.TOPIC_SELECTION_METHOD, null);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Optional
|
||||
public void getNotifiedLocale(@UIEventTopic(ILocaleChangeService.LOCALE_CHANGE) Locale s) {
|
||||
methodService.cacheAllMethods();
|
||||
((CategorizedMethodContentProvider) viewer.getContentProvider()).init();
|
||||
viewer.setInput(methodService.getAllCategories());
|
||||
viewer.refresh();
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Optional
|
||||
private void subscribeSelectionAlt(@UIEventTopic(FrameworkConstants.TOPIC_FRAMEWORK_ALLTOPICS) Object o) {
|
||||
viewer.refresh();
|
||||
DH.out("refresh", "Refrescando MethodSelectionPart");
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Optional
|
||||
private void subscribeSelectionValuation(@UIEventTopic(FrameworkConstants.TOPIC_VALUATION_ALLTOPICS) Object o) {
|
||||
viewer.refresh();
|
||||
DH.out("refresh", "Refrescando MethodSelectionPart");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package flintstones.application.perspective.method.ui.messages;
|
||||
|
||||
public class Messages {
|
||||
|
||||
public String MethodInformationPart_Execution_conditions;
|
||||
public String MethodInformationPart_Message;
|
||||
public String MethodInformationPart_No_available_information;
|
||||
public String MethodInformationPart_Start;
|
||||
public String MethodInformationPart_Success;
|
||||
public String MethodInformationPart_Type;
|
||||
public String MethodSelectionPart_Methods;
|
||||
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
MethodInformationPart_Execution_conditions=Execution conditions
|
||||
MethodInformationPart_Message=Condition
|
||||
MethodInformationPart_No_available_information=No available information for this method.
|
||||
MethodInformationPart_Start=Start
|
||||
MethodInformationPart_Success=Success
|
||||
MethodInformationPart_Type=State
|
||||
MethodSelectionPart_Methods=Methods
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
MethodInformationPart_Execution_conditions=Condiciones para la ejecución
|
||||
MethodInformationPart_Message=Condición
|
||||
MethodInformationPart_No_available_information=No exíste información para este metodo en este momento.
|
||||
MethodInformationPart_Start=Iniciar
|
||||
MethodInformationPart_Success=Correcto
|
||||
MethodInformationPart_Type=Estado
|
||||
MethodSelectionPart_Methods=Métodos
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
package flintstones.application.perspective.method.ui.provider;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.jface.viewers.ArrayContentProvider;
|
||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||
|
||||
import flintstones.entity.method.Method;
|
||||
import flintstones.model.method.service.IMethodService;
|
||||
|
||||
public class CategorizedMethodContentProvider implements ITreeContentProvider {
|
||||
|
||||
@Inject
|
||||
IMethodService methodService;
|
||||
|
||||
HashMap<String, Method> categories = new HashMap<>();
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
loadCategories();
|
||||
}
|
||||
|
||||
private void loadCategories() {
|
||||
categories.clear();
|
||||
for(String category: methodService.getAllCategories()) {
|
||||
Method[] methods = methodService.getAllMethodForCategory(category);
|
||||
Arrays.stream(methods).forEach(k -> categories.put(category, k));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Method[] getChildren(Object parentElement) {
|
||||
if (parentElement instanceof String) {
|
||||
String category = (String) parentElement;
|
||||
return methodService.getAllMethodForCategory(category);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getElements(Object inputElement) {
|
||||
return ArrayContentProvider.getInstance().getElements(inputElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getParent(Object element) {
|
||||
if (element instanceof String)
|
||||
return null;
|
||||
|
||||
Method m = (Method) element;
|
||||
return categories.get(m.getCategory());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasChildren(Object element) {
|
||||
return categories.containsKey(element);
|
||||
}
|
||||
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package flintstones.application.perspective.method.ui.provider;
|
||||
|
||||
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.jface.viewers.LabelProvider;
|
||||
import org.eclipse.jface.viewers.StyledString;
|
||||
|
||||
import flintstones.entity.method.Method;
|
||||
import flintstones.model.ui.service.UiService;
|
||||
|
||||
public class CategorizedMethodLabelProvider extends LabelProvider implements IStyledLabelProvider {
|
||||
@Override
|
||||
public StyledString getStyledText(Object element) {
|
||||
|
||||
if (element instanceof String)
|
||||
return new StyledString(element.toString());
|
||||
|
||||
Method m = (Method) element;
|
||||
if(m.canBeExecuted())
|
||||
return UiService.paintText(m.getName(), "[✔]", UiService.COLOR_FG_SUCCESS, UiService.COLOR_FG_SUCCESS);
|
||||
else
|
||||
//return UiService.paintText(m.getName(), "[" + m.getFailedExecuteConditions()[0] + "]", UiService.COLOR_FG_ERROR);
|
||||
return UiService.paintText(m.getName(), "[X]", UiService.COLOR_FG_ERROR, UiService.COLOR_FG_ERROR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Object element) {
|
||||
|
||||
if (element instanceof String)
|
||||
element.toString();
|
||||
|
||||
Method m = (Method) element;
|
||||
return m.getName();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getImage(Object element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user