summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--installer/mac/PDF-Over.platypus1
-rw-r--r--pdf-over-gui/pom.xml60
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java18
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTLoader.java109
-rw-r--r--pdf-over-gui/src/main/resources/izpack/install.xml8
-rw-r--r--pdf-over-gui/src/main/resources/scripts/pdf-over_linux.sh1
-rw-r--r--pdf-over-gui/src/main/resources/scripts/pdf-over_mac.sh1
-rw-r--r--pdf-over-gui/src/main/resources/scripts/pdf-over_win-cli.bat1
-rw-r--r--pdf-over-gui/src/main/resources/scripts/pdf-over_win.bat1
-rw-r--r--pdf-over-gui/src/main/resources/scripts/postInstall_linux.sh4
-rw-r--r--pdf-over-gui/src/main/resources/scripts/postInstall_win.bat2
-rw-r--r--pdf-over-gui/src/main/resources/scripts/postinstall_mac.sh1
-rw-r--r--pdf-over-install-helper/pom.xml69
-rw-r--r--pdf-over-install-helper/src/main/java/at/asit/helper/Main.java135
-rw-r--r--pom.xml1
15 files changed, 13 insertions, 399 deletions
diff --git a/installer/mac/PDF-Over.platypus b/installer/mac/PDF-Over.platypus
index fb61659f..91cc75ff 100644
--- a/installer/mac/PDF-Over.platypus
+++ b/installer/mac/PDF-Over.platypus
@@ -14,7 +14,6 @@
<array>
<string>/Users/TestMac/Documents/Contents/icons</string>
<string>/Users/TestMac/Documents/Contents/lib</string>
- <string>/Users/TestMac/Documents/Contents/lib-swt</string>
</array>
<key>Creator</key>
<string>Platypus-4.7</string>
diff --git a/pdf-over-gui/pom.xml b/pdf-over-gui/pom.xml
index 4815382e..62cbe410 100644
--- a/pdf-over-gui/pom.xml
+++ b/pdf-over-gui/pom.xml
@@ -173,30 +173,12 @@
<artifactItems>
<artifactItem>
<groupId>org.eclipse.swt</groupId>
- <artifactId>${swt.artifactId.64}</artifactId>
+ <artifactId>${swt.artifactId}</artifactId>
<version>${swt.version}</version>
<type>jar</type>
<overWrite>true</overWrite>
- <outputDirectory>${staging.dir}/lib-swt</outputDirectory>
- <destFileName>swt-${target.name}-32.jar</destFileName>
- </artifactItem>
- <artifactItem>
- <groupId>org.eclipse.swt</groupId>
- <artifactId>${swt.artifactId.64}</artifactId>
- <version>${swt.version}</version>
- <type>jar</type>
- <overWrite>true</overWrite>
- <outputDirectory>${staging.dir}/lib-swt</outputDirectory>
- <destFileName>swt-${target.name}-64.jar</destFileName>
- </artifactItem>
- <artifactItem>
- <groupId>at.a-sit</groupId>
- <artifactId>pdf-over-install-helper</artifactId>
- <version>${project.parent.version}</version>
- <type>jar</type>
- <overWrite>true</overWrite>
<outputDirectory>${staging.dir}/lib</outputDirectory>
- <destFileName>pdf-over-install-helper.jar</destFileName>
+ <destFileName>swt.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
@@ -321,6 +303,7 @@
<classPath>
<mainClass>at.asit.pdfover.gui.Main</mainClass>
<jarLocation>lib/</jarLocation>
+ <preCp>lib/swt.jar</preCp>
</classPath>
<chdir>.</chdir>
<icon>src/main/resources/icons/icon.ico</icon>
@@ -357,6 +340,7 @@
<classPath>
<mainClass>at.asit.pdfover.gui.Main</mainClass>
<jarLocation>lib/</jarLocation>
+ <preCp>lib/swt.jar</preCp>
</classPath>
<chdir>.</chdir>
<icon>src/main/resources/icons/icon.ico</icon>
@@ -478,9 +462,7 @@
</os>
</activation>
<properties>
-<!-- <swt.artifactId.32>org.eclipse.swt.gtk.linux.x86</swt.artifactId.32>-->
- <swt.artifactId.64>org.eclipse.swt.gtk.linux.x86_64</swt.artifactId.64>
- <swt.artifactId>${swt.artifactId.64}</swt.artifactId>
+ <swt.artifactId>org.eclipse.swt.gtk.linux.x86_64</swt.artifactId>
<target.name>linux</target.name>
</properties>
</profile>
@@ -493,9 +475,7 @@
</os>
</activation>
<properties>
-<!-- <swt.artifactId.32>org.eclipse.swt.win32.win32.x86</swt.artifactId.32>-->
- <swt.artifactId.64>org.eclipse.swt.win32.win32.x86_64</swt.artifactId.64>
- <swt.artifactId>${swt.artifactId.64}</swt.artifactId>
+ <swt.artifactId>org.eclipse.swt.win32.win32.x86_64</swt.artifactId>
<target.name>windows</target.name>
</properties>
</profile>
@@ -508,9 +488,7 @@
</os>
</activation>
<properties>
-<!-- <swt.artifactId.32>org.eclipse.swt.win32.win32.x86</swt.artifactId.32>-->
- <swt.artifactId.64>org.eclipse.swt.win32.win32.x86_64</swt.artifactId.64>
- <swt.artifactId>${swt.artifactId.64}</swt.artifactId>
+ <swt.artifactId>org.eclipse.swt.win32.win32.x86_64</swt.artifactId>
<target.name>windows</target.name>
</properties>
</profile>
@@ -523,9 +501,7 @@
</os>
</activation>
<properties>
-<!-- <swt.artifactId.32>org.eclipse.swt.gtk.linux.x86</swt.artifactId.32>-->
- <swt.artifactId.64>org.eclipse.swt.gtk.linux.x86_64</swt.artifactId.64>
- <swt.artifactId>${swt.artifactId.64}</swt.artifactId>
+ <swt.artifactId>org.eclipse.swt.gtk.linux.x86_64</swt.artifactId>
<target.name>linux</target.name>
</properties>
</profile>
@@ -541,9 +517,7 @@
</os>
</activation>
<properties>
-<!-- <swt.artifactId.32>org.eclipse.swt.cocoa.macosx</swt.artifactId.32>-->
- <swt.artifactId.64>org.eclipse.swt.cocoa.macosx.x86_64</swt.artifactId.64>
- <swt.artifactId>${swt.artifactId.64}</swt.artifactId>
+ <swt.artifactId>org.eclipse.swt.cocoa.macosx.x86_64</swt.artifactId>
<target.name>mac</target.name>
</properties>
</profile>
@@ -556,9 +530,7 @@
</os>
</activation>
<properties>
-<!-- <swt.artifactId.32>org.eclipse.swt.cocoa.macosx</swt.artifactId.32>-->
- <swt.artifactId.64>org.eclipse.swt.cocoa.macosx.x86_64</swt.artifactId.64>
- <swt.artifactId>${swt.artifactId.64}</swt.artifactId>
+ <swt.artifactId>org.eclipse.swt.cocoa.macosx.x86_64</swt.artifactId>
<target.name>mac</target.name>
</properties>
</profile>
@@ -571,9 +543,7 @@
</os>
</activation>
<properties>
-<!-- <swt.artifactId.32>org.eclipse.swt.cocoa.macosx</swt.artifactId.32>-->
- <swt.artifactId.64>org.eclipse.swt.cocoa.macosx.x86_64</swt.artifactId.64>
- <swt.artifactId>${swt.artifactId.64}</swt.artifactId>
+ <swt.artifactId>org.eclipse.swt.cocoa.macosx.x86_64</swt.artifactId>
<target.name>mac</target.name>
</properties>
</profile>
@@ -586,9 +556,7 @@
</os>
</activation>
<properties>
-<!-- <swt.artifactId.32>org.eclipse.swt.cocoa.macosx</swt.artifactId.32>-->
- <swt.artifactId.64>org.eclipse.swt.cocoa.macosx.x86_64</swt.artifactId.64>
- <swt.artifactId>${swt.artifactId.64}</swt.artifactId>
+ <swt.artifactId>org.eclipse.swt.cocoa.macosx.x86_64</swt.artifactId>
<target.name>mac</target.name>
</properties>
</profile>
@@ -601,9 +569,7 @@
</os>
</activation>
<properties>
-<!-- <swt.artifactId.32>org.eclipse.swt.cocoa.macosx</swt.artifactId.32>-->
- <swt.artifactId.64>org.eclipse.swt.cocoa.macosx.aarch64</swt.artifactId.64>
- <swt.artifactId>${swt.artifactId.64}</swt.artifactId>
+ <swt.artifactId>org.eclipse.swt.cocoa.macosx.aarch64</swt.artifactId>
<target.name>mac</target.name>
</properties>
</profile>
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
index c2528adc..6af00889 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
@@ -58,7 +58,6 @@ import at.asit.pdfover.gui.controls.MainBarRectangleButton;
import at.asit.pdfover.gui.controls.MainBarStartButton;
import at.asit.pdfover.gui.osx.CocoaUIEnhancer;
import at.asit.pdfover.commons.Messages;
-import at.asit.pdfover.gui.utils.SWTLoader;
import at.asit.pdfover.gui.workflow.StateMachine;
import at.asit.pdfover.gui.workflow.states.BKUSelectionState;
import at.asit.pdfover.gui.workflow.states.ConfigurationUIState;
@@ -212,23 +211,6 @@ public class MainWindow {
if (System.getProperty("os.name").contains("OS X")) { //$NON-NLS-1$ //$NON-NLS-2$
hookupOSXMenu();
}
- // Workaround for SWT bug on Mac: disable full screen mode
- try {
- Field field = Control.class.getDeclaredField("view"); //$NON-NLS-1$
- Object /*NSView*/ view = field.get(getShell());
- if (view != null)
- {
- Class<?> c = Class.forName("org.eclipse.swt.internal.cocoa.NSView"); //$NON-NLS-1$
- Object nswindow = c.getDeclaredMethod("window").invoke(view); //$NON-NLS-1$
- c = Class.forName("org.eclipse.swt.internal.cocoa.NSWindow"); //$NON-NLS-1$
- Method setCollectionBehavior = c.getDeclaredMethod(
- "setCollectionBehavior", //$NON-NLS-1$
- (SWTLoader.getArchBits() == 64) ? long.class : int.class);
- setCollectionBehavior.invoke(nswindow, 0);
- }
- } catch (Exception e) {
- log.error("Error disabling full screen mode", e); //$NON-NLS-1$
- }
}
try {
Display display = Display.getCurrent();
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTLoader.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTLoader.java
deleted file mode 100644
index 6184ebc7..00000000
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTLoader.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright 2012 by A-SIT, Secure Information Technology Center Austria
- *
- * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * http://joinup.ec.europa.eu/software/page/eupl
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- */
-package at.asit.pdfover.gui.utils;
-
-// Imports
-import java.io.File;
-import java.io.UnsupportedEncodingException;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.net.URLDecoder;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import at.asit.pdfover.gui.exceptions.InitializationException;
-
-/**
- *
- */
-@SuppressWarnings("nls")
-public class SWTLoader {
- /**
- * SLF4J Logger instance
- **/
- private static final Logger log = LoggerFactory.getLogger(SWTLoader.class);
-
- /**
- * Load the SWT library for this OS
- * @throws InitializationException Loading failed
- */
- public static void loadSWT() throws InitializationException {
- try {
- URLClassLoader cl = (URLClassLoader)SWTLoader.class.getClassLoader();
- Method addUrlMethod = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
- addUrlMethod.setAccessible(true);
-
- String swtLibPath = getSwtJarPath() + getSwtJarName();
- log.debug("loading " + swtLibPath);
- File swtLib = new File(swtLibPath);
- if (!swtLib.isFile())
- throw new SWTLoadFailedException("Library " + swtLibPath + " not found");
- log.debug("Adding " + swtLib + " to ClassLoader...");
- addUrlMethod.invoke(cl, swtLib.toURI().toURL());
- log.debug("Success.");
- } catch (Exception e) {
- throw new InitializationException("SWT loading failed", e);
- }
- }
-
- /**
- * Get bit-ness of the JVM
- * @return 32 or 64
- */
- public static int getArchBits() {
- String arch = System.getProperty("os.arch");
- return arch.contains("64") ? 64 : 32;
- }
-
- private static String getSwtJarName() throws SWTLoadFailedException {
- String os = System.getProperty("os.name").toLowerCase();
- if (os.contains("win"))
- os = "windows";
- else if (os.contains("mac"))
- os = "mac";
- else if (os.contains("linux") || os.contains("nix"))
- os = "linux";
- else {
- log.error("Unknown OS: " + os);
- throw new SWTLoadFailedException("Unknown OS: " + os);
- }
- return "swt-" + os + "-" + getArchBits() + ".jar";
- }
-
- private static String getSwtJarPath() {
- String path = "";
- try {
- path = URLDecoder.decode(SWTLoader.class.getProtectionDomain().getCodeSource().getLocation().getPath(), "UTF-8");
- int idx = path.lastIndexOf('/');
- idx = path.lastIndexOf('/', idx - 1);
- path = path.substring(0, idx + 1);
- } catch (UnsupportedEncodingException e) {
- // Ignore
- }
- return path + "lib-swt/";
- }
-
- private static class SWTLoadFailedException extends Exception {
- private static final long serialVersionUID = 1L;
-
- SWTLoadFailedException(String msg) {
- super(msg);
- }
- }
-
-}
diff --git a/pdf-over-gui/src/main/resources/izpack/install.xml b/pdf-over-gui/src/main/resources/izpack/install.xml
index 457fb083..f07da7ef 100644
--- a/pdf-over-gui/src/main/resources/izpack/install.xml
+++ b/pdf-over-gui/src/main/resources/izpack/install.xml
@@ -57,10 +57,8 @@
<description>Main Installation</description>
<updatecheck>
<include name="lib/**" />
- <include name="lib-swt/**" />
</updatecheck>
<file src="lib" targetdir="$INSTALL_PATH" />
- <file src="lib-swt" targetdir="$INSTALL_PATH" />
<file src="scripts" targetdir="$INSTALL_PATH" />
<file src="icons" targetdir="$INSTALL_PATH" />
<file src="ReadMe.txt" targetdir="$INSTALL_PATH" />
@@ -71,8 +69,6 @@
os="unix" stage="never"></executable>
<executable targetfile="$INSTALL_PATH/scripts/uninstall_linux.sh"
os="unix" stage="never"></executable>
- <executable targetfile="$INSTALL_PATH/lib/pdf-over-install-helper.jar"
- os="unix" stage="never"></executable>
<executable targetfile="$INSTALL_PATH/scripts/pdf-over_win.bat"
os="windows" stage="never"></executable>
<executable targetfile="$INSTALL_PATH/scripts/pdf-over_win-cli.bat"
@@ -81,12 +77,8 @@
os="windows" stage="never"></executable>
<executable targetfile="$INSTALL_PATH/scripts/pdf-over_mac.sh"
os="mac" stage="never"></executable>
-<!-- <executable targetfile="$INSTALL_PATH/scripts/postInstall_linux.sh"
- os="unix" stage="postinstall" ></executable>-->
<executable targetfile="$INSTALL_PATH/scripts/postinstall_mac.sh"
os="mac" stage="postinstall"></executable>
-<!-- <executable targetfile="$INSTALL_PATH/scripts/postInstall_win.bat"
- os="win" stage="postinstall" ></executable> -->
</pack>
</packs>
diff --git a/pdf-over-gui/src/main/resources/scripts/pdf-over_linux.sh b/pdf-over-gui/src/main/resources/scripts/pdf-over_linux.sh
index 438cec28..ca4e6279 100644
--- a/pdf-over-gui/src/main/resources/scripts/pdf-over_linux.sh
+++ b/pdf-over-gui/src/main/resources/scripts/pdf-over_linux.sh
@@ -1,5 +1,4 @@
#!/bin/sh
BASEDIR=`dirname $0`
export GDK_BACKEND=X11
-java -jar "$BASEDIR/../lib/pdf-over-install-helper.jar"
exec java -cp "$BASEDIR/../lib/*" at.asit.pdfover.gui.Main "$@"
diff --git a/pdf-over-gui/src/main/resources/scripts/pdf-over_mac.sh b/pdf-over-gui/src/main/resources/scripts/pdf-over_mac.sh
index 2c488544..dcb805ae 100644
--- a/pdf-over-gui/src/main/resources/scripts/pdf-over_mac.sh
+++ b/pdf-over-gui/src/main/resources/scripts/pdf-over_mac.sh
@@ -1,5 +1,4 @@
#!/bin/sh
BASEDIR=$(cd "$(dirname "$0")"; pwd)
export LC_CTYPE="UTF-8"
-#java -jar "$BASEDIR/../lib/pdf-over-install-helper.jar"
exec java -XstartOnFirstThread -cp "$BASEDIR/../lib/*" at.asit.pdfover.gui.Main "$@" &
diff --git a/pdf-over-gui/src/main/resources/scripts/pdf-over_win-cli.bat b/pdf-over-gui/src/main/resources/scripts/pdf-over_win-cli.bat
index fe9bad65..fb7b7c39 100644
--- a/pdf-over-gui/src/main/resources/scripts/pdf-over_win-cli.bat
+++ b/pdf-over-gui/src/main/resources/scripts/pdf-over_win-cli.bat
@@ -1,4 +1,3 @@
@echo off
-start /b javaw -jar "%~dp0\..\lib\pdf-over-install-helper.jar"
start /b /WAIT java -cp "%~dp0\..\lib\*" at.asit.pdfover.gui.Main %*
diff --git a/pdf-over-gui/src/main/resources/scripts/pdf-over_win.bat b/pdf-over-gui/src/main/resources/scripts/pdf-over_win.bat
index 5e336241..6468e582 100644
--- a/pdf-over-gui/src/main/resources/scripts/pdf-over_win.bat
+++ b/pdf-over-gui/src/main/resources/scripts/pdf-over_win.bat
@@ -1,3 +1,2 @@
@echo off
-start /b javaw -jar "%~dp0\..\lib\pdf-over-install-helper.jar"
start /b javaw -cp "%~dp0\..\lib\*" at.asit.pdfover.gui.Main %*
diff --git a/pdf-over-gui/src/main/resources/scripts/postInstall_linux.sh b/pdf-over-gui/src/main/resources/scripts/postInstall_linux.sh
deleted file mode 100644
index 7c8d9cf5..00000000
--- a/pdf-over-gui/src/main/resources/scripts/postInstall_linux.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-BASEDIR=`dirname $0`
-java -jar "$BASEDIR/../lib/pdf-over-install-helper.jar"
-
diff --git a/pdf-over-gui/src/main/resources/scripts/postInstall_win.bat b/pdf-over-gui/src/main/resources/scripts/postInstall_win.bat
deleted file mode 100644
index 78deb870..00000000
--- a/pdf-over-gui/src/main/resources/scripts/postInstall_win.bat
+++ /dev/null
@@ -1,2 +0,0 @@
-@echo off
-java -jar "%~dp0\..\lib\pdf-over-install-helper.jar"
diff --git a/pdf-over-gui/src/main/resources/scripts/postinstall_mac.sh b/pdf-over-gui/src/main/resources/scripts/postinstall_mac.sh
index 82e1add9..0b020ea3 100644
--- a/pdf-over-gui/src/main/resources/scripts/postinstall_mac.sh
+++ b/pdf-over-gui/src/main/resources/scripts/postinstall_mac.sh
@@ -3,7 +3,6 @@ SCRIPTDIR=$(cd "$(dirname "$0")"; pwd)
BASEDIR=$(cd "$(dirname "$0")/.."; pwd)
export LC_CTYPE="UTF-8"
cd "$SCRIPTDIR"
-java -jar "$BASEDIR/lib/pdf-over-install-helper.jar"
chmod a+x pdf-over_mac.sh
cd "$BASEDIR"
if [ -d "$BASEDIR.app" ]; then
diff --git a/pdf-over-install-helper/pom.xml b/pdf-over-install-helper/pom.xml
deleted file mode 100644
index 1f5d833c..00000000
--- a/pdf-over-install-helper/pom.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<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>
- <parent>
- <groupId>at.a-sit</groupId>
- <artifactId>pdf-over</artifactId>
- <version>4.3.3-RC8-SNAPSHOT</version>
- </parent>
- <artifactId>pdf-over-install-helper</artifactId>
- <version>4.3.3-RC8-SNAPSHOT</version>
-
- <dependencies>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <groupId>org.apache.maven.plugins</groupId>
- <version>3.7.0</version>
- <configuration>
- <release>8</release>
- <verbose>true</verbose>
- <showWarnings>true</showWarnings>
- <showDeprecation>true</showDeprecation>
- <encoding>UTF-8</encoding>
- <debug>true</debug>
- <debuglevel>lines,vars,source</debuglevel>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>copy-dependencies</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <outputDirectory>
- ${project.build.directory}
- </outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <archive>
- <addMavenDescriptor>false</addMavenDescriptor>
- <manifest>
- <addClasspath>true</addClasspath>
- <mainClass>at.asit.helper.Main</mainClass>
- </manifest>
- </archive>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-</project> \ No newline at end of file
diff --git a/pdf-over-install-helper/src/main/java/at/asit/helper/Main.java b/pdf-over-install-helper/src/main/java/at/asit/helper/Main.java
deleted file mode 100644
index edf5ec2f..00000000
--- a/pdf-over-install-helper/src/main/java/at/asit/helper/Main.java
+++ /dev/null
@@ -1,135 +0,0 @@
-package at.asit.helper;
-
-import java.io.File;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-
-import org.apache.commons.io.FileUtils;
-
-
-
-
-/***
- *
- * @author aabraham
- *
- * @version 1.0.0
- *
- * The created jar is used as helper library when installing pdf-over.
- * Basically, the helper determines the java version used including architecture and
- * appends afterwards the right swt library since this swt is platform dependend.
- *
- */
-public class Main {
-
- private final static String SWT_VERSION = "4.20";
-
- public static void main(String[] args) {
-
- System.out.println("start post install task");
-
- copyLib();
-
- }
-
-
- public static int getArchBits() {
- String arch = System.getProperty("sun.arch.data.model");
- return arch.contains("64") ? 64 : 32;
- }
-
- public static String getSwtJarName() throws SWTLoadFailedException {
- String os = System.getProperty("os.name").toLowerCase();
- if (os.contains("win"))
- os = "windows";
- else if (os.contains("mac"))
- os = "mac";
- else if (os.contains("linux") || os.contains("nix"))
- os = "linux";
- else {
- throw new SWTLoadFailedException("Unknown OS: " + os);
- }
- return "swt-" + os + "-" + getArchBits() + ".jar";
- }
-
- public static String getSwtJarPath() {
- String path = "";
- try {
- path = URLDecoder.decode(Main.class.getProtectionDomain().getCodeSource().getLocation().getPath(), "UTF-8");
- int idx = path.lastIndexOf('/');
- idx = path.lastIndexOf('/', idx - 1);
- path = path.substring(0, idx + 1);
- } catch (UnsupportedEncodingException e) {
- // Ignore
- System.err.println("Unsuported Encoding Exception " + e.getMessage());
- }
- return path + "lib-swt/";
- }
-
- private static class SWTLoadFailedException extends Exception {
- private static final long serialVersionUID = 1L;
-
- SWTLoadFailedException(String msg) {
- super(msg);
- }
- }
-
-
- private static String getSwtTargetLibName() throws SWTLoadFailedException {
-
- String os = System.getProperty("os.name").toLowerCase();
- System.out.println("OS " + os + " detected!");
- String swtTargetLibName;
-
- if (os.contains("win")) {
- swtTargetLibName = "org.eclipse.swt.win32.win32.x86-" + SWT_VERSION + ".jar";
- }
- else if (os.contains("mac")) {
- swtTargetLibName = "org.eclipse.swt.cocoa.macosx-" + SWT_VERSION + ".jar";
- }
- else if (os.contains("linux") || os.contains("nix")) {
- swtTargetLibName = "org.eclipse.swt.gtk.linux.x86-" + SWT_VERSION + ".jar";
- }
- else {
- throw new SWTLoadFailedException("Unknown OS: " + os);
- }
- return swtTargetLibName;
-
-
- }
-
-
- private static void copyLib() {
- try {
- String swtLibPath = Main.getSwtJarPath() + Main.getSwtJarName();
- File swtLib = new File(swtLibPath);
- if (!swtLib.isFile()) {
-
- System.err.println("not found ");
- throw new SWTLoadFailedException("Library " + swtLibPath + " not found");
- }
-
- String newPath = swtLibPath.replace("lib-swt", "lib");
- newPath = newPath.replace(Main.getSwtJarName(), getSwtTargetLibName());
- File newFile = new File(newPath);
- System.out.println("Source Lib " + swtLibPath.toString());
- System.out.println("Target Lib " + newFile.toString());
- FileUtils.copyFile(swtLib, newFile);
-
- if (!newFile.isFile()) {
- System.err.println("not found ");
- throw new SWTLoadFailedException("Library " + swtLibPath + " not found");
- }
-
- System.out.println("success ");
- return;
-
-
- } catch(Exception e){
- e.printStackTrace();
- }
-
- }
-
-
-}
diff --git a/pom.xml b/pom.xml
index 7e030844..d192b582 100644
--- a/pom.xml
+++ b/pom.xml
@@ -81,7 +81,6 @@
</issueManagement>
<modules>
- <module>pdf-over-install-helper</module>
<module>pdf-over-commons</module>
<module>pdf-over-gui</module>
<module>pdf-over-signator</module>