From 03d0d35a4220c0e32a492f00f9ed30dd517541ca Mon Sep 17 00:00:00 2001 From: dgelessus <dgelessus@users.noreply.github.com> Date: Fri, 30 Jun 2023 12:39:08 +0200 Subject: [PATCH] Remove support for BMotionStudio Groovy observer scripts This feature wasn't accessible in the GUI for 10 years and I can only find a single incomplete example of a Groovy observer script. Although the feature is now fully working again, let's remove it properly now while nobody is relying on it. --- build.gradle | 1 - de.bmotionstudio.gef.editor/.classpath | 1 - .../META-INF/MANIFEST.MF | 1 - de.bmotionstudio.gef.editor/plugin.xml | 61 ---------- .../observer/ExternalObserverScript.java | 77 ------------ .../WizardObserverExternalObserverScript.java | 111 ------------------ 6 files changed, 252 deletions(-) delete mode 100644 de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/ExternalObserverScript.java delete mode 100644 de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverExternalObserverScript.java diff --git a/build.gradle b/build.gradle index ae8b7222..552ae10f 100644 --- a/build.gradle +++ b/build.gradle @@ -52,7 +52,6 @@ project(":de.bmotionstudio.gef.editor") { // hardcode a specific MXParser version here. // It *should* be safe to update this when a new version is released. implementation group: "io.github.x-stream", name: "mxparser", version: "1.2.2" - implementation group: "org.codehaus.groovy", name: "groovy", version: "2.5.22" } } diff --git a/de.bmotionstudio.gef.editor/.classpath b/de.bmotionstudio.gef.editor/.classpath index ca96913a..769b529f 100644 --- a/de.bmotionstudio.gef.editor/.classpath +++ b/de.bmotionstudio.gef.editor/.classpath @@ -4,7 +4,6 @@ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="output" path="bin"/> - <classpathentry exported="true" kind="lib" path="lib/dependencies/groovy-2.5.22.jar"/> <classpathentry exported="true" kind="lib" path="lib/dependencies/mxparser-1.2.2.jar"/> <classpathentry exported="true" kind="lib" path="lib/dependencies/xmlpull-1.1.3.1.jar"/> <classpathentry exported="true" kind="lib" path="lib/dependencies/xstream-1.4.20.jar"/> diff --git a/de.bmotionstudio.gef.editor/META-INF/MANIFEST.MF b/de.bmotionstudio.gef.editor/META-INF/MANIFEST.MF index 4c0989e0..3cc4e62a 100644 --- a/de.bmotionstudio.gef.editor/META-INF/MANIFEST.MF +++ b/de.bmotionstudio.gef.editor/META-INF/MANIFEST.MF @@ -149,7 +149,6 @@ Export-Package: de.bmotionstudio.gef.editor; org.eclipse.swt.widgets, de.bmotionstudio.gef.editor" Bundle-ClassPath: ., - lib/dependencies/groovy-2.5.22.jar, lib/dependencies/mxparser-1.2.2.jar, lib/dependencies/xmlpull-1.1.3.1.jar, lib/dependencies/xstream-1.4.20.jar diff --git a/de.bmotionstudio.gef.editor/plugin.xml b/de.bmotionstudio.gef.editor/plugin.xml index f60e1074..2f254fad 100644 --- a/de.bmotionstudio.gef.editor/plugin.xml +++ b/de.bmotionstudio.gef.editor/plugin.xml @@ -348,10 +348,6 @@ class="de.bmotionstudio.gef.editor.observer.ColumnObserver" name="Column Observer"> </observer> - <observer - class="de.bmotionstudio.gef.editor.observer.ExternalObserverScript" - name="External Observer Script"> - </observer> </extension> <extension point="de.bmotionstudio.gef.editor.schedulerEvent"> @@ -577,63 +573,6 @@ id="de.bmotionstudio.gef.editor.visualization"> </control> </observer> - <observer - id="de.bmotionstudio.gef.editor.observer.ExternalObserverScript"> - <control - id="de.bmotionstudio.gef.editor.image"> - </control> - <control - id="de.bmotionstudio.gef.editor.button"> - </control> - <control - id="de.bmotionstudio.gef.editor.composite"> - </control> - <control - id="de.bmotionstudio.gef.editor.text"> - </control> - <control - id="de.bmotionstudio.gef.editor.rectangle"> - </control> - <control - id="de.bmotionstudio.gef.editor.radiobutton"> - </control> - <control - id="de.bmotionstudio.gef.editor.checkbox"> - </control> - <control - id="de.bmotionstudio.gef.editor.connection"> - </control> - <control - id="de.bmotionstudio.gef.editor.ellipse"> - </control> - <control - id="de.bmotionstudio.gef.editor.textfield"> - </control> - <control - id="de.bmotionstudio.gef.editor.tablecell"> - </control> - <control - id="de.bmotionstudio.gef.editor.table"> - </control> - <control - id="de.bmotionstudio.gef.editor.tablecolumn"> - </control> - <control - id="de.bmotionstudio.gef.editor.light"> - </control> - <control - id="de.bmotionstudio.gef.editor.signal"> - </control> - <control - id="de.bmotionstudio.gef.editor.switch"> - </control> - <control - id="de.bmotionstudio.gef.editor.track"> - </control> - <control - id="de.bmotionstudio.gef.editor.tracknode"> - </control> - </observer> <observer id="de.bmotionstudio.gef.editor.observer.SwitchImage"> <control diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/ExternalObserverScript.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/ExternalObserverScript.java deleted file mode 100644 index 66140364..00000000 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/ExternalObserverScript.java +++ /dev/null @@ -1,77 +0,0 @@ -/** - * (c) 2009 Lehrstuhl fuer Softwaretechnik und Programmiersprachen, - * Heinrich Heine Universitaet Duesseldorf - * This software is licenced under EPL 1.0 (http://www.eclipse.org/org/documents/epl-v10.html) - * */ - -package de.bmotionstudio.gef.editor.observer; - -import groovy.lang.GroovyClassLoader; -import groovy.lang.GroovyObject; - -import java.io.File; -import java.io.IOException; - -import org.codehaus.groovy.control.CompilationFailedException; -import org.eclipse.core.resources.IFile; - -import de.bmotionstudio.gef.editor.Animation; -import de.bmotionstudio.gef.editor.model.BControl; -import de.bmotionstudio.gef.editor.observer.wizard.WizardObserverExternalObserverScript; - -public class ExternalObserverScript extends Observer { - - public static String ID = "de.bmotionstudio.gef.editor.observer.ExternalObserverScript"; - - private transient GroovyObject groovyObject; - - private String scriptPath; - - // private String language; - - @Override - public void check(Animation animation, BControl control) { - - try { - - if (groovyObject == null) { - IFile pFile = control.getVisualization().getProjectFile(); - String myPath = (pFile.getProject().getLocation() + "/" + scriptPath) - .replace("file:", ""); - ClassLoader parent = getClass().getClassLoader(); - GroovyClassLoader loader = new GroovyClassLoader(parent); - Class<?> groovyClass; - groovyClass = loader.parseClass(new File(myPath)); - // let's call some method on an instance - groovyObject = (GroovyObject) groovyClass.newInstance(); - } - - Object[] args = { animation, control }; - groovyObject.invokeMethod("check", args); - - } catch (CompilationFailedException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - - } - - @Override - public ObserverWizard getWizard(BControl control) { - return new WizardObserverExternalObserverScript(control, this); - } - - public String getScriptPath() { - return scriptPath; - } - - public void setScriptPath(String scriptPath) { - this.scriptPath = scriptPath; - } - -} diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverExternalObserverScript.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverExternalObserverScript.java deleted file mode 100644 index 4d86d0ae..00000000 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverExternalObserverScript.java +++ /dev/null @@ -1,111 +0,0 @@ -/** - * (c) 2009 Lehrstuhl fuer Softwaretechnik und Programmiersprachen, - * Heinrich Heine Universitaet Duesseldorf - * This software is licenced under EPL 1.0 (http://www.eclipse.org/org/documents/epl-v10.html) - * */ - -package de.bmotionstudio.gef.editor.observer.wizard; - -import org.eclipse.core.databinding.DataBindingContext; -import org.eclipse.core.databinding.beans.BeansObservables; -import org.eclipse.jface.databinding.swt.SWTObservables; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Point; -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.swt.widgets.Text; - -import de.bmotionstudio.gef.editor.model.BControl; -import de.bmotionstudio.gef.editor.observer.ExternalObserverScript; -import de.bmotionstudio.gef.editor.observer.Observer; -import de.bmotionstudio.gef.editor.observer.ObserverWizard; - -public class WizardObserverExternalObserverScript extends ObserverWizard { - - private class ObserverExternalObserverScriptPage extends WizardPage { - - private Text txtScriptPath; - - protected ObserverExternalObserverScriptPage(final String pageName) { - super(pageName); - } - - public Text getTxtScriptPath() { - return txtScriptPath; - } - - public void createControl(final Composite parent) { - - final DataBindingContext dbc = new DataBindingContext(); - - Composite container = new Composite(parent, SWT.NONE); - container.setLayoutData(new GridData(GridData.FILL_BOTH)); - container.setLayout(new GridLayout(2, false)); - - Label lb = new Label(container, SWT.NONE); - lb.setText("Script File:"); - - txtScriptPath = new Text(container, SWT.BORDER); - txtScriptPath.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - txtScriptPath.setFont(new Font(Display.getDefault(), new FontData( - "Arial", 10, SWT.NONE))); - - initBindings(dbc); - - setControl(container); - - } - - private void initBindings(DataBindingContext dbc) { - - dbc.bindValue( - SWTObservables.observeText(txtScriptPath, SWT.Modify), - BeansObservables.observeValue( - (ExternalObserverScript) getObserver(), - "scriptPath")); - - } - - - } - - public WizardObserverExternalObserverScript(BControl bcontrol, - Observer bobserver) { - super(bcontrol, bobserver); - addPage(new ObserverExternalObserverScriptPage( - "ObserverExternalObserverScriptPage")); - } - - @Override - protected Boolean prepareToFinish() { - - ObserverExternalObserverScriptPage page = (ObserverExternalObserverScriptPage) getPage("ObserverExternalObserverScriptPage"); - - String errorStr = ""; - - if (page.getTxtScriptPath().getText().length() == 0) - errorStr += "Please enter a path for a script file.\n"; - - if (errorStr.length() > 0) { - MessageDialog.openError(Display.getDefault().getActiveShell(), - "An Error occured", errorStr); - return false; - } - - return true; - - } - - @Override - public Point getSize() { - return new Point(600, 500); - } - -} -- GitLab