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,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.control</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>[bundle] Control</name>
</project>
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>flintstones.application.control</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>1779484362513</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,17 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Control
Bundle-SymbolicName: flintstones.application.control
Bundle-Version: 1.0.0.qualifier
Require-Bundle: flintstones.application,
flintstones.model.application.service,
flintstones.model.ui.service,
flintstones.helper.ui,
org.eclipse.e4.core.services,
org.eclipse.e4.ui.services,
org.eclipse.e4.core.contexts,
org.eclipse.e4.core.di,
javax.inject,
javax.annotation
Automatic-Module-Name: flintstones.application.control
Bundle-RequiredExecutionEnvironment: JavaSE-11
@@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
@@ -0,0 +1,57 @@
package flintstones.application.control;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import flintstones.model.ui.service.UiService;
/**
* The Class ConsolaControl.
*/
public class ConsolaControl {
/** The context. */
@Inject
IEclipseContext context;
/** The text. */
private Text text;
/**
* Creates the part control.
*
* @param parent the parent
*/
@PostConstruct
public void createPartControl(Composite parent) {
text = new Text(parent, SWT.READ_ONLY | SWT.MULTI);
OutputStream out = new OutputStream() {
@Override
public void write(int b) throws IOException {
if (text.isDisposed())
return;
text.append(String.valueOf((char) b));
}
};
final PrintStream oldOut = System.out;
System.setOut(new PrintStream(out));
text.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
System.setOut(oldOut);
}
});
text.setBackground(UiService.getColor(255));
}
}
@@ -0,0 +1,17 @@
package flintstones.application.control;
import javax.annotation.PostConstruct;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
@SuppressWarnings("javadoc")
public class SpacerControl {
@PostConstruct
public void postConstruct(final Composite parent) {
Composite body = new Composite(parent, SWT.NONE);
body.setLayout(new FillLayout());
}
}
@@ -0,0 +1,25 @@
package flintstones.application.control.handler;
import javax.inject.Inject;
import org.eclipse.e4.core.di.annotations.Execute;
import flintstones.application.model.IApplicationService;
/**
* The Class ExitHandler. Hanlder that close the app.
*/
public class ExitHandler {
/** The app service. */
@Inject
IApplicationService appService;
/**
* Execute.
*/
@Execute
public void execute() {
this.appService.close();
}
}
@@ -0,0 +1,37 @@
package flintstones.application.control.handler;
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.Execute;
import flintstones.application.model.IApplicationService;
import flintstones.application.handlers.PerspectiveSwitcher;
/**
* The Class NewHandler creates a new proyect.
*/
public class NewHandler {
/** The context. */
@Inject
IEclipseContext context;
/** The app service. */
@Inject
IApplicationService appService;
/**
* Execute.
*
* @throws IOException Signals that an I/O exception has occurred.
*/
@Execute
public void execute() {
this.appService.newProblem();
ContextInjectionFactory.make(PerspectiveSwitcher.class, context).changePerspective("flintstones.application.perspective.framework");
}
}
@@ -0,0 +1,30 @@
package flintstones.application.control.handler;
import java.awt.Desktop;
import java.io.File;
import java.io.IOException;
import javax.inject.Inject;
import org.eclipse.e4.core.di.annotations.Execute;
import flintstones.application.model.IApplicationService;
public class OpenFs4FolderHandler {
@Inject
IApplicationService appService;
@Execute
public void execute() {
String folder = appService.getFS4FolderPath();
try {
Desktop.getDesktop().open(new File(folder));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
@@ -0,0 +1,65 @@
package flintstones.application.control.handler;
import javax.inject.Inject;
import javax.inject.Named;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.services.events.IEventBroker;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;
import flintstones.application.model.IApplicationService;
/**
* The Class OpenHandler opens a file from disk.
*/
public class OpenHandler {
/** The context. */
@Inject
IEclipseContext context;
/** The broker. */
@Inject
IEventBroker broker;
/** The app service. */
@Inject
IApplicationService appService;
/** The shell. */
@Inject
@Named(IServiceConstants.ACTIVE_SHELL)
Shell shell;
/** The Constant FILTER_NAMES. */
private static final String[] FILTER_NAMES = { "Flintstones files (*.flintstones)", "XML(*.xml)" }; //$NON-NLS-1$ //$NON-NLS-2$
/** The Constant FILTER_EXTS. */
private static final String[] FILTER_EXTS = { "*.flintstones", "*.xml" }; //$NON-NLS-1$ //$NON-NLS-2$
/**
* Execute.
*
* @throws ParserConfigurationException the parser configuration exception
* @throws IOException Signals that an I/O exception has occurred.
* @throws SAXException the SAX exception
* @throws XMLStreamException the XML stream exception
*/
@Execute
public void execute() {
FileDialog dlg = new FileDialog(this.shell, SWT.OPEN);
dlg.setFilterNames(OpenHandler.FILTER_NAMES);
dlg.setFilterExtensions(OpenHandler.FILTER_EXTS);
dlg.setFilterPath(appService.getFS4FolderPath());
String fileName = dlg.open();
if (fileName != null)
this.appService.loadProblem(fileName);
}
}
@@ -0,0 +1,11 @@
package flintstones.application.control.handler;
import org.eclipse.e4.core.di.annotations.Execute;
@SuppressWarnings("javadoc")
public class RedoHandler {
@Execute
public void execute() {
System.err.println("Redo handler called."); //$NON-NLS-1$
}
}
@@ -0,0 +1,11 @@
package flintstones.application.control.handler;
import org.eclipse.e4.core.di.annotations.Execute;
@SuppressWarnings("javadoc")
public class SaveAndCloseHandler {
@Execute
public void execute() {
// System.out.println("Save and close handler called."); //$NON-NLS-1$
}
}
@@ -0,0 +1,63 @@
package flintstones.application.control.handler;
import javax.inject.Inject;
import javax.inject.Named;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.services.events.IEventBroker;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;
import flintstones.application.model.IApplicationService;
/**
* The Class SaveAsHandler.
*/
public class SaveAsHandler {
/** The context. */
@Inject
IEclipseContext context;
/** The broker. */
@Inject
IEventBroker broker;
/** The app service. */
@Inject
IApplicationService appService;
/** The shell. */
@Inject
@Named(IServiceConstants.ACTIVE_SHELL)
Shell shell;
/** The Constant FILTER_NAMES. */
private static final String[] FILTER_NAMES = { "Flintstones files (*.flintstones)" }; //$NON-NLS-1$
/** The Constant FILTER_EXTS. */
private static final String[] FILTER_EXTS = { "*.flintstones" }; //$NON-NLS-1$
/**
* Execute.
*
* @throws ParserConfigurationException the parser configuration exception
* @throws IOException Signals that an I/O exception has occurred.
* @throws SAXException the SAX exception
* @throws XMLStreamException the XML stream exception
*/
@Execute
public void execute() {
FileDialog dlg = new FileDialog(this.shell, SWT.SAVE);
dlg.setFilterNames(SaveAsHandler.FILTER_NAMES);
dlg.setFilterExtensions(SaveAsHandler.FILTER_EXTS);
String fileName = dlg.open();
if (fileName != null)
this.appService.saveProblemAs(fileName);
}
}
@@ -0,0 +1,26 @@
package flintstones.application.control.handler;
import javax.inject.Inject;
import org.eclipse.e4.core.di.annotations.Execute;
import flintstones.application.model.IApplicationService;
/**
* The Class SaveHandler.
*/
public class SaveHandler {
/** The app service. */
@Inject
IApplicationService appService;
/**
* Execute.
*/
@Execute
public void execute() {
this.appService.saveProblem();
}
}
@@ -0,0 +1,11 @@
package flintstones.application.control.handler;
import org.eclipse.e4.core.di.annotations.Execute;
@SuppressWarnings("javadoc")
public class UndoHandler {
@Execute
public void execute() {
System.err.println("Undo handler called."); //$NON-NLS-1$
}
}