Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Fischer committed Apr 8, 2016
0 parents commit fd196a0
Show file tree
Hide file tree
Showing 9 changed files with 460 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
target/
.DS_Store
*.classpath
*.project
.settings/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
`${clipboard}` editor variable for <oXygen/>
==========================================

This plugin adds support for a `${clipboard}` editor variable in <oXygen/> 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/`
23 changes: 23 additions & 0 deletions assembly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">

<id>package</id>

<formats>
<format>zip</format>
<format>dir</format>
</formats>

<files>
<file>
<source>${project.build.directory}/build/plugin.xml</source>
<outputDirectory>/</outputDirectory>
</file>
<file>
<source>${project.build.directory}/build/${project.artifactId}.jar</source>
<outputDirectory>/lib</outputDirectory>
</file>
</files>

</assembly>
93 changes: 93 additions & 0 deletions plugin.dtd
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<!--doc: A plugin extension.-->
<!ELEMENT extension (#PCDATA|folder)*>
<!ATTLIST extension type (selectionProcessor
|WebappServlet
|documentProcessor
|generalExtension
|URLStreamHandler
|URLHandler
|TargetedURLHandler
|URLChooser
|URLChooserToolbar
|componentsValidator
|OpenRedirect
|WorkspaceAccess
|WorkspaceAccessJS
|LockHandlerFactory
|StylesFilter
|OptionPage
|RefactoringOperationsProvider
|AuthorStylesheet
|WebappStaticResourcesFolder) #REQUIRED>
<!ATTLIST extension role (config) #IMPLIED>
<!ATTLIST extension class CDATA #IMPLIED>
<!--doc: The keyboard shortcut and action name are available for the following extension types:
selectionProcessor
documentProcessor
generalExtension
Example: ctrl shift E
-->
<!ATTLIST extension keyboardShortcut CDATA #IMPLIED>
<!ATTLIST extension actionName CDATA #IMPLIED>
<!ATTLIST extension path CDATA #IMPLIED>
<!-- doc: The location of the CSS (or LESS) file that will be used for all XML documents in Author mode.
The location is relative to the plugin folder. -->
<!ATTLIST extension href CDATA #IMPLIED>
<!--doc: A folder specifying a place where additional refactoring operation descriptors and associated scripts are located.
Can only be used for the RefactoringOperationsProvider extension type.
-->
<!ELEMENT folder (#PCDATA)>
<!ATTLIST folder path CDATA #IMPLIED>

<!ELEMENT runtime (#PCDATA | library | librariesFolder)*>
<!ELEMENT library (#PCDATA)>
<!ATTLIST library name CDATA #IMPLIED>
<!-- doc: The default value is "local"
When choosing "local" the library is loaded in the plugin's own class loader.
When choosing "global" the library is loaded in the main Oxygen class loader as the last library in the list (as if it would be present in the Oxygen "lib" directory).
When choosing "globalHighPriority" the library is loaded in the main Oxygen class loader as the first library in the list (useful in border cases to patch certain behaviors in the Oxygen JARs).-->
<!ATTLIST library scope (local|global|globalHighPriority) "local">
<!-- This elements specified a folder from which all the jar files should be loaded. -->
<!ELEMENT librariesFolder (#PCDATA)>
<!-- This should be a path to a local file -->
<!ATTLIST librariesFolder name CDATA #IMPLIED>
<!-- doc: The default value is "local".
The values are the same as for the "library" element.-->
<!ATTLIST librariesFolder scope (local|global|globalHighPriority) "local">
<!ELEMENT plugin (#PCDATA | runtime | extension | view | toolbar | property)*>
<!-- An ID to identify the plugin. -->
<!ATTLIST plugin id CDATA #REQUIRED>
<!ATTLIST plugin name CDATA #IMPLIED>
<!ATTLIST plugin description CDATA #IMPLIED>
<!ATTLIST plugin version CDATA #IMPLIED>
<!ATTLIST plugin vendor CDATA #IMPLIED>
<!ATTLIST plugin class CDATA #IMPLIED>
<!-- doc: The default value is "preferOxygenResources"
When choosing "preferReferencedResources" the libraries which are referenced in the "plugin.xml"
will have precedence over the ones in the Oxygen "lib" directory if they have conflicting package names.
When choosing "preferOxygenResources" the libraries which are referenced in the Oxygen "lib"
directory will have precedence over the ones in the "plugin.xml" if they have conflicting package names.-->
<!ATTLIST plugin classLoaderType (preferReferencedResources|preferOxygenResources) "preferOxygenResources">
<!--doc: This element defines an unique ID for a view which will be customized in the WorkspaceAccess plugin extension-->
<!ELEMENT view EMPTY>
<!--doc: The ID of the view-->
<!ATTLIST view id ID #REQUIRED>
<!--doc: The initial side on the Oxygen main frame where the view will be placed. -->
<!ATTLIST view initialSide (NORTH|SOUTH|EAST|WEST) "WEST">
<!--doc: The initial row on the specified side where the view will be placed.
For example the Oxygen "Project" view has an initial row of "0" and the Outline view has an initial row of "1". -->
<!ATTLIST view initialRow CDATA #IMPLIED>

<!--doc: This element defines an unique ID for a toolbar which will be customized in the WorkspaceAccess plugin extension-->
<!ELEMENT toolbar EMPTY>
<!--doc: The ID of the toolbar-->
<!ATTLIST toolbar id ID #REQUIRED>
<!--doc: The initial side on the Oxygen main frame where the toolbar will be placed. -->
<!ATTLIST toolbar initialSide (NORTH|SOUTH) "NORTH">
<!--doc: The initial row on the specified side where the toolbar will be placed.
For example the Oxygen main menu has an initial row of "0" and the "Edit" toolbar has an initial row of "1". -->
<!ATTLIST toolbar initialRow CDATA #IMPLIED>
<!-- Property element -->
<!ELEMENT property EMPTY>
<!ATTLIST property name CDATA #REQUIRED>
<!ATTLIST property value CDATA #REQUIRED>
19 changes: 19 additions & 0 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- The plugin.dtd file is located in the OXYGEN_INSATALL_DIR/plugins directory -->
<!DOCTYPE plugin SYSTEM "../plugin.dtd">

<plugin
id="de.paginagmbh.oxygen.clipboardEditorVariable"
name="ClipboardEditorVariable"
description="Adds support for ${clipboard} variable"
version="0.0.1-SNAPSHOT"
vendor="pagina GmbH, Tübingen, Germany"
class="de.paginagmbh.oxygen.clipboardEditorVariable.ClipboardEditorVariablePlugin"
classLoaderType="preferReferencedResources">
<runtime>
<library name="lib/clipboardEditorVariable.jar"/>
</runtime>
<extension type="WorkspaceAccess"
class="de.paginagmbh.oxygen.clipboardEditorVariable.ClipboardEditorVariablePluginExtension"/>

</plugin>
166 changes: 166 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>de.paginagmbh.oxygen</groupId>
<artifactId>clipboardEditorVariable</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>clipboardEditorVariable</name>
<url>https://github.com/paginagmbh/oxygen-plugin_clipboard-editor-variable</url>

<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<oxygen.sdk.version>17.1.0.4</oxygen.sdk.version>
</properties>

<dependencies>
<dependency>
<groupId>com.oxygenxml</groupId>
<artifactId>oxygen-sdk</artifactId>
<version>${oxygen.sdk.version}</version>
</dependency>
</dependencies>

<build>
<!-- is used from within the plugin.xml -->
<finalName>${project.artifactId}</finalName>

<plugins>
<!-- rename JAR file for distribution -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<configuration>
<!-- We only want the final JAR package in the target folder so that
it's easier for users to identify it. -->
<outputDirectory>${project.build.directory}/build</outputDirectory>
<finalName>${project.artifactId}</finalName>
</configuration>
</plugin>

<!-- package all components mentioned in assembly.xml -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archiveBaseDirectory>${project.basedir}</archiveBaseDirectory>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>

<!-- copy and process plugin.xml to target/ -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>filter-plugin-descriptors</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/build</outputDirectory>
<resources>
<resource>
<directory>${basedir}</directory>
<filtering>true</filtering>
<includes>
<include>plugin.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<!-- If an Oxygen plugins dir is provided we will automatically deploy the plugins in it. -->
<id>auto-install</id>
<activation>
<property>
<name>oxygen.plugins.dir</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-nodeps</artifactId>
<version>1.6.5</version>
</dependency>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b3</version>
<!-- ant-contrib has a dependency on ant-1.5 -->
<exclusions>
<exclusion>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<executions>
<execution>
<id>deploy-to-oxygen</id>
<phase>install</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<taskdef resource="net/sf/antcontrib/antcontrib.properties"
classpathref="maven.plugin.classpath"/>

<!-- checks if build went well and ZIP file was created ... -->
<available property="package.available"
file="target/${project.build.finalName}.zip"/>
<if>
<equals arg1="${package.available}" arg2="true"/>
<then>
<!-- ... then deletes the old plugin version ... -->
<delete
dir="${oxygen.plugins.dir}/${project.build.finalName}"/>
<!-- ... and extracts the new build ZIP -->
<unzip src="target/${project.build.finalName}.zip"
dest="${oxygen.plugins.dir}"/>
</then>
</if>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Loading

0 comments on commit fd196a0

Please sign in to comment.