From 329e16a250aa5a42dcc314b4f8ab3a0396111b68 Mon Sep 17 00:00:00 2001 From: krakjoe Date: Fri, 20 Dec 2013 12:51:24 +0000 Subject: tidy up repository for merging --- tutorials/java/build.xml | 73 - tutorials/java/dist/README.TXT | 32 - tutorials/java/dist/phpdbg-ui.jar | Bin 45423 -> 0 bytes tutorials/java/manifest.mf | 3 - tutorials/java/nbproject/build-impl.xml | 1407 -------------------- tutorials/java/nbproject/genfiles.properties | 8 - tutorials/java/nbproject/private/config.properties | 0 .../java/nbproject/private/private.properties | 6 - tutorials/java/nbproject/project.properties | 76 -- tutorials/java/nbproject/project.xml | 15 - tutorials/java/src/phpdbg/ui/CommandHistory.java | 49 - tutorials/java/src/phpdbg/ui/DebugSocket.java | 157 --- tutorials/java/src/phpdbg/ui/JConsole.form | 225 ---- tutorials/java/src/phpdbg/ui/JConsole.java | 471 ------- tutorials/java/src/phpdbg/ui/JTerminalPane.java | 182 --- tutorials/java/src/phpdbg/ui/logo-dbg.png | Bin 248 -> 0 bytes tutorials/java/src/phpdbg/ui/logo-small.png | Bin 4964 -> 0 bytes 17 files changed, 2704 deletions(-) delete mode 100644 tutorials/java/build.xml delete mode 100644 tutorials/java/dist/README.TXT delete mode 100644 tutorials/java/dist/phpdbg-ui.jar delete mode 100644 tutorials/java/manifest.mf delete mode 100644 tutorials/java/nbproject/build-impl.xml delete mode 100644 tutorials/java/nbproject/genfiles.properties delete mode 100644 tutorials/java/nbproject/private/config.properties delete mode 100644 tutorials/java/nbproject/private/private.properties delete mode 100644 tutorials/java/nbproject/project.properties delete mode 100644 tutorials/java/nbproject/project.xml delete mode 100644 tutorials/java/src/phpdbg/ui/CommandHistory.java delete mode 100644 tutorials/java/src/phpdbg/ui/DebugSocket.java delete mode 100644 tutorials/java/src/phpdbg/ui/JConsole.form delete mode 100644 tutorials/java/src/phpdbg/ui/JConsole.java delete mode 100644 tutorials/java/src/phpdbg/ui/JTerminalPane.java delete mode 100644 tutorials/java/src/phpdbg/ui/logo-dbg.png delete mode 100644 tutorials/java/src/phpdbg/ui/logo-small.png (limited to 'tutorials/java') diff --git a/tutorials/java/build.xml b/tutorials/java/build.xml deleted file mode 100644 index b8895fa38e..0000000000 --- a/tutorials/java/build.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - Builds, tests, and runs the project phpdbg-ui. - - - diff --git a/tutorials/java/dist/README.TXT b/tutorials/java/dist/README.TXT deleted file mode 100644 index 74e385cc4f..0000000000 --- a/tutorials/java/dist/README.TXT +++ /dev/null @@ -1,32 +0,0 @@ -======================== -BUILD OUTPUT DESCRIPTION -======================== - -When you build an Java application project that has a main class, the IDE -automatically copies all of the JAR -files on the projects classpath to your projects dist/lib folder. The IDE -also adds each of the JAR files to the Class-Path element in the application -JAR files manifest file (MANIFEST.MF). - -To run the project from the command line, go to the dist folder and -type the following: - -java -jar "phpdbg-ui.jar" - -To distribute this project, zip up the dist folder (including the lib folder) -and distribute the ZIP file. - -Notes: - -* If two JAR files on the project classpath have the same name, only the first -JAR file is copied to the lib folder. -* Only JAR files are copied to the lib folder. -If the classpath contains other types of files or folders, these files (folders) -are not copied. -* If a library on the projects classpath also has a Class-Path element -specified in the manifest,the content of the Class-Path element has to be on -the projects runtime path. -* To set a main class in a standard Java project, right-click the project node -in the Projects window and choose Properties. Then click Run and enter the -class name in the Main Class field. Alternatively, you can manually type the -class name in the manifest Main-Class element. diff --git a/tutorials/java/dist/phpdbg-ui.jar b/tutorials/java/dist/phpdbg-ui.jar deleted file mode 100644 index 0de3d09b7d..0000000000 Binary files a/tutorials/java/dist/phpdbg-ui.jar and /dev/null differ diff --git a/tutorials/java/manifest.mf b/tutorials/java/manifest.mf deleted file mode 100644 index 328e8e5bc3..0000000000 --- a/tutorials/java/manifest.mf +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -X-COMMENT: Main-Class will be added automatically by build - diff --git a/tutorials/java/nbproject/build-impl.xml b/tutorials/java/nbproject/build-impl.xml deleted file mode 100644 index f937ce8944..0000000000 --- a/tutorials/java/nbproject/build-impl.xml +++ /dev/null @@ -1,1407 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set src.dir - Must set test.src.dir - Must set build.dir - Must set dist.dir - Must set build.classes.dir - Must set dist.javadoc.dir - Must set build.test.classes.dir - Must set build.test.results.dir - Must set build.classes.excludes - Must set dist.jar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - No tests executed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set JVM to use for profiling in profiler.info.jvm - Must set profiler agent JVM arguments in profiler.info.jvmargs.agent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To run this application from the command line without Ant, try: - - java -jar "${dist.jar.resolved}" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - Must select one file in the IDE or set run.class - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set debug.class - - - - - Must select one file in the IDE or set debug.class - - - - - Must set fix.includes - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - Must select one file in the IDE or set profile.class - This target only works when run from inside the NetBeans IDE. - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - - - Must select some files in the IDE or set test.includes - - - - - Must select one file in the IDE or set run.class - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - Some tests failed; see details above. - - - - - - - - - Must select some files in the IDE or set test.includes - - - - Some tests failed; see details above. - - - - Must select some files in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - Some tests failed; see details above. - - - - - Must select one file in the IDE or set test.class - - - - Must select one file in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - - - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tutorials/java/nbproject/genfiles.properties b/tutorials/java/nbproject/genfiles.properties deleted file mode 100644 index 0b6d3d0efb..0000000000 --- a/tutorials/java/nbproject/genfiles.properties +++ /dev/null @@ -1,8 +0,0 @@ -build.xml.data.CRC32=ed67686a -build.xml.script.CRC32=8c03bdb5 -build.xml.stylesheet.CRC32=8064a381@1.68.1.46 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=ed67686a -nbproject/build-impl.xml.script.CRC32=ea01fe36 -nbproject/build-impl.xml.stylesheet.CRC32=5a01deb7@1.68.1.46 diff --git a/tutorials/java/nbproject/private/config.properties b/tutorials/java/nbproject/private/config.properties deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tutorials/java/nbproject/private/private.properties b/tutorials/java/nbproject/private/private.properties deleted file mode 100644 index 9595bd60a1..0000000000 --- a/tutorials/java/nbproject/private/private.properties +++ /dev/null @@ -1,6 +0,0 @@ -compile.on.save=true -do.depend=false -do.jar=true -javac.debug=true -javadoc.preview=true -user.properties.file=/home/joe/.netbeans/7.4/build.properties diff --git a/tutorials/java/nbproject/project.properties b/tutorials/java/nbproject/project.properties deleted file mode 100644 index df42d35d16..0000000000 --- a/tutorials/java/nbproject/project.properties +++ /dev/null @@ -1,76 +0,0 @@ -annotation.processing.enabled=true -annotation.processing.enabled.in.editor=false -annotation.processing.processors.list= -annotation.processing.run.all.processors=true -annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output -application.title=phpdbg-ui -application.vendor=joe -build.classes.dir=${build.dir}/classes -build.classes.excludes=**/*.java,**/*.form -# This directory is removed when the project is cleaned: -build.dir=build -build.generated.dir=${build.dir}/generated -build.generated.sources.dir=${build.dir}/generated-sources -# Only compile against the classpath explicitly listed here: -build.sysclasspath=ignore -build.test.classes.dir=${build.dir}/test/classes -build.test.results.dir=${build.dir}/test/results -# Uncomment to specify the preferred debugger connection transport: -#debug.transport=dt_socket -debug.classpath=\ - ${run.classpath} -debug.test.classpath=\ - ${run.test.classpath} -# Files in build.classes.dir which should be excluded from distribution jar -dist.archive.excludes= -# This directory is removed when the project is cleaned: -dist.dir=dist -dist.jar=${dist.dir}/phpdbg-ui.jar -dist.javadoc.dir=${dist.dir}/javadoc -endorsed.classpath= -excludes= -includes=** -jar.compress=false -javac.classpath=\ - ${libs.eclipselink.classpath} -# Space-separated list of extra javac options -javac.compilerargs= -javac.deprecation=false -javac.processorpath=\ - ${javac.classpath} -javac.source=1.7 -javac.target=1.7 -javac.test.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -javac.test.processorpath=\ - ${javac.test.classpath} -javadoc.additionalparam= -javadoc.author=false -javadoc.encoding=${source.encoding} -javadoc.noindex=false -javadoc.nonavbar=false -javadoc.notree=false -javadoc.private=false -javadoc.splitindex=true -javadoc.use=true -javadoc.version=false -javadoc.windowtitle= -main.class=phpdbg.ui.JConsole -manifest.file=manifest.mf -meta.inf.dir=${src.dir}/META-INF -mkdist.disabled=false -platform.active=default_platform -run.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -# Space-separated list of JVM arguments used when running the project. -# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. -# To set system properties for unit tests define test-sys-prop.name=value: -run.jvmargs= -run.test.classpath=\ - ${javac.test.classpath}:\ - ${build.test.classes.dir} -source.encoding=UTF-8 -src.dir=src -test.src.dir=test diff --git a/tutorials/java/nbproject/project.xml b/tutorials/java/nbproject/project.xml deleted file mode 100644 index 0c410ae796..0000000000 --- a/tutorials/java/nbproject/project.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - org.netbeans.modules.java.j2seproject - - - phpdbg-ui - - - - - - - - - diff --git a/tutorials/java/src/phpdbg/ui/CommandHistory.java b/tutorials/java/src/phpdbg/ui/CommandHistory.java deleted file mode 100644 index b8a3b0ff0a..0000000000 --- a/tutorials/java/src/phpdbg/ui/CommandHistory.java +++ /dev/null @@ -1,49 +0,0 @@ -package phpdbg.ui; - - -import java.util.ArrayList; - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -/** - * Implement a simple history list for command input - * @author krakjoe - */ -public class CommandHistory extends ArrayList { - private Integer position = new Integer(0); - - public CommandHistory() { - super(); - } - - @Override public boolean add(String text) { - String last = last(); - if (text != null) { - if (last == null || !last.equals(text)) { - if (super.add(text)) { - position = size(); - return true; - } - } - } - return false; - } - - public String last() { - if (position >= 1) { - position--; - return get(position); - } else return new String(); - } - - public String next() { - if (position+1 < size()) { - position++; - return get(position); - } else return new String(); - } -} \ No newline at end of file diff --git a/tutorials/java/src/phpdbg/ui/DebugSocket.java b/tutorials/java/src/phpdbg/ui/DebugSocket.java deleted file mode 100644 index 8e811e9be9..0000000000 --- a/tutorials/java/src/phpdbg/ui/DebugSocket.java +++ /dev/null @@ -1,157 +0,0 @@ -package phpdbg.ui; - - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.InetSocketAddress; -import java.net.Socket; -import java.nio.ByteBuffer; -import java.nio.channels.SelectionKey; -import static java.nio.channels.SelectionKey.OP_READ; -import java.nio.channels.Selector; -import java.nio.channels.ServerSocketChannel; -import java.nio.channels.SocketChannel; -import java.nio.channels.spi.SelectorProvider; -import java.util.Iterator; -import java.util.Set; -import phpdbg.ui.JConsole.MessageType; - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -/** - * Manage input and output data - * @author krakjoe - */ -public class DebugSocket implements Runnable { - private final String host; - private final Integer port; - private final Boolean reader; - private final JConsole main; - private final Thread thread; - - private volatile Boolean quit; - private volatile Boolean started; - - public DebugSocket(final String host, final Integer port, final JConsole main, Boolean reader) throws IOException { - this.host = host; - this.port = port; - this.main = main; - this.reader = reader; - this.quit = false; - this.started = false; - this.thread = new Thread(this); - } - - public void start() { - synchronized(this) { - if (!started) { - quit = false; - started = true; - thread.start(); - } - } - } - - public void quit() { - synchronized(this) { - quit = true; - started = false; - notifyAll(); - } - } - - @Override public void run() { - try { - synchronized(main) { - if (!main.isConnected()) { - main.setConnected(true); - } - } - - if (reader) { - /* The reader thread will wait() until there is input */ - Socket socket = new Socket(this.host, this.port); - String command; - OutputStream output = socket.getOutputStream(); - - do { - synchronized(this) { - wait(); - - if (!quit) { - command = main.getInputField().getText(); - /* send command to stdin socket */ - if (command != null) { - if (main.isEchoing()) { - main.getOutputField() - .appendANSI( - String.format("remote> %s\n", command)); - } - output.write( - command.getBytes()); - output.write("\n".getBytes()); - output.flush(); - } - main.getInputField().setText(null); - } - } - } while (!quit); - - socket.close(); - } else { - /* - * The writer thread will use non-blocking i/o consuming - * resources only when there is data to read - */ - Selector selector = Selector.open(); - SocketChannel channel = SocketChannel.open(); - - channel.connect( - new InetSocketAddress(this.host, this.port)); - channel.configureBlocking(false); - channel.register(selector, OP_READ); - - while (!quit) { - selector.select(); - - Iterator iter = selector.selectedKeys().iterator(); - - while (iter.hasNext()) { - if (!quit) { - SocketChannel ready = (SocketChannel) (iter.next().channel()); - ByteBuffer bytes = ByteBuffer.allocate(128); - - if (ready != null) { - if (ready.read(bytes) != -1) { - bytes.flip(); - - main.getOutputField() - .appendANSI(new String(bytes.array())); - - } - } - - iter.remove(); - } - } - } - channel.close(); - } - } catch (IOException | InterruptedException ex) { - if (!quit) { - main.messageBox(ex.getMessage(), MessageType.ERROR); - } - } finally { - synchronized(main) { - if (main.isConnected()) { - main.setConnected(false); - } - } - } - } -} diff --git a/tutorials/java/src/phpdbg/ui/JConsole.form b/tutorials/java/src/phpdbg/ui/JConsole.form deleted file mode 100644 index d2808942db..0000000000 --- a/tutorials/java/src/phpdbg/ui/JConsole.form +++ /dev/null @@ -1,225 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tutorials/java/src/phpdbg/ui/JConsole.java b/tutorials/java/src/phpdbg/ui/JConsole.java deleted file mode 100644 index 6c8cfb364b..0000000000 --- a/tutorials/java/src/phpdbg/ui/JConsole.java +++ /dev/null @@ -1,471 +0,0 @@ -package phpdbg.ui; - - -import java.awt.AWTException; -import java.awt.Frame; -import java.awt.Image; -import java.awt.SystemTray; -import java.awt.TrayIcon; -import static java.awt.event.KeyEvent.VK_DOWN; -import static java.awt.event.KeyEvent.VK_ENTER; -import static java.awt.event.KeyEvent.VK_UP; -import java.awt.event.WindowEvent; -import java.io.IOException; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.imageio.ImageIO; -import javax.swing.JOptionPane; -import javax.swing.JScrollPane; -import javax.swing.JTextField; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -/** - * - * @author krakjoe - */ -public class JConsole extends javax.swing.JDialog { - /** - * Creates user interface - * @param parent - * @param modal - */ - public JConsole(java.awt.Frame parent, boolean modal) { - super(parent, modal); - initComponents(); - } - - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // //GEN-BEGIN:initComponents - private void initComponents() { - - stdoutPopupMenu = new javax.swing.JPopupMenu(); - resetStdout = new javax.swing.JMenuItem(); - systrayMenu = new java.awt.PopupMenu(); - systrayExitMenuItem = new java.awt.MenuItem(); - host = new javax.swing.JTextField(); - stdoutPort = new javax.swing.JTextField(); - stdinCheckBox = new javax.swing.JCheckBox(); - stdoutCheckBox = new javax.swing.JCheckBox(); - openButton = new javax.swing.JButton(); - stdinPort = new javax.swing.JTextField(); - hostnameLabel = new javax.swing.JLabel(); - input = new javax.swing.JTextField(); - outputScrollPane = new javax.swing.JScrollPane(); - output = new phpdbg.ui.JTerminalPane(); - echoCheckBox = new javax.swing.JCheckBox(); - commandLabel = new javax.swing.JLabel(); - - resetStdout.setText("Clear"); - resetStdout.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - resetStdoutActionPerformed(evt); - } - }); - stdoutPopupMenu.add(resetStdout); - - systrayMenu.setLabel("phpdbg"); - systrayMenu.setName(""); - systrayMenu.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - systrayMenuActionPerformed(evt); - } - }); - - systrayExitMenuItem.setLabel("Exit"); - systrayExitMenuItem.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - systrayExitMenuItemActionPerformed(evt); - } - }); - systrayMenu.add(systrayExitMenuItem); - - setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - setTitle("phpdbg jui"); - - host.setText("127.0.0.1"); - host.setToolTipText("Set the hostname, or IPv4 address of the machine running the phpdbg remote console server"); - - stdoutPort.setText("8000"); - stdoutPort.setToolTipText("By default, stdin * 2"); - - stdinCheckBox.setSelected(true); - stdinCheckBox.setText("stdin:"); - stdinCheckBox.setToolTipText("Set the port for stdin, or uncheck to disable stdin"); - - stdoutCheckBox.setSelected(true); - stdoutCheckBox.setText("stdout:"); - stdoutCheckBox.setToolTipText("Set the port for stdout, or unset to disable stdout"); - - openButton.setText("Connect"); - openButton.setActionCommand("open"); - openButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - openButtonActionPerformed(evt); - } - }); - - stdinPort.setText("4000"); - stdinPort.setToolTipText("The listen port passed to phpdbg (-l option)"); - - hostnameLabel.setText("Hostname:"); - - input.setToolTipText("Enter phpdbg commands here!"); - input.setEnabled(false); - input.addKeyListener(new java.awt.event.KeyAdapter() { - public void keyReleased(java.awt.event.KeyEvent evt) { - inputKeyReleased(evt); - } - }); - - output.setFont(new java.awt.Font("DialogInput", 0, 12)); // NOI18N - output.setComponentPopupMenu(stdoutPopupMenu); - outputScrollPane.setViewportView(output); - - echoCheckBox.setSelected(true); - echoCheckBox.setToolTipText("Check to echo sent commands in output"); - echoCheckBox.setEnabled(false); - echoCheckBox.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); - echoCheckBox.setLabel("echo"); - - commandLabel.setText("Command:"); - commandLabel.setEnabled(false); - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); - getContentPane().setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(outputScrollPane) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(hostnameLabel) - .addComponent(commandLabel)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addComponent(input) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(echoCheckBox)) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addComponent(host, javax.swing.GroupLayout.DEFAULT_SIZE, 345, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(stdinCheckBox) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(stdinPort, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(18, 18, 18) - .addComponent(stdoutCheckBox) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(stdoutPort, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(openButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))))) - .addContainerGap()) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(outputScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(input, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(echoCheckBox) - .addComponent(commandLabel)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(stdoutPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(stdinCheckBox) - .addComponent(stdoutCheckBox) - .addComponent(stdinPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(hostnameLabel) - .addComponent(host, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(openButton)) - .addContainerGap()) - ); - - pack(); - }// //GEN-END:initComponents - - private void inputKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_inputKeyReleased - switch (evt.getKeyCode()) { - case VK_ENTER: { - if (in != null) { - history.add(input.getText()); - synchronized(in) { - in.notifyAll(); - } - } - } break; - - case VK_UP: { - String last = history.last(); - if (last.length() > 0) { - input.setText(last); - } - } break; - - case VK_DOWN: { - String next = history.next(); - if (next.length() > 0) { - input.setText(next); - } - } break; - } - }//GEN-LAST:event_inputKeyReleased - - private void openButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openButtonActionPerformed - try { - if (!connected) { - connect(); - } else { - disconnect(); - } - } catch (IOException ex) { - messageBox(ex.getMessage(), MessageType.ERROR); - } - }//GEN-LAST:event_openButtonActionPerformed - - private void resetStdoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_resetStdoutActionPerformed - // TODO add your handling code here: - output.setText(null); - }//GEN-LAST:event_resetStdoutActionPerformed - - private void systrayExitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_systrayExitMenuItemActionPerformed - // TODO add your handling code here: - dialog.disconnect(); - System.exit(0); - }//GEN-LAST:event_systrayExitMenuItemActionPerformed - - private void systrayMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_systrayMenuActionPerformed - // TODO add your handling code here: - }//GEN-LAST:event_systrayMenuActionPerformed - - private void disconnect() { - if (in != null) { - in.quit(); - } - if (out != null) { - out.quit(); - } - } - - private void connect() throws IOException { - Integer ports[] = new Integer[2]; - String address = getHost(); - - if (address != null) { - ports[0] = stdinCheckBox.isSelected() ? getStdinPort() : -1; - ports[1] = stdoutCheckBox.isSelected() ? getStdoutPort() : -1; - - if (ports[0] != 0 && ports[1] != 0) { - if (stdinCheckBox.isSelected()) { - if (ports[0] > 0) { - in = new DebugSocket( - address, ports[0], this, true); - in.start(); - } - } - - if (stdoutCheckBox.isSelected()) { - if (ports[1] > 0) { - out = new DebugSocket( - address, ports[1], this, false); - out.start(); - } - } - } - } - } - - public Boolean isConnected() { - return connected; - } - - public Boolean isEchoing() { - return echoCheckBox.isSelected(); - } - - public void setConnected(Boolean isConnected) { - synchronized(this) { - if (isConnected) { - connected = true; - openButton.setText("Disconnect"); - host.setEnabled(false); - stdinPort.setEnabled(false); - stdinCheckBox.setEnabled(false); - if (stdinCheckBox.isSelected()) { - input.setEnabled(true); - commandLabel.setEnabled(true); - echoCheckBox.setEnabled(true); - } else { - input.setEnabled(false); - commandLabel.setEnabled(false); - echoCheckBox.setEnabled(false); - } - stdoutPort.setEnabled(false); - stdoutCheckBox.setEnabled(false); - hostnameLabel.setEnabled(false); - commandLabel.setEnabled(true); - } else { - connected = false; - openButton.setText("Connect"); - host.setEnabled(true); - stdinPort.setEnabled(true); - input.setEnabled(false); - commandLabel.setEnabled(false); - echoCheckBox.setEnabled(false); - stdinCheckBox.setEnabled(true); - stdoutPort.setEnabled(true); - stdoutCheckBox.setEnabled(true); - hostnameLabel.setEnabled(true); - } - } - } - - public JTextField getInputField() { return input; } - public JTerminalPane getOutputField() { return output; } - - public String getHost() { - String address = host.getText(); - if (address != null && address.length() > 0) { - return address; - } else { - messageBox("Invalid hostname provided!", MessageType.WARN); - } - - return null; - } - - public Integer getStdinPort() { - try { - return Integer.parseInt(stdinPort.getText()); - } catch (NumberFormatException ex) { - messageBox("Invalid stdin port provided!", MessageType.WARN); - } - return 0; - } - - public Integer getStdoutPort() { - try { - return Integer.parseInt(stdoutPort.getText()); - } catch (NumberFormatException ex) { - messageBox("Invalid stdout port provided!", MessageType.WARN); - } - return 0; - } - - public JScrollPane getOutputScrollPane() { - return outputScrollPane; - } - - public synchronized void messageBox(String message) { - messageBox(message, MessageType.INFO); - } - - public synchronized void messageBox(String message, MessageType type) { - JOptionPane.showMessageDialog(this, message, "phpdbg jui", type.getType()); - } - /** - * @param args the command line arguments - */ - public static void main(final String args[]) { - - for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { - if (info.getName().equals("Nimbus")) { - try { - UIManager.setLookAndFeel( - info.getClassName()); - break; - } catch (ClassNotFoundException | - InstantiationException | - IllegalAccessException | - UnsupportedLookAndFeelException ex) { - Logger.getLogger(JConsole.class.getName()).log(Level.SEVERE, null, ex); - } - } - } - - /* Create and display the dialog */ - java.awt.EventQueue.invokeLater(new Runnable() { - @Override public void run() { - dialog = new JConsole(new javax.swing.JFrame(), true); - dialog.addWindowListener(new java.awt.event.WindowAdapter() { - @Override - public void windowClosing(java.awt.event.WindowEvent e) { - dialog.disconnect(); - System.exit(0); - } - }); - try { - if (tray == null) { - Image trayIconImage = ImageIO.read( - JConsole.class.getResource("logo-dbg.png")); - dialog.setIconImage(trayIconImage); - - tray = new TrayIcon(trayIconImage); - tray.setPopupMenu(systrayMenu); - tray.setToolTip("phpdbg - The Interactive PHP Debugger"); - - SystemTray.getSystemTray().add(tray); - } - } catch ( AWTException | IOException ex) { - dialog.messageBox(ex.getMessage(), MessageType.ERROR); - } - dialog.setVisible(true); - } - }); - } - - private static DebugSocket in; - private static DebugSocket out; - private static JConsole dialog; - private static Boolean connected = false; - private static CommandHistory history = new CommandHistory(); - private static TrayIcon tray; - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JLabel commandLabel; - private javax.swing.JCheckBox echoCheckBox; - private javax.swing.JTextField host; - private javax.swing.JLabel hostnameLabel; - private javax.swing.JTextField input; - private javax.swing.JButton openButton; - private phpdbg.ui.JTerminalPane output; - private javax.swing.JScrollPane outputScrollPane; - private javax.swing.JMenuItem resetStdout; - private javax.swing.JCheckBox stdinCheckBox; - private javax.swing.JTextField stdinPort; - private javax.swing.JCheckBox stdoutCheckBox; - private javax.swing.JPopupMenu stdoutPopupMenu; - private javax.swing.JTextField stdoutPort; - private java.awt.MenuItem systrayExitMenuItem; - private static java.awt.PopupMenu systrayMenu; - // End of variables declaration//GEN-END:variables - public enum MessageType { - INFO (JOptionPane.INFORMATION_MESSAGE), - WARN (JOptionPane.WARNING_MESSAGE), - ERROR (JOptionPane.ERROR_MESSAGE); - - private final Integer type; - private MessageType(Integer type) { - this.type = type; - } - public Integer getType() { return this.type; } - public Boolean equals(Integer other) { return this.type.equals(other); } - public Boolean equals(MessageType other) { return this.type.equals(other.getType()); } - } -} diff --git a/tutorials/java/src/phpdbg/ui/JTerminalPane.java b/tutorials/java/src/phpdbg/ui/JTerminalPane.java deleted file mode 100644 index a08be440d3..0000000000 --- a/tutorials/java/src/phpdbg/ui/JTerminalPane.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package phpdbg.ui; - -/** - * - * @author krakjoe - */ -import javax.swing.*; -import javax.swing.text.*; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Image; -import java.io.IOException; -import java.util.HashMap; -import javax.imageio.ImageIO; - -public class JTerminalPane extends JTextPane { - private static class JTerminalColor { - private final Color color; - private final Boolean bold; - private final Boolean underline; - - public JTerminalColor(Float h, Float s, Float b, Boolean bold, Boolean underline) { - this.color = Color.getHSBColor(h, s, b); - this.bold = bold; - this.underline = underline; - } - - public JTerminalColor(Float h, Float s, Float b, Boolean bold) { - this(h, s, b, bold, false); - } - - public JTerminalColor(Float h, Float s, Float b) { - this(h, s, b, false, false); - } - - public Boolean isUnderlined() { return this.underline; } - public Boolean isBold() { return this.bold; } - public Color getColor() { return this.color; } - } - - private static class JTerminalColors extends HashMap { - public JTerminalColors() { - put("\u001B[0;30m", new JTerminalColor(0.000f, 0.000f, 0.502f)); - put("\u001B[0;31m", new JTerminalColor(0.000f, 1.000f, 1.000f)); - put("\u001B[0;32m", new JTerminalColor(0.333f, 1.000f, 1.000f)); - put("\u001B[0;33m", new JTerminalColor(0.167f, 1.000f, 1.000f)); - put("\u001B[0;34m", new JTerminalColor(0.667f, 1.000f, 1.000f)); - put("\u001B[0;35m", new JTerminalColor(0.833f, 1.000f, 1.000f)); - put("\u001B[0;36m", new JTerminalColor(0.500f, 1.000f, 1.000f)); - put("\u001B[0;37m", new JTerminalColor(0.000f, 0.000f, 1.000f)); - put("\u001B[0;64m", new JTerminalColor(0.000f, 0.000f, 1.000f)); - put("\u001B[1;30m", new JTerminalColor(0.000f, 0.000f, 0.502f, true)); - put("\u001B[1;31m", new JTerminalColor(0.000f, 1.000f, 1.000f, true)); - put("\u001B[1;32m", new JTerminalColor(0.333f, 1.000f, 1.000f, true)); - put("\u001B[1;33m", new JTerminalColor(0.167f, 1.000f, 1.000f, true)); - put("\u001B[1;34m", new JTerminalColor(0.667f, 1.000f, 1.000f, true)); - put("\u001B[1;35m", new JTerminalColor(0.833f, 1.000f, 1.000f, true)); - put("\u001B[1;36m", new JTerminalColor(0.500f, 1.000f, 1.000f, true)); - put("\u001B[1;37m", new JTerminalColor(0.000f, 0.000f, 1.000f, true)); - put("\u001B[1;64m", new JTerminalColor(0.000f, 0.000f, 1.000f, true)); - put("\u001B[4;30m", new JTerminalColor(0.000f, 0.000f, 0.502f, false, true)); - put("\u001B[4;31m", new JTerminalColor(0.000f, 1.000f, 1.000f, false, true)); - put("\u001B[4;32m", new JTerminalColor(0.333f, 1.000f, 1.000f, false, true)); - put("\u001B[4;33m", new JTerminalColor(0.167f, 1.000f, 1.000f, false, true)); - put("\u001B[4;34m", new JTerminalColor(0.667f, 1.000f, 1.000f, false, true)); - put("\u001B[4;35m", new JTerminalColor(0.833f, 1.000f, 1.000f, false, true)); - put("\u001B[4;36m", new JTerminalColor(0.500f, 1.000f, 1.000f, false, true)); - put("\u001B[4;37m", new JTerminalColor(0.000f, 0.000f, 1.000f, false, true)); - put("\u001B[4;64m", new JTerminalColor(0.000f, 0.000f, 1.000f, false, true)); - - put("reset", new JTerminalColor(0.000f, 0.000f, 1.000f)); - } - - public JTerminalColor find(String ANSIColor) { - if (containsKey(ANSIColor)) { - return get(ANSIColor); - } else return get("reset"); - } - } - - public JTerminalPane() { - super(); - setOpaque(false); - setBackground(new Color(0, 0, 0, 0)); - colorCurrent = colors.find("reset"); - } - - @Override public void paintComponent(Graphics g) { - g.setColor(Color.BLACK); - g.fillRect(0, 0, getWidth(), getHeight()); - - try { - Image image = ImageIO.read( - JTerminalPane.class.getResource("logo-small.png")); - - g.drawImage( - image, - getWidth() - image.getWidth(this) - 10, - getHeight() - image.getHeight(this) - 10, - image.getWidth(this), image.getHeight(this), this); - - } catch (IOException | NullPointerException | IllegalArgumentException ex) {} - - super.paintComponent(g); - } - - private void append(JTerminalColor c, String s) { - StyleContext sc = StyleContext.getDefaultStyleContext(); - AttributeSet aset = sc.addAttribute( - SimpleAttributeSet.EMPTY, StyleConstants.Foreground, c.getColor()); - - aset = sc.addAttribute(aset, StyleConstants.Underline, c.isUnderlined()); - aset = sc.addAttribute(aset, StyleConstants.Bold, c.isBold()); - - setCharacterAttributes(aset, false); - replaceSelection(s); - setCaretPosition(getDocument().getLength()); - } - - public synchronized void appendANSI(String s) { - int aPos = 0; - int aIndex; - int mIndex; - String tmpString; - boolean stillSearching; - - String addString = remaining + s; - - remaining = ""; - - if (addString.length() > 0) { - aIndex = addString.indexOf("\u001B"); - if (aIndex == -1) { - append(colorCurrent,addString); - return; - } - - if (aIndex > 0) { - tmpString = addString.substring(0,aIndex); - append(colorCurrent, tmpString); - aPos = aIndex; - } - - stillSearching = true; - while (stillSearching) { - mIndex = addString.indexOf("m",aPos); - if (mIndex < 0) { - remaining = addString.substring(aPos,addString.length()); - stillSearching = false; - continue; - } - else { - tmpString = addString.substring(aPos,mIndex+1); - colorCurrent = colors.find(tmpString); - } - aPos = mIndex + 1; - - aIndex = addString.indexOf("\u001B", aPos); - - if (aIndex == -1) { - tmpString = addString.substring(aPos,addString.length()); - append(colorCurrent, tmpString); - stillSearching = false; - continue; - } - tmpString = addString.substring(aPos,aIndex); - aPos = aIndex; - append(colorCurrent, tmpString); - } - } - } - - private static JTerminalColors colors = new JTerminalColors(); - private JTerminalColor colorCurrent; - private String remaining = ""; -} diff --git a/tutorials/java/src/phpdbg/ui/logo-dbg.png b/tutorials/java/src/phpdbg/ui/logo-dbg.png deleted file mode 100644 index 621f29b53e..0000000000 Binary files a/tutorials/java/src/phpdbg/ui/logo-dbg.png and /dev/null differ diff --git a/tutorials/java/src/phpdbg/ui/logo-small.png b/tutorials/java/src/phpdbg/ui/logo-small.png deleted file mode 100644 index 1792379f77..0000000000 Binary files a/tutorials/java/src/phpdbg/ui/logo-small.png and /dev/null differ -- cgit v1.2.1