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.entity.method.phase.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.entity.method.phase.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>1779484362567</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>
|
||||
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
||||
@@ -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
|
||||
@@ -0,0 +1,4 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
||||
@@ -0,0 +1,15 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Ui
|
||||
Bundle-SymbolicName: flintstones.entity.method.phase.ui;singleton:=true
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Automatic-Module-Name: flintstones.entity.method.phase.ui
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Require-Bundle: flintstones.entity.method.phase;visibility:=reexport,
|
||||
flintstones.entity.extensionenum,
|
||||
flintstones.application.constants,
|
||||
flintstones.helper.debug,
|
||||
org.eclipse.e4.core.services,
|
||||
javax.inject,
|
||||
org.eclipse.swt;visibility:=reexport
|
||||
Export-Package: flintstones.entity.method.phase.ui
|
||||
@@ -0,0 +1,6 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml,\
|
||||
schema/
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE xml>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension-point id="flintstones.phasemethod.ui" name="MethodphaseUI" schema="schema/methodphaseui.exsd"/>
|
||||
</plugin>
|
||||
@@ -0,0 +1,123 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="flintstones.phasemethod.ui" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="flintstones.phasemethod.ui" id="flintstones.phasemethod.ui" name="Method phase UI"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
Este punto de extensión nos permite definir la interfaz gráfica asociadas a una fase de metodo.
|
||||
|
||||
==============================================================================================================================================
|
||||
|
||||
This extension point allows us to define the graphical interface associated with a method phase.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<choice minOccurs="1" maxOccurs="unbounded">
|
||||
<element ref="phasemethod_ui"/>
|
||||
</choice>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="xid" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="phasemethod_ui">
|
||||
<complexType>
|
||||
<attribute name="uid" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="phasemethod" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="identifier" basedOn="flintstones.phasemethod.extensionpoint/phase/@uid"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="implementation" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn="flintstones.entity.method.phase.ui.PhaseMethodUI:"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter the first release in which this extension point appears.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="examples"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter extension point usage example here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter API information here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter information about supplied implementation of this extension point.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
|
||||
</schema>
|
||||
+206
@@ -0,0 +1,206 @@
|
||||
package flintstones.entity.method.phase.ui;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.e4.core.services.events.IEventBroker;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
||||
import flintstones.application.constants.FrameworkConstants;
|
||||
import flintstones.entity.extensionenum.ExtensionEnum;
|
||||
import flintstones.entity.method.phase.PhaseMethod;
|
||||
import flintstones.helper.debug.DH;
|
||||
|
||||
/**
|
||||
* The Class PhaseMethodUI.
|
||||
*/
|
||||
public abstract class PhaseMethodUI {
|
||||
|
||||
@Inject
|
||||
IEventBroker broker;
|
||||
|
||||
/** The model. */
|
||||
private PhaseMethod model;
|
||||
|
||||
/** The base composite. */
|
||||
protected Composite baseComposite;
|
||||
|
||||
/** The Constant EXTENSION_POINT. */
|
||||
public final static String EXTENSION_POINT = "flintstones.phasemethod.ui"; //$NON-NLS-1$
|
||||
|
||||
/** The Constant REFRESH_BUS_ID. */
|
||||
protected final static String REFRESH_BUS_ID = "TOPIC_RATING/CONTAINER/REFRESH"; //$NON-NLS-1$
|
||||
|
||||
/* Debug refresh -> Changes on model then refresh the ui suscribing to this sub */
|
||||
public final static String REFRESH_SUB_ID = "TOPIC_RATING/PHASEMETHODUI/REFRESH"; //$NON-NLS-1$
|
||||
|
||||
// DEBUG
|
||||
long lastTime = 0;
|
||||
|
||||
/**
|
||||
* The Enum Fields.
|
||||
*/
|
||||
public enum Fields implements ExtensionEnum {
|
||||
|
||||
/** The id. */
|
||||
uid,
|
||||
/** The name. */
|
||||
name,
|
||||
/** The ui. */
|
||||
ui,
|
||||
/** The phasemethod. */
|
||||
phasemethod,
|
||||
/** The view. */
|
||||
view,
|
||||
/** The step. */
|
||||
step;
|
||||
}
|
||||
|
||||
|
||||
// NEW
|
||||
public static enum Status implements ExtensionEnum {
|
||||
Unloaded, Loaded, ActiveReloaded, Active
|
||||
}
|
||||
|
||||
private Status status = Status.Unloaded;
|
||||
|
||||
public Status getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
// 1.INIT
|
||||
/**
|
||||
* This will be called on every phase when drawing it before calling concrete init.
|
||||
* @param base Composite to draw
|
||||
*/
|
||||
public void preInit(Composite base) {
|
||||
this.baseComposite = base;
|
||||
lastTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public void postInit() {
|
||||
status = Status.Active;
|
||||
long currentTime = System.currentTimeMillis();
|
||||
DH.out("router","Fase " + model.getName() + " cargada en " + (currentTime - lastTime) + " ms. ");
|
||||
lastTime = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Common refresh.
|
||||
*
|
||||
* @param parent the parent
|
||||
*/
|
||||
public void preRefresh() {
|
||||
|
||||
lastTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public void postRefresh() {
|
||||
status = Status.ActiveReloaded;
|
||||
|
||||
long currentTime = System.currentTimeMillis();
|
||||
DH.out("router", "Fase " + model.getName() + " refrescada en " + (currentTime - lastTime) + " ms. ");
|
||||
lastTime = 0;
|
||||
}
|
||||
|
||||
public void exit() {
|
||||
status = Status.Loaded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Entrypoint when drawing.
|
||||
*/
|
||||
public abstract void init();
|
||||
|
||||
// Iniciar y cargar los datos de fases anteriores y de la fase actual desde
|
||||
// phasemethodui?
|
||||
/**
|
||||
* Refresh.
|
||||
*/
|
||||
// Redibujar usando model. llamar a model.refresh?
|
||||
public abstract void refresh();
|
||||
|
||||
/**
|
||||
* Can the user open the next phase?.
|
||||
*
|
||||
* @return true if the user can go to the next phase
|
||||
*/
|
||||
// 2. CONTROL
|
||||
protected abstract boolean isForwardEnabled();
|
||||
|
||||
/**
|
||||
* Can the user open the previous phase?.
|
||||
*
|
||||
* @return true if the user can go to the previous phase
|
||||
*/
|
||||
public boolean isBackwardEnabled() {
|
||||
return true;
|
||||
};
|
||||
|
||||
public boolean isSkippable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void beforeSkip() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the phase name.
|
||||
*
|
||||
* @return the phase name
|
||||
*/
|
||||
// 3. UI TEXT
|
||||
public String getPhaseName() {
|
||||
return this.model.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the position.
|
||||
*
|
||||
* @return The number of the phase
|
||||
*/
|
||||
public int getPosition() {
|
||||
return this.model.getPosition();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the model.
|
||||
*
|
||||
* @return The phase model
|
||||
*/
|
||||
public PhaseMethod getModel() {
|
||||
return this.model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the model.
|
||||
*
|
||||
* @param model The data model
|
||||
*/
|
||||
public void setModel(PhaseMethod model) {
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the base composite.
|
||||
*
|
||||
* @return the base composite
|
||||
*/
|
||||
// 4.Debug
|
||||
public Composite getBaseComposite() {
|
||||
return this.baseComposite;
|
||||
}
|
||||
|
||||
protected void sendRefresh() {
|
||||
this.broker.send(PhaseMethodUI.REFRESH_BUS_ID, null);
|
||||
this.broker.send(FrameworkConstants.TOPIC_METHOD_PHASE_REFRESH, null);
|
||||
}
|
||||
|
||||
public boolean isPhaseCompleted() {
|
||||
if(status == Status.Unloaded)
|
||||
return false;
|
||||
return this.isForwardEnabled();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user