Systray: Remove old 32-bit Windows implementation, replaced by DTG

This commit is contained in:
zzz
2016-10-25 23:59:20 +00:00
parent d2569fa446
commit 3063e37cbd
8 changed files with 6 additions and 313 deletions

View File

@ -28,7 +28,6 @@
<pathelement location="../../jetty/jettylib/javax.servlet.jar" />
<pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
<pathelement location="../../systray/java/build/obj" />
<pathelement location="../../systray/java/lib/systray4j.jar" />
<pathelement location="../../desktopgui/build" />
<pathelement location="../../../installer/lib/wrapper/all/wrapper.jar" />
<pathelement location="../../jrobin/jrobin-1.5.9.1.jar" />
@ -73,7 +72,6 @@
<pathelement location="../../jetty/jettylib/javax.servlet.jar" />
<pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
<pathelement location="../../systray/java/build/systray.jar" />
<pathelement location="../../systray/java/lib/systray4j.jar" />
<pathelement location="../../desktopgui/dist/desktopgui.jar" />
<pathelement location="../../../installer/lib/wrapper/all/wrapper.jar" />
<pathelement location="../../jrobin/jrobin-1.5.9.1.jar" />
@ -374,7 +372,6 @@
<pathelement location="${ant.home}/lib/ant.jar" />
<pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
<pathelement location="../../systray/java/build/obj" />
<pathelement location="../../systray/java/lib/systray4j.jar" />
<pathelement location="../../desktopgui/dist/desktopgui.jar" />
<pathelement location="../../../installer/lib/wrapper/all/wrapper.jar" />
<pathelement location="build/routerconsole.jar" />
@ -412,7 +409,6 @@
<pathelement location="../../jetty/jettylib/jetty-util.jar" />
<pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
<pathelement location="../../systray/java/build/obj" />
<pathelement location="../../systray/java/lib/systray4j.jar" />
<pathelement location="../../desktopgui/dist/desktopgui.jar" />
<pathelement location="../../../installer/lib/wrapper/all/wrapper.jar" />
<pathelement location="build/routerconsole.jar" />

View File

@ -25,7 +25,6 @@ import net.i2p.I2PAppContext;
import net.i2p.app.ClientAppManager;
import net.i2p.app.ClientAppState;
import static net.i2p.app.ClientAppState.*;
import net.i2p.apps.systray.SysTray;
import net.i2p.crypto.KeyStoreUtil;
import net.i2p.data.DataHelper;
import net.i2p.jetty.I2PLogger;
@ -294,8 +293,8 @@ public class RouterConsoleRunner implements RouterApp {
// required true for jrobin to work
System.setProperty("java.awt.headless", "true");
// this check is in SysTray but do it here too
if (SystemVersion.isWindows() && (!Boolean.getBoolean("systray.disable")) && (!SystemVersion.is64Bit()))
SysTray.getInstance();
//if (SystemVersion.isWindows() && (!Boolean.getBoolean("systray.disable")) && (!SystemVersion.is64Bit()))
// SysTray.getInstance();
}
} catch (Throwable t) {
t.printStackTrace();

View File

@ -16,7 +16,6 @@
<!-- Depend on classes instead of jars where available -->
<classpath>
<pathelement location="../../../core/java/build/obj" />
<pathelement location="lib/systray4j.jar" />
</classpath>
</depend>
</target>
@ -36,7 +35,7 @@
destdir="./build/obj"
includeAntRuntime="false"
includes="**/*.java"
classpath="./lib/systray4j.jar:../../../core/java/build/i2p.jar" >
classpath="../../../core/java/build/i2p.jar" >
<compilerarg line="${javac.compilerargs}" />
</javac>
</target>
@ -61,7 +60,6 @@
<jar destfile="./build/systray.jar" basedir="./build/obj" includes="**/*.class">
<manifest>
<attribute name="Main-Class" value="net.i2p.apps.systray.SysTray" />
<attribute name="Class-Path" value="systray4j.jar" />
<attribute name="Implementation-Version" value="${full.version}" />
<attribute name="Built-By" value="${build.built-by}" />
<attribute name="Build-Date" value="${build.timestamp}" />
@ -90,7 +88,7 @@
<mkdir dir="./build/javadoc" />
<javadoc
sourcepath="./src"
classpath="./src:./lib/systray4j.jar"
classpath="./src"
destdir="./build/javadoc"
packagenames="*"
use="true"

Binary file not shown.

Binary file not shown.

View File

@ -1,66 +0,0 @@
package net.i2p.apps.systray;
import java.lang.reflect.Method;
import net.i2p.util.SystemVersion;
/**
* A system tray control for launching the I2P router console.
*
* Not part of the public API. Works on 32-bit Windows only.
* To be removed or replaced.
*
* @since implementation moved to SysTrayImpl in 0.9.26
*/
public class SysTray {
/**
* Warning - systray4j.jar may not be present - may return null.
* As of 0.9.26, uses reflection so we may compile without systray4j.jar.
*
* @return null if not supported, since 0.9.26 (prior to that would throw NoClassDefFoundError)
* @since 0.8.1
*/
public static SysTray getInstance() {
if (SystemVersion.isWindows() && !SystemVersion.is64Bit())
return getImpl();
return null;
}
/**
* Warning - systray4j.jar may not be present - may return null
*
* @return null if not supported
* @since 0.9.26
*/
private static SysTray getImpl() {
try {
Class<?> impl = Class.forName("net.i2p.apps.systray.SysTrayImpl", true, ClassLoader.getSystemClassLoader());
Method getInstance = impl.getMethod("getInstance");
return (SysTray) getInstance.invoke(null,(Object[]) null);
} catch (Throwable t) {
System.out.println("WARN: Unable to start systray");
t.printStackTrace();
return null;
}
}
/**
* This mimics what is now in SysTrayImpl.main(),
* not that anybody was using that.
*/
public static void main(String[] args) {
SysTray impl = getImpl();
if (impl == null) {
System.out.println("No systray implementation found");
System.exit(1);
}
System.err.println("Hit ^C to exit");
Thread t = Thread.currentThread();
synchronized(t) {
try {
t.wait();
} catch (InterruptedException ie) {}
}
}
}

View File

@ -1,218 +0,0 @@
/*
* I2P - An anonymous, secure, and fully-distributed communication network.
*
* SysTray.java
* 2004 The I2P Project
* http://www.i2p.net
* This code is public domain.
*/
package net.i2p.apps.systray;
import java.awt.Frame;
import java.io.File;
import java.io.IOException;
import net.i2p.I2PAppContext;
import net.i2p.util.SimpleTimer;
import net.i2p.util.SimpleTimer2;
import net.i2p.util.SystemVersion;
import snoozesoft.systray4j.SysTrayMenu;
import snoozesoft.systray4j.SysTrayMenuEvent;
import snoozesoft.systray4j.SysTrayMenuIcon;
import snoozesoft.systray4j.SysTrayMenuItem;
import snoozesoft.systray4j.SysTrayMenuListener;
/**
* A system tray control for launching the I2P router console.
*
* Not part of the public API. Works on 32-bit Windows only.
* To be removed or replaced.
* This source file may be safely removed in non-Windows builds.
*
* @author hypercubus
* @since moved from SysTray in 0.9.26
* @deprecated
*/
@Deprecated
class SysTrayImpl extends SysTray implements SysTrayMenuListener {
private static BrowserChooser _browserChooser;
private static String _browserString;
private static ConfigFile _configFile = new ConfigFile();
private static Frame _frame;
private static SysTrayImpl _instance;
private static String _portString;
private static boolean _showIcon;
private static final boolean _is64 = SystemVersion.is64Bit();
static {
File config = new File(I2PAppContext.getGlobalContext().getConfigDir(), "systray.config");
if (!_configFile.init(config.getAbsolutePath())) {
_configFile.setProperty("browser", "default");
_configFile.setProperty("port", "7657");
}
_browserString = _configFile.getProperty("browser", "default");
_portString = _configFile.getProperty("port", "7657");
_showIcon = Boolean.parseBoolean(_configFile.getProperty("visible", "true"));
//if (!(new File("router.config")).exists())
// openRouterConsole("http://localhost:" + _portString + "/index.jsp");
if ( (SystemVersion.isWindows()) && (!Boolean.getBoolean("systray.disable")) && (!_is64))
_instance = new SysTrayImpl();
}
private SysTrayMenuItem _itemOpenConsole = new SysTrayMenuItem("Open router console", "openconsole");
private SysTrayMenuItem _itemSelectBrowser = new SysTrayMenuItem("Select browser...", "selectbrowser");
// private SysTrayMenuItem _itemShutdown = new SysTrayMenuItem("Shut down I2P router", "shutdown");
private SysTrayMenuIcon _sysTrayMenuIcon = new SysTrayMenuIcon("icons/iggy");
private SysTrayMenu _sysTrayMenu = new SysTrayMenu(_sysTrayMenuIcon, "I2P Control");
private SysTrayImpl() {
_sysTrayMenuIcon.addSysTrayMenuListener(this);
createSysTrayMenu();
SimpleTimer2.getInstance().addPeriodicEvent(new RefreshDisplayEvent(), REFRESH_DISPLAY_FREQUENCY);
}
private static final long REFRESH_DISPLAY_FREQUENCY = 30*1000;
private class RefreshDisplayEvent implements SimpleTimer.TimedEvent {
public void timeReached() {
refreshDisplay();
}
}
/**
* Warning - systray4j.jar may not be present - may throw NoClassDefFoundError
*
* @throws NoClassDefFoundError
* @since 0.8.1
*/
public static synchronized SysTrayImpl getInstance() {
return _instance;
}
private static void openRouterConsole(String url) {
String browser = null;
UrlLauncher urlLauncher = new UrlLauncher();
if (_browserString == null || _browserString.equals("default")) {
try {
if (urlLauncher.openUrl(url))
return;
} catch (IOException ex) {
// Fall through.
}
} else {
try {
if (urlLauncher.openUrl(url, _browserString))
return;
} catch (IOException ex) {
// Fall through.
}
}
if (!(browser = promptForBrowser("Please select another browser")).equals("nullnull"))
setBrowser(browser);
}
private static String promptForBrowser(String windowTitle) {
String browser = null;
_frame = new Frame();
_browserChooser = new BrowserChooser(_frame, windowTitle);
browser = _browserChooser.getDirectory() + _browserChooser.getFile();
_browserChooser = null;
_frame = null;
return browser;
}
private static void setBrowser(String browser) {
_browserString = browser;
_configFile.setProperty("browser", browser);
}
public void refreshDisplay() {
if (_showIcon)
_sysTrayMenu.showIcon();
else
_sysTrayMenu.hideIcon();
}
public void hide() {
_configFile.setProperty("visible", "false");
_showIcon = false;
_sysTrayMenu.hideIcon();
}
public void iconLeftClicked(SysTrayMenuEvent e) {}
public void iconLeftDoubleClicked(SysTrayMenuEvent e) {
openRouterConsole("http://127.0.0.1:" + _portString + "/index.jsp");
}
public void menuItemSelected(SysTrayMenuEvent e) {
String browser = null;
// if (e.getActionCommand().equals("shutdown")) {
// _browserChooser = null;
// _frame = null;
// _itemShutdown = null;
// _itemSelectBrowser = null;
// _sysTrayMenuIcon = null;
// _sysTrayMenu = null;
// _browserChooser = null;
// _frame = null;
// System.exit(0);
if (e.getActionCommand().equals("selectbrowser")) {
if (!(browser = promptForBrowser("Select browser")).equals("nullnull"))
setBrowser(browser);
} else if (e.getActionCommand().equals("openconsole")) {
openRouterConsole("http://127.0.0.1:" + _portString + "/index.jsp");
}
}
public void show() {
_configFile.setProperty("visible", "true");
_showIcon = true;
_sysTrayMenu.showIcon();
}
private void createSysTrayMenu() {
// _itemShutdown.addSysTrayMenuListener(this);
_itemSelectBrowser.addSysTrayMenuListener(this);
_itemOpenConsole.addSysTrayMenuListener(this);
// _sysTrayMenu.addItem(_itemShutdown);
// _sysTrayMenu.addSeparator();
// hide it, as there have been reports of b0rked behavior on some JVMs.
// specifically, that on XP & sun1.5.0.1, a user launching i2p w/out the
// service wrapper would create netDb/, peerProfiles/, and other files
// underneath each directory browsed to - as if the router's "." directory
// is changing whenever the itemSelectBrowser's JFileChooser changed
// directories. This has not been reproduced or confirmed yet, but is
// pretty scary, and this function isn't too necessary.
//_sysTrayMenu.addItem(_itemSelectBrowser);
_sysTrayMenu.addItem(_itemOpenConsole);
refreshDisplay();
}
/**
* Starts SysTray, even on linux (but requires kde3 libsystray4j.so to do anything)
* @since 0.8.1
*/
public static void main(String args[]) {
System.err.println("SysTray4j version " + SysTrayMenu.VERSION);
System.err.println("Hit ^C to exit");
new SysTrayImpl();
Thread t = Thread.currentThread();
synchronized(t) {
try {
t.wait();
} catch (InterruptedException ie) {}
}
}
}

View File

@ -519,7 +519,7 @@
<jar destfile="./build/launchi2p.jar">
<manifest>
<attribute name="Main-Class" value="net.i2p.router.RouterLaunch" />
<attribute name="Class-Path" value="lib/i2p.jar lib/router.jar lib/jbigi.jar lib/BOB.jar lib/sam.jar lib/mstreaming.jar lib/streaming.jar lib/routerconsole.jar lib/i2ptunnel.jar lib/org.mortbay.jetty.jar lib/javax.servlet.jar lib/jasper-runtime.jar lib/commons-logging.jar lib/commons-el.jar lib/wrapper.jar lib/systray.jar lib/systray4j.jar lib/desktopgui.jar lib/i2psnark.jar lib/jrobin.jar lib/jstl.jar lib/standard.jar lib/jetty-continuation.jar lib/jetty-deploy.jar lib/jetty-http.jar lib/jetty-i2p.jar lib/jetty-io.jar lib/jetty-rewrite-handler.jar lib/jetty-security.jar lib/jetty-servlet.jar lib/jetty-servlets.jar lib/jetty-start.jar lib/jetty-util.jar lib/jetty-webapp.jar lib/jetty-xml.jar" />
<attribute name="Class-Path" value="lib/i2p.jar lib/router.jar lib/jbigi.jar lib/BOB.jar lib/sam.jar lib/mstreaming.jar lib/streaming.jar lib/routerconsole.jar lib/i2ptunnel.jar lib/org.mortbay.jetty.jar lib/javax.servlet.jar lib/jasper-runtime.jar lib/commons-logging.jar lib/commons-el.jar lib/wrapper.jar lib/systray.jar lib/desktopgui.jar lib/i2psnark.jar lib/jrobin.jar lib/jstl.jar lib/standard.jar lib/jetty-continuation.jar lib/jetty-deploy.jar lib/jetty-http.jar lib/jetty-i2p.jar lib/jetty-io.jar lib/jetty-rewrite-handler.jar lib/jetty-security.jar lib/jetty-servlet.jar lib/jetty-servlets.jar lib/jetty-start.jar lib/jetty-util.jar lib/jetty-webapp.jar lib/jetty-xml.jar" />
<attribute name="Built-By" value="${build.built-by}" />
<attribute name="Build-Date" value="${build.timestamp}" />
<attribute name="Base-Revision" value="${workspace.version}" />
@ -778,7 +778,6 @@
<pathelement location="apps/jetty/jettylib/jetty-util.jar" />
<pathelement location="apps/jetty/jettylib/jetty-webapp.jar" />
<pathelement location="apps/jetty/jettylib/jetty-xml.jar" />
<pathelement location="apps/systray/java/lib/systray4j.jar" />
<pathelement location="apps/jrobin/jrobin-1.5.9.1.jar" />
<pathelement location="installer/lib/wrapper/all/wrapper.jar" />
<!-- following are only for debian builds -->
@ -1162,10 +1161,6 @@
<target name="preppkg-windows" depends="preppkg-base, preplicenses-windows, buildUtilityJar, buildexe">
<copy file="build/i2p.exe" todir="pkg-temp/" failonerror="false" />
<copy file="apps/systray/java/lib/systray4j.jar" todir="pkg-temp/lib" />
<copy file="apps/systray/java/lib/systray4j.dll" todir="pkg-temp/lib" />
<copy file="apps/systray/java/resources/iggy.ico" todir="pkg-temp/icons" />
<copy file="apps/systray/java/resources/iggy.xpm" todir="pkg-temp/icons" />
<copy file="installer/resources/eepget.bat" todir="pkg-temp/" />
<copy file="installer/resources/i2prouter.bat" todir="pkg-temp/" />
<copy file="installer/resources/fixperms.bat" todir="pkg-temp/" />
@ -1889,7 +1884,7 @@
<arg value="-output"/>
<arg value="i2p.fba"/>
<arg value="-auxclasspath"/>
<arg value="build/commons-el.jar:build/commons-logging.jar:build/jasper-runtime.jar:build/javax.servlet.jar:build/org.mortbay.jetty.jar:apps/jrobin/jrobin-1.5.9.1.jar:apps/systray/java/lib/systray4j.jar:installer/lib/wrapper/all/wrapper.jar:apps/susidns/src/lib/standard.jar:apps/susidns/src/lib/jstl.jar:apps/jrobin/jrobin-1.5.9.1.jar"/>
<arg value="build/commons-el.jar:build/commons-logging.jar:build/jasper-runtime.jar:build/javax.servlet.jar:build/org.mortbay.jetty.jar:apps/jrobin/jrobin-1.5.9.1.jar:installer/lib/wrapper/all/wrapper.jar:apps/susidns/src/lib/standard.jar:apps/susidns/src/lib/jstl.jar:apps/jrobin/jrobin-1.5.9.1.jar"/>
<arg value="-sourcepath"/>
<arg value="apps/BOB/src/:apps/addressbook/java/src/:apps/i2psnark/java/src/:apps/i2ptunnel/java/src/:apps/ministreaming/java/src/:apps/routerconsole/java/src/:apps/sam/java/src/:apps/streaming/java/src/:apps/susidns/src/java/src/:apps/susimail/src/src/:apps/systray/java/src/:core/java/src/:router/java/src/:installer/java/src"/>
<!-- start of the files to be analyzed -->
@ -2190,9 +2185,6 @@
<!--
<fileset dir="../i2p-${Extended.Version}/core/java/src/org/apache/http" />
-->
<!-- systray4j -->
<fileset dir="../i2p-${Extended.Version}/apps/systray/java/lib" />
<file name="../i2p-${Extended.Version}/apps/systray/java/src/net/i2p/apps/systray/SysTrayImpl.java" />
<!-- geoip-database -->
<file name="../i2p-${Extended.Version}/installer/resources/geoip.txt" />
<file name="../i2p-${Extended.Version}/installer/resources/geoipv6.dat.gz" />
@ -2275,9 +2267,6 @@
<!--
<fileset dir="../i2p-${Extended.Version}/core/java/src/org/apache/http" />
-->
<!-- systray4j -->
<fileset dir="../i2p-${Extended.Version}/apps/systray/java/lib" />
<file name="../i2p-${Extended.Version}/apps/systray/java/src/net/i2p/apps/systray/SysTrayImpl.java" />
<!-- geoip-database -->
<file name="../i2p-${Extended.Version}/installer/resources/geoip.txt" />
<file name="../i2p-${Extended.Version}/installer/resources/geoipv6.dat.gz" />
@ -2358,8 +2347,6 @@
<!--
<fileset dir="../i2p-${Extended.Version}/core/java/src/org/apache/http" />
-->
<fileset dir="../i2p-${Extended.Version}/apps/systray/java/lib" />
<file name="../i2p-${Extended.Version}/apps/systray/java/src/net/i2p/apps/systray/SysTrayImpl.java" />
<file name="../i2p-${Extended.Version}/installer/resources/geoip.txt" />
<file name="../i2p-${Extended.Version}/installer/resources/geoipv6.dat.gz" />
<fileset dir="../i2p-${Extended.Version}/apps/jetty/jetty-distribution-8.1.17.v20150415" />
@ -2489,9 +2476,6 @@
</target>
<!-- *3* os dependent procedure/commands -->
<target name = "preppkg-portable-win32" depends="preppkg-portable-win32-jbigi,preppkg-portable-basic">
<!-- systray4.j - why do we need trayicons for portable version ? dependency hardcoded in console -->
<copy file="apps/systray/java/lib/systray4j.dll" todir="pkg-temp/lib" />
<copy file="apps/systray/java/lib/systray4j.jar" todir="pkg-temp/lib" />
<!--wrapper - dont even think about it. i2p cosumes appreantly more mem without it on win32-->
<copy file="installer/lib/wrapper/win32/wrapper.dll" todir="pkg-temp/lib" />
<copy file="installer/lib/wrapper/all/wrapper.jar" todir="pkg-temp/lib" />