mirror of
https://github.com/deathmarine/Luyten.git
synced 2025-02-17 04:59:01 +00:00
Open file from command line (or as a Total Commander external viewer)
This commit is contained in:
parent
4999971014
commit
9c2362b504
294
pom.xml
294
pom.xml
@ -1,148 +1,148 @@
|
||||
<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>us.deathmarine</groupId>
|
||||
<artifactId>luyten</artifactId>
|
||||
<version>0.4.1</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.fifesoft</groupId>
|
||||
<artifactId>rsyntaxtextarea</artifactId>
|
||||
<version>LATEST</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bitbucket.mstrobel</groupId>
|
||||
<artifactId>procyon-core</artifactId>
|
||||
<version>LATEST</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bitbucket.mstrobel</groupId>
|
||||
<artifactId>procyon-expressions</artifactId>
|
||||
<version>LATEST</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bitbucket.mstrobel</groupId>
|
||||
<artifactId>procyon-reflection</artifactId>
|
||||
<version>LATEST</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bitbucket.mstrobel</groupId>
|
||||
<artifactId>procyon-compilertools</artifactId>
|
||||
<version>LATEST</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
<id>central</id>
|
||||
<name>Central Repository</name>
|
||||
<url>http://repo.maven.apache.org/maven2</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<finalName>${project.artifactId}-${project.version}-lib</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src</directory>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>Assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>com.modcrafting.luyten.Model</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.bluestemsoftware.open.maven.plugin</groupId>
|
||||
<artifactId>launch4j-plugin</artifactId>
|
||||
<version>1.5.0.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>l4j-gui</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>launch4j</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<headerType>gui</headerType>
|
||||
<outfile>target/${project.artifactId}-${project.version}.exe</outfile>
|
||||
<jar>target/${project.artifactId}-${project.version}.jar</jar>
|
||||
<errTitle>App Err</errTitle>
|
||||
<classPath>
|
||||
<mainClass>com.modcrafting.luyten.Model</mainClass>
|
||||
</classPath>
|
||||
<icon>Luyten.ico</icon>
|
||||
<jre>
|
||||
<minVersion>1.6.0</minVersion>
|
||||
<maxVersion>1.8.0</maxVersion>
|
||||
<initialHeapSize>128</initialHeapSize>
|
||||
<maxHeapSize>1024</maxHeapSize>
|
||||
</jre>
|
||||
<versionInfo>
|
||||
<fileVersion>0.${project.version}</fileVersion>
|
||||
<txtFileVersion>0.${project.version}</txtFileVersion>
|
||||
<fileDescription>Java Decompiler</fileDescription>
|
||||
<copyright>2014</copyright>
|
||||
<productVersion>0.${project.version}</productVersion>
|
||||
<txtProductVersion>0.${project.version}</txtProductVersion>
|
||||
<productName>${project.artifactId}</productName>
|
||||
<internalName>${project.artifactId}</internalName>
|
||||
<originalFilename>Luyten.exe</originalFilename>
|
||||
</versionInfo>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9</version>
|
||||
<configuration>
|
||||
<show>public</show>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<reporting>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9</version>
|
||||
<configuration>
|
||||
<show>public</show>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
<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>us.deathmarine</groupId>
|
||||
<artifactId>luyten</artifactId>
|
||||
<version>0.4.1</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.fifesoft</groupId>
|
||||
<artifactId>rsyntaxtextarea</artifactId>
|
||||
<version>LATEST</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bitbucket.mstrobel</groupId>
|
||||
<artifactId>procyon-core</artifactId>
|
||||
<version>LATEST</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bitbucket.mstrobel</groupId>
|
||||
<artifactId>procyon-expressions</artifactId>
|
||||
<version>LATEST</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bitbucket.mstrobel</groupId>
|
||||
<artifactId>procyon-reflection</artifactId>
|
||||
<version>LATEST</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bitbucket.mstrobel</groupId>
|
||||
<artifactId>procyon-compilertools</artifactId>
|
||||
<version>LATEST</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
<id>central</id>
|
||||
<name>Central Repository</name>
|
||||
<url>http://repo.maven.apache.org/maven2</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<finalName>${project.artifactId}-${project.version}-lib</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src</directory>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>Assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>com.modcrafting.luyten.Luyten</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.bluestemsoftware.open.maven.plugin</groupId>
|
||||
<artifactId>launch4j-plugin</artifactId>
|
||||
<version>1.5.0.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>l4j-gui</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>launch4j</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<headerType>gui</headerType>
|
||||
<outfile>target/${project.artifactId}-${project.version}.exe</outfile>
|
||||
<jar>target/${project.artifactId}-${project.version}.jar</jar>
|
||||
<errTitle>App Err</errTitle>
|
||||
<classPath>
|
||||
<mainClass>com.modcrafting.luyten.Luyten</mainClass>
|
||||
</classPath>
|
||||
<icon>Luyten.ico</icon>
|
||||
<jre>
|
||||
<minVersion>1.6.0</minVersion>
|
||||
<maxVersion>1.8.0</maxVersion>
|
||||
<initialHeapSize>128</initialHeapSize>
|
||||
<maxHeapSize>1024</maxHeapSize>
|
||||
</jre>
|
||||
<versionInfo>
|
||||
<fileVersion>0.${project.version}</fileVersion>
|
||||
<txtFileVersion>0.${project.version}</txtFileVersion>
|
||||
<fileDescription>Java Decompiler</fileDescription>
|
||||
<copyright>2014</copyright>
|
||||
<productVersion>0.${project.version}</productVersion>
|
||||
<txtProductVersion>0.${project.version}</txtProductVersion>
|
||||
<productName>${project.artifactId}</productName>
|
||||
<internalName>${project.artifactId}</internalName>
|
||||
<originalFilename>Luyten.exe</originalFilename>
|
||||
</versionInfo>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9</version>
|
||||
<configuration>
|
||||
<show>public</show>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<reporting>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9</version>
|
||||
<configuration>
|
||||
<show>public</show>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
</project>
|
@ -1,5 +1,6 @@
|
||||
package com.modcrafting.luyten;
|
||||
|
||||
import java.io.File;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
@ -15,12 +16,30 @@ public class Luyten {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// for TotalCommander External Viewer setting:
|
||||
// javaw -jar "c:\Program Files\Luyten\luyten.jar"
|
||||
// (TC will not complain about temporary file when opening .class from .zip or .jar)
|
||||
final File fileFromCommandLine = getFileFromCommandLine(args);
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MainWindow mainWindow = new MainWindow();
|
||||
MainWindow mainWindow = new MainWindow(fileFromCommandLine);
|
||||
mainWindow.setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static File getFileFromCommandLine(String[] args) {
|
||||
File fileFromCommandLine = null;
|
||||
try {
|
||||
if (args.length > 0) {
|
||||
String realFileName = new File(args[0]).getCanonicalPath();
|
||||
fileFromCommandLine = new File(realFileName);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return fileFromCommandLine;
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public class MainWindow extends JFrame {
|
||||
private FileDialog fileDialog;
|
||||
private FileSaver fileSaver;
|
||||
|
||||
public MainWindow() {
|
||||
public MainWindow(File fileFromCommandLine) {
|
||||
configSaver = ConfigSaver.getLoadedInstance();
|
||||
windowPosition = configSaver.getMainWindowPosition();
|
||||
luytenPrefs = configSaver.getLuytenPreferences();
|
||||
@ -77,6 +77,10 @@ public class MainWindow extends JFrame {
|
||||
this.getContentPane().add(model);
|
||||
this.add(pane, BorderLayout.SOUTH);
|
||||
|
||||
if (fileFromCommandLine != null) {
|
||||
model.loadFile(fileFromCommandLine);
|
||||
}
|
||||
|
||||
try {
|
||||
DropTarget dt = new DropTarget();
|
||||
dt.addDropTargetListener(new DropListener(this));
|
||||
|
@ -551,6 +551,10 @@ public class Model extends JSplitPane {
|
||||
settings.setTypeLoader(new InputTypeLoader());
|
||||
open = true;
|
||||
label.setText("Complete");
|
||||
|
||||
// open it automatically
|
||||
TreePath trp = new TreePath(top.getPath());
|
||||
openEntryByTreePath(trp);
|
||||
}
|
||||
} catch (TooLargeFileException e) {
|
||||
label.setText("File is too large: " + file.getName() + " - size: " + e.getReadableFileSize());
|
||||
|
Loading…
x
Reference in New Issue
Block a user