this will make a YaCy icon in the tray area on supported platforms enabled by default the search page will open on double click used JDIC 0.9.4 from https://jdic.dev.java.net/ git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4992 6c8d7289-2bf4-0310-a012-ef5d649a1542pull/1/head
parent
4a7e5f377e
commit
f8a1e3175e
@ -1,42 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry excluding="env/|htdocsdefault/|proxymsg/|yacy/|env/|yacy/user/|yacy/user/|yacy/ui/|processing/domaingraph/applet/|processing/domaingraph/" kind="src" path="htroot"/>
|
||||
<classpathentry excluding="user/|user/|ui/" kind="src" path="htroot/yacy"/>
|
||||
<classpathentry kind="src" path="htroot/env"/>
|
||||
<classpathentry kind="src" path="source"/>
|
||||
<classpathentry kind="src" path="htroot/yacy/user"/>
|
||||
<classpathentry kind="src" path="htroot/yacy/ui"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="lib/tar.jar"/>
|
||||
<classpathentry kind="lib" path="libx/bzip2.jar"/>
|
||||
<classpathentry kind="lib" path="libx/commons-discovery.jar"/>
|
||||
<classpathentry kind="lib" path="libx/commons-jxpath-1.1.jar"/>
|
||||
<classpathentry kind="lib" path="libx/jakarta-oro-2.0.7.jar"/>
|
||||
<classpathentry kind="lib" path="libx/jaxrpc.jar"/>
|
||||
<classpathentry kind="lib" path="libx/jmimemagic-0.1.0.jar"/>
|
||||
<classpathentry kind="lib" path="libx/jrpm-head.jar"/>
|
||||
<classpathentry kind="lib" path="libx/jrpm-SNAPSHOT.jar"/>
|
||||
<classpathentry kind="lib" path="libx/jsch-0.1.21.jar"/>
|
||||
<classpathentry kind="lib" path="libx/log4j-1.2.9.jar"/>
|
||||
<classpathentry kind="lib" path="libx/odf_utils_05_11_29.jar"/>
|
||||
<classpathentry kind="lib" path="libx/saaj.jar"/>
|
||||
<classpathentry kind="lib" path="libx/sbbi-upnplib-1.0.3.jar"/>
|
||||
<classpathentry kind="lib" path="libx/tm-extractors-0.4.jar"/>
|
||||
<classpathentry kind="lib" path="libx/wsdl4j.jar"/>
|
||||
<classpathentry kind="lib" path="libx/xerces.jar"/>
|
||||
<classpathentry kind="lib" path="libx/poi-3.0-alpha2-20060616.jar"/>
|
||||
<classpathentry kind="lib" path="libx/poi-scratchpad-3.0-alpha2-20060616.jar"/>
|
||||
<classpathentry kind="lib" path="libx/inetlib.jar"/>
|
||||
<classpathentry kind="lib" path="libx/gnumail.jar"/>
|
||||
<classpathentry kind="lib" path="libx/activation.jar"/>
|
||||
<classpathentry kind="lib" path="libx/webcat-0.1-swf.jar"/>
|
||||
<classpathentry kind="lib" path="libx/J7Zip-modified.jar"/>
|
||||
<classpathentry kind="lib" path="libx/PDFBox-0.7.3.jar"/>
|
||||
<classpathentry kind="lib" path="libx/FontBox-0.1.0-dev.jar"/>
|
||||
<classpathentry kind="lib" path="libx/bcprov-jdk14-139.jar"/>
|
||||
<classpathentry kind="lib" path="libx/bcmail-jdk14-139.jar"/>
|
||||
<classpathentry kind="lib" path="libx/commons-codec-1.3.jar"/>
|
||||
<classpathentry kind="lib" path="lib/commons-httpclient-3.1.jar"/>
|
||||
<classpathentry kind="lib" path="lib/commons-logging-1.1.1.jar"/>
|
||||
<classpathentry kind="output" path="gen"/>
|
||||
</classpath>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry excluding="env/|htdocsdefault/|proxymsg/|yacy/|env/|yacy/user/|yacy/user/|yacy/ui/|processing/domaingraph/applet/|processing/domaingraph/" kind="src" path="htroot"/>
|
||||
<classpathentry excluding="user/|user/|ui/" kind="src" path="htroot/yacy"/>
|
||||
<classpathentry kind="src" path="htroot/env"/>
|
||||
<classpathentry kind="src" path="source"/>
|
||||
<classpathentry kind="src" path="htroot/yacy/user"/>
|
||||
<classpathentry kind="src" path="htroot/yacy/ui"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="lib/tar.jar"/>
|
||||
<classpathentry kind="lib" path="libx/bzip2.jar"/>
|
||||
<classpathentry kind="lib" path="libx/commons-discovery.jar"/>
|
||||
<classpathentry kind="lib" path="libx/commons-jxpath-1.1.jar"/>
|
||||
<classpathentry kind="lib" path="libx/jakarta-oro-2.0.7.jar"/>
|
||||
<classpathentry kind="lib" path="libx/jaxrpc.jar"/>
|
||||
<classpathentry kind="lib" path="libx/jmimemagic-0.1.0.jar"/>
|
||||
<classpathentry kind="lib" path="libx/jrpm-head.jar"/>
|
||||
<classpathentry kind="lib" path="libx/jrpm-SNAPSHOT.jar"/>
|
||||
<classpathentry kind="lib" path="libx/jsch-0.1.21.jar"/>
|
||||
<classpathentry kind="lib" path="libx/log4j-1.2.9.jar"/>
|
||||
<classpathentry kind="lib" path="libx/odf_utils_05_11_29.jar"/>
|
||||
<classpathentry kind="lib" path="libx/saaj.jar"/>
|
||||
<classpathentry kind="lib" path="libx/sbbi-upnplib-1.0.3.jar"/>
|
||||
<classpathentry kind="lib" path="libx/tm-extractors-0.4.jar"/>
|
||||
<classpathentry kind="lib" path="libx/wsdl4j.jar"/>
|
||||
<classpathentry kind="lib" path="libx/xerces.jar"/>
|
||||
<classpathentry kind="lib" path="libx/poi-3.0-alpha2-20060616.jar"/>
|
||||
<classpathentry kind="lib" path="libx/poi-scratchpad-3.0-alpha2-20060616.jar"/>
|
||||
<classpathentry kind="lib" path="libx/inetlib.jar"/>
|
||||
<classpathentry kind="lib" path="libx/gnumail.jar"/>
|
||||
<classpathentry kind="lib" path="libx/activation.jar"/>
|
||||
<classpathentry kind="lib" path="libx/webcat-0.1-swf.jar"/>
|
||||
<classpathentry kind="lib" path="libx/J7Zip-modified.jar"/>
|
||||
<classpathentry kind="lib" path="libx/PDFBox-0.7.3.jar"/>
|
||||
<classpathentry kind="lib" path="libx/FontBox-0.1.0-dev.jar"/>
|
||||
<classpathentry kind="lib" path="libx/bcprov-jdk14-139.jar"/>
|
||||
<classpathentry kind="lib" path="libx/bcmail-jdk14-139.jar"/>
|
||||
<classpathentry kind="lib" path="libx/commons-codec-1.3.jar"/>
|
||||
<classpathentry kind="lib" path="lib/commons-httpclient-3.1.jar"/>
|
||||
<classpathentry kind="lib" path="lib/commons-logging-1.1.1.jar"/>
|
||||
<classpathentry kind="lib" path="lib/jdic.jar"/>
|
||||
<classpathentry kind="output" path="gen"/>
|
||||
</classpath>
|
||||
|
After Width: | Height: | Size: 991 B |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,140 @@
|
||||
// yacyTray.java
|
||||
// (C) 2008 by David Wieditz; d.wieditz@gmx.de
|
||||
// first published 13.07.2008 on http://yacy.net
|
||||
//
|
||||
// This is a part of YaCy, a peer-to-peer based web search engine
|
||||
//
|
||||
// $LastChangedDate: $
|
||||
// $LastChangedRevision: $
|
||||
// $LastChangedBy: $
|
||||
//
|
||||
// LICENSE
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package de.anomic.yacy;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.io.File;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import org.jdesktop.jdic.tray.SystemTray;
|
||||
import org.jdesktop.jdic.tray.TrayIcon;
|
||||
|
||||
import de.anomic.plasma.plasmaSwitchboard;
|
||||
import de.anomic.server.serverSystem;
|
||||
|
||||
|
||||
public class yacyTray implements ActionListener, ItemListener {
|
||||
private boolean testing = false;
|
||||
|
||||
plasmaSwitchboard sb;
|
||||
|
||||
private long t1;
|
||||
|
||||
final private static SystemTray tray = SystemTray.getDefaultSystemTray();
|
||||
private static TrayIcon ti;
|
||||
|
||||
public yacyTray(plasmaSwitchboard sb, boolean showmenu) {
|
||||
this.sb = sb;
|
||||
|
||||
try {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if( Integer.parseInt(System.getProperty("java.version").substring(2,3)) >=5 )
|
||||
System.setProperty("javax.swing.adjustPopupLocationToFit", "false");
|
||||
|
||||
JPopupMenu menu;
|
||||
JMenuItem menuItem;
|
||||
|
||||
final String iconpath = sb.getRootPath().toString() + "/addon/YaCy_TrayIcon.gif".replace("/", File.separator);
|
||||
final ImageIcon i = new ImageIcon(iconpath);
|
||||
|
||||
// the menu is disabled because of visibility conflicts on windows (tested on xp)
|
||||
// anyway the code might be a template for future use
|
||||
if (showmenu) {
|
||||
// this is the popup menu
|
||||
menu = new JPopupMenu("YaCy");
|
||||
|
||||
// YaCy Search
|
||||
menuItem = new JMenuItem("YaCy Search");
|
||||
menuItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
openBrowser("");
|
||||
}
|
||||
});
|
||||
menu.add(menuItem);
|
||||
|
||||
// Quit
|
||||
if (testing) {
|
||||
menu.addSeparator();
|
||||
menuItem = new JMenuItem("Quit");
|
||||
menuItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
menu.add(menuItem);
|
||||
}
|
||||
|
||||
// Tray Icon
|
||||
ti = new TrayIcon(i, "YaCy", menu);
|
||||
} else {
|
||||
ti = new TrayIcon(i, "YaCy");
|
||||
}
|
||||
|
||||
ti.setIconAutoSize(true);
|
||||
ti.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
trayClickAction();
|
||||
}
|
||||
});
|
||||
tray.addTrayIcon(ti);
|
||||
}
|
||||
|
||||
private void trayClickAction(){ //detect doubleclick
|
||||
if(System.currentTimeMillis() - t1 < 500){
|
||||
openBrowser("");
|
||||
t1 = 0; //protecting against tripleclick
|
||||
} else { t1 = System.currentTimeMillis(); }
|
||||
}
|
||||
|
||||
private void openBrowser(String browserPopUpPage){
|
||||
// no need for https, because we are on localhost
|
||||
serverSystem.openBrowser("http://localhost:" + sb.getConfig("port", "8080") + "/" + browserPopUpPage);
|
||||
}
|
||||
|
||||
public void removeTray(){
|
||||
tray.removeTrayIcon(ti);
|
||||
}
|
||||
|
||||
public void displayBalloonMessage(String title, String message){
|
||||
ti.displayMessage(title, message, 0);
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) { }
|
||||
|
||||
public void itemStateChanged(ItemEvent e) { }
|
||||
|
||||
}
|
Loading…
Reference in new issue