public code v1

This commit is contained in:
Francisco Jesús Martínez Mimbrera
2026-05-23 00:32:57 +02:00
commit 759a8968a2
4357 changed files with 163763 additions and 0 deletions
@@ -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,17 @@
<?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.model.sensitiveanalysismodel.provider</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>[bundle] Provider sensitive analysis model</name>
<organization>
<name>Sinbad2</name>
</organization>
</project>
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>flintstones.model.sensitiveanalysismodel.provider</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.pde.ds.core.builder</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>1779484362727</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,16 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Provider sensitive analysis model
Bundle-SymbolicName: flintstones.model.sensitiveanalysismodel.provider
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: Sinbad2
Automatic-Module-Name: flintstones.model.sensitiveanalysismodel.provider
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: flintstones.model.sensitiveanalysismodel.service,
flintstones.helper.extensionpoint,
org.eclipse.e4.ui.model.workbench,
flintstones.entity.sensitiveanalysismodel,
javax.annotation,
javax.inject
Service-Component: component.xml
Bundle-ActivationPolicy: lazy
@@ -0,0 +1,5 @@
output.. = bin/
bin.includes = META-INF/,\
.,\
component.xml
source.. = src/
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="sensitive analysis model context function">
<implementation class="flintstones.model.sensitiveanalysismodel.provider.SensitiveAnalysisModelContextFunction"/>
<property name="service.context.key" type="String" value="flintstones.model.sensitiveanalysismodel.service.ISensitiveAnalysisModelService"/>
<service>
<provide interface="org.eclipse.e4.core.contexts.IContextFunction"/>
</service>
</scr:component>
@@ -0,0 +1,26 @@
package flintstones.model.sensitiveanalysismodel.provider;
import org.eclipse.e4.core.contexts.ContextFunction;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.ui.model.application.MApplication;
import flintstones.model.sensitiveanalysismodel.service.ISensitiveAnalysisModelService;
public class SensitiveAnalysisModelContextFunction extends ContextFunction {
/* (non-Javadoc)
*
* @see
* org.eclipse.e4.core.contexts.ContextFunction#compute(org.eclipse.e4.core.
* contexts.IEclipseContext, java.lang.String) */
@Override
public Object compute(IEclipseContext context, String contextKey) {
ISensitiveAnalysisModelService service = ContextInjectionFactory.make(SensitiveAnalysisModelServiceProvider.class, context);
MApplication application = context.get(MApplication.class);
IEclipseContext applicationContext = application.getContext();
applicationContext.set(ISensitiveAnalysisModelService.class, service);
return service;
}
}
@@ -0,0 +1,106 @@
package flintstones.model.sensitiveanalysismodel.provider;
import java.util.LinkedHashMap;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import org.eclipse.e4.core.contexts.IEclipseContext;
import flintstones.entity.sensitiveanalysismodel.SensitiveAnalysisModel;
import flintstones.entity.sensitiveanalysismodel.ui.SensitiveAnalysisModelUi;
import flintstones.helper.extensionpoint.BaseRegistry;
import flintstones.helper.extensionpoint.ExtensionRegistry;
import flintstones.model.sensitiveanalysismodel.service.ISensitiveAnalysisModelService;
public class SensitiveAnalysisModelServiceProvider implements ISensitiveAnalysisModelService {
/** The context. */
@Inject
IEclipseContext context;
/** The reg. */
private BaseRegistry reg;
private BaseRegistry uireg;
/** The SensitiveAnalysisModel list. */
private final LinkedHashMap<String, SensitiveAnalysisModelUi> models = new LinkedHashMap<>();
/**
* Initialize.
*/
@PostConstruct
private void init() {
this.reg = new BaseRegistry(SensitiveAnalysisModel.EXTENSION_POINT);
this.uireg = new BaseRegistry(SensitiveAnalysisModelUi.EXTENSION_POINT);
createSensitiveAnalysisModels();
}
@Override
public SensitiveAnalysisModelUi[] getAll() {
return this.models.values().toArray(new SensitiveAnalysisModelUi[this.models.values().size()]);
}
@Override
public SensitiveAnalysisModelUi get(String modelId) {
return models.get(modelId);
}
@Override
public void createSensitiveAnalysisModels() {
models.clear();
ExtensionRegistry[] registries = uireg.getAllRegistries();
String modelId;
for (ExtensionRegistry reg : registries) {
modelId = reg.getAttribute(SensitiveAnalysisModelUi.Fields.sensitivemodel);
SensitiveAnalysisModelUi modelUI = createSensitiveAnalysisModel(modelId);
models.put(modelId, modelUI);
}
}
@Override
public SensitiveAnalysisModelUi createSensitiveAnalysisModel(String modelId) {
// Create the model
SensitiveAnalysisModel model = (SensitiveAnalysisModel) this.reg.instantiate(modelId, this.context);
model.setId(modelId);
model.setName(this.reg.getAttributeFromId(modelId, SensitiveAnalysisModel.Fields.name));
// Create the Phase UI
String modelUiId = getIdFor(model.getId());
SensitiveAnalysisModelUi modelui = (SensitiveAnalysisModelUi) this.uireg.instantiate(modelUiId, this.context);
modelui.setModel(model);
return modelui;
}
@Override
public SensitiveAnalysisModel getSensitiveAnalysisModel(String id) {
SensitiveAnalysisModelUi modelUi;
for(String modelId: models.keySet()) {
modelUi = models.get(modelId);
if(modelUi.getModel().getId().equals(id)) {
return modelUi.getModel();
}
}
return null;
}
private String getIdFor(String modelId) {
String[] matches = this.uireg.getAllAttributesWhere(SensitiveAnalysisModelUi.Fields.sensitivemodel, modelId,
SensitiveAnalysisModelUi.Fields.uid);
if (matches.length != 1)
throw new Error("Encontrados " + matches.length + " " + modelId + " (Debe ser 1) --> "
+ this.uireg.getRegistryId());
return this.uireg.getAllAttributesWhere(SensitiveAnalysisModelUi.Fields.sensitivemodel, modelId, SensitiveAnalysisModelUi.Fields.uid)[0];
}
@Override
public void clear() {
this.models.clear();
}
}