From: <her...@us...> - 2006-10-20 17:13:34
|
Revision: 7627 http://svn.sourceforge.net/jedit/?rev=7627&view=rev Author: hertzhaft Date: 2006-10-20 10:13:12 -0700 (Fri, 20 Oct 2006) Log Message: ----------- Automatic reload of a changed buffer without prompting (feature request #1578785), not persistent yet. Autoreload settings configurable per buffer. Factored out options/BufferOptionPane. Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/Buffer.java jEdit/trunk/org/gjt/sp/jedit/gui/BufferOptions.java jEdit/trunk/org/gjt/sp/jedit/jEdit.java jEdit/trunk/org/gjt/sp/jedit/jedit.props jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props jEdit/trunk/org/gjt/sp/jedit/options/GeneralOptionPane.java jEdit/trunk/org/gjt/sp/jedit/perspective.dtd Added Paths: ----------- jEdit/trunk/org/gjt/sp/jedit/options/BufferOptionPane.java Modified: jEdit/trunk/org/gjt/sp/jedit/Buffer.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/Buffer.java 2006-10-20 13:45:04 UTC (rev 7626) +++ jEdit/trunk/org/gjt/sp/jedit/Buffer.java 2006-10-20 17:13:12 UTC (rev 7627) @@ -588,6 +588,49 @@ this.modTime = modTime; } //}}} + //{{{ getAutoReload() method + /** + * Returns the status of the AUTORELOAD flag + * If true, reload changed files automatically + */ + public boolean getAutoReload() + { + return getFlag(AUTORELOAD); + } //}}} + + //{{{ setAutoReload() method + /** + * Sets the status of the AUTORELOAD flag + * @param value # If true, reload changed files automatically + */ + public void setAutoReload(boolean value) + { + setFlag(AUTORELOAD, value); + } //}}} + + //{{{ getAutoReloadDialog() method + /** + * Returns the status of the AUTORELOAD_DIALOG flag + * If true, prompt for reloading or notify user + * when the file has changed on disk + */ + public boolean getAutoReloadDialog() + { + return getFlag(AUTORELOAD_DIALOG); + } //}}} + + //{{{ setAutoReloadDialog() method + /** + * Sets the status of the AUTORELOAD_DIALOG flag + * @param value # If true, prompt for reloading or notify user + * when the file has changed on disk + + */ + public void setAutoReloadDialog(boolean value) + { + setFlag(AUTORELOAD_DIALOG, value); + } //}}} + //{{{ getVFS() method /** * Returns the virtual filesystem responsible for loading and @@ -1493,6 +1536,8 @@ */ setFlag(UNTITLED,newFile); setFlag(NEW_FILE,newFile); + setFlag(AUTORELOAD,jEdit.getBooleanProperty("autoReload")); + setFlag(AUTORELOAD_DIALOG,jEdit.getBooleanProperty("autoReloadDialog")); } //}}} //{{{ commitTemporary() method @@ -1556,6 +1601,8 @@ private static final int NEW_FILE = 3; private static final int UNTITLED = 4; private static final int AUTOSAVE_DIRTY = 5; + private static final int AUTORELOAD = 6; + private static final int AUTORELOAD_DIALOG = 7; private static final int TEMPORARY = 10; private static final int MARKERS_CHANGED = 12; //}}} Modified: jEdit/trunk/org/gjt/sp/jedit/gui/BufferOptions.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/gui/BufferOptions.java 2006-10-20 13:45:04 UTC (rev 7626) +++ jEdit/trunk/org/gjt/sp/jedit/gui/BufferOptions.java 2006-10-20 17:13:12 UTC (rev 7627) @@ -49,324 +49,73 @@ //{{{ Imports import javax.swing.border.EmptyBorder; - import javax.swing.*; - import java.awt.*; - import java.awt.event.*; import java.util.Arrays; import org.gjt.sp.jedit.buffer.FoldHandler; import org.gjt.sp.jedit.buffer.JEditBuffer; +import org.gjt.sp.jedit.options.BufferOptionPane; import org.gjt.sp.jedit.*; //}}} - - /** * Buffer-specific options dialog. - * @author Slava Pestov - * @version $Id$ - * - */ public class BufferOptions extends EnhancedDialog - { - //{{{ BufferOptions constructor public BufferOptions(View view, Buffer buffer) - { - super(view,jEdit.getProperty("buffer-options.title"),true); - this.view = view; - this.buffer = buffer; - - JPanel content = new JPanel(new BorderLayout()); - content.setBorder(new EmptyBorder(12,12,12,12)); - setContentPane(content); - - ActionHandler actionListener = new ActionHandler(); + panel = new BufferOptionPane(); - AbstractOptionPane panel = new AbstractOptionPane(null); - - - - panel.addComponent(GUIUtilities.createMultilineLabel( - - jEdit.getProperty("buffer-options.caption"))); - - - - panel.addSeparator("buffer-options.loading-saving"); - - - - //{{{ Line separator - - String[] lineSeps = { jEdit.getProperty("lineSep.unix"), - - jEdit.getProperty("lineSep.windows"), - - jEdit.getProperty("lineSep.mac") }; - - lineSeparator = new JComboBox(lineSeps); - - String lineSep = buffer.getStringProperty(JEditBuffer.LINESEP); - - if(lineSep == null) - - lineSep = System.getProperty("line.separator"); - - if("\n".equals(lineSep)) - - lineSeparator.setSelectedIndex(0); - - else if("\r\n".equals(lineSep)) - - lineSeparator.setSelectedIndex(1); - - else if("\r".equals(lineSep)) - - lineSeparator.setSelectedIndex(2); - - panel.addComponent(jEdit.getProperty("buffer-options.lineSeparator"), - - lineSeparator); - - //}}} - - - - //{{{ Encoding - - String[] encodings = MiscUtilities.getEncodings(true); - - Arrays.sort(encodings,new MiscUtilities.StringICaseCompare()); - - encoding = new JComboBox(encodings); - - encoding.setEditable(true); - - encoding.setSelectedItem(buffer.getStringProperty(JEditBuffer.ENCODING)); - - panel.addComponent(jEdit.getProperty("buffer-options.encoding"), - - encoding); - - //}}} - - - - //{{{ GZipped setting - - gzipped = new JCheckBox(jEdit.getProperty( - - "buffer-options.gzipped")); - - gzipped.setSelected(buffer.getBooleanProperty(Buffer.GZIPPED)); - - panel.addComponent(gzipped); - - //}}} - - - - panel.addSeparator("buffer-options.editing"); - - - - //{{{ Edit mode - - modes = jEdit.getModes(); - - Arrays.sort(modes,new MiscUtilities.StringICaseCompare()); - - mode = new JComboBox(modes); - - mode.setSelectedItem(buffer.getMode()); - - mode.addActionListener(actionListener); - - panel.addComponent(jEdit.getProperty("buffer-options.mode"),mode); - - //}}} - - - - //{{{ Fold mode - - String[] foldModes = FoldHandler.getFoldModes(); - - - - folding = new JComboBox(foldModes); - - folding.setSelectedItem(buffer.getStringProperty("folding")); - - panel.addComponent(jEdit.getProperty("options.editing.folding"), - - folding); - - //}}} - - - - //{{{ Wrap mode - - String[] wrapModes = { - - "none", - - "soft", - - "hard" - - }; - - - - wrap = new JComboBox(wrapModes); - - wrap.setSelectedItem(buffer.getStringProperty("wrap")); - - panel.addComponent(jEdit.getProperty("options.editing.wrap"), - - wrap); - - //}}} - - - - //{{{ Max line length - - String[] lineLengths = { "0", "72", "76", "80" }; - - - - maxLineLen = new JComboBox(lineLengths); - - maxLineLen.setEditable(true); - - maxLineLen.setSelectedItem(buffer.getStringProperty("maxLineLen")); - - panel.addComponent(jEdit.getProperty("options.editing.maxLineLen"), - - maxLineLen); - - //}}} - - - - //{{{ Tab size - - String[] tabSizes = { "2", "4", "8" }; - - tabSize = new JComboBox(tabSizes); - - tabSize.setEditable(true); - - tabSize.setSelectedItem(buffer.getStringProperty("tabSize")); - - panel.addComponent(jEdit.getProperty("options.editing.tabSize"),tabSize); - - //}}} - - - - //{{{ Indent size - - indentSize = new JComboBox(tabSizes); - - indentSize.setEditable(true); - - indentSize.setSelectedItem(buffer.getStringProperty("indentSize")); - - panel.addComponent(jEdit.getProperty("options.editing.indentSize"), - - indentSize); - - //}}} - - - - //{{{ Soft tabs - - noTabs = new JCheckBox(jEdit.getProperty( - - "options.editing.noTabs")); - - noTabs.setSelected(buffer.getBooleanProperty("noTabs")); - - panel.addComponent(noTabs); - - //}}} - - - content.add(BorderLayout.NORTH,panel); - - //{{{ Buttons JPanel buttons = new JPanel(); - buttons.setLayout(new BoxLayout(buttons,BoxLayout.X_AXIS)); - buttons.setBorder(new EmptyBorder(12,0,0,0)); - buttons.add(Box.createGlue()); ok = new JButton(jEdit.getProperty("common.ok")); - ok.addActionListener(actionListener); - getRootPane().setDefaultButton(ok); - buttons.add(ok); buttons.add(Box.createHorizontalStrut(6)); cancel = new JButton(jEdit.getProperty("common.cancel")); - cancel.addActionListener(actionListener); - buttons.add(cancel); buttons.add(Box.createGlue()); - content.add(BorderLayout.SOUTH,buttons); //}}} - - pack(); - setLocationRelativeTo(view); - setVisible(true); - } //}}} @@ -374,263 +123,38 @@ //{{{ ok() method public void ok() - { - - int index = lineSeparator.getSelectedIndex(); - - String lineSep; - - if(index == 0) - - lineSep = "\n"; - - else if(index == 1) - - lineSep = "\r\n"; - - else if(index == 2) - - lineSep = "\r"; - - else - - throw new InternalError(); - - - - String oldLineSep = buffer.getStringProperty(JEditBuffer.LINESEP); - - if(oldLineSep == null) - - oldLineSep = System.getProperty("line.separator"); - - if(!oldLineSep.equals(lineSep)) - - { - - buffer.setStringProperty("lineSeparator",lineSep); - - buffer.setDirty(true); - - } - - - - String encoding = (String)this.encoding.getSelectedItem(); - - String oldEncoding = buffer.getStringProperty(JEditBuffer.ENCODING); - - if(!oldEncoding.equals(encoding)) - - { - - buffer.setStringProperty(JEditBuffer.ENCODING,encoding); - - buffer.setDirty(true); - - } - - - - boolean gzippedValue = gzipped.isSelected(); - - boolean oldGzipped = buffer.getBooleanProperty( - - Buffer.GZIPPED); - - if(gzippedValue != oldGzipped) - - { - - buffer.setBooleanProperty(Buffer.GZIPPED,gzippedValue); - - buffer.setDirty(true); - - } - - - - buffer.setStringProperty("folding",(String)folding.getSelectedItem()); - - - - buffer.setStringProperty("wrap",(String)wrap.getSelectedItem()); - - - - try - - { - - buffer.setProperty("maxLineLen",new Integer( - - maxLineLen.getSelectedItem().toString())); - - } - - catch(NumberFormatException nf) - - { - - } - - - - try - - { - - buffer.setProperty("tabSize",new Integer( - - tabSize.getSelectedItem().toString())); - - } - - catch(NumberFormatException nf) - - { - - } - - - - try - - { - - buffer.setProperty("indentSize",new Integer( - - indentSize.getSelectedItem().toString())); - - } - - catch(NumberFormatException nf) - - { - - } - - - - buffer.setBooleanProperty("noTabs",noTabs.isSelected()); - - - - index = mode.getSelectedIndex(); - - buffer.setMode(modes[index]); - - - + panel.save(); dispose(); - } //}}} - - //{{{ cancel() method public void cancel() - { - dispose(); - } //}}} - - //{{{ Private members private View view; - private Buffer buffer; - - private Mode[] modes; - - private JComboBox mode; - - private JComboBox lineSeparator; - - private JComboBox encoding; - - private JCheckBox gzipped; - - private JComboBox folding; - - private JComboBox wrap; - - private JComboBox maxLineLen; - - private JComboBox tabSize; - - private JComboBox indentSize; - - private JCheckBox noTabs; - + private BufferOptionPane panel; private JButton ok; - private JButton cancel; - //}}} - - - //{{{ ActionHandler class class ActionHandler implements ActionListener - { - //{{{ actionPerformed() method - public void actionPerformed(ActionEvent evt) - { - Object source = evt.getSource(); - if(source == ok) - ok(); - else if(source == cancel) - cancel(); - - else if(source == mode) - - { - - Mode _mode = (Mode)mode.getSelectedItem(); - - folding.setSelectedItem(_mode.getProperty( - - "folding")); - - wrap.setSelectedItem(_mode.getProperty( - - "wrap")); - - maxLineLen.setSelectedItem(_mode.getProperty( - - "maxLineLen")); - - tabSize.setSelectedItem(_mode.getProperty( - - "tabSize")); - - indentSize.setSelectedItem(_mode.getProperty( - - "indentSize")); - - noTabs.setSelected(_mode.getBooleanProperty( - - "noTabs")); - - } - } //}}} } //}}} Modified: jEdit/trunk/org/gjt/sp/jedit/jEdit.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/jEdit.java 2006-10-20 13:45:04 UTC (rev 7626) +++ jEdit/trunk/org/gjt/sp/jedit/jEdit.java 2006-10-20 17:13:12 UTC (rev 7627) @@ -2010,12 +2010,9 @@ // still need to call the status check even if the option is // off, so that the write protection is updated if it changes // on disk - boolean showDialogSetting = getBooleanProperty( - "autoReloadDialog"); // auto reload changed buffers? - boolean autoReloadSetting = getBooleanProperty( - "autoReload"); + boolean autoReload = getBooleanProperty("autoReload"); // the problem with this is that if we have two edit panes // looking at the same buffer and the file is reloaded both @@ -2034,7 +2031,7 @@ Buffer buffer = buffersFirst; int[] states = new int[bufferCount]; int i = 0; - boolean show = false; + boolean notifyFileChanged = false; while(buffer != null) { states[i] = buffer.checkFileStatus(view); @@ -2042,15 +2039,21 @@ switch(states[i]) { case Buffer.FILE_CHANGED: - if(autoReloadSetting - && showDialogSetting - && !buffer.isDirty()) + if(buffer.getAutoReload()) { - buffer.load(view,true); + if(buffer.isDirty()) + notifyFileChanged = true; + else + buffer.load(view,true); } - /* fall through */ + else // no automatic reload even if general setting is true + autoReload = false; + // don't notify user if "do nothing" was chosen + if(buffer.getAutoReloadDialog()) + notifyFileChanged = true; + break; case Buffer.FILE_DELETED: - show = true; + notifyFileChanged = true; break; } @@ -2058,8 +2061,8 @@ i++; } - if(show && showDialogSetting) - new FilesChangedDialog(view,states,autoReloadSetting); + if(notifyFileChanged) + new FilesChangedDialog(view,states,autoReload); } //}}} //}}} Modified: jEdit/trunk/org/gjt/sp/jedit/jedit.props =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/jedit.props 2006-10-20 13:45:04 UTC (rev 7626) +++ jEdit/trunk/org/gjt/sp/jedit/jedit.props 2006-10-20 17:13:12 UTC (rev 7627) @@ -95,10 +95,13 @@ # Check modification status on focus? -# If this is true, show a dialog; if false, do nothing +# if false and autoReload == false, do nothing +# if false and autoReload == true, autoreload silently +# If true and autoReload == false, prompt for reloading +# if true and autoReload == true, reload and notify user (message box) autoReloadDialog=true -# If this is true, auto reload; if false, 'reload' button in dialog +# If this is true, auto reload; if false, use 'reload' button in dialog autoReload=true #}}} Modified: jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props 2006-10-20 13:45:04 UTC (rev 7626) +++ jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props 2006-10-20 17:13:12 UTC (rev 7627) @@ -1605,7 +1605,8 @@ options.general.checkModStatus=If open files are changed on disk: options.general.checkModStatus.nothing=do nothing options.general.checkModStatus.prompt=prompt -options.general.checkModStatus.reload=automatically reload +options.general.checkModStatus.reload=automatically reload and notify user +options.general.checkModStatus.silentReload=autoreload without notification options.general.recentFiles=Recent files to remember: options.general.sortRecent=Sort recent file list options.general.saveCaret=Save caret positions in recent file list Added: jEdit/trunk/org/gjt/sp/jedit/options/BufferOptionPane.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/options/BufferOptionPane.java (rev 0) +++ jEdit/trunk/org/gjt/sp/jedit/options/BufferOptionPane.java 2006-10-20 17:13:12 UTC (rev 7627) @@ -0,0 +1,330 @@ +/* + * BufferOptionPane.java - + * :tabSize=8:indentSize=8:noTabs=false: + * :folding=explicit:collapseFolds=1: + * + * Copyright (C) 1998, 2003 Slava Pestov + * Portions copyright (C) 1999 mike dillon + * + * 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 org.gjt.sp.jedit.options; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Arrays; + +import javax.swing.JCheckBox; +import javax.swing.JComboBox; + +import org.gjt.sp.jedit.AbstractOptionPane; +import org.gjt.sp.jedit.Buffer; +import org.gjt.sp.jedit.GUIUtilities; +import org.gjt.sp.jedit.MiscUtilities; +import org.gjt.sp.jedit.Mode; +import org.gjt.sp.jedit.jEdit; +import org.gjt.sp.jedit.buffer.FoldHandler; + + +public class BufferOptionPane extends AbstractOptionPane +{ + JComboBox encoding; + JComboBox lineSeparator; + JCheckBox gzipped; + Mode[] modes; + JComboBox mode; + JComboBox folding; + JComboBox wrap; + JComboBox maxLineLen; + JComboBox tabSize; + JComboBox indentSize; + JComboBox checkModStatus; + JCheckBox noTabs; + Buffer buffer; + + + public BufferOptionPane() + { + super("Buffer Options"); + init(); + } + + protected void _init() + { + + + buffer = jEdit.getActiveView().getBuffer(); + String filename = buffer.getName(); + setName("Buffer: " + filename); + addComponent(GUIUtilities.createMultilineLabel( + jEdit.getProperty("buffer-options.caption"))); + + addSeparator("buffer-options.loading-saving"); + + //{{{ Line separator + String[] lineSeps = { jEdit.getProperty("lineSep.unix"), + jEdit.getProperty("lineSep.windows"), + jEdit.getProperty("lineSep.mac") }; + lineSeparator = new JComboBox(lineSeps); + String lineSep = buffer.getStringProperty(Buffer.LINESEP); + if(lineSep == null) + lineSep = System.getProperty("line.separator"); + if("\n".equals(lineSep)) + lineSeparator.setSelectedIndex(0); + else if("\r\n".equals(lineSep)) + lineSeparator.setSelectedIndex(1); + else if("\r".equals(lineSep)) + lineSeparator.setSelectedIndex(2); + addComponent(jEdit.getProperty("buffer-options.lineSeparator"), + lineSeparator); + //}}} + + //{{{ Encoding + String[] encodings = MiscUtilities.getEncodings(); + Arrays.sort(encodings,new MiscUtilities.StringICaseCompare()); + encoding = new JComboBox(encodings); + encoding.setEditable(true); + encoding.setSelectedItem(buffer.getStringProperty(Buffer.ENCODING)); + addComponent(jEdit.getProperty("buffer-options.encoding"), + encoding); + //}}} + + //{{{ GZipped setting + gzipped = new JCheckBox(jEdit.getProperty( + "buffer-options.gzipped")); + gzipped.setSelected(buffer.getBooleanProperty(Buffer.GZIPPED)); + addComponent(gzipped); + //}}} + + //{{{ Autoreload settings + /* Check mod status on focus */ + String[] modCheckOptions = { + jEdit.getProperty("options.general.checkModStatus.nothing"), + jEdit.getProperty("options.general.checkModStatus.prompt"), + jEdit.getProperty("options.general.checkModStatus.reload"), + jEdit.getProperty("options.general.checkModStatus.silentReload") + }; + checkModStatus = new JComboBox(modCheckOptions); + if(buffer.getAutoReload()) { + if(buffer.getAutoReloadDialog()) + // reload and notify + checkModStatus.setSelectedIndex(2); + else // reload silently + checkModStatus.setSelectedIndex(3); + } + else { + if(buffer.getAutoReloadDialog()) + // prompt + checkModStatus.setSelectedIndex(1); + else // do nothing + checkModStatus.setSelectedIndex(0); + } + addComponent(jEdit.getProperty("options.general.checkModStatus"), + checkModStatus); + + // }}} + + addSeparator("buffer-options.editing"); + + //{{{ Edit mode + modes = jEdit.getModes(); + MiscUtilities.quicksort(modes,new MiscUtilities.StringICaseCompare()); + mode = new JComboBox(modes); + mode.setSelectedItem(buffer.getMode()); + ActionHandler actionListener = new ActionHandler(); + mode.addActionListener(actionListener); + addComponent(jEdit.getProperty("buffer-options.mode"),mode); + //}}} + + //{{{ Fold mode + String[] foldModes = FoldHandler.getFoldModes(); + + folding = new JComboBox(foldModes); + folding.setSelectedItem(buffer.getStringProperty("folding")); + addComponent(jEdit.getProperty("options.editing.folding"), + folding); + //}}} + + //{{{ Wrap mode + String[] wrapModes = { + "none", + "soft", + "hard" + }; + + wrap = new JComboBox(wrapModes); + wrap.setSelectedItem(buffer.getStringProperty("wrap")); + addComponent(jEdit.getProperty("options.editing.wrap"), + wrap); + //}}} + + //{{{ Max line length + String[] lineLengths = { "0", "72", "76", "80" }; + + maxLineLen = new JComboBox(lineLengths); + maxLineLen.setEditable(true); + maxLineLen.setSelectedItem(buffer.getStringProperty("maxLineLen")); + addComponent(jEdit.getProperty("options.editing.maxLineLen"), + maxLineLen); + //}}} + + //{{{ Tab size + String[] tabSizes = { "2", "4", "8" }; + tabSize = new JComboBox(tabSizes); + tabSize.setEditable(true); + tabSize.setSelectedItem(buffer.getStringProperty("tabSize")); + addComponent(jEdit.getProperty("options.editing.tabSize"),tabSize); + //}}} + + //{{{ Indent size + indentSize = new JComboBox(tabSizes); + indentSize.setEditable(true); + indentSize.setSelectedItem(buffer.getStringProperty("indentSize")); + addComponent(jEdit.getProperty("options.editing.indentSize"), + indentSize); + //}}} + + //{{{ Soft tabs + noTabs = new JCheckBox(jEdit.getProperty( + "options.editing.noTabs")); + noTabs.setSelected(buffer.getBooleanProperty("noTabs")); + addComponent(noTabs); + + } + + + protected void _save() + { + int index = lineSeparator.getSelectedIndex(); + String lineSep; + if(index == 0) + lineSep = "\n"; + else if(index == 1) + lineSep = "\r\n"; + else if(index == 2) + lineSep = "\r"; + else + throw new InternalError(); + + String oldLineSep = buffer.getStringProperty(Buffer.LINESEP); + if(oldLineSep == null) + oldLineSep = System.getProperty("line.separator"); + if(!oldLineSep.equals(lineSep)) + { + buffer.setStringProperty("lineSeparator",lineSep); + buffer.setDirty(true); + } + + String encoding = (String)this.encoding.getSelectedItem(); + String oldEncoding = buffer.getStringProperty(Buffer.ENCODING); + if(!oldEncoding.equals(encoding)) + { + buffer.setStringProperty(Buffer.ENCODING,encoding); + buffer.setDirty(true); + } + + boolean gzippedValue = gzipped.isSelected(); + boolean oldGzipped = buffer.getBooleanProperty( + Buffer.GZIPPED); + if(gzippedValue != oldGzipped) + { + buffer.setBooleanProperty(Buffer.GZIPPED,gzippedValue); + buffer.setDirty(true); + } + + buffer.setStringProperty("folding",(String)folding.getSelectedItem()); + + buffer.setStringProperty("wrap",(String)wrap.getSelectedItem()); + + try + { + buffer.setProperty("maxLineLen",new Integer( + maxLineLen.getSelectedItem().toString())); + } + catch(NumberFormatException nf) + { + } + + try + { + buffer.setProperty("tabSize",new Integer( + tabSize.getSelectedItem().toString())); + } + catch(NumberFormatException nf) + { + } + + try + { + buffer.setProperty("indentSize",new Integer( + indentSize.getSelectedItem().toString())); + } + catch(NumberFormatException nf) + { + } + + buffer.setBooleanProperty("noTabs",noTabs.isSelected()); + + index = mode.getSelectedIndex(); + buffer.setMode(modes[index]); + switch(checkModStatus.getSelectedIndex()) + { + case 0: + buffer.setAutoReloadDialog(false); + buffer.setAutoReload(false); + break; + case 1: + buffer.setAutoReloadDialog(true); + buffer.setAutoReload(false); + break; + case 2: + buffer.setAutoReloadDialog(true); + buffer.setAutoReload(true); + break; + case 3: + buffer.setAutoReloadDialog(false); + buffer.setAutoReload(true); + break; + } + } + + + class ActionHandler implements ActionListener + { + //{{{ actionPerformed() method + public void actionPerformed(ActionEvent evt) + { + Object source = evt.getSource(); + if(source == mode) + { + Mode _mode = (Mode)mode.getSelectedItem(); + folding.setSelectedItem(_mode.getProperty( + "folding")); + wrap.setSelectedItem(_mode.getProperty( + "wrap")); + maxLineLen.setSelectedItem(_mode.getProperty( + "maxLineLen")); + tabSize.setSelectedItem(_mode.getProperty( + "tabSize")); + indentSize.setSelectedItem(_mode.getProperty( + "indentSize")); + noTabs.setSelected(_mode.getBooleanProperty( + "noTabs")); + } + } //}}} + } //}}} + +} Modified: jEdit/trunk/org/gjt/sp/jedit/options/GeneralOptionPane.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/options/GeneralOptionPane.java 2006-10-20 13:45:04 UTC (rev 7626) +++ jEdit/trunk/org/gjt/sp/jedit/options/GeneralOptionPane.java 2006-10-20 17:13:12 UTC (rev 7627) @@ -78,15 +78,24 @@ String[] modCheckOptions = { jEdit.getProperty("options.general.checkModStatus.nothing"), jEdit.getProperty("options.general.checkModStatus.prompt"), - jEdit.getProperty("options.general.checkModStatus.reload") + jEdit.getProperty("options.general.checkModStatus.reload"), + jEdit.getProperty("options.general.checkModStatus.silentreload") }; checkModStatus = new JComboBox(modCheckOptions); - if(jEdit.getBooleanProperty("autoReload")) - checkModStatus.setSelectedIndex(2); - else if(jEdit.getBooleanProperty("autoReloadDialog")) - checkModStatus.setSelectedIndex(1); - else - checkModStatus.setSelectedIndex(0); + if(jEdit.getBooleanProperty("autoReload")) { + if(jEdit.getBooleanProperty("autoReloadDialog")) + // reload and notify + checkModStatus.setSelectedIndex(2); + else // reload silently + checkModStatus.setSelectedIndex(3); + } + else { + if(jEdit.getBooleanProperty("autoReloadDialog")) + // prompt + checkModStatus.setSelectedIndex(1); + else // do nothing + checkModStatus.setSelectedIndex(0); + } addComponent(jEdit.getProperty("options.general.checkModStatus"), checkModStatus); @@ -199,6 +208,10 @@ jEdit.setBooleanProperty("autoReloadDialog",true); jEdit.setBooleanProperty("autoReload",true); break; + case 3: + jEdit.setBooleanProperty("autoReloadDialog",false); + jEdit.setBooleanProperty("autoReload",true); + break; } jEdit.setProperty("recentFiles",recentFiles.getText()); jEdit.setBooleanProperty("sortRecent",sortRecent.isSelected()); Modified: jEdit/trunk/org/gjt/sp/jedit/perspective.dtd =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/perspective.dtd 2006-10-20 13:45:04 UTC (rev 7626) +++ jEdit/trunk/org/gjt/sp/jedit/perspective.dtd 2006-10-20 17:13:12 UTC (rev 7627) @@ -5,6 +5,9 @@ <!-- BUFFER element --> <!ELEMENT BUFFER ( #PCDATA ) > +<!ATTLIST BUFFER + AUTORELOAD %att-bool; "TRUE" + AUTORELOAD_DIALOG %att-bool; "TRUE" > <!-- VIEW element --> <!ELEMENT VIEW ( PANES | GEOMETRY | DOCKING ) > This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ez...@us...> - 2006-11-03 19:28:52
|
Revision: 7889 http://svn.sourceforge.net/jedit/?rev=7889&view=rev Author: ezust Date: 2006-11-03 11:28:38 -0800 (Fri, 03 Nov 2006) Log Message: ----------- Added a tooltip for the maxlinelen=0 Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props jEdit/trunk/org/gjt/sp/jedit/options/EditingOptionPane.java jEdit/trunk/org/gjt/sp/jedit/textarea/AntiAlias.java Modified: jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props 2006-11-03 10:11:55 UTC (rev 7888) +++ jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props 2006-11-03 19:28:38 UTC (rev 7889) @@ -1698,6 +1698,7 @@ options.editing.collapseFolds=Initially collapse folds with level: options.editing.wrap=Word wrap: options.editing.maxLineLen=Wrap margin: +options.editing.maxLineLen.tooltip=Select 0 for text area width options.editing.tabSize=Tab width: options.editing.indentSize=Indent width: options.editing.noWordSep=Extra word characters: Modified: jEdit/trunk/org/gjt/sp/jedit/options/EditingOptionPane.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/options/EditingOptionPane.java 2006-11-03 10:11:55 UTC (rev 7888) +++ jEdit/trunk/org/gjt/sp/jedit/options/EditingOptionPane.java 2006-11-03 19:28:38 UTC (rev 7889) @@ -92,8 +92,9 @@ wrap = new JComboBox(wrapModes)); String[] lineLens = { "0", "72", "76", "80" }; - addComponent(jEdit.getProperty("options.editing.maxLineLen"), - maxLineLen = new JComboBox(lineLens)); + maxLineLen = new JComboBox(lineLens); + maxLineLen.setToolTipText(jEdit.getProperty("options.editing.maxLineLen.tooltip")); + addComponent(jEdit.getProperty("options.editing.maxLineLen"), maxLineLen); maxLineLen.setEditable(true); String[] tabSizes = { "2", "4", "8" }; Modified: jEdit/trunk/org/gjt/sp/jedit/textarea/AntiAlias.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/textarea/AntiAlias.java 2006-11-03 10:11:55 UTC (rev 7888) +++ jEdit/trunk/org/gjt/sp/jedit/textarea/AntiAlias.java 2006-11-03 19:28:38 UTC (rev 7889) @@ -1,5 +1,5 @@ /* - * EditPane.java - Text area and buffer switcher + * AntiAlias.java - a small helper class for AntiAlias settings. * :tabSize=8:indentSize=8:noTabs=false: * :folding=explicit:collapseFolds=1: * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ez...@us...> - 2006-11-13 16:39:51
|
Revision: 8015 http://svn.sourceforge.net/jedit/?rev=8015&view=rev Author: ezust Date: 2006-11-11 14:01:10 -0800 (Sat, 11 Nov 2006) Log Message: ----------- [ 1593900 ] Bug 1593389 - non-empty directory not being deleted Applied patch + added info for the dialog. Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/browser/VFSBrowser.java jEdit/trunk/org/gjt/sp/jedit/io/FileVFS.java jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props Modified: jEdit/trunk/org/gjt/sp/jedit/browser/VFSBrowser.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/browser/VFSBrowser.java 2006-11-11 05:34:24 UTC (rev 8014) +++ jEdit/trunk/org/gjt/sp/jedit/browser/VFSBrowser.java 2006-11-11 22:01:10 UTC (rev 8015) @@ -615,13 +615,17 @@ } StringBuffer buf = new StringBuffer(); + String typeStr = "files"; for(int i = 0; i < files.length; i++) { buf.append(files[i].getPath()); buf.append('\n'); + if (files[i].getType() == VFSFile.DIRECTORY) + typeStr = "directories and their contents"; } - Object[] args = { buf.toString() }; + Object[] args = { buf.toString(), typeStr}; + int result = GUIUtilities.confirm(this,dialogType,args, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); Modified: jEdit/trunk/org/gjt/sp/jedit/io/FileVFS.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/io/FileVFS.java 2006-11-11 05:34:24 UTC (rev 8014) +++ jEdit/trunk/org/gjt/sp/jedit/io/FileVFS.java 2006-11-11 22:01:10 UTC (rev 8015) @@ -143,6 +143,27 @@ return super.insert(view,buffer,path); } //}}} + //{{{ recursiveDelete() method + /** + * # + * @param path the directory path to recursive delete + * @return true if successful, else false + */ + public boolean recursiveDelete(File path) { + if( path.exists() ) { + File[] files = path.listFiles(); + for(int i=0; i<files.length; i++) { + if(files[i].isDirectory()) { + recursiveDelete(files[i]); + } + else { + files[i].delete(); + } + } + } + return( path.delete() ); + } //}}} + //{{{ _canonPath() method /** * Returns the canonical form if the specified path name. For example, @@ -317,8 +338,15 @@ { canonPath = path; } - - boolean retVal = file.delete(); + // if directory, do recursive delete + boolean retVal; + if (!file.isDirectory()) { + retVal = file.delete(); + } + else + { + retVal = recursiveDelete(file); + } if(retVal) VFSManager.sendVFSUpdate(this,canonPath,true); return retVal; Modified: jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props 2006-11-11 05:34:24 UTC (rev 8014) +++ jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props 2006-11-11 22:01:10 UTC (rev 8015) @@ -2188,7 +2188,7 @@ vfs.browser.recurse-favorites.message=The favorites list cannot be added to itself. vfs.browser.delete-confirm.title=Delete File Confirmation -vfs.browser.delete-confirm.message=Are you sure you want to delete the following files?\n\n\ +vfs.browser.delete-confirm.message=Are you sure you want to delete the following {1}?\n\n\ {0} vfs.browser.delete-favorites.title=Delete From Favorites This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ez...@us...> - 2006-11-13 17:14:35
|
Revision: 8017 http://svn.sourceforge.net/jedit/?rev=8017&view=rev Author: ezust Date: 2006-11-11 16:19:50 -0800 (Sat, 11 Nov 2006) Log Message: ----------- Changed big label into a tooltip. Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props jEdit/trunk/org/gjt/sp/jedit/search/SearchDialog.java Modified: jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props 2006-11-11 22:09:09 UTC (rev 8016) +++ jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props 2006-11-12 00:19:50 UTC (rev 8017) @@ -1224,7 +1224,8 @@ #{{{ Search and replace dialog search.title=Search And Replace -search.find=Search for: (PgUp/PgDown or right-click to recall previous) +search.find=Search for: +search.find.tooltip=PgUp/PgDown or right-click to recall previous search.find.mnemonic=s search.replace=Replace with: search.replace.mnemonic=w Modified: jEdit/trunk/org/gjt/sp/jedit/search/SearchDialog.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/search/SearchDialog.java 2006-11-11 22:09:09 UTC (rev 8016) +++ jEdit/trunk/org/gjt/sp/jedit/search/SearchDialog.java 2006-11-12 00:19:50 UTC (rev 8017) @@ -327,11 +327,13 @@ GridBagConstraints cons) { JLabel label = new JLabel(jEdit.getProperty("search.find")); + label.setDisplayedMnemonic(jEdit.getProperty("search.find.mnemonic") .charAt(0)); find = new HistoryTextArea("find"); find.setColumns(25); - + find.setToolTipText(jEdit.getProperty("search.find.tooltip")); + label.setToolTipText(jEdit.getProperty("search.find.tooltip")); label.setLabelFor(find); label.setBorder(new EmptyBorder(12,0,2,0)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <va...@us...> - 2006-11-20 06:01:41
|
Revision: 8100 http://svn.sourceforge.net/jedit/?rev=8100&view=rev Author: vanza Date: 2006-11-19 22:01:39 -0800 (Sun, 19 Nov 2006) Log Message: ----------- - some doc updates - check whether the input encoding is valid before trying to use it to open the buffer. Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props jEdit/trunk/org/gjt/sp/jedit/menu/ReloadWithEncodingProvider.java Modified: jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props 2006-11-20 05:39:56 UTC (rev 8099) +++ jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props 2006-11-20 06:01:39 UTC (rev 8100) @@ -23,6 +23,7 @@ common.ok=OK common.cancel=Cancel common.close=Close +common.error=Error common.apply=Apply common.more=More common.insert=Insert @@ -211,6 +212,7 @@ reload-encoding.code=new ReloadWithEncodingProvider(); reload-encoding.label=Reload with $Encoding +reload-encoding.error={0} is not a valid encoding #}}} #{{{ Edit menu Modified: jEdit/trunk/org/gjt/sp/jedit/menu/ReloadWithEncodingProvider.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/menu/ReloadWithEncodingProvider.java 2006-11-20 05:39:56 UTC (rev 8099) +++ jEdit/trunk/org/gjt/sp/jedit/menu/ReloadWithEncodingProvider.java 2006-11-20 06:01:39 UTC (rev 8100) @@ -1,9 +1,9 @@ /* - * RecentFilesProvider.java - Recent file list menu + * ReloadWithEncodingProvider.java - Recent file list menu * :tabSize=8:indentSize=8:noTabs=false: * :folding=explicit:collapseFolds=1: * - * Copyright (C) 2000, 2003 Slava Pestov + * Copyright (C) 2006 Marcelo Vanzin * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -22,10 +22,12 @@ package org.gjt.sp.jedit.menu; -//{{{ Imports import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.nio.charset.Charset; +import java.nio.charset.UnsupportedCharsetException; + import java.util.Arrays; import java.util.Hashtable; @@ -38,8 +40,13 @@ import org.gjt.sp.jedit.GUIUtilities; import org.gjt.sp.jedit.MiscUtilities; import org.gjt.sp.jedit.View; -//}}} +/** + * Menu provider for actions to reload the current buffer with a + * specific encoding. + * + * @version $Id$ + */ public class ReloadWithEncodingProvider implements ActionListener, DynamicMenuProvider @@ -115,6 +122,21 @@ JOptionPane.QUESTION_MESSAGE); if (encoding == null) return; + + try + { + Charset.forName(encoding); + } + catch (UnsupportedCharsetException uce) + { + String msg = jEdit.getProperty("reload-encoding.error", + new Object[] { encoding }); + JOptionPane.showMessageDialog(view, + msg, + jEdit.getProperty("common.error"), + JOptionPane.ERROR_MESSAGE); + return; + } } if (encoding != null) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ez...@us...> - 2006-12-18 04:25:11
|
Revision: 8235 http://svn.sourceforge.net/jedit/?rev=8235&view=rev Author: ezust Date: 2006-12-17 20:25:09 -0800 (Sun, 17 Dec 2006) Log Message: ----------- Added a tooltip. Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props jEdit/trunk/org/gjt/sp/jedit/search/SearchDialog.java Modified: jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props 2006-12-16 21:18:43 UTC (rev 8234) +++ jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props 2006-12-18 04:25:09 UTC (rev 8235) @@ -1277,6 +1277,7 @@ search.directoryField.mnemonic=y search.filterField=Filter: search.filterField.mnemonic=f +search.filterField.tooltip={*.c,*.h} for multiple extensions search.subdirs=Search subdirectories search.subdirs.mnemonic=u search.choose=Choose... Modified: jEdit/trunk/org/gjt/sp/jedit/search/SearchDialog.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/search/SearchDialog.java 2006-12-16 21:18:43 UTC (rev 8234) +++ jEdit/trunk/org/gjt/sp/jedit/search/SearchDialog.java 2006-12-18 04:25:09 UTC (rev 8235) @@ -524,6 +524,8 @@ MultiFileActionHandler actionListener = new MultiFileActionHandler(); filter = new HistoryTextField("search.filter"); + + filter.setToolTipText(jEdit.getProperty("search.filterField.tooltip")); filter.addActionListener(actionListener); cons.insets = new Insets(0,0,3,0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kp...@us...> - 2006-12-25 21:39:28
|
Revision: 8258 http://svn.sourceforge.net/jedit/?rev=8258&view=rev Author: kpouer Date: 2006-12-25 13:39:27 -0800 (Mon, 25 Dec 2006) Log Message: ----------- use of generics Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/print/BufferPrintable.java jEdit/trunk/org/gjt/sp/jedit/syntax/DisplayTokenHandler.java Modified: jEdit/trunk/org/gjt/sp/jedit/print/BufferPrintable.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/print/BufferPrintable.java 2006-12-25 21:26:39 UTC (rev 8257) +++ jEdit/trunk/org/gjt/sp/jedit/print/BufferPrintable.java 2006-12-25 21:39:27 UTC (rev 8258) @@ -24,7 +24,6 @@ package org.gjt.sp.jedit.print; //{{{ Imports -import javax.swing.text.Segment; import javax.swing.text.TabExpander; import javax.swing.SwingUtilities; import java.awt.font.*; @@ -33,11 +32,16 @@ import java.awt.*; import java.lang.reflect.Method; import java.util.*; +import java.util.List; + import org.gjt.sp.jedit.syntax.*; import org.gjt.sp.jedit.*; import org.gjt.sp.util.*; //}}} +/** + * @version $Id$ + */ class BufferPrintable implements Printable { //{{{ BufferPrintable constructor @@ -72,7 +76,7 @@ } } - lineList = new ArrayList(); + lineList = new ArrayList<Chunk>(); tokenHandler = new DisplayTokenHandler(); } //}}} @@ -197,7 +201,7 @@ private boolean end; private LineMetrics lm; - private ArrayList lineList; + private final List<Chunk> lineList; private FontRenderContext frc; @@ -208,7 +212,7 @@ private void printPage(Graphics _gfx, PageFormat pageFormat, int pageIndex, boolean actuallyPaint) { - Log.log(Log.DEBUG,this,"printPage(" + pageIndex + "," + actuallyPaint + ")"); + Log.log(Log.DEBUG,this,"printPage(" + pageIndex + ',' + actuallyPaint + ')'); Graphics2D gfx = (Graphics2D)_gfx; gfx.setFont(font); @@ -218,7 +222,7 @@ double pageHeight = pageFormat.getImageableHeight(); Log.log(Log.DEBUG,this,"#1 - Page dimensions: " + pageWidth - + "x" + pageHeight); + + 'x' + pageHeight); if(header) { @@ -259,7 +263,7 @@ Log.log(Log.DEBUG,this,"#2 - Page dimensions: " + (pageWidth - lineNumberWidth) - + "x" + pageHeight); + + 'x' + pageHeight); //{{{ calculate tab size int tabSize = jEdit.getIntegerProperty("print.tabSize",8); @@ -271,11 +275,10 @@ PrintTabExpander e = new PrintTabExpander(tabWidth); //}}} - double y = 0.0; - lm = font.getLineMetrics("gGyYX",frc); Log.log(Log.DEBUG,this,"Line height is " + lm.getHeight()); + double y = 0.0; print_loop: for(;;) { if(currentPhysicalLine == buffer.getLineCount()) @@ -299,7 +302,7 @@ (float)(pageWidth - lineNumberWidth)); buffer.markTokens(currentPhysicalLine,tokenHandler); - if(lineList.size() == 0) + if(lineList.isEmpty()) lineList.add(null); if(y + (lm.getHeight() * lineList.size()) >= pageHeight) @@ -319,7 +322,7 @@ for(int i = 0; i < lineList.size(); i++) { y += lm.getHeight(); - Chunk chunks = (Chunk)lineList.get(i); + Chunk chunks = lineList.get(i); if(chunks != null && actuallyPaint) { Chunk.paintChunkBackgrounds(chunks,gfx, @@ -368,7 +371,7 @@ boolean actuallyPaint) { String footerText = jEdit.getProperty("print.footerText", - new Object[] { new Date(), new Integer(pageIndex + 1) }); + new Object[] { new Date(), Integer.valueOf(pageIndex + 1)}); FontRenderContext frc = gfx.getFontRenderContext(); lm = font.getLineMetrics(footerText,frc); @@ -399,7 +402,7 @@ private double tabWidth; //{{{ PrintTabExpander constructor - public PrintTabExpander(double tabWidth) + PrintTabExpander(double tabWidth) { this.tabWidth = tabWidth; } //}}} Modified: jEdit/trunk/org/gjt/sp/jedit/syntax/DisplayTokenHandler.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/syntax/DisplayTokenHandler.java 2006-12-25 21:26:39 UTC (rev 8257) +++ jEdit/trunk/org/gjt/sp/jedit/syntax/DisplayTokenHandler.java 2006-12-25 21:39:27 UTC (rev 8258) @@ -26,11 +26,11 @@ import javax.swing.text.*; import java.awt.font.*; import java.util.List; -import org.gjt.sp.jedit.syntax.*; //}}} /** * Creates {@link Chunk} objects that can be painted on screen. + * @version $Id$ */ public class DisplayTokenHandler extends DefaultTokenHandler { @@ -40,7 +40,7 @@ //{{{ init() method public void init(SyntaxStyle[] styles, FontRenderContext fontRenderContext, - TabExpander expander, List out, + TabExpander expander, List<Chunk> out, float wrapMargin) { super.init(); @@ -69,7 +69,7 @@ * Returns the list of chunks. * @since jEdit 4.1pre7 */ - public List getChunkList() + public List<Chunk> getChunkList() { return out; } //}}} @@ -156,7 +156,7 @@ private TabExpander expander; private float x; - private List out; + private List<Chunk> out; private float wrapMargin; private float endX; private Token end; @@ -217,7 +217,7 @@ } //}}} //{{{ canMerge() method - private boolean canMerge(Chunk c1, Chunk c2, Segment seg) + private static boolean canMerge(Chunk c1, Chunk c2, Segment seg) { if(!c1.accessable || !c2.accessable) return false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ez...@us...> - 2006-12-28 22:11:08
|
Revision: 8276 http://svn.sourceforge.net/jedit/?rev=8276&view=rev Author: ezust Date: 2006-12-28 14:11:07 -0800 (Thu, 28 Dec 2006) Log Message: ----------- Added a tooltip to the filter prefix textfield. Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props jEdit/trunk/org/gjt/sp/jedit/menu/RecentFilesProvider.java Modified: jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props 2006-12-28 21:57:59 UTC (rev 8275) +++ jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props 2006-12-28 22:11:07 UTC (rev 8276) @@ -206,6 +206,7 @@ #{{{ Recent Files menu recent-files.code=new RecentFilesProvider(); recent-files.label=Recent $Files +recent-files.textfield.tooltip=a filter prefix can be entered here no-recent-files.label=No Recent Files clear-recent-files.label=Clear Recent Files #}}} Modified: jEdit/trunk/org/gjt/sp/jedit/menu/RecentFilesProvider.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/menu/RecentFilesProvider.java 2006-12-28 21:57:59 UTC (rev 8275) +++ jEdit/trunk/org/gjt/sp/jedit/menu/RecentFilesProvider.java 2006-12-28 22:11:07 UTC (rev 8276) @@ -95,9 +95,10 @@ return; } - final List<JMenuItem> menuItems = new ArrayList<JMenuItem>(); - final JTextField text = new JTextField(); - menu.add(text); + final List<JMenuItem> menuItems = new ArrayList<JMenuItem>(); + final JTextField text = new JTextField(); + text.setToolTipText(jEdit.getProperty("recent-files.textfield.tooltip")); + menu.add(text); text.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kp...@us...> - 2006-12-30 13:06:26
|
Revision: 8287 http://svn.sourceforge.net/jedit/?rev=8287&view=rev Author: kpouer Date: 2006-12-30 05:06:24 -0800 (Sat, 30 Dec 2006) Log Message: ----------- some generics used and minor change Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/browser/VFSBrowser.java jEdit/trunk/org/gjt/sp/jedit/textarea/TextArea.java Modified: jEdit/trunk/org/gjt/sp/jedit/browser/VFSBrowser.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/browser/VFSBrowser.java 2006-12-30 12:11:59 UTC (rev 8286) +++ jEdit/trunk/org/gjt/sp/jedit/browser/VFSBrowser.java 2006-12-30 13:06:24 UTC (rev 8287) @@ -326,13 +326,8 @@ path = System.getProperty("user.dir"); else if(defaultPath.equals("buffer")) { - if(view != null) - { - Buffer buffer = view.getBuffer(); - path = buffer.getDirectory(); - } - else - path = userHome; + Buffer buffer = view.getBuffer(); + path = buffer.getDirectory(); } else if(defaultPath.equals("last")) { @@ -871,7 +866,7 @@ List<JMenuItem> vec = new ArrayList<JMenuItem>(); //{{{ old API - Enumeration e = VFSManager.getFilesystems(); + Enumeration<VFS> e = VFSManager.getFilesystems(); while(e.hasMoreElements()) { @@ -1377,7 +1372,7 @@ ); } - private boolean isProcessingEvent = false; + private boolean isProcessingEvent; } //}}} @@ -1923,7 +1918,7 @@ else { setCaretPosition(0); - this.getCaret().setVisible(false); + getCaret().setVisible(false); } } Modified: jEdit/trunk/org/gjt/sp/jedit/textarea/TextArea.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/textarea/TextArea.java 2006-12-30 12:11:59 UTC (rev 8286) +++ jEdit/trunk/org/gjt/sp/jedit/textarea/TextArea.java 2006-12-30 13:06:24 UTC (rev 8287) @@ -141,7 +141,6 @@ listenerList = new EventListenerList(); caretEvent = new MutableCaretEvent(); blink = true; - lineSegment = new Segment(); offsetXY = new Point(); structureMatchers = new LinkedList<StructureMatcher>(); structureMatchers.add(new StructureMatcher.BracketMatcher()); @@ -200,7 +199,7 @@ //{{{ setMouseHandler() method public void setMouseHandler(MouseInputAdapter mouseInputAdapter) { - this.mouseHandler = mouseInputAdapter; + mouseHandler = mouseInputAdapter; painter.addMouseListener(mouseHandler); painter.addMouseMotionListener(mouseHandler); } //}}} @@ -754,8 +753,8 @@ extraEndVirt = 0; int _electricScroll = doElectricScroll - && visibleLines - 1 > electricScroll * 2 - ? electricScroll : 0; + && visibleLines - 1 > (electricScroll << 1) + ? electricScroll : 0; //}}} if(visibleLines <= 1) @@ -819,7 +818,7 @@ Log.log(Log.DEBUG,this,"Last physical line is " + getLastPhysicalLine()); } setFirstPhysicalLine(line,subregion - - visibleLines / 2); + - (visibleLines >> 1)); if(Debug.SCROLL_TO_DEBUG) { Log.log(Log.DEBUG,this,"Last physical line is " + getLastPhysicalLine()); @@ -1670,10 +1669,11 @@ * Returns the selection with the specified index. This must be * between 0 and the return value of <code>getSelectionCount()</code>. * @since jEdit 4.3pre1 + * @param index the index of the selection you want */ public Selection getSelection(int index) { - return (Selection)selectionManager.selection.get(index); + return selectionManager.selection.get(index); } //}}} //{{{ selectNone() method @@ -2128,7 +2128,7 @@ */ public void centerCaret() { - int offset = getScreenLineStartOffset(visibleLines / 2); + int offset = getScreenLineStartOffset(visibleLines >> 1); if(offset == -1) getToolkit().beep(); else @@ -2284,6 +2284,7 @@ //{{{ goToNextBracket() method /** * Moves the caret to the next closing bracket. + * @param select true if you want to extend selection * @since jEdit 2.7pre2. */ public void goToNextBracket(boolean select) @@ -2321,6 +2322,7 @@ //{{{ goToNextCharacter() method /** * Moves the caret to the next character. + * @param select true if you want to extend selection * @since jEdit 2.7pre2. */ public void goToNextCharacter(boolean select) @@ -2408,6 +2410,7 @@ //{{{ goToNextLine() method /** * Move the caret to the next line. + * @param select true if you want to extend selection * @since jEdit 2.7pre2 */ public void goToNextLine(boolean select) @@ -2431,35 +2434,15 @@ newCaret = end; } - if(select) - { - RectParams params = getRectParams(caret,newCaret); - int extraStartVirt; - int extraEndVirt; - if(params == null) - { - extraStartVirt = 0; - extraEndVirt = 0; - } - else - { - extraStartVirt = params.extraStartVirt; - extraEndVirt = params.extraEndVirt; - newCaret = params.newCaret; - } - extendSelection(caret,newCaret,extraStartVirt,extraEndVirt); - } - else if(!multi) - selectNone(); + _changeLine(select, newCaret); - moveCaretPosition(newCaret); - setMagicCaretPosition(magic); - } //}}} + }//}}} //{{{ goToNextPage() method /** * Moves the caret to the next screenful. + * @param select true if you want to extend selection * @since jEdit 2.7pre2. */ public void goToNextPage(boolean select) @@ -2504,6 +2487,7 @@ //{{{ goToNextParagraph() method /** * Moves the caret to the start of the next paragraph. + * @param select true if you want to extend selection * @since jEdit 2.7pre2 */ public void goToNextParagraph(boolean select) @@ -2554,6 +2538,7 @@ * Moves the caret to the start of the next word. * Note that if the "view.eatWhitespace" boolean propery is false, * this method moves the caret to the end of the current word instead. + * @param select true if you want to extend selection * @since jEdit 2.7pre2 */ public void goToNextWord(boolean select) @@ -2602,6 +2587,7 @@ //{{{ goToPrevBracket() method /** * Moves the caret to the previous bracket. + * @param select true if you want to extend selection * @since jEdit 2.7pre2 */ public void goToPrevBracket(boolean select) @@ -2635,6 +2621,7 @@ //{{{ goToPrevCharacter() method /** * Moves the caret to the previous character. + * @param select true if you want to extend selection * @since jEdit 2.7pre2. */ public void goToPrevCharacter(boolean select) @@ -2715,6 +2702,7 @@ //{{{ goToPrevLine() method /** * Moves the caret to the previous line. + * @param select true if you want to extend selection * @since jEdit 2.7pre2 */ public void goToPrevLine(boolean select) @@ -2739,35 +2727,15 @@ newCaret = start; } - if(select) - { - RectParams params = getRectParams(caret,newCaret); - int extraStartVirt; - int extraEndVirt; - if(params == null) - { - extraStartVirt = 0; - extraEndVirt = 0; - } - else - { - extraStartVirt = params.extraStartVirt; - extraEndVirt = params.extraEndVirt; - newCaret = params.newCaret; - } - extendSelection(caret,newCaret,extraStartVirt,extraEndVirt); - } - else if(!multi) - selectNone(); + _changeLine(select, newCaret); - moveCaretPosition(newCaret); - setMagicCaretPosition(magic); } //}}} //{{{ goToPrevPage() method /** * Moves the caret to the previous screenful. + * @param select true if you want to extend selection * @since jEdit 2.7pre2 */ public void goToPrevPage(boolean select) @@ -2811,6 +2779,7 @@ //{{{ goToPrevParagraph() method /** * Moves the caret to the start of the previous paragraph. + * @param select true if you want to extend selection * @since jEdit 2.7pre2 */ public void goToPrevParagraph(boolean select) @@ -2858,6 +2827,7 @@ //{{{ goToPrevWord() method /** * Moves the caret to the start of the previous word. + * @param select true if you want to extend selection * @since jEdit 2.7pre2 */ public void goToPrevWord(boolean select) @@ -2916,6 +2886,7 @@ * On subsequent invocations, first moves the caret to the first * non-whitespace character of the line, then the beginning of the * line, then to the first visible line. + * @param select true if you want to extend selection * @since jEdit 4.3pre7 */ public void smartHome(boolean select) @@ -2939,6 +2910,7 @@ * On subsequent invocations, first moves the caret to the last * non-whitespace character of the line, then the end of the * line, then to the last visible line. + * @param select true if you want to extend selection * @since jEdit 4.3pre7 */ public void smartEnd(boolean select) @@ -2960,6 +2932,7 @@ //{{{ goToStartOfLine() method /** * Moves the caret to the beginning of the current line. + * @param select true if you want to extend selection * @since jEdit 2.7pre2 */ public void goToStartOfLine(boolean select) @@ -2977,6 +2950,7 @@ //{{{ goToEndOfLine() method /** * Moves the caret to the end of the current line. + * @param select true if you want to extend selection * @since jEdit 2.7pre2 */ public void goToEndOfLine(boolean select) @@ -2999,6 +2973,7 @@ /** * Moves the caret to the first non-whitespace character of the current * line. + * @param select true if you want to extend selection * @since jEdit 2.7pre2 */ public void goToStartOfWhiteSpace(boolean select) @@ -3036,6 +3011,7 @@ /** * Moves the caret to the last non-whitespace character of the current * line. + * @param select true if you want to extend selection * @since jEdit 2.7pre2 */ public void goToEndOfWhiteSpace(boolean select) @@ -3077,6 +3053,7 @@ //{{{ goToFirstVisibleLine() method /** * Moves the caret to the first visible line. + * @param select true if you want to extend selection * @since jEdit 2.7pre2 */ public void goToFirstVisibleLine(boolean select) @@ -3099,6 +3076,7 @@ //{{{ goToLastVisibleLine() method /** * Moves the caret to the last visible line. + * @param select true if you want to extend selection * @since jEdit 2.7pre2 */ public void goToLastVisibleLine(boolean select) @@ -3136,6 +3114,7 @@ //{{{ goToBufferStart() method /** * Moves the caret to the beginning of the buffer. + * @param select true if you want to extend selection * @since jEdit 4.0pre3 */ public void goToBufferStart(boolean select) @@ -3152,6 +3131,7 @@ //{{{ goToBufferEnd() method /** * Moves the caret to the end of the buffer. + * @param select true if you want to extend selection * @since jEdit 4.0pre3 */ public void goToBufferEnd(boolean select) @@ -3430,52 +3410,29 @@ return; } - int start = 0, end = buffer.getLength(); - -loop: for(int i = caretLine - 1; i >= 0; i--) + // find the beginning of the paragraph. + int start = 0; + for(int i = caretLine - 1; i >= 0; i--) { - //if(!displayManager.isLineVisible(i)) - // continue loop; - - getLineText(i,lineSegment); - - for(int j = 0; j < lineSegment.count; j++) + if (lineContainsSpaceAndTabs(i)) { - switch(lineSegment.array[lineSegment.offset + j]) - { - case ' ': - case '\t': - break; - default: - continue loop; - } + start = getLineStartOffset(i); + break; } - - start = getLineStartOffset(i); - break loop; } -loop: for(int i = caretLine + 1; i < getLineCount(); i++) + // Find the end of the paragraph + int end = buffer.getLength(); + for(int i = caretLine + 1; i < getLineCount(); i++) { //if(!displayManager.isLineVisible(i)) // continue loop; - getLineText(i,lineSegment); - - for(int j = 0; j < lineSegment.count; j++) + if (lineContainsSpaceAndTabs(i)) { - switch(lineSegment.array[lineSegment.offset + j]) - { - case ' ': - case '\t': - break; - default: - continue loop; - } + end = getLineEndOffset(i) - 1; + break; } - - end = getLineEndOffset(i) - 1; - break loop; } buffer.remove(start,end - start); @@ -3691,6 +3648,7 @@ //{{{ goToNextFold() method /** * Moves the caret to the next fold. + * @param select true if you want to extend selection * @since jEdit 4.0pre3 */ public void goToNextFold(boolean select) @@ -3728,6 +3686,7 @@ //{{{ goToPrevFold() method /** * Moves the caret to the previous fold. + * @param select true if you want to extend selection * @since jEdit 4.0pre3 */ public void goToPrevFold(boolean select) @@ -3921,6 +3880,7 @@ caretBack = addExplicitFold(selection.start, selection.end, selection.startLine,selection.endLine); } // Selection cannot be null because there is at least 1 selection + assert selection != null; setCaretPosition(selection.start - caretBack, false); } } @@ -4076,44 +4036,22 @@ int start = 0, end = buffer.getLength(); -loop: for(int i = lineNo - 1; i >= 0; i--) + for(int i = lineNo - 1; i >= 0; i--) { - getLineText(i,lineSegment); - - for(int j = 0; j < lineSegment.count; j++) + if (lineContainsSpaceAndTabs(i)) { - switch(lineSegment.array[lineSegment.offset + j]) - { - case ' ': - case '\t': - break; - default: - continue loop; - } + start = getLineEndOffset(i); + break; } - - start = getLineEndOffset(i); - break loop; } -loop: for(int i = lineNo + 1; i < getLineCount(); i++) + for(int i = lineNo + 1; i < getLineCount(); i++) { - getLineText(i,lineSegment); - - for(int j = 0; j < lineSegment.count; j++) + if (lineContainsSpaceAndTabs(i)) { - switch(lineSegment.array[lineSegment.offset + j]) - { - case ' ': - case '\t': - break; - default: - continue loop; - } + end = getLineStartOffset(i) - 1; + break; } - - end = getLineStartOffset(i) - 1; - break loop; } try @@ -4598,7 +4536,7 @@ } //}}} //{{{ Input method support - private InputMethodSupport inputMethodSupport = null; + private InputMethodSupport inputMethodSupport; public InputMethodRequests getInputMethodRequests() { if(inputMethodSupport == null) @@ -4724,7 +4662,8 @@ */ public final void setSelectionStart(int selectionStart) { - select(selectionStart,getSelectionEnd(),true); + int selectionEnd = getSelectionCount() == 1 ? getSelection(0).getEnd() : caret; + select(selectionStart,selectionEnd,true); } //}}} //{{{ getSelectionEnd() method @@ -4734,10 +4673,8 @@ */ public final int getSelectionEnd() { - if(getSelectionCount() != 1) - return caret; + return getSelectionCount() == 1 ? getSelection(0).getEnd() : caret; - return getSelection(0).getEnd(); } //}}} //{{{ getSelectionEnd() method @@ -4854,10 +4791,7 @@ public boolean isSelectionRectangular() { Selection s = getSelectionAtOffset(caret); - if(s == null) - return false; - else - return s instanceof Selection.Rect; + return s != null && s instanceof Selection.Rect; } //}}} //}}} @@ -4867,12 +4801,12 @@ static TextArea focusedComponent; //{{{ Instance variables - Segment lineSegment; + final Segment lineSegment = new Segment(); MouseInputAdapter mouseHandler; - ChunkCache chunkCache; - FastRepaintManager repaintMgr; + final ChunkCache chunkCache; + final FastRepaintManager repaintMgr; DisplayManager displayManager; - SelectionManager selectionManager; + final SelectionManager selectionManager; boolean bufferChanging; int maxHorizontalScrollWidth; @@ -4892,7 +4826,7 @@ * Cursor location, measured as an offset (in pixels) from upper left corner * of the TextArea. */ - Point offsetXY; + final Point offsetXY; boolean lastLinePartial; @@ -4939,9 +4873,9 @@ horizontal.setUnitIncrement(10); horizontal.setBlockIncrement(painter.getWidth()); } - else if (horizontal.getValue() != -getHorizontalOffset()) + else if (horizontal.getValue() != -horizontalOffset) { - horizontal.setValue(-getHorizontalOffset()); + horizontal.setValue(-horizontalOffset); } } //}}} @@ -5130,18 +5064,18 @@ //{{{ Private members //{{{ Static variables - private static Timer caretTimer; - private static Timer structureTimer; + private static final Timer caretTimer; + private static final Timer structureTimer; //}}} //{{{ Instance variables protected Cursor hiddenCursor; - private Gutter gutter; - protected TextAreaPainter painter; + private final Gutter gutter; + protected final TextAreaPainter painter; - private EventListenerList listenerList; - private MutableCaretEvent caretEvent; + private final EventListenerList listenerList; + private final MutableCaretEvent caretEvent; private boolean caretBlinks; private InputHandlerProvider inputHandlerProvider; @@ -5157,9 +5091,9 @@ private boolean quickCopy; // JDiff, error list add stuff here - private Box verticalBox; - private JScrollBar vertical; - private JScrollBar horizontal; + private final Box verticalBox; + private final JScrollBar vertical; + private final JScrollBar horizontal; protected JEditBuffer buffer; @@ -5310,6 +5244,58 @@ } } //}}} + //{{{ _changeLine() method + private void _changeLine(boolean select, int newCaret) + { + if(select) + { + RectParams params = getRectParams(caret,newCaret); + int extraStartVirt; + int extraEndVirt; + if(params == null) + { + extraStartVirt = 0; + extraEndVirt = 0; + } + else + { + extraStartVirt = params.extraStartVirt; + extraEndVirt = params.extraEndVirt; + newCaret = params.newCaret; + } + extendSelection(caret,newCaret,extraStartVirt,extraEndVirt); + } + else if(!multi) + selectNone(); + + moveCaretPosition(newCaret); + }//}}} + + + /** + * Check if the line contains only spaces and tabs. + * + * @param lineIndex the line index + * @return <code>true</code> if the line contains only spaces and tabs + */ + private boolean lineContainsSpaceAndTabs(int lineIndex) + { + getLineText(lineIndex,lineSegment); + + for(int j = 0; j < lineSegment.count; j++) + { + switch(lineSegment.array[lineSegment.offset + j]) + { + case ' ': + case '\t': + break; + default: + return false; + } + } + return true; + } + //{{{ insert() method protected void insert(String str, boolean indent) { @@ -5584,9 +5570,9 @@ //{{{ getRectParams() method static class RectParams { - int extraStartVirt; - int extraEndVirt; - int newCaret; + final int extraStartVirt; + final int extraEndVirt; + final int newCaret; RectParams(int extraStartVirt, int extraEndVirt, int newCaret) { @@ -5831,7 +5817,7 @@ String endCommentStart = buffer.getContextSensitiveProperty(endCaret,"commentStart"); String endCommentEnd = buffer.getContextSensitiveProperty(endCaret,"commentEnd"); - String start, end; + String start; int caretBack = 1; if(startLineComment != null) start = startLineComment + "{{{ "; @@ -5856,6 +5842,7 @@ start += "\n"; } + String end; if(endLineComment != null) end = endLineComment + "}}}"; else if(endCommentStart != null && endCommentEnd != null) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kp...@us...> - 2007-01-06 09:50:05
|
Revision: 8314 http://svn.sourceforge.net/jedit/?rev=8314&view=rev Author: kpouer Date: 2007-01-06 01:50:04 -0800 (Sat, 06 Jan 2007) Log Message: ----------- minor fixes Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/pluginmgr/MirrorListHandler.java jEdit/trunk/org/gjt/sp/jedit/search/HyperSearchOperationNode.java Modified: jEdit/trunk/org/gjt/sp/jedit/pluginmgr/MirrorListHandler.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/pluginmgr/MirrorListHandler.java 2007-01-05 21:43:00 UTC (rev 8313) +++ jEdit/trunk/org/gjt/sp/jedit/pluginmgr/MirrorListHandler.java 2007-01-06 09:50:04 UTC (rev 8314) @@ -22,16 +22,19 @@ package org.gjt.sp.jedit.pluginmgr; -import java.io.*; import java.util.*; import org.xml.sax.Attributes; import org.xml.sax.InputSource; import org.xml.sax.helpers.DefaultHandler; -import org.gjt.sp.util.Log; import org.gjt.sp.util.XMLUtilities; +import org.gjt.sp.util.Log; +import org.gjt.sp.jedit.options.PluginOptions; +/** + * @version $Id$ + */ class MirrorListHandler extends DefaultHandler { //{{{ Constructor @@ -39,26 +42,19 @@ { this.mirrors = mirrors; this.path = path; - stateStack = new Stack(); - - description = new StringBuffer(); - location = new StringBuffer(); - country = new StringBuffer(); - continent = new StringBuffer(); } //}}} //{{{ resolveEntity() method public InputSource resolveEntity(String publicId, String systemId) { return XMLUtilities.findEntity(systemId, "mirrors.dtd", - org.gjt.sp.jedit.options.PluginOptions.class); + PluginOptions.class); } //}}} //{{{ characters() method public void characters(char[] c, int off, int len) { String tag = peekElement(); - String text = new String(c, off, len); if(tag == "DESCRIPTION") description.append(c, off, len); @@ -112,7 +108,7 @@ } catch (Exception e) { - e.printStackTrace(); + Log.log(Log.ERROR, this, e); } } //}}} @@ -126,35 +122,33 @@ //{{{ Variables private String id; - private StringBuffer description; - private StringBuffer location; - private StringBuffer country; - private StringBuffer continent; + private final StringBuilder description = new StringBuilder(); + private final StringBuilder location = new StringBuilder(); + private final StringBuilder country = new StringBuilder(); + private final StringBuilder continent = new StringBuilder(); - private MirrorList mirrors; + private final MirrorList mirrors; private MirrorList.Mirror mirror; - private Stack stateStack; - private String path; + private final Stack<String> stateStack = new Stack<String>(); + private final String path; //}}} private String pushElement(String name) { - name = (name == null) ? null : name.intern(); - + name = name == null ? null : name.intern(); stateStack.push(name); - return name; } private String peekElement() { - return (String) stateStack.peek(); + return stateStack.peek(); } - private String popElement() + private void popElement() { - return (String) stateStack.pop(); + stateStack.pop(); } //}}} Modified: jEdit/trunk/org/gjt/sp/jedit/search/HyperSearchOperationNode.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/search/HyperSearchOperationNode.java 2007-01-05 21:43:00 UTC (rev 8313) +++ jEdit/trunk/org/gjt/sp/jedit/search/HyperSearchOperationNode.java 2007-01-06 09:50:04 UTC (rev 8314) @@ -22,14 +22,13 @@ package org.gjt.sp.jedit.search; +//{{{ Imports import java.io.File; import java.util.ArrayList; import java.util.Enumeration; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.TreeMap; import javax.swing.JTree; import javax.swing.tree.DefaultMutableTreeNode; @@ -37,15 +36,14 @@ import javax.swing.tree.MutableTreeNode; import javax.swing.tree.TreePath; -//{{{ Imports //}}} public class HyperSearchOperationNode { - private boolean treeViewDisplayed = false; - private String searchString; - private List resultNodes; + private boolean treeViewDisplayed; + private final String searchString; + private List<DefaultMutableTreeNode> resultNodes; //{{{ HyperSearchOperationNode constructor public HyperSearchOperationNode(String searchString) @@ -74,8 +72,9 @@ //{{{ restoreFlatNodes() method public void restoreFlatNodes(JTree resultTree, DefaultMutableTreeNode operNode) { - for (Iterator iter = resultNodes.iterator(); iter.hasNext();) { - DefaultMutableTreeNode element = (DefaultMutableTreeNode) iter.next(); + for (int i = 0; i < resultNodes.size(); i++) + { + DefaultMutableTreeNode element = resultNodes.get(i); operNode.insert(element, operNode.getChildCount()); } @@ -93,13 +92,13 @@ //{{{ cacheFlatNodes() method public void cacheResultNodes(DefaultMutableTreeNode operNode) { - resultNodes = new ArrayList(); + resultNodes = new ArrayList<DefaultMutableTreeNode>(operNode.getChildCount()); for (Enumeration e = operNode.children(); e.hasMoreElements();) - resultNodes.add(e.nextElement()); + resultNodes.add((DefaultMutableTreeNode) e.nextElement()); }//}}} //{{{ removeNodeFromCache() method - public static void removeNodeFromCache (MutableTreeNode mnode) + public static void removeNodeFromCache(MutableTreeNode mnode) { DefaultMutableTreeNode node = (DefaultMutableTreeNode)mnode; if (node.getUserObject() instanceof HyperSearchOperationNode) @@ -124,18 +123,18 @@ //{{{ insertTreeNodes() method public void insertTreeNodes(JTree resultTree, DefaultMutableTreeNode operNode) { - Map pathElementCountFile = new TreeMap(); String fileSep = System.getProperty("file.separator"); String fileSepRegex = System.getProperty("file.separator"); if (fileSep.equals("\\")) fileSepRegex = "\\\\"; //find the highest level common path - String topPathTmp[] = null; + String[] topPathTmp = null; int topPathNdx = -1; - for (Iterator it = resultNodes.iterator(); it.hasNext();) + + for (int i = 0;i < resultNodes.size();i++) { - DefaultMutableTreeNode fileTreeNode = (DefaultMutableTreeNode)it.next(); + DefaultMutableTreeNode fileTreeNode = resultNodes.get(i); Object obj = fileTreeNode.getUserObject(); if (!(obj instanceof HyperSearchFileNode)) continue; @@ -143,7 +142,7 @@ int pos = fileNode.path.lastIndexOf(fileSep); String pathName = fileNode.path.substring(0, pos); - String paths[] = pathName.split(fileSepRegex); + String[] paths = pathName.split(fileSepRegex); if (topPathNdx == -1) { topPathNdx = paths.length; @@ -166,23 +165,23 @@ } } } - String topPath[] = new String[topPathNdx]; + String[] topPath = new String[topPathNdx]; String topPathPath = ""; for (int ndx = 0 ; ndx < topPathNdx; ndx++) { topPath[ndx] = topPathTmp[ndx]; topPathPath = topPathPath.concat(topPath[ndx] + fileSep); } - Map treeNodes = new HashMap(); + Map<String, DefaultMutableTreeNode> treeNodes = new HashMap<String, DefaultMutableTreeNode>(); HyperSearchFolderNode folderNode = new HyperSearchFolderNode(new File(topPathPath), true); DefaultMutableTreeNode folderTreeNode = new DefaultMutableTreeNode(folderNode); operNode.insert(folderTreeNode, operNode.getChildCount()); treeNodes.put(topPathPath, folderTreeNode); - for (Iterator it = resultNodes.iterator(); it.hasNext();) + for (int i = 0;i < resultNodes.size();i++) { - DefaultMutableTreeNode fileTreeNode = (DefaultMutableTreeNode)it.next(); + DefaultMutableTreeNode fileTreeNode = resultNodes.get(i); Object obj = fileTreeNode.getUserObject(); if (!(obj instanceof HyperSearchFileNode)) continue; @@ -191,14 +190,14 @@ fileNode.showFullPath = false; int pos = fileNode.path.lastIndexOf(fileSep); String pathName = fileNode.path.substring(0, pos); - String paths[] = pathName.split(fileSepRegex); + String[] paths = pathName.split(fileSepRegex); DefaultMutableTreeNode insNode = folderTreeNode; String partialPath = topPathPath; for (int ndx = topPathNdx; ndx < paths.length; ndx++) { partialPath = partialPath.concat(paths[ndx] + fileSep); - DefaultMutableTreeNode tmpNode = (DefaultMutableTreeNode) treeNodes.get(partialPath); + DefaultMutableTreeNode tmpNode = treeNodes.get(partialPath); if (tmpNode == null) { HyperSearchFolderNode tmpFolderNode = This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <va...@us...> - 2007-01-17 07:40:12
|
Revision: 8604 http://svn.sourceforge.net/jedit/?rev=8604&view=rev Author: vanza Date: 2007-01-16 23:38:58 -0800 (Tue, 16 Jan 2007) Log Message: ----------- - add a couple of different states to the PropertiesChanging message and also send a message when the dialog is canceled. Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/msg/PropertiesChanging.java jEdit/trunk/org/gjt/sp/jedit/options/GlobalOptions.java Modified: jEdit/trunk/org/gjt/sp/jedit/msg/PropertiesChanging.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/msg/PropertiesChanging.java 2007-01-17 07:20:44 UTC (rev 8603) +++ jEdit/trunk/org/gjt/sp/jedit/msg/PropertiesChanging.java 2007-01-17 07:38:58 UTC (rev 8604) @@ -34,12 +34,29 @@ */ public class PropertiesChanging extends EBMessage { + + public enum State { + LOADING, + CANCELED + } + /** * Creates a new properties changing message. - * @param source The message source + * @param source The message source + * @param what Object describing what's happening. */ - public PropertiesChanging(EBComponent source) + public PropertiesChanging(EBComponent source, State state) { super(source); + assert (state != null) : "state shouldn't be null"; + this.state = state; } + + public State getState() + { + return state; + } + + private final State state; + } Modified: jEdit/trunk/org/gjt/sp/jedit/options/GlobalOptions.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/options/GlobalOptions.java 2007-01-17 07:20:44 UTC (rev 8603) +++ jEdit/trunk/org/gjt/sp/jedit/options/GlobalOptions.java 2007-01-17 07:38:58 UTC (rev 8604) @@ -96,14 +96,26 @@ return paneTreeModel; } //}}} + //{{{ setVisible() method public void setVisible(boolean flag) { if (flag) { - EditBus.send(new PropertiesChanging(null)); + EditBus.send( + new PropertiesChanging(null, + PropertiesChanging.State.LOADING)); } super.setVisible(flag); - } + } //}}} + //{{{ cancel() method + public void cancel() + { + EditBus.send( + new PropertiesChanging(null, + PropertiesChanging.State.CANCELED)); + super.cancel(); + } //}}} + //{{{ getDefaultGroup() method protected OptionGroup getDefaultGroup() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vam...@us...> - 2007-01-20 10:07:38
|
Revision: 8687 http://svn.sourceforge.net/jedit/?rev=8687&view=rev Author: vampire0 Date: 2007-01-20 02:07:37 -0800 (Sat, 20 Jan 2007) Log Message: ----------- minor fix Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/MiscUtilities.java jEdit/trunk/org/gjt/sp/jedit/io/VFS.java Modified: jEdit/trunk/org/gjt/sp/jedit/MiscUtilities.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/MiscUtilities.java 2007-01-20 01:42:17 UTC (rev 8686) +++ jEdit/trunk/org/gjt/sp/jedit/MiscUtilities.java 2007-01-20 10:07:37 UTC (rev 8687) @@ -154,7 +154,7 @@ return path; } //}}} - //{{ expandVariables() method + //{{{ expandVariables() method static final String varPatternString = "(\\$([a-zA-Z0-9_]+))"; static final String varPatternString2 = "(\\$\\{([^}]+)\\})"; static final Pattern varPattern = Pattern.compile(varPatternString); @@ -196,7 +196,7 @@ return m.replaceFirst(expansion); } return arg; - } + } //}}} //{{{ resolveSymlinks() method /** Modified: jEdit/trunk/org/gjt/sp/jedit/io/VFS.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/io/VFS.java 2007-01-20 01:42:17 UTC (rev 8686) +++ jEdit/trunk/org/gjt/sp/jedit/io/VFS.java 2007-01-20 10:07:37 UTC (rev 8687) @@ -759,6 +759,7 @@ * @exception IOException if an I/O error occurred * @return The specified directory entry, or null if it doesn't exist. * @since jEdit 2.7pre1 + * @deprecated Use <code>_getFile()</code> instead. */ public DirectoryEntry _getDirectoryEntry(Object session, String path, Component comp) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ez...@us...> - 2007-01-23 16:54:32
|
Revision: 8726 http://svn.sourceforge.net/jedit/?rev=8726&view=rev Author: ezust Date: 2007-01-23 08:54:28 -0800 (Tue, 23 Jan 2007) Log Message: ----------- Javadoc fixes. Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/MiscUtilities.java jEdit/trunk/org/gjt/sp/jedit/PluginJAR.java jEdit/trunk/org/gjt/sp/jedit/io/VFSFile.java jEdit/trunk/org/gjt/sp/jedit/msg/PropertiesChanging.java Modified: jEdit/trunk/org/gjt/sp/jedit/MiscUtilities.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/MiscUtilities.java 2007-01-23 16:46:29 UTC (rev 8725) +++ jEdit/trunk/org/gjt/sp/jedit/MiscUtilities.java 2007-01-23 16:54:28 UTC (rev 8726) @@ -1448,7 +1448,7 @@ //{{{ StringCompare class /** * Compares strings. - * @deprecated use {@link StandardUtilities.StringCompare} + * @deprecated use {@link org.gjt.sp.jedit.StandardUtilities.StringCompare} */ @Deprecated public static class StringCompare implements Compare Modified: jEdit/trunk/org/gjt/sp/jedit/PluginJAR.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/PluginJAR.java 2007-01-23 16:46:29 UTC (rev 8725) +++ jEdit/trunk/org/gjt/sp/jedit/PluginJAR.java 2007-01-23 16:54:28 UTC (rev 8726) @@ -977,7 +977,7 @@ //{{{ PluginJAR constructor /** * Creates a PluginJAR object which is not necessarily loaded, but can be later. - * @see {@link #load(String, boolean)} + * @see #load(String, boolean) */ public PluginJAR(File file) { Modified: jEdit/trunk/org/gjt/sp/jedit/io/VFSFile.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/io/VFSFile.java 2007-01-23 16:46:29 UTC (rev 8725) +++ jEdit/trunk/org/gjt/sp/jedit/io/VFSFile.java 2007-01-23 16:54:28 UTC (rev 8726) @@ -47,7 +47,7 @@ * in a case-insensitive manner. Exact matches are preferred. * @param files The list of files * @param start The start index, inclusive - * @param start The end index, exclusive + * @param end The end index, exclusive * @param str The string to match * @param dirsOnly Only match directories? * @since jEdit 4.3pre3 Modified: jEdit/trunk/org/gjt/sp/jedit/msg/PropertiesChanging.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/msg/PropertiesChanging.java 2007-01-23 16:46:29 UTC (rev 8725) +++ jEdit/trunk/org/gjt/sp/jedit/msg/PropertiesChanging.java 2007-01-23 16:54:28 UTC (rev 8726) @@ -43,7 +43,7 @@ /** * Creates a new properties changing message. * @param source The message source - * @param what Object describing what's happening. + * @param state An enum describing what is happening. */ public PropertiesChanging(EBComponent source, State state) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ez...@us...> - 2007-02-07 18:07:22
|
Revision: 8913 http://svn.sourceforge.net/jedit/?rev=8913&view=rev Author: ezust Date: 2007-02-07 10:06:52 -0800 (Wed, 07 Feb 2007) Log Message: ----------- Oops Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/GUIUtilities.java jEdit/trunk/org/gjt/sp/jedit/PerspectiveManager.java jEdit/trunk/org/gjt/sp/jedit/textarea/TextArea.java Modified: jEdit/trunk/org/gjt/sp/jedit/GUIUtilities.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/GUIUtilities.java 2007-02-07 16:51:03 UTC (rev 8912) +++ jEdit/trunk/org/gjt/sp/jedit/GUIUtilities.java 2007-02-07 18:06:52 UTC (rev 8913) @@ -83,10 +83,11 @@ * <li>{@link #confirm(Component,String,Object[],int,int)}</li> * <li>{@link #error(Component,String,Object[])}</li> * <li>{@link #message(Component,String,Object[])}</li> - * <li>{@link #showPopupMenu(JPopupMenu,Component,int,int)}</li> + * <li>{@link #showVFSFileDialog(View,String,int,boolean)}</li> * <li>{@link #loadGeometry(Window,String)}</li> * <li>{@link #saveGeometry(Window,String)}</li> + * <li>{@link #showPopupMenu(JPopupMenu,Component,int,int)}</li> * </ul> * * @author Slava Pestov @@ -1399,6 +1400,9 @@ * @param x The x co-ordinate * @param y The y co-ordinate * @since jEdit 4.0pre1 + * @deprecated - use {@link javax.swing.JComponent#setComponentPopupMenu()}, + * which works better and is simpler to use: you don't have to write the code to + * show/hide popups in response to mouse events anymore. */ public static void showPopupMenu(JPopupMenu popup, Component comp, int x, int y) Modified: jEdit/trunk/org/gjt/sp/jedit/PerspectiveManager.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/PerspectiveManager.java 2007-02-07 16:51:03 UTC (rev 8912) +++ jEdit/trunk/org/gjt/sp/jedit/PerspectiveManager.java 2007-02-07 18:06:52 UTC (rev 8913) @@ -338,7 +338,7 @@ { if(name.equals("BUFFER")) { - if (restoreFiles && !skipRemote(uri)) + if (restoreFiles && !skipRemote(charData.toString())) { currentBuffer = jEdit.openFile(null,charData.toString()); // if the autoReload attributes are not present, don't set anything Modified: jEdit/trunk/org/gjt/sp/jedit/textarea/TextArea.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/textarea/TextArea.java 2007-02-07 16:51:03 UTC (rev 8912) +++ jEdit/trunk/org/gjt/sp/jedit/textarea/TextArea.java 2007-02-07 18:06:52 UTC (rev 8913) @@ -1307,8 +1307,8 @@ //{{{ getLineText() method /** * Returns the text on the specified line. - * @param lineIndex The line - * @return The text, or null if the line is invalid + * @param lineIndex the line number + * @return The text, or null if the lineIndex is invalid */ public final String getLineText(int lineIndex) { @@ -1317,10 +1317,10 @@ //{{{ getLineText() method /** - * Copies the text on the specified line into a segment. If the line + * Copies the text on the specified line into a Segment. If lineIndex * is invalid, the segment will contain a null string. - * @param lineIndex The line (physical line) - * @param the segment to which the datas will be stored + * @param lineIndex The line number (physical line) + * @param segment the segment into which the datas will be stored. */ public final void getLineText(int lineIndex, Segment segment) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ez...@us...> - 2007-02-09 21:19:36
|
Revision: 8942 http://svn.sourceforge.net/jedit/?rev=8942&view=rev Author: ezust Date: 2007-02-09 13:19:35 -0800 (Fri, 09 Feb 2007) Log Message: ----------- 1642574 - number of visible rows in buffer switcher GUI. Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/EditPane.java jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props jEdit/trunk/org/gjt/sp/jedit/options/ViewOptionPane.java Modified: jEdit/trunk/org/gjt/sp/jedit/EditPane.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/EditPane.java 2007-02-09 20:48:15 UTC (rev 8941) +++ jEdit/trunk/org/gjt/sp/jedit/EditPane.java 2007-02-09 21:19:35 UTC (rev 8942) @@ -830,6 +830,11 @@ "view.joinNonWordChars")); textArea.propertiesChanged(); + + if (bufferSwitcher != null) { + bufferSwitcher.setMaximumRowCount(jEdit.getIntegerProperty( + "bufferSwitcher.maxRowCount",10)); + } } //}}} //{{{ loadBufferSwitcher() method Modified: jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props 2007-02-09 20:48:15 UTC (rev 8941) +++ jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props 2007-02-09 21:19:35 UTC (rev 8942) @@ -1953,6 +1953,7 @@ options.view.showSearchbar=Always show search bar options.view.beepOnSearchAutoWrap=Beep when searching automatically wraps options.view.showBufferSwitcher=Show buffer switcher +options.view.bufferSwitcherMaxRowsCount=Visible rows in buffer switcher: #}}} #{{{ File System Browser panes Modified: jEdit/trunk/org/gjt/sp/jedit/options/ViewOptionPane.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/options/ViewOptionPane.java 2007-02-09 20:48:15 UTC (rev 8941) +++ jEdit/trunk/org/gjt/sp/jedit/options/ViewOptionPane.java 2007-02-09 21:19:35 UTC (rev 8942) @@ -109,6 +109,14 @@ showBufferSwitcher.setSelected(jEdit.getBooleanProperty( "view.showBufferSwitcher")); addComponent(showBufferSwitcher); + + + /* Buffer switcher max row count */ + bufferSwitcherMaxRowCount = new JTextField(jEdit.getProperty("bufferSwitcher.maxRowCount")); + addComponent(jEdit.getProperty("options.view.bufferSwitcherMaxRowsCount"), + bufferSwitcherMaxRowCount); + + } //}}} //{{{ _save() method @@ -128,6 +136,8 @@ .isSelected()); jEdit.setBooleanProperty("view.showBufferSwitcher", showBufferSwitcher.isSelected()); + jEdit.setProperty("bufferSwitcher.maxRowCount", + bufferSwitcherMaxRowCount.getText()); } //}}} //{{{ Private members @@ -138,6 +148,7 @@ private JCheckBox showSearchbar; private JCheckBox beepOnSearchAutoWrap; private JCheckBox showBufferSwitcher; + private JTextField bufferSwitcherMaxRowCount; //}}} //{{{ ActionHandler class This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <va...@us...> - 2007-03-08 06:39:16
|
Revision: 9102 http://svn.sourceforge.net/jedit/?rev=9102&view=rev Author: vanza Date: 2007-03-07 22:39:12 -0800 (Wed, 07 Mar 2007) Log Message: ----------- SF Patch #1676041: "CamelHumps" words Add option to separate camel cased words when selecting with the keyboard. Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/TextUtilities.java jEdit/trunk/org/gjt/sp/jedit/jedit.props jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props jEdit/trunk/org/gjt/sp/jedit/options/EditingOptionPane.java jEdit/trunk/org/gjt/sp/jedit/textarea/TextArea.java jEdit/trunk/org/gjt/sp/jedit/textarea/TextAreaMouseHandler.java Modified: jEdit/trunk/org/gjt/sp/jedit/TextUtilities.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/TextUtilities.java 2007-03-08 06:07:14 UTC (rev 9101) +++ jEdit/trunk/org/gjt/sp/jedit/TextUtilities.java 2007-03-08 06:39:12 UTC (rev 9102) @@ -308,6 +308,26 @@ public static int findWordStart(String line, int pos, String noWordSep, boolean joinNonWordChars, boolean eatWhitespace) { + return findWordStart(line, pos, noWordSep, joinNonWordChars, false, eatWhitespace); + } //}}} + + //{{{ findWordStart() method + /** + * Locates the start of the word at the specified position. + * @param line The text + * @param pos The position + * @param noWordSep Characters that are non-alphanumeric, but + * should be treated as word characters anyway + * @param joinNonWordChars Treat consecutive non-alphanumeric + * characters as one word + * @param camelCasedWords Treat "camelCased" parts as words + * @param eatWhitespace Include whitespace at start of word + * @since jEdit 4.3pre10 + */ + public static int findWordStart(String line, int pos, String noWordSep, + boolean joinNonWordChars, boolean camelCasedWords, + boolean eatWhitespace) + { char ch = line.charAt(pos); if(noWordSep == null) @@ -319,6 +339,7 @@ loop: for(int i = pos; i >= 0; i--) { + char lastCh = ch; ch = line.charAt(i); switch(type) { @@ -332,8 +353,21 @@ return i + 1; //}}} //{{{ Word character... case WORD_CHAR: + // stop at next last (in writing direction) upper case char if camel cased + // (don't stop at every upper case char, don't treat noWordSep as word chars) + if (camelCasedWords && Character.isUpperCase(ch) && !Character.isUpperCase(lastCh) + && Character.isLetterOrDigit(lastCh)) + { + return i; + } + // stop at next first (in writing direction) upper case char if camel cased + // (don't stop at every upper case char) + else if (camelCasedWords && !Character.isUpperCase(ch) && Character.isUpperCase(lastCh)) + { + return i + 1; + } // word char; keep going - if(Character.isLetterOrDigit(ch) || + else if(Character.isLetterOrDigit(ch) || noWordSep.indexOf(ch) != -1) { break; @@ -423,6 +457,26 @@ public static int findWordEnd(String line, int pos, String noWordSep, boolean joinNonWordChars, boolean eatWhitespace) { + return findWordEnd(line, pos, noWordSep, joinNonWordChars, false, eatWhitespace); + } //}}} + + //{{{ findWordEnd() method + /** + * Locates the end of the word at the specified position. + * @param line The text + * @param pos The position + * @param noWordSep Characters that are non-alphanumeric, but + * should be treated as word characters anyway + * @param joinNonWordChars Treat consecutive non-alphanumeric + * characters as one word + * @param camelCasedWords Treat "camelCased" parts as words + * @param eatWhitespace Include whitespace at end of word + * @since jEdit 4.3pre10 + */ + public static int findWordEnd(String line, int pos, String noWordSep, + boolean joinNonWordChars, boolean camelCasedWords, + boolean eatWhitespace) + { if(pos != 0) pos--; @@ -437,6 +491,7 @@ loop: for(int i = pos; i < line.length(); i++) { + char lastCh = ch; ch = line.charAt(i); switch(type) { @@ -449,7 +504,19 @@ return i; //}}} //{{{ Word character... case WORD_CHAR: - if(Character.isLetterOrDigit(ch) || + // stop at next last upper case char if camel cased + // (don't stop at every upper case char, don't treat noWordSep as word chars) + if (camelCasedWords && i > pos + 1 && !Character.isUpperCase(ch) && Character.isLetterOrDigit(ch) + && Character.isUpperCase(lastCh)) + { + return i - 1; + } + // stop at next first upper case char if camel caseg (don't stop at every upper case char) + else if (camelCasedWords && Character.isUpperCase(ch) && !Character.isUpperCase(lastCh)) + { + return i; + } + else if(Character.isLetterOrDigit(ch) || noWordSep.indexOf(ch) != -1) { break; Modified: jEdit/trunk/org/gjt/sp/jedit/jedit.props =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/jedit.props 2007-03-08 06:07:14 UTC (rev 9101) +++ jEdit/trunk/org/gjt/sp/jedit/jedit.props 2007-03-08 06:39:12 UTC (rev 9102) @@ -150,6 +150,9 @@ # Non-alphanumeric word characters buffer.noWordSep=_ +# Whether to separate "CamelCased" words +buffer.camelCasedWords=false + # Fold mode (explicit, indent, or none) buffer.folding=none Modified: jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props 2007-03-08 06:07:14 UTC (rev 9101) +++ jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props 2007-03-08 06:39:12 UTC (rev 9102) @@ -1720,6 +1720,7 @@ options.editing.tabSize=Tab width: options.editing.indentSize=Indent width: options.editing.noWordSep=Extra word characters: +options.editing.camelCasedWords=Separate "CamelCased" words options.editing.noTabs=Soft (emulated with spaces) tabs options.editing.deepIndent=Deep indent #}}} Modified: jEdit/trunk/org/gjt/sp/jedit/options/EditingOptionPane.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/options/EditingOptionPane.java 2007-03-08 06:07:14 UTC (rev 9101) +++ jEdit/trunk/org/gjt/sp/jedit/options/EditingOptionPane.java 2007-03-08 06:39:12 UTC (rev 9102) @@ -77,6 +77,9 @@ addComponent(jEdit.getProperty("options.editing.noWordSep"), noWordSep = new JTextField()); + addComponent(camelCasedWords = new JCheckBox(jEdit.getProperty( + "options.editing.camelCasedWords"))); + String[] foldModes = FoldHandler.getFoldModes(); addComponent(jEdit.getProperty("options.editing.folding"), folding = new JComboBox(foldModes)); @@ -131,7 +134,7 @@ undoCount = new JTextField(jEdit.getProperty("buffer.undoCount")); addComponent(jEdit.getProperty("options.editing.undoCount"),undoCount); - + //{{{ Reset Undo Manager On Save resetUndoOnSave = new JCheckBox(jEdit.getProperty("options.general.resetUndo")); resetUndoOnSave.setSelected(jEdit.getBooleanProperty("resetUndoOnSave")); @@ -173,6 +176,7 @@ private JTextField filenameGlob; private JTextField firstlineGlob; private JTextField noWordSep; + private JCheckBox camelCasedWords; private JComboBox folding; private JTextField collapseFolds; private JComboBox wrap; @@ -190,6 +194,7 @@ current.filenameGlob = filenameGlob.getText(); current.firstlineGlob = firstlineGlob.getText(); current.noWordSep = noWordSep.getText(); + current.camelCasedWords = camelCasedWords.isSelected(); current.folding = (String)folding.getSelectedItem(); current.collapseFolds = collapseFolds.getText(); current.wrap = (String)wrap.getSelectedItem(); @@ -217,6 +222,7 @@ filenameGlob.setText(current.filenameGlob); firstlineGlob.setText(current.firstlineGlob); noWordSep.setText(current.noWordSep); + camelCasedWords.setSelected(current.camelCasedWords); folding.setSelectedItem(current.folding); collapseFolds.setText(current.collapseFolds); wrap.setSelectedItem(current.wrap); @@ -251,6 +257,7 @@ } noWordSep.setEnabled(enabled); + camelCasedWords.setEnabled(enabled); folding.setEnabled(enabled); collapseFolds.setEnabled(enabled); wrap.setEnabled(enabled); @@ -295,6 +302,7 @@ String filenameGlob; String firstlineGlob; String noWordSep; + boolean camelCasedWords; String folding; String collapseFolds; String wrap; @@ -333,6 +341,7 @@ filenameGlob = (String)mode.getProperty("filenameGlob"); firstlineGlob = (String)mode.getProperty("firstlineGlob"); noWordSep = (String)mode.getProperty("noWordSep"); + camelCasedWords = mode.getBooleanProperty("camelCasedWords"); folding = mode.getProperty("folding").toString(); collapseFolds = mode.getProperty("collapseFolds").toString(); wrap = mode.getProperty("wrap").toString(); @@ -345,6 +354,7 @@ else { noWordSep = jEdit.getProperty("buffer.noWordSep"); + camelCasedWords = jEdit.getBooleanProperty("buffer.camelCasedWords"); folding = jEdit.getProperty("buffer.folding"); collapseFolds = jEdit.getProperty("buffer.collapseFolds"); wrap = jEdit.getProperty("buffer.wrap"); @@ -379,6 +389,7 @@ jEdit.resetProperty(prefix + "filenameGlob"); jEdit.resetProperty(prefix + "firstlineGlob"); jEdit.resetProperty(prefix + "noWordSep"); + jEdit.resetProperty(prefix + "camelCasedWords"); jEdit.resetProperty(prefix + "folding"); jEdit.resetProperty(prefix + "collapseFolds"); jEdit.resetProperty(prefix + "wrap"); @@ -387,7 +398,7 @@ jEdit.resetProperty(prefix + "indentSize"); jEdit.resetProperty(prefix + "noTabs"); jEdit.resetProperty(prefix + "deepIndent"); - + if(!(StandardUtilities.objectsEqual(oldFilenameGlob, mode.getProperty("filenameGlob")) && StandardUtilities.objectsEqual(oldFirstlineGlob, @@ -418,6 +429,7 @@ } jEdit.setProperty(prefix + "noWordSep",noWordSep); + jEdit.setBooleanProperty(prefix + "camelCasedWords",camelCasedWords); jEdit.setProperty(prefix + "folding",folding); jEdit.setProperty(prefix + "collapseFolds",collapseFolds); jEdit.setProperty(prefix + "wrap",wrap); Modified: jEdit/trunk/org/gjt/sp/jedit/textarea/TextArea.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/textarea/TextArea.java 2007-03-08 06:07:14 UTC (rev 9101) +++ jEdit/trunk/org/gjt/sp/jedit/textarea/TextArea.java 2007-03-08 06:39:12 UTC (rev 9102) @@ -1445,8 +1445,10 @@ if(offset == getLineLength(line)) offset--; - int wordStart = TextUtilities.findWordStart(lineText,offset,noWordSep); - int wordEnd = TextUtilities.findWordEnd(lineText,offset+1,noWordSep); + int wordStart = TextUtilities.findWordStart(lineText,offset, + noWordSep,true,false,false); + int wordEnd = TextUtilities.findWordEnd(lineText,offset+1, + noWordSep,true,false,false); Selection s = new Selection.Range(lineStart + wordStart, lineStart + wordEnd); @@ -2561,8 +2563,10 @@ else { String noWordSep = buffer.getStringProperty("noWordSep"); + boolean camelCasedWords = buffer.getBooleanProperty("camelCasedWords"); newCaret = TextUtilities.findWordEnd(lineText, - newCaret + 1,noWordSep,true,eatWhitespace); + newCaret + 1,noWordSep,true,camelCasedWords, + eatWhitespace); newCaret += lineStart; } @@ -2858,8 +2862,9 @@ else { String noWordSep = buffer.getStringProperty("noWordSep"); + boolean camelCasedWords = buffer.getBooleanProperty("camelCasedWords"); newCaret = TextUtilities.findWordStart(lineText, - newCaret - 1,noWordSep,true,eatWhitespace); + newCaret - 1,noWordSep,true,camelCasedWords,eatWhitespace); newCaret += lineStart; } @@ -3299,8 +3304,9 @@ else { String noWordSep = buffer.getStringProperty("noWordSep"); + boolean camelCasedWords = buffer.getBooleanProperty("camelCasedWords"); _caret = TextUtilities.findWordStart(lineText,_caret-1, - noWordSep,true,eatWhitespace); + noWordSep,true,camelCasedWords,eatWhitespace); } buffer.remove(_caret + lineStart, @@ -3493,8 +3499,9 @@ else { String noWordSep = buffer.getStringProperty("noWordSep"); + boolean camelCasedWords = buffer.getBooleanProperty("camelCasedWords"); _caret = TextUtilities.findWordEnd(lineText, - _caret+1,noWordSep,true,eatWhitespace); + _caret+1,noWordSep,true,camelCasedWords,eatWhitespace); } buffer.remove(caret,(_caret + lineStart) - caret); @@ -5261,7 +5268,7 @@ moveCaretPosition(newCaret); }//}}} - + /** * Check if the line contains only spaces and tabs. * Modified: jEdit/trunk/org/gjt/sp/jedit/textarea/TextAreaMouseHandler.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/textarea/TextAreaMouseHandler.java 2007-03-08 06:07:14 UTC (rev 9101) +++ jEdit/trunk/org/gjt/sp/jedit/textarea/TextAreaMouseHandler.java 2007-03-08 06:39:12 UTC (rev 9102) @@ -217,10 +217,10 @@ boolean joinNonWordChars = textArea.getJoinNonWordChars(); int wordStart = TextUtilities.findWordStart(lineText,dragStartOffset, - noWordSep,textArea.getJoinNonWordChars()); + noWordSep,joinNonWordChars,false,false); int wordEnd = TextUtilities.findWordEnd(lineText, dragStartOffset+1,noWordSep, - textArea.getJoinNonWordChars()); + joinNonWordChars,false,false); int lineStart = textArea.getLineStartOffset(dragStartLine); Selection sel = new Selection.Range( This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ez...@us...> - 2007-04-24 16:35:44
|
Revision: 9465 http://svn.sourceforge.net/jedit/?rev=9465&view=rev Author: ezust Date: 2007-04-24 09:35:38 -0700 (Tue, 24 Apr 2007) Log Message: ----------- Made consistent the "glob.tooltip" used in 3 places where a filename glob is asked for by the user. Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/browser/VFSBrowser.java jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props jEdit/trunk/org/gjt/sp/jedit/options/EditingOptionPane.java jEdit/trunk/org/gjt/sp/jedit/search/SearchDialog.java Modified: jEdit/trunk/org/gjt/sp/jedit/browser/VFSBrowser.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/browser/VFSBrowser.java 2007-04-22 22:21:42 UTC (rev 9464) +++ jEdit/trunk/org/gjt/sp/jedit/browser/VFSBrowser.java 2007-04-24 16:35:38 UTC (rev 9465) @@ -244,6 +244,7 @@ filterField = new JComboBox(); filterEditor = new HistoryComboBoxEditor("vfs.browser.filter"); + filterEditor.setToolTipText(jEdit.getProperty("glob.tooltip")); filterEditor.setInstantPopups(true); filterEditor.setSelectAllOnFocus(true); filterEditor.addActionListener(actionHandler); Modified: jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props 2007-04-22 22:21:42 UTC (rev 9464) +++ jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props 2007-04-24 16:35:38 UTC (rev 9465) @@ -1285,7 +1285,7 @@ search.directoryField.mnemonic=y search.filterField=Filter: search.filterField.mnemonic=f -search.filterField.tooltip={*.c,*.h} for multiple extensions +glob.tooltip={*.c,*.h} for multiple extensions search.subdirs=Search subdirectories search.subdirs.mnemonic=u search.choose=Choose... Modified: jEdit/trunk/org/gjt/sp/jedit/options/EditingOptionPane.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/options/EditingOptionPane.java 2007-04-22 22:21:42 UTC (rev 9464) +++ jEdit/trunk/org/gjt/sp/jedit/options/EditingOptionPane.java 2007-04-24 16:35:38 UTC (rev 9465) @@ -116,8 +116,10 @@ addComponent(deepIndent = new JCheckBox(jEdit.getProperty( "options.editing.deepIndent"))); + filenameGlob = new JTextField(); + filenameGlob.setToolTipText(jEdit.getProperty("glob.tooltip")); addComponent(jEdit.getProperty("options.editing.filenameGlob"), - filenameGlob = new JTextField()); + filenameGlob); addComponent(jEdit.getProperty("options.editing.firstlineGlob"), firstlineGlob = new JTextField()); Modified: jEdit/trunk/org/gjt/sp/jedit/search/SearchDialog.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/search/SearchDialog.java 2007-04-22 22:21:42 UTC (rev 9464) +++ jEdit/trunk/org/gjt/sp/jedit/search/SearchDialog.java 2007-04-24 16:35:38 UTC (rev 9465) @@ -540,7 +540,7 @@ MultiFileActionHandler actionListener = new MultiFileActionHandler(); filter = new HistoryTextField("search.filter"); - filter.setToolTipText(jEdit.getProperty("search.filterField.tooltip")); + filter.setToolTipText(jEdit.getProperty("glob.tooltip")); filter.addActionListener(actionListener); cons.insets = new Insets(0,0,3,0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <k_s...@us...> - 2007-06-26 15:18:23
|
Revision: 9856 http://svn.sourceforge.net/jedit/?rev=9856&view=rev Author: k_satoda Date: 2007-06-26 08:18:20 -0700 (Tue, 26 Jun 2007) Log Message: ----------- Set a tool tip to the text field of fallback encodings. The tool tip helps users to know that the list is separated by whitespaces. Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props jEdit/trunk/org/gjt/sp/jedit/options/GeneralOptionPane.java Modified: jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props 2007-06-26 14:22:49 UTC (rev 9855) +++ jEdit/trunk/org/gjt/sp/jedit/jedit_gui.props 2007-06-26 15:18:20 UTC (rev 9856) @@ -1639,6 +1639,7 @@ options.general.newkeyhandling=Use new keyboard handling (experimental) options.general.encodingDetectors=Ordered list of encoding autodetector names (experimental) options.general.fallbackEncodings=Ordered list of fallback encoding names (experimental) +options.general.fallbackEncodings.tooltip=A whitespace-separated list of encodings to try against encoding errors on loading #}}} #{{{ Abbreviations pane Modified: jEdit/trunk/org/gjt/sp/jedit/options/GeneralOptionPane.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/options/GeneralOptionPane.java 2007-06-26 14:22:49 UTC (rev 9855) +++ jEdit/trunk/org/gjt/sp/jedit/options/GeneralOptionPane.java 2007-06-26 15:18:20 UTC (rev 9856) @@ -211,6 +211,8 @@ "options.general.fallbackEncodings")); fallbackEncodings.setText(jEdit.getProperty("fallbackEncodings", "")); + fallbackEncodings.setToolTipText(jEdit.getProperty( + "options.general.fallbackEncodings.tooltip")); addComponent(jEdit.getProperty("options.general.fallbackEncodings"), fallbackEncodings); } //}}} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kp...@us...> - 2007-06-27 20:58:23
|
Revision: 9860 http://svn.sourceforge.net/jedit/?rev=9860&view=rev Author: kpouer Date: 2007-06-27 13:58:22 -0700 (Wed, 27 Jun 2007) Log Message: ----------- Introduced FoldHandlerProvider to remove dependency on ServiceManager Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/ServiceManager.java jEdit/trunk/org/gjt/sp/jedit/buffer/FoldHandler.java jEdit/trunk/org/gjt/sp/jedit/jEdit.java Added Paths: ----------- jEdit/trunk/org/gjt/sp/jedit/buffer/FoldHandlerProvider.java Modified: jEdit/trunk/org/gjt/sp/jedit/ServiceManager.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/ServiceManager.java 2007-06-27 16:35:39 UTC (rev 9859) +++ jEdit/trunk/org/gjt/sp/jedit/ServiceManager.java 2007-06-27 20:58:22 UTC (rev 9860) @@ -27,6 +27,9 @@ import java.util.*; import org.gjt.sp.util.Log; import org.gjt.sp.util.XMLUtilities; +import org.gjt.sp.util.StandardUtilities; +import org.gjt.sp.jedit.buffer.FoldHandlerProvider; +import org.gjt.sp.jedit.buffer.FoldHandler; /** * A generic way for plugins to provide various API extensions.<p> @@ -319,4 +322,44 @@ return false; } } //}}} + + /** + * A FoldHandler based on the ServiceManager + * @author Matthieu Casanova + * @since jEdit 4.3pre10 + */ + public static class ServiceFoldHandlerProvider implements FoldHandlerProvider + { + /** + * The service type. See {@link org.gjt.sp.jedit.ServiceManager}. + * @since jEdit 4.3pre10 + */ + public static final String SERVICE = "org.gjt.sp.jedit.buffer.FoldHandler"; + + /** + * Returns the fold handler with the specified name, or null if + * there is no registered handler with that name. + * @param name The name of the desired fold handler + * @return the FoldHandler or null if it doesn't exists + * @since jEdit 4.3pre10 + */ + public FoldHandler getFoldHandler(String name) + { + FoldHandler handler = (FoldHandler) getService(SERVICE,name); + return handler; + } + + /** + * Returns an array containing the names of all registered fold + * handlers. + * + * @since jEdit 4.3pre10 + */ + public String[] getFoldModes() + { + String[] handlers = getServiceNames(SERVICE); + Arrays.sort(handlers,new StandardUtilities.StringCompare()); + return handlers; + } + } } Modified: jEdit/trunk/org/gjt/sp/jedit/buffer/FoldHandler.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/buffer/FoldHandler.java 2007-06-27 16:35:39 UTC (rev 9859) +++ jEdit/trunk/org/gjt/sp/jedit/buffer/FoldHandler.java 2007-06-27 20:58:22 UTC (rev 9860) @@ -22,10 +22,7 @@ package org.gjt.sp.jedit.buffer; -import java.util.*; import javax.swing.text.Segment; -import org.gjt.sp.jedit.ServiceManager; -import org.gjt.sp.util.StandardUtilities; /** * Interface for obtaining the fold level of a specified line.<p> @@ -48,9 +45,14 @@ /** * The service type. See {@link org.gjt.sp.jedit.ServiceManager}. * @since jEdit 4.2pre1 + * @deprecated use {@link org.gjt.sp.jedit.ServiceManager.ServiceFoldHandlerProvider} */ + @Deprecated public static final String SERVICE = "org.gjt.sp.jedit.buffer.FoldHandler"; + /** The FoldHandlerProvider. */ + public static FoldHandlerProvider foldHandlerProvider; + //{{{ getName() method /** * Returns the internal name of this FoldHandler @@ -105,9 +107,7 @@ */ public static FoldHandler getFoldHandler(String name) { - FoldHandler handler = (FoldHandler)ServiceManager - .getService(SERVICE,name); - return handler; + return foldHandlerProvider.getFoldHandler(name); } //}}} @@ -120,9 +120,7 @@ */ public static String[] getFoldModes() { - String[] handlers = ServiceManager.getServiceNames(SERVICE); - Arrays.sort(handlers,new StandardUtilities.StringCompare()); - return handlers; + return foldHandlerProvider.getFoldModes(); } //}}} Added: jEdit/trunk/org/gjt/sp/jedit/buffer/FoldHandlerProvider.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/buffer/FoldHandlerProvider.java (rev 0) +++ jEdit/trunk/org/gjt/sp/jedit/buffer/FoldHandlerProvider.java 2007-06-27 20:58:22 UTC (rev 9860) @@ -0,0 +1,48 @@ +/* + * FoldHandlerProvider.java - Fold handler provider interface + * :tabSize=8:indentSize=8:noTabs=false: + * :folding=explicit:collapseFolds=1: + * + * Copyright (C) 2007 Matthieu Casanova + * + * 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 org.gjt.sp.jedit.buffer; + +/** + * @author Matthieu Casanova + * @version $Id: Buffer.java 8190 2006-12-07 07:58:34Z kpouer $ + * @since jEdit 4.3pre10 + */ +public interface FoldHandlerProvider +{ + /** + * Returns the fold handler with the specified name, or null if + * there is no registered handler with that name. + * @param name The name of the desired fold handler + * @return the FoldHandler or null if it doesn't exists + * @since jEdit 4.3pre10 + */ + FoldHandler getFoldHandler(String name); + + /** + * Returns an array containing the names of all registered fold + * handlers. + * + * @since jEdit 4.0pre6 + */ + String[] getFoldModes(); +} Modified: jEdit/trunk/org/gjt/sp/jedit/jEdit.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/jEdit.java 2007-06-27 16:35:39 UTC (rev 9859) +++ jEdit/trunk/org/gjt/sp/jedit/jEdit.java 2007-06-27 20:58:22 UTC (rev 9860) @@ -42,6 +42,7 @@ import org.gjt.sp.jedit.bufferio.JEditKillRing; import org.gjt.sp.jedit.buffer.KillRing; import org.gjt.sp.jedit.buffer.JEditBuffer; +import org.gjt.sp.jedit.buffer.FoldHandler; import org.gjt.sp.jedit.msg.*; import org.gjt.sp.jedit.gui.*; import org.gjt.sp.jedit.help.HelpViewer; @@ -2986,6 +2987,7 @@ private static void initMisc() { jars = new Vector<PluginJAR>(); + FoldHandler.foldHandlerProvider = new ServiceManager.ServiceFoldHandlerProvider(); actionContext = new ActionContext() { public void invokeAction(EventObject evt, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Vam...@us...> - 2007-06-29 04:13:35
|
Revision: 9879 http://svn.sourceforge.net/jedit/?rev=9879&view=rev Author: Vampire0 Date: 2007-06-28 21:13:34 -0700 (Thu, 28 Jun 2007) Log Message: ----------- Removed a dependency of the textarea package on jEdit class Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/EditPane.java jEdit/trunk/org/gjt/sp/jedit/textarea/MouseHandler.java jEdit/trunk/org/gjt/sp/jedit/textarea/TextArea.java Modified: jEdit/trunk/org/gjt/sp/jedit/EditPane.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/EditPane.java 2007-06-29 03:51:20 UTC (rev 9878) +++ jEdit/trunk/org/gjt/sp/jedit/EditPane.java 2007-06-29 04:13:34 UTC (rev 9879) @@ -829,6 +829,9 @@ textArea.setJoinNonWordChars(jEdit.getBooleanProperty( "view.joinNonWordChars")); + textArea.setCtrlForRectangularSelection(jEdit.getBooleanProperty( + "view.ctrlForRectangularSelection")); + textArea.propertiesChanged(); if (bufferSwitcher != null) { Modified: jEdit/trunk/org/gjt/sp/jedit/textarea/MouseHandler.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/textarea/MouseHandler.java 2007-06-29 03:51:20 UTC (rev 9878) +++ jEdit/trunk/org/gjt/sp/jedit/textarea/MouseHandler.java 2007-06-29 04:13:34 UTC (rev 9879) @@ -28,8 +28,6 @@ import org.gjt.sp.jedit.Registers; import org.gjt.sp.jedit.OperatingSystem; - -import static org.gjt.sp.jedit.jEdit.getBooleanProperty; //}}} /** @@ -52,7 +50,7 @@ control = (OperatingSystem.isMacOS() && evt.isMetaDown()) || (!OperatingSystem.isMacOS() && evt.isControlDown()); - ctrlForRectangularSelection = getBooleanProperty("view.ctrlForRectangularSelection"); + ctrlForRectangularSelection = textArea.isCtrlForRectangularSelection(); // so that Home <mouse click> Home is not the same // as pressing Home twice in a row Modified: jEdit/trunk/org/gjt/sp/jedit/textarea/TextArea.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/textarea/TextArea.java 2007-06-29 03:51:20 UTC (rev 9878) +++ jEdit/trunk/org/gjt/sp/jedit/textarea/TextArea.java 2007-06-29 04:13:34 UTC (rev 9879) @@ -510,6 +510,26 @@ this.joinNonWordChars = joinNonWordChars; } //}}} + //{{{ getCtrlForRectangularSelection() method + /** + * If set, CTRL enables rectangular selection mode while pressed. + * @since jEdit 4.3pre10 + */ + public boolean isCtrlForRectangularSelection() + { + return ctrlForRectangularSelection; + } //}}} + + //{{{ setCtrlForRectangularSelection() method + /** + * If set, CTRL enables rectangular selection mode while pressed. + * @since jEdit 4.3pre10 + */ + public void setCtrlForRectangularSelection(boolean ctrlForRectangularSelection) + { + this.ctrlForRectangularSelection = ctrlForRectangularSelection; + } //}}} + //{{{ Scrolling //{{{ getFirstLine() method @@ -5166,6 +5186,7 @@ private int oldCaretLine; private boolean joinNonWordChars; + private boolean ctrlForRectangularSelection; //}}} //{{{ invalidateSelectedLines() method This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kp...@us...> - 2007-06-29 22:03:40
|
Revision: 9883 http://svn.sourceforge.net/jedit/?rev=9883&view=rev Author: kpouer Date: 2007-06-29 15:03:35 -0700 (Fri, 29 Jun 2007) Log Message: ----------- independent textArea Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/Mode.java jEdit/trunk/org/gjt/sp/jedit/ModeCatalogHandler.java jEdit/trunk/org/gjt/sp/jedit/buffer/JEditBuffer.java jEdit/trunk/org/gjt/sp/jedit/jEdit.java jEdit/trunk/org/gjt/sp/jedit/textarea/TextArea.java Added Paths: ----------- jEdit/trunk/org/gjt/sp/jedit/JEditMode.java jEdit/trunk/org/gjt/sp/jedit/syntax/ModeProvider.java Added: jEdit/trunk/org/gjt/sp/jedit/JEditMode.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/JEditMode.java (rev 0) +++ jEdit/trunk/org/gjt/sp/jedit/JEditMode.java 2007-06-29 22:03:35 UTC (rev 9883) @@ -0,0 +1,103 @@ +/* + * JEditMode.java - jEdit editing mode + * :tabSize=8:indentSize=8:noTabs=false: + * :folding=explicit:collapseFolds=1: + * + * Copyright (C) 2007 Matthieu Casanova + * + * 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 org.gjt.sp.jedit; + +import org.gjt.sp.util.Log; + +/** + * @author Matthieu Casanova + * @version $Id: Buffer.java 8190 2006-12-07 07:58:34Z kpouer $ + * @since jEdit 4.3pre10 + */ +public class JEditMode extends Mode +{ + //{{{ JEditMode constructor + public JEditMode(String name) + { + super(name); + } //}}} + + //{{{ getProperty() method + /** + * Returns a mode property. + * + * @param key The property name + * @since jEdit 4.3pre10 + */ + public Object getProperty(String key) + { + String prefix = "mode." + name + '.'; + + //if(jEdit.getBooleanProperty(prefix + "customSettings")) + //{ + String property = jEdit.getProperty(prefix + key); + if(property != null) + { + Object value; + try + { + value = new Integer(property); + } + catch(NumberFormatException nf) + { + value = property; + } + return value; + } + //} + + Object value = props.get(key); + if(value != null) + return value; + + String global = jEdit.getProperty("buffer." + key); + if(global != null) + { + try + { + return new Integer(global); + } + catch(NumberFormatException nf) + { + return global; + } + } + else + return null; + } //}}} + + //{{{ loadIfNecessary() method + /** + * Loads the mode from disk if it hasn't been loaded already. + * @since jEdit 4.3pre10 + */ + public void loadIfNecessary() + { + if(marker == null) + { + jEdit.loadMode(this); + if (marker == null) + Log.log(Log.ERROR, this, "Mode not correctly loaded, token marker is still null"); + } + } //}}} +} Modified: jEdit/trunk/org/gjt/sp/jedit/Mode.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/Mode.java 2007-06-29 14:41:12 UTC (rev 9882) +++ jEdit/trunk/org/gjt/sp/jedit/Mode.java 2007-06-29 22:03:35 UTC (rev 9883) @@ -37,6 +37,7 @@ import org.gjt.sp.jedit.indent.IndentRuleFactory; import org.gjt.sp.jedit.indent.WhitespaceRule; import org.gjt.sp.jedit.syntax.TokenMarker; +import org.gjt.sp.jedit.syntax.ModeProvider; import org.gjt.sp.util.Log; import org.gjt.sp.util.StandardUtilities; //}}} @@ -133,7 +134,7 @@ { if(marker == null) { - jEdit.loadMode(this); + ModeProvider.instance.loadMode(this); if (marker == null) Log.log(Log.ERROR, this, "Mode not correctly loaded, token marker is still null"); } @@ -148,44 +149,10 @@ */ public Object getProperty(String key) { - String prefix = "mode." + name + '.'; - - //if(jEdit.getBooleanProperty(prefix + "customSettings")) - //{ - String property = jEdit.getProperty(prefix + key); - if(property != null) - { - Object value; - try - { - value = new Integer(property); - } - catch(NumberFormatException nf) - { - value = property; - } - return value; - } - //} - Object value = props.get(key); if(value != null) return value; - - String global = jEdit.getProperty("buffer." + key); - if(global != null) - { - try - { - return new Integer(global); - } - catch(NumberFormatException nf) - { - return global; - } - } - else - return null; + return null; } //}}} //{{{ getBooleanProperty() method @@ -448,11 +415,11 @@ //}}} //{{{ Private members - private String name; - private Map<String, Object> props; + protected String name; + protected Map<String, Object> props; private Pattern firstlineRE; private Pattern filenameRE; - private TokenMarker marker; + protected TokenMarker marker; private List<IndentRule> indentRules; private String electricKeys; private boolean ignoreWhitespace; Modified: jEdit/trunk/org/gjt/sp/jedit/ModeCatalogHandler.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/ModeCatalogHandler.java 2007-06-29 14:41:12 UTC (rev 9882) +++ jEdit/trunk/org/gjt/sp/jedit/ModeCatalogHandler.java 2007-06-29 22:03:35 UTC (rev 9883) @@ -19,28 +19,34 @@ package org.gjt.sp.jedit; -import java.io.*; - +//{{{ Imports +import org.gjt.sp.jedit.syntax.ModeProvider; +import org.gjt.sp.util.Log; +import org.gjt.sp.util.XMLUtilities; import org.xml.sax.Attributes; import org.xml.sax.InputSource; import org.xml.sax.helpers.DefaultHandler; +//}}} -import org.gjt.sp.util.Log; -import org.gjt.sp.util.XMLUtilities; - +/** + * @author Slava Pestov + */ class ModeCatalogHandler extends DefaultHandler { + //{{{ ModeCatalogHandler constructor ModeCatalogHandler(String directory, boolean resource) { this.directory = directory; this.resource = resource; - } + } //}}} + //{{{ resolveEntity() method public InputSource resolveEntity(String publicId, String systemId) { return XMLUtilities.findEntity(systemId, "catalog.dtd", getClass()); - } + } //}}} + //{{{ startElement() method public void startElement(String uri, String localName, String qName, Attributes attrs) { @@ -60,11 +66,11 @@ String firstlineGlob = attrs.getValue("FIRST_LINE_GLOB"); - Mode mode = jEdit.getMode(modeName); + Mode mode = ModeProvider.instance.getMode(modeName); if(mode == null) { - mode = new Mode(modeName); - jEdit.addMode(mode); + mode = instantiateMode(modeName); + ModeProvider.instance.addMode(mode); } Object path; @@ -86,6 +92,11 @@ mode.init(); } + } //}}} + + protected Mode instantiateMode(String modeName) + { + return new Mode(modeName); } private String directory; Modified: jEdit/trunk/org/gjt/sp/jedit/buffer/JEditBuffer.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/buffer/JEditBuffer.java 2007-06-29 14:41:12 UTC (rev 9882) +++ jEdit/trunk/org/gjt/sp/jedit/buffer/JEditBuffer.java 2007-06-29 22:03:35 UTC (rev 9883) @@ -24,38 +24,26 @@ package org.gjt.sp.jedit.buffer; //{{{ Imports -import java.awt.Toolkit; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Vector; -import java.util.concurrent.locks.ReentrantReadWriteLock; -import java.util.regex.Pattern; -import javax.swing.SwingUtilities; -import javax.swing.text.Position; -import javax.swing.text.Segment; - import org.gjt.sp.jedit.Debug; import org.gjt.sp.jedit.Mode; import org.gjt.sp.jedit.TextUtilities; -import org.gjt.sp.jedit.jEdit; import org.gjt.sp.jedit.indent.IndentAction; import org.gjt.sp.jedit.indent.IndentRule; -import org.gjt.sp.jedit.syntax.DefaultTokenHandler; -import org.gjt.sp.jedit.syntax.DummyTokenHandler; -import org.gjt.sp.jedit.syntax.KeywordMap; -import org.gjt.sp.jedit.syntax.ParserRuleSet; -import org.gjt.sp.jedit.syntax.Token; -import org.gjt.sp.jedit.syntax.TokenHandler; -import org.gjt.sp.jedit.syntax.TokenMarker; +import org.gjt.sp.jedit.syntax.*; import org.gjt.sp.jedit.textarea.JEditTextArea; import org.gjt.sp.util.IntegerArray; import org.gjt.sp.util.Log; import org.gjt.sp.util.StandardUtilities; + +import javax.swing.*; +import javax.swing.text.Position; +import javax.swing.text.Segment; +import java.awt.*; +import java.util.*; +import java.util.List; +import java.util.concurrent.locks.ReentrantReadWriteLock; +import java.util.regex.Pattern; //}}} /** @@ -1195,7 +1183,7 @@ public boolean isElectricKey(char ch, int line) { TokenMarker.LineContext ctx = lineMgr.getLineContext(line); - Mode mode = jEdit.getMode(ctx.rules.getModeName()); + Mode mode = ModeProvider.instance.getMode(ctx.rules.getModeName()); // mode can be null, though that's probably an error "further up": if( mode == null ) @@ -2490,7 +2478,7 @@ modeName = ctx.rules.getModeName(); if (modeName == null) modeName = tokenMarker.getMainRuleSet().getModeName(); - return jEdit.getMode(modeName).getIndentRules(); + return ModeProvider.instance.getMode(modeName).getIndentRules(); } //}}} //}}} Modified: jEdit/trunk/org/gjt/sp/jedit/jEdit.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/jEdit.java 2007-06-29 14:41:12 UTC (rev 9882) +++ jEdit/trunk/org/gjt/sp/jedit/jEdit.java 2007-06-29 22:03:35 UTC (rev 9883) @@ -1281,7 +1281,7 @@ { /* Try to guess the eventual size to avoid unnecessary * copying */ - modes = new Vector<Mode>(160); + ModeProvider.instance.removeAll(); //{{{ Load the global catalog if(jEditHome == null) @@ -1342,13 +1342,7 @@ */ public static Mode getMode(String name) { - for(int i = 0; i < modes.size(); i++) - { - Mode mode = modes.elementAt(i); - if(mode.getName().equals(name)) - return mode; - } - return null; + return ModeProvider.instance.getMode(name); } //}}} //{{{ getModes() method @@ -1357,9 +1351,7 @@ */ public static Mode[] getModes() { - Mode[] array = new Mode[modes.size()]; - modes.copyInto(array); - return array; + return ModeProvider.instance.getModes(); } //}}} //}}} @@ -2649,20 +2641,6 @@ } } //}}} - //{{{ addMode() method - /** - * Do not call this method. It is only public so that classes - * in the org.gjt.sp.jedit.syntax package can access it. - * @param mode The edit mode - */ - public static void addMode(Mode mode) - { - //Log.log(Log.DEBUG,jEdit.class,"Adding edit mode " - // + mode.getName()); - - modes.addElement(mode); - } //}}} - //{{{ loadMode() method /** * Loads an XML-defined edit mode from the specified reader. @@ -2671,16 +2649,6 @@ /* package-private */ static void loadMode(Mode mode) { final String fileName = (String)mode.getProperty("file"); - - Log.log(Log.NOTICE,jEdit.class,"Loading edit mode " + fileName); - - XMLReader parser = null; - try { - parser = XMLReaderFactory.createXMLReader(); - } catch (SAXException saxe) { - Log.log(Log.ERROR, jEdit.class, saxe); - return; - } XModeHandler xmh = new XModeHandler(mode.getName()) { public void error(String what, Object subst) @@ -2714,43 +2682,7 @@ return mode.getTokenMarker(); } }; - - mode.setTokenMarker(xmh.getTokenMarker()); - - Reader grammar = null; - - try - { - grammar = new BufferedReader(new FileReader(fileName)); - - InputSource isrc = new InputSource(grammar); - isrc.setSystemId("jedit.jar"); - parser.setContentHandler(xmh); - parser.setDTDHandler(xmh); - parser.setEntityResolver(xmh); - parser.setErrorHandler(xmh); - parser.parse(isrc); - - mode.setProperties(xmh.getModeProperties()); - } - catch (Throwable e) - { - Log.log(Log.ERROR, jEdit.class, e); - - if (e instanceof SAXParseException) - { - String message = e.getMessage(); - int line = ((SAXParseException)e).getLineNumber(); - int col = ((SAXParseException)e).getColumnNumber(); - - Object[] args = { fileName, line, col, message }; - GUIUtilities.error(null,"xmode-error",args); - } - } - finally - { - IOUtilities.closeQuietly(grammar); - } + ModeProvider.instance.loadMode(mode, xmh); } //}}} //{{{ addPluginProps() method @@ -2837,7 +2769,7 @@ private static Vector<ErrorListDialog.ErrorEntry> pluginErrors; private static final Object pluginErrorLock = new Object(); private static Vector<PluginJAR> jars; - private static Vector<Mode> modes; + private static boolean saveCaret; private static InputHandler inputHandler; @@ -3931,7 +3863,13 @@ Log.log(Log.MESSAGE,jEdit.class,"Loading mode catalog file " + path); ModeCatalogHandler handler = new ModeCatalogHandler( - MiscUtilities.getParentOfPath(path),resource); + MiscUtilities.getParentOfPath(path),resource) + { + protected Mode instantiateMode(String modeName) + { + return new JEditMode(modeName); + } + }; try { InputStream _in; Added: jEdit/trunk/org/gjt/sp/jedit/syntax/ModeProvider.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/syntax/ModeProvider.java (rev 0) +++ jEdit/trunk/org/gjt/sp/jedit/syntax/ModeProvider.java 2007-06-29 22:03:35 UTC (rev 9883) @@ -0,0 +1,178 @@ +/* + * ModeProvider.java - An edit mode provider. + * :tabSize=8:indentSize=8:noTabs=false: + * :folding=explicit:collapseFolds=1: + * + * Copyright (C) 2003 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 org.gjt.sp.jedit.syntax; + +//{{{ Imports + +import org.gjt.sp.jedit.GUIUtilities; +import org.gjt.sp.jedit.Mode; +import org.gjt.sp.jedit.jEdit; +import org.gjt.sp.util.IOUtilities; +import org.gjt.sp.util.Log; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.XMLReader; +import org.xml.sax.helpers.XMLReaderFactory; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.Reader; +import java.util.ArrayList; +import java.util.List; +//}}} + +/** + * @author Matthieu Casanova + * @version $Id: Buffer.java 8190 2006-12-07 07:58:34Z kpouer $ + * @since jEdit 4.3pre10 + */ +public class ModeProvider +{ + public static final ModeProvider instance = new ModeProvider(); + + private List<Mode> modes = new ArrayList<Mode>(160); + + //{{{ ModeProvider constructor + private ModeProvider() + { + } //}}} + + //{{{ removeAll() method + public void removeAll() + { + modes = new ArrayList<Mode>(160); + } //}}} + + //{{{ getMode() method + /** + * Returns the edit mode with the specified name. + * @param name The edit mode + * @since jEdit 4.3pre10 + */ + public Mode getMode(String name) + { + for(int i = 0; i < modes.size(); i++) + { + Mode mode = modes.get(i); + if(mode.getName().equals(name)) + return mode; + } + return null; + } //}}} + + //{{{ getModes() method + /** + * Returns an array of installed edit modes. + * @since jEdit 4.3pre10 + */ + public Mode[] getModes() + { + Mode[] array = new Mode[modes.size()]; + modes.toArray(array); + return array; + } //}}} + + //{{{ addMode() method + /** + * Do not call this method. It is only public so that classes + * in the org.gjt.sp.jedit.syntax package can access it. + * @since jEdit 4.3pre10 + * @param mode The edit mode + */ + public void addMode(Mode mode) + { + modes.add(mode); + } //}}} + + public void loadMode(Mode mode, XModeHandler xmh) + { + String fileName = (String)mode.getProperty("file"); + + Log.log(Log.NOTICE,jEdit.class,"Loading edit mode " + fileName); + + XMLReader parser = null; + try { + parser = XMLReaderFactory.createXMLReader(); + } catch (SAXException saxe) { + Log.log(Log.ERROR, jEdit.class, saxe); + return; + } + mode.setTokenMarker(xmh.getTokenMarker()); + + Reader grammar = null; + + try + { + grammar = new BufferedReader(new FileReader(fileName)); + + InputSource isrc = new InputSource(grammar); + isrc.setSystemId("jedit.jar"); + parser.setContentHandler(xmh); + parser.setDTDHandler(xmh); + parser.setEntityResolver(xmh); + parser.setErrorHandler(xmh); + parser.parse(isrc); + + mode.setProperties(xmh.getModeProperties()); + } + catch (Throwable e) + { + Log.log(Log.ERROR, jEdit.class, e); + + if (e instanceof SAXParseException) + { + String message = e.getMessage(); + int line = ((SAXParseException)e).getLineNumber(); + int col = ((SAXParseException)e).getColumnNumber(); + + Object[] args = { fileName, line, col, message }; + GUIUtilities.error(null,"xmode-error",args); + } + } + finally + { + IOUtilities.closeQuietly(grammar); + } + } + + public void loadMode(Mode mode) + { + XModeHandler xmh = new XModeHandler(mode.getName()) + { + public void error(String what, Object subst) + { + Log.log(Log.ERROR, this, subst); + } + + public TokenMarker getTokenMarker(String modeName) + { + Mode mode = getMode(modeName); + if(mode == null) + return null; + else + return mode.getTokenMarker(); + } + }; + loadMode(mode, xmh); + } +} Modified: jEdit/trunk/org/gjt/sp/jedit/textarea/TextArea.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/textarea/TextArea.java 2007-06-29 14:41:12 UTC (rev 9882) +++ jEdit/trunk/org/gjt/sp/jedit/textarea/TextArea.java 2007-06-29 22:03:35 UTC (rev 9883) @@ -23,33 +23,35 @@ */ package org.gjt.sp.jedit.textarea; -import org.gjt.sp.jedit.input.InputHandlerProvider; +//{{{ Imports +import org.gjt.sp.jedit.Debug; +import org.gjt.sp.jedit.Mode; +import org.gjt.sp.jedit.TextUtilities; +import org.gjt.sp.jedit.buffer.DefaultFoldHandlerProvider; +import org.gjt.sp.jedit.buffer.FoldHandler; +import org.gjt.sp.jedit.buffer.JEditBuffer; import org.gjt.sp.jedit.input.AbstractInputHandler; import org.gjt.sp.jedit.input.DefaultInputHandlerProvider; +import org.gjt.sp.jedit.input.InputHandlerProvider; import org.gjt.sp.jedit.input.TextAreaInputHandler; -import org.gjt.sp.jedit.syntax.Chunk; -import org.gjt.sp.jedit.syntax.TokenMarker; -import org.gjt.sp.jedit.syntax.ParserRuleSet; -import org.gjt.sp.jedit.syntax.SyntaxStyle; -import org.gjt.sp.jedit.buffer.JEditBuffer; -import org.gjt.sp.jedit.Debug; -import org.gjt.sp.jedit.TextUtilities; +import org.gjt.sp.jedit.syntax.*; import org.gjt.sp.util.Log; import org.gjt.sp.util.StandardUtilities; +import javax.swing.*; +import javax.swing.event.CaretEvent; +import javax.swing.event.CaretListener; import javax.swing.event.EventListenerList; import javax.swing.event.MouseInputAdapter; -import javax.swing.event.CaretListener; -import javax.swing.event.CaretEvent; +import javax.swing.plaf.metal.MetalLookAndFeel; import javax.swing.text.Segment; -import javax.swing.*; -import javax.swing.Timer; -import javax.swing.plaf.metal.MetalLookAndFeel; import java.awt.*; +import java.awt.event.*; import java.awt.im.InputMethodRequests; -import java.awt.event.*; -import java.util.*; - +import java.util.Iterator; +import java.util.LinkedList; +import java.util.TooManyListenersException; +//}}} /** * jEdit's text component.<p> * @@ -114,12 +116,16 @@ setCaretBlinkEnabled(true); setElectricScroll(3); + FoldHandler.foldHandlerProvider = new DefaultFoldHandlerProvider(); JEditBuffer buffer = new JEditBuffer(); TokenMarker tokenMarker = new TokenMarker(); tokenMarker.addRuleSet(new ParserRuleSet("text","MAIN")); buffer.setTokenMarker(tokenMarker); buffer.insert(0,"ahaha coucou\ncaca"); setBuffer(buffer); + Mode mode = new Mode("text"); + mode.setTokenMarker(tokenMarker); + ModeProvider.instance.addMode(mode); } //}}} //{{{ TextArea constructor This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ez...@us...> - 2007-07-08 02:36:08
|
Revision: 9955 http://svn.sourceforge.net/jedit/?rev=9955&view=rev Author: ezust Date: 2007-07-07 19:36:06 -0700 (Sat, 07 Jul 2007) Log Message: ----------- s/anyways/available Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/EditPlugin.java jEdit/trunk/org/gjt/sp/jedit/pluginmgr/PluginList.java Modified: jEdit/trunk/org/gjt/sp/jedit/EditPlugin.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/EditPlugin.java 2007-07-08 02:16:20 UTC (rev 9954) +++ jEdit/trunk/org/gjt/sp/jedit/EditPlugin.java 2007-07-08 02:36:06 UTC (rev 9955) @@ -321,7 +321,8 @@ /** * Returns the home of your plugin. * - * @return the plugin home. It can be null if there is no settings directory + * @return the plugin home. It can be null if there is no + settings directory * @since 4.3pre10 * @see #getResourceAsStream * @see #getResourceAsOutputStream @@ -332,17 +333,22 @@ return getPluginHome(getClassName()); } //}}} - //{{{ getPluginHome() method + //{{{ static getPluginHome() method /** * Returns the home of the specified plugin. - * As you need a reference to the {@code Class} instance for the plugin - * this method needs the plugin to be activated. If you use the - * {@link getPluginHome(EditPlugin)} method, the plugin doesn't need - * to be activated. So if you don't have the {@code Class} instance - * anyways, consider using the {@code EditPlugin} method. + * + * Since the first parameter is a reference to the + * {@code Class} instance for the plugin, + * this method requires the plugin to be activated. * + * @see {@link getPluginHome(EditPlugin)} method, as + * an alternate, for when the plugin doesn't need + * to be activated, or when you do not have the + * {@code Class} instance available. + * * @param clazz the class of the plugin - * @return the plugin home. It can be null if there is no settings directory + * @return the plugin home. It can be null if there is no + * settings directory * @since 4.3pre10 * @see #getPluginHome(EditPlugin) * @see #getResourceAsStream @@ -362,7 +368,7 @@ * {@code jEdit.getPlugin(String)} or {@code jEdit.getPlugins()} if * the plugin in question is not activated yet and this method doesn't * cause the plugin to get activated. If you have a reference to the - * plugins {@code Class} instance anyways, consider using the + * plugins {@code Class} instance available, consider using the * {@code Class} method. * * @param plugin the plugin @@ -407,7 +413,7 @@ * this method needs the plugin to be activated. If you use the * {@link getPluginHome(EditPlugin)} method, the plugin doesn't need * to be activated. So if you don't have the {@code Class} instance - * anyways, consider using the {@code EditPlugin} method. + * available, consider using the {@code EditPlugin} method. * * @param clazz the plugin class * @param path The path to the resource to be returned, relative to @@ -433,7 +439,7 @@ * {@code jEdit.getPlugin(String)} or {@code jEdit.getPlugins()} if * the plugin in question is not activated yet and this method doesn't * cause the plugin to get activated. If you have a reference to the - * plugins {@code Class} instance anyways, consider using the + * plugins {@code Class} instance available, consider using the * {@code Class} method. * * @param plugin the plugin @@ -488,7 +494,7 @@ * this method needs the plugin to be activated. If you use the * {@link getPluginHome(EditPlugin)} method, the plugin doesn't need * to be activated. So if you don't have the {@code Class} instance - * anyways, consider using the {@code EditPlugin} method. + * available, consider using the {@code EditPlugin} method. * * @param clazz the plugin class * @param path The path to the resource to be returned, relative to @@ -514,7 +520,7 @@ * {@code jEdit.getPlugin(String)} or {@code jEdit.getPlugins()} if * the plugin in question is not activated yet and this method doesn't * cause the plugin to get activated. If you have a reference to the - * plugins {@code Class} instance anyways, consider using the + * plugins {@code Class} instance available, consider using the * {@code Class} method. * * @param plugin the plugin @@ -577,7 +583,7 @@ * this method needs the plugin to be activated. If you use the * {@link getPluginHome(EditPlugin)} method, the plugin doesn't need * to be activated. So if you don't have the {@code Class} instance - * anyways, consider using the {@code EditPlugin} method. + * available, consider using the {@code EditPlugin} method. * * @param clazz the plugin class * @param path The relative path to the resource from the plugin's @@ -602,7 +608,7 @@ * {@code jEdit.getPlugin(String)} or {@code jEdit.getPlugins()} if * the plugin in question is not activated yet and this method doesn't * cause the plugin to get activated. If you have a reference to the - * plugins {@code Class} instance anyways, consider using the + * plugins {@code Class} instance available, consider using the * {@code Class} method. * * @param plugin the plugin Modified: jEdit/trunk/org/gjt/sp/jedit/pluginmgr/PluginList.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/pluginmgr/PluginList.java 2007-07-08 02:16:20 UTC (rev 9954) +++ jEdit/trunk/org/gjt/sp/jedit/pluginmgr/PluginList.java 2007-07-08 02:36:06 UTC (rev 9955) @@ -72,8 +72,8 @@ readPluginList(); } - void readPluginList() { - boolean cache=true; + void readPluginList() + { gzipURL = jEdit.getProperty("plugin-manager.export-url"); if (!id.equals(MirrorList.Mirror.NONE)) gzipURL += "?mirror="+id; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Vam...@us...> - 2007-07-11 10:25:02
|
Revision: 9998 http://svn.sourceforge.net/jedit/?rev=9998&view=rev Author: Vampire0 Date: 2007-07-11 03:25:00 -0700 (Wed, 11 Jul 2007) Log Message: ----------- Changed EncodingsOptionPane so that it looks like the other option panes. Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/AbstractOptionPane.java jEdit/trunk/org/gjt/sp/jedit/options/EncodingsOptionPane.java Modified: jEdit/trunk/org/gjt/sp/jedit/AbstractOptionPane.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/AbstractOptionPane.java 2007-07-11 06:25:52 UTC (rev 9997) +++ jEdit/trunk/org/gjt/sp/jedit/AbstractOptionPane.java 2007-07-11 10:25:00 UTC (rev 9998) @@ -120,7 +120,7 @@ _save(); } //}}} - // {{{ newLabel() + //{{{ newLabel() /** *@return a label which has the same tooltiptext as the Component * that it is a label for. This is used to create labels from inside @@ -144,7 +144,7 @@ } return retval; }// }}} - + //{{{ addComponent() method /** * Adds a labeled component to the option pane. Components are @@ -269,6 +269,7 @@ add(comp); } //}}} + //{{{ copyToolTips() method private void copyToolTips (Component c1, Component c2) { int tooltips = 0; int jc=0; @@ -296,7 +297,8 @@ jc2.setToolTipText(text); } - } + } //}}} + //{{{ addSeparator() method /** * Adds a separator component. Modified: jEdit/trunk/org/gjt/sp/jedit/options/EncodingsOptionPane.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/options/EncodingsOptionPane.java 2007-07-11 06:25:52 UTC (rev 9997) +++ jEdit/trunk/org/gjt/sp/jedit/options/EncodingsOptionPane.java 2007-07-11 10:25:00 UTC (rev 9998) @@ -23,12 +23,8 @@ package org.gjt.sp.jedit.options; //{{{ Imports -import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -47,6 +43,7 @@ import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; + import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; @@ -54,15 +51,25 @@ import org.gjt.sp.jedit.Buffer; import org.gjt.sp.jedit.MiscUtilities; import org.gjt.sp.jedit.jEdit; + import org.gjt.sp.jedit.MiscUtilities.StringICaseCompare; + import org.gjt.sp.jedit.gui.JCheckBoxList; + import org.gjt.sp.jedit.gui.JCheckBoxList.Entry; + +import static java.awt.GridBagConstraints.BOTH; + import static java.util.Arrays.sort; + import static javax.swing.Box.createHorizontalBox; +import static javax.swing.Box.createHorizontalStrut; + import static org.gjt.sp.jedit.jEdit.getBooleanProperty; import static org.gjt.sp.jedit.jEdit.getProperty; import static org.gjt.sp.jedit.jEdit.setBooleanProperty; import static org.gjt.sp.jedit.jEdit.unsetProperty; + import static org.gjt.sp.jedit.MiscUtilities.getEncodings; //}}} @@ -77,8 +84,7 @@ public class EncodingsOptionPane extends AbstractOptionPane { //{{{ Instance variables - private JPanel optionsPanel; - private JComboBox encoding; + private JComboBox defaultEncoding; private JCheckBox encodingAutodetect; private JTextField encodingDetectors; private JTextField fallbackEncodings; @@ -88,110 +94,54 @@ private JButton selectNoneButton; //}}} - //{{{ EncodingsOptionPane constructor public EncodingsOptionPane() { super("encodings"); - optionsPanel = new JPanel(); - optionsPanel.setLayout(gridBag = new GridBagLayout()); } //}}} - /** Overridden from the base class to add to a custom panel */ - public void addComponent(Component comp) - { - GridBagConstraints cons = new GridBagConstraints(); - cons.gridy = y++; - cons.gridheight = 1; - cons.gridwidth = cons.REMAINDER; - cons.fill = GridBagConstraints.NONE; - cons.anchor = GridBagConstraints.WEST; - cons.weightx = 1.0f; - cons.insets = new Insets(1,0,1,0); - - gridBag.setConstraints(comp,cons); - optionsPanel.add(comp); - } //}}} - - - //{{{ addComponent() method - /** - * overridden from the base class to add to a custom panel - * @param comp1 The label - * @param comp2 The component - * @param fill Fill parameter to GridBagConstraints for the right - * component - * - * - */ - public void addComponent(Component comp1, Component comp2, int fill) - { - GridBagConstraints cons = new GridBagConstraints(); - cons.gridy = y++; - cons.gridheight = 1; - cons.gridwidth = 1; - cons.weightx = 0.0f; - cons.insets = new Insets(1,0,1,0); - cons.fill = GridBagConstraints.BOTH; - - gridBag.setConstraints(comp1,cons); - optionsPanel.add(comp1); - - cons.fill = fill; - cons.gridx = 1; - cons.weightx = 1.0f; - gridBag.setConstraints(comp2,cons); - optionsPanel.add(comp2); - } //}}} - - //{{{ _init() method protected void _init() { - setLayout(new BorderLayout()); -// add(new JLabel(getProperty("options.encodings.selectEncodings")),BorderLayout.NORTH); - - /* Default file encoding */ - String[] encodings = MiscUtilities.getEncodings(true); - Arrays.sort(encodings,new MiscUtilities.StringICaseCompare()); - encoding = new JComboBox(encodings); - encoding.setEditable(true); - encoding.setSelectedItem(jEdit.getProperty("buffer."+Buffer.ENCODING, + // Default file encoding + String[] encodings = getEncodings(true); + sort(encodings,new StringICaseCompare()); + defaultEncoding = new JComboBox(encodings); + defaultEncoding.setEditable(true); + defaultEncoding.setSelectedItem(jEdit.getProperty("buffer."+Buffer.ENCODING, System.getProperty("file.encoding"))); - addComponent(jEdit.getProperty("options.general.encoding"),encoding); + addComponent(jEdit.getProperty("options.general.encoding"),defaultEncoding); - /* Auto detect encoding */ + // Auto detect encoding encodingAutodetect = new JCheckBox(jEdit.getProperty( "options.general.encodingAutodetect")); - encodingAutodetect.setSelected(jEdit.getBooleanProperty("buffer.encodingAutodetect")); - addComponent(encodingAutodetect); + encodingAutodetect.setSelected(jEdit.getBooleanProperty( + "buffer.encodingAutodetect")); + addComponent(encodingAutodetect,BOTH); + // Encoding detectors encodingDetectors = new JTextField(jEdit.getProperty( - "options.general.encodingDetectors")); - encodingDetectors.setText(jEdit.getProperty("encodingDetectors", - "BOM XML-PI")); - addComponent(jEdit.getProperty("options.general.encodingDetectors"), - encodingDetectors); + "encodingDetectors","BOM XML-PI")); + addComponent(jEdit.getProperty("options.general.encodingDetectors"),encodingDetectors); + // Fallback Encodings fallbackEncodings = new JTextField(jEdit.getProperty( - "options.general.fallbackEncodings")); - fallbackEncodings.setText(jEdit.getProperty("fallbackEncodings", - "")); + "fallbackEncodings","")); fallbackEncodings.setToolTipText(jEdit.getProperty( "options.general.fallbackEncodings.tooltip")); - addComponent(jEdit.getProperty("options.general.fallbackEncodings"), - fallbackEncodings); + addComponent(jEdit.getProperty("options.general.fallbackEncodings"),fallbackEncodings); + // Encodings to display encodings = getEncodings(false); sort(encodings,new StringICaseCompare()); Vector<Entry> encodingEntriesVector = new Vector<Entry>(); boolean enableSelectAll = false; boolean enableSelectNone = false; - for (String encodstr : encodings) { - boolean selected = !getBooleanProperty("encoding.opt-out."+encodstr,false); + for (String encoding : encodings) { + boolean selected = !getBooleanProperty("encoding.opt-out."+encoding,false); enableSelectAll = enableSelectAll || !selected; enableSelectNone = enableSelectNone || selected; - encodingEntriesVector.add(new Entry(selected,encodstr)); + encodingEntriesVector.add(new Entry(selected,encoding)); } encodingsList = new JCheckBoxList(encodingEntriesVector); encodingsList.getModel().addTableModelListener(new TableModelHandler()); @@ -201,21 +151,26 @@ Dimension d = encodingsList.getPreferredSize(); d.height = Math.min(d.height,200); encodingsScrollPane.setPreferredSize(d); + addComponent(encodingsScrollPane,BOTH); - add(optionsPanel, BorderLayout.NORTH); - add(encodingsScrollPane,BorderLayout.CENTER); - - ActionHandler actionHandler = new ActionHandler(); + // Select All/None Buttons Box buttonsBox = createHorizontalBox(); + buttonsBox.add(createHorizontalStrut(12)); + + ActionHandler actionHandler = new ActionHandler(); selectAllButton = new JButton(getProperty("options.encodings.selectAll")); selectAllButton.addActionListener(actionHandler); selectAllButton.setEnabled(enableSelectAll); buttonsBox.add(selectAllButton); + buttonsBox.add(createHorizontalStrut(12)); + selectNoneButton = new JButton(getProperty("options.encodings.selectNone")); selectNoneButton.addActionListener(actionHandler); selectNoneButton.setEnabled(enableSelectNone); buttonsBox.add(selectNoneButton); - add(buttonsBox,BorderLayout.SOUTH); + buttonsBox.add(createHorizontalStrut(12)); + + addComponent(buttonsBox); } //}}} //{{{ _save() method @@ -223,7 +178,7 @@ { jEdit.setProperty("buffer."+Buffer.ENCODING,(String) - encoding.getSelectedItem()); + defaultEncoding.getSelectedItem()); jEdit.setBooleanProperty("buffer.encodingAutodetect", encodingAutodetect.isSelected()); jEdit.setProperty("encodingDetectors",encodingDetectors.getText()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ez...@us...> - 2007-08-02 18:22:26
|
Revision: 10288 http://jedit.svn.sourceforge.net/jedit/?rev=10288&view=rev Author: ezust Date: 2007-08-02 11:22:25 -0700 (Thu, 02 Aug 2007) Log Message: ----------- VFSPathSelected requires a "view" as the source object. Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/browser/VFSDirectoryEntryTable.java jEdit/trunk/org/gjt/sp/jedit/msg/VFSPathSelected.java Modified: jEdit/trunk/org/gjt/sp/jedit/browser/VFSDirectoryEntryTable.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/browser/VFSDirectoryEntryTable.java 2007-08-02 16:50:43 UTC (rev 10287) +++ jEdit/trunk/org/gjt/sp/jedit/browser/VFSDirectoryEntryTable.java 2007-08-02 18:22:25 UTC (rev 10288) @@ -566,7 +566,7 @@ super.mouseClicked(e); int ind = getSelectionModel().getMinSelectionIndex(); Entry node = (Entry) (getModel().getValueAt(ind, 0)); - EditBus.send(new VFSPathSelected(this, node.dirEntry)); + EditBus.send(new VFSPathSelected(jEdit.getActiveView(), node.dirEntry)); } Modified: jEdit/trunk/org/gjt/sp/jedit/msg/VFSPathSelected.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/msg/VFSPathSelected.java 2007-08-02 16:50:43 UTC (rev 10287) +++ jEdit/trunk/org/gjt/sp/jedit/msg/VFSPathSelected.java 2007-08-02 18:22:25 UTC (rev 10288) @@ -1,6 +1,7 @@ package org.gjt.sp.jedit.msg; import org.gjt.sp.jedit.EBMessage; +import org.gjt.sp.jedit.View; import org.gjt.sp.jedit.io.VFSFile; /** Message sent when a file system tree node, @@ -14,11 +15,11 @@ protected String path = "NULL"; /** * - * @param source + * @param source the View that is considered the "source" of this event * @param node if an instance of VFSFile, will extract * the path automatically */ - public VFSPathSelected(Object source, Object node) { + public VFSPathSelected(View source, Object node) { super(source); this.treeNode=node; if (node instanceof VFSFile) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <va...@us...> - 2007-08-05 23:02:52
|
Revision: 10326 http://jedit.svn.sourceforge.net/jedit/?rev=10326&view=rev Author: vanza Date: 2007-08-05 16:02:51 -0700 (Sun, 05 Aug 2007) Log Message: ----------- Clean up the VFSPathSelected API. Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/browser/VFSDirectoryEntryTable.java jEdit/trunk/org/gjt/sp/jedit/msg/VFSPathSelected.java Modified: jEdit/trunk/org/gjt/sp/jedit/browser/VFSDirectoryEntryTable.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/browser/VFSDirectoryEntryTable.java 2007-08-05 19:29:15 UTC (rev 10325) +++ jEdit/trunk/org/gjt/sp/jedit/browser/VFSDirectoryEntryTable.java 2007-08-05 23:02:51 UTC (rev 10326) @@ -73,9 +73,9 @@ (DefaultTableCellRenderer)header.getDefaultRenderer())); setRowSelectionAllowed(true); - + getColumnModel().addColumnModelListener(new ColumnHandler()); - + setAutoResizeMode(AUTO_RESIZE_OFF); } //}}} @@ -320,7 +320,7 @@ ea = ac.getAction("vfs.browser.delete"); ac.invokeAction(evt, ea); break; - case KeyEvent.CTRL_MASK | KeyEvent.VK_N: + case KeyEvent.CTRL_MASK | KeyEvent.VK_N: evt.consume(); ea = ac.getAction("vfs.browser.new-file"); ac.invokeAction(evt, ea); @@ -558,7 +558,8 @@ } //}}} //{{{ class MainMouseHandler - class MainMouseHandler extends MouseInputAdapter { + class MainMouseHandler extends MouseInputAdapter + { @Override public void mouseClicked(MouseEvent e) @@ -566,12 +567,12 @@ super.mouseClicked(e); int ind = getSelectionModel().getMinSelectionIndex(); Entry node = (Entry) (getModel().getValueAt(ind, 0)); - EditBus.send(new VFSPathSelected(jEdit.getActiveView(), node.dirEntry)); + EditBus.send(new VFSPathSelected(jEdit.getActiveView(), + node.dirEntry.getPath())); } - - + } //}}} - + //{{{ MouseHandler class class MouseHandler extends MouseInputAdapter { Modified: jEdit/trunk/org/gjt/sp/jedit/msg/VFSPathSelected.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/msg/VFSPathSelected.java 2007-08-05 19:29:15 UTC (rev 10325) +++ jEdit/trunk/org/gjt/sp/jedit/msg/VFSPathSelected.java 2007-08-05 23:02:51 UTC (rev 10326) @@ -5,41 +5,35 @@ import org.gjt.sp.jedit.io.VFSFile; /** Message sent when a file system tree node, - * or a ProjectViewer tree node, is selected. + * or a ProjectViewer tree node, is selected. * @since jEdit 4.3pre11 */ public class VFSPathSelected extends EBMessage { - /** The underlying node in the tree model that was selected */ - protected Object treeNode; - protected String path = "NULL"; /** - * * @param source the View that is considered the "source" of this event - * @param node if an instance of VFSFile, will extract - * the path automatically + * @param path The selected path. */ - public VFSPathSelected(View source, Object node) { + public VFSPathSelected(View source, String path) + { super(source); - this.treeNode=node; - if (node instanceof VFSFile) { - VFSFile f = (VFSFile) node; - path = f.getPath(); - } - + this.path = path; } - - /** @return A URL or file path to the file represented by the - * selected node. - */ - public String getPath() { - return path; - } + public View getView() + { + return (View) getSource(); + } + /** - * @return The associated node object (may be VFSFile or VPTNode) + * @return The selected URL (or file path). */ - public Object getNode() { - return treeNode; + public String getPath() + { + return path; } + + private final String path; + } + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |