diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..23abeb7
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+target/
+.DS_Store
+*.classpath
+*.project
+.settings/
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..5fc6d21
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2016 pagina GmbH (www.pagina-online.de)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..13fd360
--- /dev/null
+++ b/README.md
@@ -0,0 +1,42 @@
+`${clipboard}` editor variable for
+==========================================
+
+This plugin adds support for a `${clipboard}` editor variable in XML Editor.
+
+When using `${clipboard}` (e.g. in a code template) it will insert the contents from your clipboard in **plain text**.
+
+The editor variable may be used in all contexts where oXygen allows to use editor variables.
+However it will not show up in the context menu of the "green arrow button variable chooser"!
+
+
+Building the plugin
+-------------------
+
+### Packaging
+
+Run `mvn clean package` to trigger a ZIP + folder build in `target/` directory:
+
+* `target/clipboardEditorVariable.zip`
+* `target/clipboardEditorVariable/`
+
+### Install to Maven
+
+Run `mvn clean install` to install the current version of the plugin in your local Maven repository.
+
+### Debugging
+
+To debug plugin internals follow the oXygen users guide at https://www.oxygenxml.com/doc/versions/17.1/ug-editor/index.html#topics/debug-plugin.html
+
+### Deploy to oXygen
+
+On Mac OS X you can deploy the plugin automatically to the oXygen plugins directory in `/Applications/OXYGEN-DIR/plugins/`
+
+### Commandline (Mac only)
+`mvn clean install -Doxygen.plugins.dir=/Applications/oxygen-17/plugins/`
+
+### Eclipse (Windows & Mac)
+* Add a Maven launch scenario
+* Set the _Goal_ to `install`
+* Add a new _Parameter_:
+ * _Name:_ `oxygen.plugins.dir`
+ * _Value:_ `/Applications/oxygen-17/plugins/`
\ No newline at end of file
diff --git a/assembly.xml b/assembly.xml
new file mode 100644
index 0000000..c937f9a
--- /dev/null
+++ b/assembly.xml
@@ -0,0 +1,23 @@
+
+
+ package
+
+
+ zip
+ dir
+
+
+
+
+
+ /
+
+
+
+ /lib
+
+
+
+
diff --git a/plugin.dtd b/plugin.dtd
new file mode 100644
index 0000000..298965a
--- /dev/null
+++ b/plugin.dtd
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugin.xml b/plugin.xml
new file mode 100644
index 0000000..9c6067b
--- /dev/null
+++ b/plugin.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..fe9e82d
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,166 @@
+
+ 4.0.0
+
+ de.paginagmbh.oxygen
+ clipboardEditorVariable
+ 0.0.1-SNAPSHOT
+ jar
+
+ clipboardEditorVariable
+ https://github.com/paginagmbh/oxygen-plugin_clipboard-editor-variable
+
+
+ 1.7
+ 1.7
+ UTF-8
+ 17.1.0.4
+
+
+
+
+ com.oxygenxml
+ oxygen-sdk
+ ${oxygen.sdk.version}
+
+
+
+
+
+ ${project.artifactId}
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.2
+
+
+ ${project.build.directory}/build
+ ${project.artifactId}
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+ 2.4
+
+
+ make-assembly
+ package
+
+ single
+
+
+ ${project.basedir}
+ false
+
+ assembly.xml
+
+
+
+
+
+
+
+
+ maven-resources-plugin
+
+
+ filter-plugin-descriptors
+ prepare-package
+
+ copy-resources
+
+
+ ${project.build.directory}/build
+
+
+ ${basedir}
+ true
+
+ plugin.xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+ auto-install
+
+
+ oxygen.plugins.dir
+
+
+
+
+
+ maven-antrun-plugin
+ 1.3
+
+
+ ant
+ ant-nodeps
+ 1.6.5
+
+
+ ant-contrib
+ ant-contrib
+ 1.0b3
+
+
+
+ ant
+ ant
+
+
+
+
+
+
+ deploy-to-oxygen
+ install
+
+ run
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/de/paginagmbh/oxygen/clipboardEditorVariable/ClipboardEditorVariablePlugin.java b/src/main/java/de/paginagmbh/oxygen/clipboardEditorVariable/ClipboardEditorVariablePlugin.java
new file mode 100644
index 0000000..a546641
--- /dev/null
+++ b/src/main/java/de/paginagmbh/oxygen/clipboardEditorVariable/ClipboardEditorVariablePlugin.java
@@ -0,0 +1,41 @@
+package de.paginagmbh.oxygen.clipboardEditorVariable;
+
+import ro.sync.exml.plugin.Plugin;
+import ro.sync.exml.plugin.PluginDescriptor;
+
+
+/**
+ * @author Tobias Fischer
+ * @copyright pagina GmbH, Tübingen
+ * @email tobias.fischer@pagina-tuebingen.de
+ */
+public class ClipboardEditorVariablePlugin extends Plugin {
+
+ /**
+ * The static plugin instance.
+ */
+ private static ClipboardEditorVariablePlugin instance = null;
+
+ /**
+ * Constructs the plugin.
+ *
+ * @param descriptor
+ * The plugin descriptor
+ */
+ public ClipboardEditorVariablePlugin(PluginDescriptor descriptor) {
+ super(descriptor);
+ if (instance != null) {
+ throw new IllegalStateException("Already instantiated!");
+ }
+ instance = this;
+ }
+
+ /**
+ * Get the plugin instance.
+ *
+ * @return the shared plugin instance.
+ */
+ public static ClipboardEditorVariablePlugin getInstance() {
+ return instance;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/de/paginagmbh/oxygen/clipboardEditorVariable/ClipboardEditorVariablePluginExtension.java b/src/main/java/de/paginagmbh/oxygen/clipboardEditorVariable/ClipboardEditorVariablePluginExtension.java
new file mode 100644
index 0000000..2fc66f0
--- /dev/null
+++ b/src/main/java/de/paginagmbh/oxygen/clipboardEditorVariable/ClipboardEditorVariablePluginExtension.java
@@ -0,0 +1,50 @@
+package de.paginagmbh.oxygen.clipboardEditorVariable;
+
+import java.awt.Toolkit;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.io.IOException;
+
+import ro.sync.exml.plugin.workspace.WorkspaceAccessPluginExtension;
+import ro.sync.exml.workspace.api.standalone.StandalonePluginWorkspace;
+import ro.sync.exml.workspace.api.util.EditorVariablesResolver;
+
+
+/**
+ * @author Tobias Fischer
+ * @copyright pagina GmbH, Tübingen
+ * @email tobias.fischer@pagina-tuebingen.de
+ */
+public class ClipboardEditorVariablePluginExtension implements WorkspaceAccessPluginExtension {
+
+ @Override
+ public void applicationStarted(StandalonePluginWorkspace pluginWorkspaceAccess) {
+ pluginWorkspaceAccess.getUtilAccess().addCustomEditorVariablesResolver(new EditorVariablesResolver() {
+ /**
+ * @see ro.sync.exml.workspace.api.util.EditorVariablesResolver#resolveEditorVariables(java.lang.String, java.lang.String)
+ */
+ @Override
+ public String resolveEditorVariables(String contentWithEditorVariables, String currentEditedFileURL) {
+ String clipboardPattern = "clipboard";
+ if(contentWithEditorVariables != null && contentWithEditorVariables.contains("${" + clipboardPattern + "}")){
+ Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
+ try {
+ String clipboardData = (String) clipboard.getData(DataFlavor.stringFlavor);
+ return contentWithEditorVariables.replaceAll("\\$\\{" + clipboardPattern + "\\}", clipboardData);
+
+ } catch (UnsupportedFlavorException | IOException e) {
+ // error: don't replace variable
+ return contentWithEditorVariables;
+ }
+ }
+ return contentWithEditorVariables;
+ }
+ });
+ }
+
+ @Override
+ public boolean applicationClosing() {
+ return true;
+ }
+}