Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Commit [161727] jedit-3-2-pre1 Maximize Restore History

import of auxiliary files for jEdit-3.2pre1

Slava Pestov Slava Pestov 2001-05-08

1 2 3 > >> (Page 1 of 3)
added installer/done-HalfAnOS.html
added installer/done-MacOS.html
added installer/done-MacOSX.html
added installer/done-Unix.html
added installer/done-Windows.html
removed jars/PluginManager
removed jars/PluginManager/InstallPluginsDialog.java
removed jars/PluginManager/JCheckBoxList.java
removed jars/PluginManager/PluginDownloadProgress.java
removed jars/PluginManager/PluginDownloadThread.java
removed jars/PluginManager/PluginList.java
removed jars/PluginManager/PluginManager.java
removed jars/PluginManager/PluginManager.props
removed jars/PluginManager/PluginManagerPlugin.java
removed jars/PluginManager/UpdatePluginsDialog.java
removed jars/PluginManager/actions.xml
removed jars/PluginManager/makefile.jmk
changed bsh
changed bsh/BshMethod.java
changed bsh/CHANGES.SP.txt
changed bsh/Name.java
changed bsh/NameSpace.java
changed doc
changed doc/CHANGES.txt
changed doc/README.txt
changed doc/TODO.txt
changed doc/users-guide
changed doc/users-guide/text-edit.sgml
changed gnu
changed gnu/regexp
changed gnu/regexp/RE.java
changed gnu/regexp/REMatch.java
changed installer
changed installer/ConsoleProgress.java
changed installer/Install.java
changed installer/Progress.java
changed installer/SwingInstall.java
changed installer/install.props
changed installer/mk_filelist.sh
changed installer/mk_installer.sh
changed jars
changed jedit.spec
changed macros
changed macros/Misc
changed macros/Misc/Notepad.bsh
changed macros/Search
changed macros/Search/Search_Buffer.bsh
changed macros/Search/Search_Directory_Tree.bsh
changed makefile.jmk
changed org
changed org/gjt
changed org/gjt/sp
changed org/gjt/sp/jedit
changed org/gjt/sp/jedit/gui
copied site-props -> properties
copied site-props/example.props -> properties/example.props
copied installer/SwingProgress.java -> org/gjt/sp/jedit/gui/MarkersMenu.java
copied installer/Wizard.java -> jedit.cmd
installer/done-HalfAnOS.html Diff Switch to side-by-side view
Loading...
installer/done-MacOS.html Diff Switch to side-by-side view
Loading...
installer/done-MacOSX.html Diff Switch to side-by-side view
Loading...
installer/done-Unix.html Diff Switch to side-by-side view
Loading...
installer/done-Windows.html Diff Switch to side-by-side view
Loading...
jars/PluginManager
File was removed.
jars/PluginManager/actions.xml
File was removed.
bsh
Directory.
bsh/BshMethod.java Diff Switch to side-by-side view
Loading...
bsh/CHANGES.SP.txt Diff Switch to side-by-side view
Loading...
bsh/Name.java Diff Switch to side-by-side view
Loading...
bsh/NameSpace.java Diff Switch to side-by-side view
Loading...
doc
Directory.
doc/CHANGES.txt Diff Switch to side-by-side view
Loading...
doc/README.txt Diff Switch to side-by-side view
Loading...
doc/TODO.txt Diff Switch to side-by-side view
Loading...
doc/users-guide
Directory.
doc/users-guide/text-edit.sgml Diff Switch to side-by-side view
Loading...
gnu
Directory.
gnu/regexp
Directory.
gnu/regexp/RE.java Diff Switch to side-by-side view
Loading...
gnu/regexp/REMatch.java Diff Switch to side-by-side view
Loading...
installer
Directory.
installer/ConsoleProgress.java Diff Switch to side-by-side view
Loading...
installer/Install.java Diff Switch to side-by-side view
Loading...
installer/Progress.java Diff Switch to side-by-side view
Loading...
installer/SwingInstall.java Diff Switch to side-by-side view
Loading...
installer/install.props Diff Switch to side-by-side view
Loading...
installer/mk_filelist.sh Diff Switch to side-by-side view
Loading...
installer/mk_installer.sh Diff Switch to side-by-side view
Loading...
jars
Directory.
jedit.spec Diff Switch to side-by-side view
Loading...
macros
Directory.
macros/Misc
Directory.
macros/Misc/Notepad.bsh Diff Switch to side-by-side view
Loading...
macros/Search
Directory.
macros/Search/Search_Buffer.bsh Diff Switch to side-by-side view
Loading...
macros/Search/Search_Directory_Tree.bsh Diff Switch to side-by-side view
Loading...
makefile.jmk Diff Switch to side-by-side view
Loading...
org
Directory.
org/gjt
Directory.
org/gjt/sp
Directory.
org/gjt/sp/jedit
Directory.
site-props to properties
File was copied or renamed.
site-props/example.props to properties/example.props
File was copied or renamed.
installer/SwingProgress.java to org/gjt/sp/jedit/gui/MarkersMenu.java
--- a/installer/SwingProgress.java
+++ b/org/gjt/sp/jedit/gui/MarkersMenu.java
@@ -1,6 +1,6 @@
 /*
- * SwingProgress.java
- * Copyright (C) 1999 Slava Pestov
+ * MarkersMenu.java - Markers menu
+ * Copyright (C) 2001 Slava Pestov
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -17,155 +17,211 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
-package installer;
-
-import javax.swing.border.EmptyBorder;
+package org.gjt.sp.jedit.gui;
+
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Element;
 import javax.swing.*;
 import java.awt.event.*;
 import java.awt.*;
-
-/*
- * Graphical progress monitor.
- */
-public class SwingProgress extends JFrame
-implements ActionListener, Progress
+import java.util.*;
+import org.gjt.sp.jedit.*;
+import org.gjt.sp.util.Log;
+
+public class MarkersMenu extends JMenu
 {
-	public SwingProgress(String appName)
+	public MarkersMenu(View view)
 	{
-		super("Installing " + appName);
-
-		JPanel content = new JPanel(new BorderLayout());
-		content.setBorder(new EmptyBorder(12,12,12,12));
-		setContentPane(content);
-
-		this.appName = appName;
-
-		message = new JLabel("Installing " + appName + "...");
-		message.setBorder(new EmptyBorder(0,0,12,0));
-		content.add(BorderLayout.NORTH,message);
-
-		progress = new JProgressBar();
-		progress.setStringPainted(true);
-		content.add(BorderLayout.CENTER,progress);
-
-		stop = new JButton("Stop");
-		stop.addActionListener(this);
-		JPanel panel = new JPanel();
-		panel.setLayout(new BoxLayout(panel,BoxLayout.X_AXIS));
-		panel.setBorder(new EmptyBorder(12,0,0,0));
-		panel.add(Box.createGlue());
-		panel.add(stop);
-		panel.add(Box.createGlue());
-		content.add(BorderLayout.SOUTH,panel);
-
-		Dimension screen = getToolkit().getScreenSize();
-		pack();
-		Dimension size = getSize();
-		size.width = Math.max(500,size.width);
-		setBounds((screen.width - size.width) / 2,
-			(screen.height - size.height) / 2,
-			size.width,size.height);
-		show();
+		String label = jEdit.getProperty("markers.label");
+		int index = label.indexOf('$');
+		char mnemonic = '\0';
+		if(index != -1)
+		{
+			mnemonic = Character.toUpperCase(label.charAt(index+1));
+			label = label.substring(0,index) + label.substring(index+1);
+		}
+		setText(label);
+		setMnemonic(mnemonic);
+
+		StringTokenizer st = new StringTokenizer(jEdit.getProperty("markers"));
+		while(st.hasMoreTokens())
+		{
+			String menuItem = st.nextToken();
+			if(menuItem.equals("-"))
+				addSeparator();
+			else
+				add(GUIUtilities.loadMenuItem(menuItem));
+		}
+
+		this.view = view;
 	}
 
-	public void showMessage(final String msg)
+	public void setPopupMenuVisible(boolean b)
 	{
-		SwingUtilities.invokeLater(new Runnable()
-		{
-			public void run()
-			{
-				message.setText(msg);
-			}
-		});
+		if(b)
+		{
+			if(getMenuComponentCount() != 0)
+			{
+				for(int i = getMenuComponentCount() - 1;
+					i >= 0;
+					i--)
+				{
+					Component comp = getMenuComponent(i);
+					if(comp instanceof JSeparator)
+						break;
+					else
+						remove(comp);
+				}
+			}
+
+			Buffer buffer = view.getBuffer();
+			Element map = buffer.getDefaultRootElement();
+
+			Vector markers = buffer.getMarkers();
+
+			if(markers.size() == 0)
+			{
+				JMenuItem mi = new JMenuItem(jEdit.getProperty(
+					"no-markers.label"));
+				mi.setEnabled(false);
+				add(mi);
+				super.setPopupMenuVisible(b);
+				return;
+			}
+
+			JMenu current = this;
+
+			for(int i = 0; i < markers.size(); i++)
+			{
+				final Marker marker = (Marker)markers.elementAt(i);
+				int lineNo = map.getElementIndex(
+					marker.getPosition());
+
+				if(current.getItemCount() >= 20)
+				{
+					//current.addSeparator();
+					JMenu newCurrent = new JMenu(
+						jEdit.getProperty(
+						"common.more"));
+					current.add(newCurrent);
+					current = newCurrent;
+				}
+
+				JMenuItem mi = new MarkersMenuItem(buffer,
+					lineNo,marker.getShortcut());
+				mi.addActionListener(new ActionListener()
+				{
+					public void actionPerformed(ActionEvent evt)
+					{
+						view.getTextArea().setCaretPosition(
+							marker.getPosition());
+					}
+				});
+				current.add(mi);
+			}
+		}
+
+		super.setPopupMenuVisible(b);
 	}
 
-	public void setMaximum(final int max)
+	// private members
+	private View view;
+
+	static class MarkersMenuItem extends JMenuItem
 	{
-		SwingUtilities.invokeLater(new Runnable()
-		{
-			public void run()
-			{
-				progress.setMaximum(max);
-			}
-		});
+		MarkersMenuItem(Buffer buffer, int lineNo, char shortcut)
+		{
+			Element line = buffer.getDefaultRootElement()
+				.getElement(lineNo);
+
+			try
+			{
+				int start = line.getStartOffset();
+				String text = buffer.getText(start,
+					line.getEndOffset() - start - 1);
+				text = text.trim();
+				if(text.length() == 0)
+					text = jEdit.getProperty("markers.blank-line");
+				setText(lineNo + ": " + text);
+			}
+			catch(BadLocationException ble)
+			{
+				Log.log(Log.ERROR,this,ble);
+			}
+
+			shortcutProp = "goto-marker.shortcut";
+			MarkersMenuItem.this.shortcut = shortcut;
+		}
+
+		public Dimension getPreferredSize()
+		{
+			Dimension d = super.getPreferredSize();
+
+			String shortcut = getShortcut();
+
+			if(shortcut != null)
+			{
+				d.width += (getToolkit().getFontMetrics(acceleratorFont)
+					.stringWidth(shortcut) + 10);
+			}
+			return d;
+		}
+
+		public void paint(Graphics g)
+		{
+			super.paint(g);
+
+			String shortcut = getShortcut();
+
+			if(shortcut != null)
+			{
+				g.setFont(acceleratorFont);
+				g.setColor(getModel().isArmed() ?
+					acceleratorSelectionForeground :
+					acceleratorForeground);
+				FontMetrics fm = g.getFontMetrics();
+				Insets insets = getInsets();
+				g.drawString(shortcut,getWidth() - (fm.stringWidth(
+					shortcut) + insets.right + insets.left),
+					getFont().getSize() + (insets.top - 1)
+					/* XXX magic number */);
+			}
+		}
+
+		// private members
+		private String shortcutProp;
+		private char shortcut;
+		private static Font acceleratorFont;
+		private static Color acceleratorForeground;
+		private static Color acceleratorSelectionForeground;
+
+		private String getShortcut()
+		{
+			if(shortcut == '\0')
+				return null;
+			else
+			{
+				String shortcutPrefix = jEdit.getProperty(shortcutProp);
+
+				if(shortcutPrefix == null)
+					return null;
+				else
+				{
+					return shortcutPrefix + " " + shortcut;
+				}
+			}
+		}
+
+		static
+		{
+			acceleratorFont = UIManager.getFont("MenuItem.acceleratorFont");
+			acceleratorFont = new Font("Monospaced",
+				acceleratorFont.getStyle(),
+				acceleratorFont.getSize());
+			acceleratorForeground = UIManager
+				.getColor("MenuItem.acceleratorForeground");
+			acceleratorSelectionForeground = UIManager
+				.getColor("MenuItem.acceleratorSelectionForeground");
+		}
 	}
-
-	public void advance(final int value)
-	{
-		try
-		{
-			SwingUtilities.invokeAndWait(new Runnable()
-			{
-				public void run()
-				{
-					progress.setValue(progress
-						.getValue() + value);
-				}
-			});
-			Thread.yield();
-		}
-		catch(Exception e)
-		{
-		}
-	}
-
-	public void done()
-	{
-		SwingUtilities.invokeLater(new Runnable()
-		{
-			public void run()
-			{
-				dispose();
-				JOptionPane.showMessageDialog(null,
-					appName + " installed successfully.",
-					"Installation complete",
-					JOptionPane.INFORMATION_MESSAGE);
-				System.exit(0);
-			}
-		});
-	}
-
-	public void error(final String message)
-	{
-		SwingUtilities.invokeLater(new Runnable()
-		{
-			public void run()
-			{
-				dispose();
-				JOptionPane.showMessageDialog(null,
-					message,
-					"Installation aborted",
-					JOptionPane.ERROR_MESSAGE);
-				System.exit(1);
-			}
-		});
-	}
-
-	public void setThread(InstallThread thread)
-	{
-		this.thread = thread;
-	}
-
-	public void actionPerformed(ActionEvent evt)
-	{
-		if(evt.getSource() == stop)
-		{
-			stop.getModel().setEnabled(false);
-			thread.stop();
-
-			dispose();
-			JOptionPane.showMessageDialog(null,
-				"Installation aborted.",
-				"Installation aborted",
-				JOptionPane.ERROR_MESSAGE);
-			System.exit(1);
-		}
-	}
-
-	// private members
-	private String appName;
-	private JLabel message;
-	private JProgressBar progress;
-	private JButton stop;
-	private InstallThread thread;
 }
installer/Wizard.java to jedit.cmd
--- a/installer/Wizard.java
+++ b/jedit.cmd
@@ -1,187 +1,73 @@
-/*
- * Wizard.java
- * Copyright (C) 2000 Slava Pestov
- *
- * 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 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 installer;
-
-import javax.swing.*;
-import java.awt.event.*;
-import java.awt.*;
-
-/*
- * An abstract class that steps the user through a set of pages. Used by
- * SwingInstall.
- */
-public abstract class Wizard extends JPanel
-{
-	public Wizard(String cancelButtonLabel, String prevButtonLabel,
-		String nextButtonLabel, String finishButtonLabel)
-	{
-		ActionHandler actionHandler = new ActionHandler();
-
-		cancelButton = new JButton(cancelButtonLabel);
-		cancelButton.setRequestFocusEnabled(false);
-		cancelButton.addActionListener(actionHandler);
-		prevButton = new JButton(prevButtonLabel);
-		prevButton.setRequestFocusEnabled(false);
-		prevButton.addActionListener(actionHandler);
-		nextButton = new JButton();
-		nextButton.setRequestFocusEnabled(false);
-		nextButton.addActionListener(actionHandler);
-		this.nextButtonLabel = nextButtonLabel;
-		this.finishButtonLabel = finishButtonLabel;
-
-		setLayout(new WizardLayout());
-		add(cancelButton);
-		add(prevButton);
-		add(nextButton);
-	}
-
-	public void setPages(Component[] pages)
-	{
-		this.pages = pages;
-		for(int i = 0; i < pages.length; i++)
-		{
-			add(pages[i]);
-		}
-
-		pageChanged();
-	}
-
-	// protected members
-	protected abstract void cancelCallback();
-	protected abstract void finishCallback();
-
-	// private members
-	private JButton cancelButton;
-	private JButton prevButton;
-	private JButton nextButton;
-	private String nextButtonLabel, finishButtonLabel;
-	private Component[] pages;
-	private int currentPage;
-
-	private static int PADDING = 12;
-
-	private void pageChanged()
-	{
-		prevButton.setEnabled(currentPage != 0);
-		if(currentPage == pages.length - 1)
-			nextButton.setText(finishButtonLabel);
-		else
-			nextButton.setText(nextButtonLabel);
-
-		revalidate();
-	}
-
-	class ActionHandler implements ActionListener
-	{
-		public void actionPerformed(ActionEvent evt)
-		{
-			Object source = evt.getSource();
-			if(evt.getSource() == cancelButton)
-				cancelCallback();
-			else if(evt.getSource() == prevButton)
-			{
-				currentPage--;
-				pageChanged();
-			}
-			else if(evt.getSource() == nextButton)
-			{
-				if(currentPage == pages.length - 1)
-					finishCallback();
-				else
-				{
-					currentPage++;
-					pageChanged();
-				}
-			}
-		}
-	}
-
-	class WizardLayout implements LayoutManager
-	{
-		public void addLayoutComponent(String name, Component comp)
-		{
-		}
-
-		public void removeLayoutComponent(Component comp)
-		{
-		}
-
-		public Dimension preferredLayoutSize(Container parent)
-		{
-			Dimension dim = new Dimension();
-
-			for(int i = 0; i < pages.length; i++)
-			{
-				Dimension _dim = pages[i].getPreferredSize();
-				dim.width = Math.max(_dim.width,dim.width);
-				dim.height = Math.max(_dim.height,dim.height);
-			}
-
-			dim.width += PADDING * 2;
-			dim.height += PADDING * 2;
-			return dim;
-		}
-
-		public Dimension minimumLayoutSize(Container parent)
-		{
-			return preferredLayoutSize(parent);
-		}
-
-		public void layoutContainer(Container parent)
-		{
-			Dimension size = getSize();
-
-			// make all buttons the same size
-			Dimension buttonSize = cancelButton.getPreferredSize();
-			buttonSize.width = Math.max(buttonSize.width,prevButton.getPreferredSize().width);
-			buttonSize.width = Math.max(buttonSize.width,nextButton.getPreferredSize().width);
-
-			int bottomBorder = buttonSize.height + PADDING;
-
-			// cancel button goes on far left
-			cancelButton.setBounds(PADDING,size.height - buttonSize.height
-				- PADDING,buttonSize.width,buttonSize.height);
-
-			// prev and next buttons are on the right
-			prevButton.setBounds(size.width - buttonSize.width * 2 - 6 - PADDING,
-				size.height - buttonSize.height - PADDING,
-				buttonSize.width,buttonSize.height);
-
-			nextButton.setBounds(size.width - buttonSize.width - PADDING,
-				size.height - buttonSize.height - PADDING,
-				buttonSize.width,buttonSize.height);
-
-			// calculate size for current page
-			Rectangle currentPageBounds = new Rectangle();
-			currentPageBounds.x = PADDING;
-			currentPageBounds.y = PADDING;
-			currentPageBounds.width = size.width - PADDING * 2;
-			currentPageBounds.height = size.height - PADDING
-				- bottomBorder - PADDING;
-
-			for(int i = 0; i < pages.length; i++)
-			{
-				Component page = pages[i];
-				page.setBounds(currentPageBounds);
-				page.setVisible(i == currentPage);
-			}
-		}
-	}
-}
+/* MAINTAINERS: Robert Henschel (os2info@gmx.net)
+ *              Christoph vogt (ch.vogt@gmx.net)
+ *              Gili Tzabari (junk@bbs.darktech.org)
+ * PLATFORM: OS/2, eCS
+ * 
+ * Used to run JEdit 3.1
+ */
+
+
+rc = QueryJavaVersion()
+if (rc = -1) then
+do
+  say "java.exe cannot be found"
+  return -1;
+end
+if (rc = -2) then
+  say "Unexpected response to JAVA -VERSION. Assuming newest version is being used."
+
+arguments = "-settings=%HOME%\.jedit -server=%HOME%\.jedit\server"
+jedit_dir = GetExecPath()
+
+if (iMajor = 1 & iMid <= 1) then
+    'java -classpath %classpath%;'jedit_dir'\jedit.jar org.gjt.sp.jedit.jEdit 'arguments
+  else
+    'java -jar 'jedit_dir'\jedit.jar 'arguments
+
+return 0
+
+
+
+
+
+ /*
+  * Java version detector.
+  * Assumes java -version return quoted ("") version number.
+  * Written by os2bird on #netlabs
+  *
+  * Returns -1 on no java or failed to execute
+  *         -2 on invalid java version string.
+  *         version number.
+  */
+QueryJavaVersion: procedure expose iMajor iMid iMinor
+cQueued =  queued();
+'@echo off'
+'java -version 2>&1 | rxqueue /LIFO'
+i = queued();
+do while i > cQueued
+    pull sStr
+    if (pos("JAVA VERSION ", sStr) > 0) | (pos("JAVA.EXE VERSION ", sStr) > 0) then
+    do
+        do while(queued() > 0) 
+          pull sStrIngore; /* flush input stream */
+        end
+        parse var sStr sStuff '"'iMajor'.'iMid'.'iMinor'"'
+        if (iMinor <> '') then
+            return iMajor*100 + iMid * 10 + iMinor;
+         else
+             return -2
+     end
+     i = i - 1;
+ end
+ return -1;
+
+
+/*
+ * Returns the path of the script being executed.
+ */
+GetExecPath: procedure
+parse source result
+parse var result 'OS/2 ' dummy result                        /* Get full path of script */
+result=filespec("drive", result) || filespec("path", result) /* strip away filename */
+result=substr(result, 1, length(result)-1)                   /* remove backslash */
+return result
1 2 3 > >> (Page 1 of 3)