Update of /cvsroot/squirrel-sql/sql12/plugins/syntax/src/net/sourceforge/squirrel_sql/plugins/syntax
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv1806/plugins/syntax/src/net/sourceforge/squirrel_sql/plugins/syntax
Modified Files:
SyntaxPugin.java SyntaxPluginResources.properties
SyntaxPreferences.java KeyManager.java
SyntaxPreferencesPanel.java ToolsPopupHandler.java
I18NStrings.properties SQLEntryPanelFactoryProxy.java
Added Files:
FindAction.java GoToLineAction.java RepeatLastFindAction.java
MarkSelectedAction.java FindSelectedAction.java
ReplaceAction.java UnmarkAction.java
Log Message:
RSyntax editor integration
Index: SQLEntryPanelFactoryProxy.java
===================================================================
RCS file: /cvsroot/squirrel-sql/sql12/plugins/syntax/src/net/sourceforge/squirrel_sql/plugins/syntax/SQLEntryPanelFactoryProxy.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** SQLEntryPanelFactoryProxy.java 27 Dec 2008 19:30:37 -0000 1.7
--- SQLEntryPanelFactoryProxy.java 29 Nov 2009 21:17:53 -0000 1.8
***************
*** 12,15 ****
--- 12,16 ----
import net.sourceforge.squirrel_sql.plugins.syntax.netbeans.NetbeansSQLEntryAreaFactory;
import net.sourceforge.squirrel_sql.plugins.syntax.oster.OsterSQLEntryAreaFactory;
+ import net.sourceforge.squirrel_sql.plugins.syntax.rsyntax.RSyntaxSQLEntryAreaFactory;
***************
*** 27,30 ****
--- 28,32 ----
private ISQLEntryPanelFactory _originalFactory;
+ private RSyntaxSQLEntryAreaFactory _rsyntaxFactory;
***************
*** 32,35 ****
--- 34,38 ----
{
_originalFactory = originalFactory;
+ _rsyntaxFactory = new RSyntaxSQLEntryAreaFactory(syntaxPugin);
_netbeansFactory = new NetbeansSQLEntryAreaFactory(syntaxPugin);
_osterFactory = new OsterSQLEntryAreaFactory(syntaxPugin);
***************
*** 56,60 ****
! if (prefs.getUseNetbeansTextControl())
{
newPnl = _netbeansFactory.createSQLEntryPanel(session, props);
--- 59,67 ----
! if (prefs.getUseRSyntaxTextArea())
! {
! newPnl = _rsyntaxFactory.createSQLEntryPanel(session, props);
! }
! else if (prefs.getUseNetbeansTextControl())
{
newPnl = _netbeansFactory.createSQLEntryPanel(session, props);
--- NEW FILE: UnmarkAction.java ---
package net.sourceforge.squirrel_sql.plugins.syntax;
import net.sourceforge.squirrel_sql.client.IApplication;
import net.sourceforge.squirrel_sql.client.action.SquirrelAction;
import net.sourceforge.squirrel_sql.client.session.ISession;
import net.sourceforge.squirrel_sql.client.session.ISQLEntryPanel;
import net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI;
import net.sourceforge.squirrel_sql.client.session.action.ISQLPanelAction;
import net.sourceforge.squirrel_sql.plugins.syntax.SyntaxPluginResources;
import net.sourceforge.squirrel_sql.plugins.syntax.rsyntax.SquirrelRSyntaxTextArea;
import net.sourceforge.squirrel_sql.plugins.syntax.rsyntax.RSyntaxSQLEntryPanel;
import net.sourceforge.squirrel_sql.fw.util.StringManager;
import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
import javax.swing.*;
import java.awt.event.ActionEvent;
public class UnmarkAction extends SquirrelAction implements ISQLPanelAction
{
private static final StringManager s_stringMgr =
StringManagerFactory.getStringManager(UnmarkAction.class);
private ISession _session;
private ISQLEntryPanel _sqlEntryPanel;
public UnmarkAction(IApplication app, SyntaxPluginResources rsrc, ISQLEntryPanel sqlEntryPanel)
{
this(app, rsrc);
_sqlEntryPanel = sqlEntryPanel;
}
public UnmarkAction(IApplication app, SyntaxPluginResources rsrc)
{
super(app, rsrc);
}
public void actionPerformed(ActionEvent evt)
{
if(null != _sqlEntryPanel)
{
doActionPerformed(_sqlEntryPanel, evt);
}
else if(null != _session)
{
ISQLEntryPanel sqlEntryPanel = _session.getSQLPanelAPIOfActiveSessionWindow().getSQLEntryPanel();
doActionPerformed(sqlEntryPanel, evt);
}
}
private void doActionPerformed(ISQLEntryPanel sqlEntryPanel, ActionEvent evt)
{
if(sqlEntryPanel instanceof RSyntaxSQLEntryPanel)
{
SquirrelRSyntaxTextArea rsep = (SquirrelRSyntaxTextArea) sqlEntryPanel.getTextComponent();
rsep.unmarkAll();
}
else
{
String msg = s_stringMgr.getString("syntax.unmarkOnlyOnRecommendedEditors");
JOptionPane.showMessageDialog(_session.getApplication().getMainFrame(), msg);
}
}
public void setSQLPanel(ISQLPanelAPI panel)
{
if(null != panel)
{
_session = panel.getSession();
}
else
{
_session = null;
}
setEnabled(null != _session);
}
}
Index: SyntaxPugin.java
===================================================================
RCS file: /cvsroot/squirrel-sql/sql12/plugins/syntax/src/net/sourceforge/squirrel_sql/plugins/syntax/SyntaxPugin.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** SyntaxPugin.java 27 Dec 2008 19:30:37 -0000 1.28
--- SyntaxPugin.java 29 Nov 2009 21:17:53 -0000 1.29
***************
*** 18,34 ****
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
- import java.beans.PropertyChangeEvent;
- import java.beans.PropertyChangeListener;
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.io.IOException;
- import java.util.HashMap;
- import java.util.Iterator;
- import java.util.Map;
-
- import javax.swing.Action;
- import javax.swing.JMenu;
- import javax.swing.JMenuItem;
- import javax.swing.JOptionPane;
import net.sourceforge.squirrel_sql.client.IApplication;
--- 18,21 ----
***************
*** 52,59 ****
import net.sourceforge.squirrel_sql.fw.xml.XMLBeanReader;
import net.sourceforge.squirrel_sql.fw.xml.XMLBeanWriter;
- import net.sourceforge.squirrel_sql.plugins.syntax.netbeans.FindAction;
import net.sourceforge.squirrel_sql.plugins.syntax.netbeans.NetbeansSQLEntryPanel;
! import net.sourceforge.squirrel_sql.plugins.syntax.netbeans.ReplaceAction;
import net.sourceforge.squirrel_sql.plugins.syntax.oster.OsterSQLEntryPanel;
/**
--- 39,57 ----
import net.sourceforge.squirrel_sql.fw.xml.XMLBeanReader;
import net.sourceforge.squirrel_sql.fw.xml.XMLBeanWriter;
import net.sourceforge.squirrel_sql.plugins.syntax.netbeans.NetbeansSQLEntryPanel;
! import net.sourceforge.squirrel_sql.plugins.syntax.ReplaceAction;
import net.sourceforge.squirrel_sql.plugins.syntax.oster.OsterSQLEntryPanel;
+ import net.sourceforge.squirrel_sql.plugins.syntax.rsyntax.RSyntaxSQLEntryPanel;
+ import net.sourceforge.squirrel_sql.plugins.syntax.UnmarkAction;
+
+ import javax.swing.*;
+ import java.beans.PropertyChangeEvent;
+ import java.beans.PropertyChangeListener;
+ import java.io.File;
+ import java.io.FileNotFoundException;
+ import java.io.IOException;
+ import java.util.HashMap;
+ import java.util.Iterator;
+ import java.util.Map;
/**
***************
*** 78,83 ****
--- 76,91 ----
//i18n[SyntaxPlugin.find=find]
String FIND = s_stringMgr.getString("SyntaxPlugin.find");
+ //i18n[SyntaxPlugin.findSelected=findselected]
+ String FIND_SELECTED = s_stringMgr.getString("SyntaxPlugin.findselected");
+ //i18n[SyntaxPlugin.repeatLastFind=findrepeatlast]
+ String REPEAT_LAST_FIND = s_stringMgr.getString("SyntaxPlugin.repeatLastFind");
+ //i18n[SyntaxPlugin.markSelected=markselected]
+ String MARK_SELECTED = s_stringMgr.getString("SyntaxPlugin.markSelected");
//i18n[SyntaxPlugin.replace=replace]
String REPLACE = s_stringMgr.getString("SyntaxPlugin.replace");
+ //i18n[SyntaxPlugin.unmark=unmark]
+ String UNMARK = s_stringMgr.getString("SyntaxPlugin.unmark");
+ //i18n[SyntaxPlugin.gotoline=gotoline]
+ String GO_TO_LINE = s_stringMgr.getString("SyntaxPlugin.gotoline");
//i18n[SyntaxPlugin.autocorr=autocorr]
String AUTO_CORR = s_stringMgr.getString("SyntaxPlugin.autocorr");
***************
*** 249,256 ****
--- 257,284 ----
_resources.addToMenu(act, menu);
+ act = new FindSelectedAction(getApplication(), _resources);
+ coll.add(act);
+ _resources.addToMenu(act, menu);
+
+ act = new RepeatLastFindAction(getApplication(), _resources);
+ coll.add(act);
+ _resources.addToMenu(act, menu);
+
+ act = new MarkSelectedAction(getApplication(), _resources);
+ coll.add(act);
+ _resources.addToMenu(act, menu);
+
act = new ReplaceAction(getApplication(), _resources);
coll.add(act);
_resources.addToMenu(act, menu);
+ act = new UnmarkAction(getApplication(), _resources);
+ coll.add(act);
+ _resources.addToMenu(act, menu);
+
+ act = new GoToLineAction(getApplication(), _resources);
+ coll.add(act);
+ _resources.addToMenu(act, menu);
+
act = new DuplicateLineAction(getApplication(), _resources);
coll.add(act);
***************
*** 339,344 ****
JMenuItem mnuComment = sqlPanelAPI.addToSQLEntryAreaMenu(coll.get(CommentAction.class));
- JMenuItem mnuUncomment = sqlPanelAPI.addToSQLEntryAreaMenu(coll.get(UncommentAction.class));
_resources.configureMenuItem(coll.get(CommentAction.class), mnuComment);
_resources.configureMenuItem(coll.get(UncommentAction.class), mnuUncomment);
}
--- 367,372 ----
JMenuItem mnuComment = sqlPanelAPI.addToSQLEntryAreaMenu(coll.get(CommentAction.class));
_resources.configureMenuItem(coll.get(CommentAction.class), mnuComment);
+ JMenuItem mnuUncomment = sqlPanelAPI.addToSQLEntryAreaMenu(coll.get(UncommentAction.class));
_resources.configureMenuItem(coll.get(UncommentAction.class), mnuUncomment);
}
***************
*** 359,365 ****
ISQLPanelAPI sqlPanelAPI = sqlInternalFrame.getSQLPanelAPI();
JMenuItem mnuComment = sqlPanelAPI.addToSQLEntryAreaMenu(coll.get(CommentAction.class));
JMenuItem mnuUncomment = sqlPanelAPI.addToSQLEntryAreaMenu(coll.get(UncommentAction.class));
- _resources.configureMenuItem(coll.get(CommentAction.class), mnuComment);
_resources.configureMenuItem(coll.get(UncommentAction.class), mnuUncomment);
--- 387,395 ----
ISQLPanelAPI sqlPanelAPI = sqlInternalFrame.getSQLPanelAPI();
+ JMenuItem mnuUnmark = sqlPanelAPI.addToSQLEntryAreaMenu(coll.get(UnmarkAction.class));
+ _resources.configureMenuItem(coll.get(UnmarkAction.class), mnuUnmark);
JMenuItem mnuComment = sqlPanelAPI.addToSQLEntryAreaMenu(coll.get(CommentAction.class));
+ _resources.configureMenuItem(coll.get(CommentAction.class), mnuComment);
JMenuItem mnuUncomment = sqlPanelAPI.addToSQLEntryAreaMenu(coll.get(UncommentAction.class));
_resources.configureMenuItem(coll.get(UncommentAction.class), mnuUncomment);
***************
*** 505,509 ****
if( false == SyntaxPreferences.IPropertyNames.USE_NETBEANS_CONTROL.equals(propName)
! && false == SyntaxPreferences.IPropertyNames.USE_OSTER_CONTROL.equals(propName) )
{
--- 535,540 ----
if( false == SyntaxPreferences.IPropertyNames.USE_NETBEANS_CONTROL.equals(propName)
! && false == SyntaxPreferences.IPropertyNames.USE_OSTER_CONTROL.equals(propName)
! && false == SyntaxPreferences.IPropertyNames.USE_RSYNTAX_CONTROL.equals(propName) )
{
***************
*** 521,524 ****
--- 552,560 ----
((OsterSQLEntryPanel)pluginObject).updateFromPreferences();
}
+
+ if(pluginObject instanceof RSyntaxSQLEntryPanel)
+ {
+ ((RSyntaxSQLEntryPanel)pluginObject).updateFromPreferences();
+ }
}
else
Index: ToolsPopupHandler.java
===================================================================
RCS file: /cvsroot/squirrel-sql/sql12/plugins/syntax/src/net/sourceforge/squirrel_sql/plugins/syntax/ToolsPopupHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ToolsPopupHandler.java 13 Sep 2007 22:14:47 -0000 1.1
--- ToolsPopupHandler.java 29 Nov 2009 21:17:53 -0000 1.2
***************
*** 1,19 ****
package net.sourceforge.squirrel_sql.plugins.syntax;
- import net.sourceforge.squirrel_sql.client.session.ISQLEntryPanel;
- import net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI;
- import net.sourceforge.squirrel_sql.client.gui.session.ToolsPopupAccessor;
- import net.sourceforge.squirrel_sql.client.gui.session.SessionInternalFrame;
- import net.sourceforge.squirrel_sql.client.gui.session.SQLInternalFrame;
import net.sourceforge.squirrel_sql.client.IApplication;
import net.sourceforge.squirrel_sql.client.action.ActionCollection;
! import net.sourceforge.squirrel_sql.plugins.syntax.netbeans.*;
import net.sourceforge.squirrel_sql.fw.util.Resources;
import javax.swing.*;
import java.util.HashMap;
- import org.netbeans.editor.BaseKit;
-
public class ToolsPopupHandler
{
--- 1,25 ----
package net.sourceforge.squirrel_sql.plugins.syntax;
import net.sourceforge.squirrel_sql.client.IApplication;
import net.sourceforge.squirrel_sql.client.action.ActionCollection;
! import net.sourceforge.squirrel_sql.client.gui.session.SQLInternalFrame;
! import net.sourceforge.squirrel_sql.client.gui.session.SessionInternalFrame;
! import net.sourceforge.squirrel_sql.client.gui.session.ToolsPopupAccessor;
! import net.sourceforge.squirrel_sql.client.session.ISQLEntryPanel;
! import net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI;
import net.sourceforge.squirrel_sql.fw.util.Resources;
+ import net.sourceforge.squirrel_sql.plugins.syntax.netbeans.NetbeansSQLEditorPane;
+ import net.sourceforge.squirrel_sql.plugins.syntax.ReplaceAction;
+ import net.sourceforge.squirrel_sql.plugins.syntax.netbeans.SQLKit;
+ import net.sourceforge.squirrel_sql.plugins.syntax.netbeans.SQLSettingsInitializer;
+ import net.sourceforge.squirrel_sql.plugins.syntax.rsyntax.SquirreLRSyntaxTextAreaUI;
+ import net.sourceforge.squirrel_sql.plugins.syntax.rsyntax.SquirrelRSyntaxTextArea;
+ import net.sourceforge.squirrel_sql.plugins.syntax.UnmarkAction;
+ import org.fife.ui.rtextarea.RTextAreaEditorKit;
+ import org.netbeans.editor.BaseKit;
import javax.swing.*;
import java.util.HashMap;
public class ToolsPopupHandler
{
***************
*** 41,45 ****
--- 47,56 ----
tpa.addToToolsPopup(SyntaxPugin.i18n.FIND , new FindAction(app, rsrc, isqlEntryPanel));
+ tpa.addToToolsPopup(SyntaxPugin.i18n.FIND_SELECTED , new FindSelectedAction(app, rsrc, isqlEntryPanel));
+ tpa.addToToolsPopup(SyntaxPugin.i18n.REPEAT_LAST_FIND , new RepeatLastFindAction(app, rsrc, isqlEntryPanel));
+ tpa.addToToolsPopup(SyntaxPugin.i18n.MARK_SELECTED , new MarkSelectedAction(app, rsrc, isqlEntryPanel));
tpa.addToToolsPopup(SyntaxPugin.i18n.REPLACE , new ReplaceAction(app, rsrc, isqlEntryPanel));
+ tpa.addToToolsPopup(SyntaxPugin.i18n.UNMARK , new UnmarkAction(app, rsrc, isqlEntryPanel));
+ tpa.addToToolsPopup(SyntaxPugin.i18n.GO_TO_LINE , new GoToLineAction(app, rsrc, isqlEntryPanel));
tpa.addToToolsPopup(SyntaxPugin.i18n.AUTO_CORR , new ConfigureAutoCorrectAction(app, rsrc, _syntaxPugin));
tpa.addToToolsPopup(SyntaxPugin.i18n.DUP_LINE , new DuplicateLineAction(app, rsrc, isqlEntryPanel));
***************
*** 58,63 ****
--- 69,85 ----
tpa.addToToolsPopup(SyntaxPugin.i18n.TO_LOWER_CASE, toLowerAction);
}
+ else if (isqlEntryPanel.getTextComponent() instanceof SquirrelRSyntaxTextArea)
+ {
+ SquirrelRSyntaxTextArea rsEdit = (SquirrelRSyntaxTextArea) isqlEntryPanel.getTextComponent();
+ Action toUpperAction = SquirreLRSyntaxTextAreaUI.getActionForName(rsEdit, RTextAreaEditorKit.rtaUpperSelectionCaseAction);
+ toUpperAction.putValue(Resources.ACCELERATOR_STRING, SquirreLRSyntaxTextAreaUI.RS_ACCELERATOR_STRING_TO_UPPER_CASE);
+ tpa.addToToolsPopup(SyntaxPugin.i18n.TO_UPPER_CASE, toUpperAction);
+
+ Action toLowerAction = SquirreLRSyntaxTextAreaUI.getActionForName(rsEdit, RTextAreaEditorKit.rtaLowerSelectionCaseAction);
+ toLowerAction.putValue(Resources.ACCELERATOR_STRING, SquirreLRSyntaxTextAreaUI.RS_ACCELERATOR_STRING_TO_LOWER_CASE);
+ tpa.addToToolsPopup(SyntaxPugin.i18n.TO_LOWER_CASE, toLowerAction);
+ }
}
***************
*** 69,73 ****
--- 91,100 ----
sif.addToToolsPopUp(SyntaxPugin.i18n.FIND, coll.get(FindAction.class));
+ sif.addToToolsPopUp(SyntaxPugin.i18n.FIND_SELECTED , coll.get(FindSelectedAction.class));
+ sif.addToToolsPopUp(SyntaxPugin.i18n.REPEAT_LAST_FIND , coll.get(RepeatLastFindAction.class));
+ sif.addToToolsPopUp(SyntaxPugin.i18n.MARK_SELECTED , coll.get(MarkSelectedAction.class));
sif.addToToolsPopUp(SyntaxPugin.i18n.REPLACE, coll.get(ReplaceAction.class));
+ sif.addToToolsPopUp(SyntaxPugin.i18n.UNMARK, coll.get(UnmarkAction.class));
+ sif.addToToolsPopUp(SyntaxPugin.i18n.GO_TO_LINE, coll.get(GoToLineAction.class));
sif.addToToolsPopUp(SyntaxPugin.i18n.AUTO_CORR, coll.get(ConfigureAutoCorrectAction.class));
sif.addToToolsPopUp(SyntaxPugin.i18n.DUP_LINE, coll.get(DuplicateLineAction.class));
***************
*** 88,91 ****
--- 115,131 ----
sif.addToToolsPopUp(SyntaxPugin.i18n.TO_LOWER_CASE, toLowerAction);
}
+ else if (sep.getTextComponent() instanceof SquirrelRSyntaxTextArea)
+ {
+ SquirrelRSyntaxTextArea rsEdit = (SquirrelRSyntaxTextArea) sep.getTextComponent();
+
+ Action toUpperAction = SquirreLRSyntaxTextAreaUI.getActionForName(rsEdit, RTextAreaEditorKit.rtaUpperSelectionCaseAction);
+ toUpperAction.putValue(Resources.ACCELERATOR_STRING, SquirreLRSyntaxTextAreaUI.RS_ACCELERATOR_STRING_TO_UPPER_CASE);
+ sif.addToToolsPopUp(SyntaxPugin.i18n.TO_UPPER_CASE, toUpperAction);
+
+ Action toLowerAction = SquirreLRSyntaxTextAreaUI.getActionForName(rsEdit, RTextAreaEditorKit.rtaLowerSelectionCaseAction);
+ toLowerAction.putValue(Resources.ACCELERATOR_STRING, SquirreLRSyntaxTextAreaUI.RS_ACCELERATOR_STRING_TO_LOWER_CASE);
+ sif.addToToolsPopUp(SyntaxPugin.i18n.TO_LOWER_CASE, toLowerAction);
+
+ }
}
***************
*** 94,98 ****
--- 134,143 ----
{
sqlInternalFrame.addToToolsPopUp(SyntaxPugin.i18n.FIND , coll.get(FindAction.class));
+ sqlInternalFrame.addToToolsPopUp(SyntaxPugin.i18n.FIND_SELECTED , coll.get(FindSelectedAction.class));
+ sqlInternalFrame.addToToolsPopUp(SyntaxPugin.i18n.REPEAT_LAST_FIND , coll.get(RepeatLastFindAction.class));
+ sqlInternalFrame.addToToolsPopUp(SyntaxPugin.i18n.MARK_SELECTED , coll.get(MarkSelectedAction.class));
sqlInternalFrame.addToToolsPopUp(SyntaxPugin.i18n.REPLACE , coll.get(ReplaceAction.class));
+ sqlInternalFrame.addToToolsPopUp(SyntaxPugin.i18n.UNMARK , coll.get(UnmarkAction.class));
+ sqlInternalFrame.addToToolsPopUp(SyntaxPugin.i18n.GO_TO_LINE , coll.get(GoToLineAction.class));
sqlInternalFrame.addToToolsPopUp(SyntaxPugin.i18n.AUTO_CORR , coll.get(ConfigureAutoCorrectAction.class));
sqlInternalFrame.addToToolsPopUp(SyntaxPugin.i18n.DUP_LINE , coll.get(DuplicateLineAction.class));
***************
*** 113,116 ****
--- 158,174 ----
sqlInternalFrame.addToToolsPopUp(SyntaxPugin.i18n.TO_LOWER_CASE, toLowerAction);
}
+ else if (sqlPanelAPI.getSQLEntryPanel().getTextComponent() instanceof SquirrelRSyntaxTextArea)
+ {
+ SquirrelRSyntaxTextArea rsEdit = (SquirrelRSyntaxTextArea) sqlPanelAPI.getSQLEntryPanel().getTextComponent();
+
+ Action toUpperAction = SquirreLRSyntaxTextAreaUI.getActionForName(rsEdit, RTextAreaEditorKit.rtaUpperSelectionCaseAction);
+ toUpperAction.putValue(Resources.ACCELERATOR_STRING, SquirreLRSyntaxTextAreaUI.RS_ACCELERATOR_STRING_TO_UPPER_CASE);
+ sqlInternalFrame.addToToolsPopUp(SyntaxPugin.i18n.TO_UPPER_CASE, toUpperAction);
+
+ Action toLowerAction = SquirreLRSyntaxTextAreaUI.getActionForName(rsEdit, RTextAreaEditorKit.rtaLowerSelectionCaseAction);
+ toLowerAction.putValue(Resources.ACCELERATOR_STRING, SquirreLRSyntaxTextAreaUI.RS_ACCELERATOR_STRING_TO_LOWER_CASE);
+ sqlInternalFrame.addToToolsPopUp(SyntaxPugin.i18n.TO_LOWER_CASE, toLowerAction);
+
+ }
}
--- NEW FILE: GoToLineAction.java ---
package net.sourceforge.squirrel_sql.plugins.syntax;
import net.sourceforge.squirrel_sql.client.IApplication;
import net.sourceforge.squirrel_sql.client.action.SquirrelAction;
import net.sourceforge.squirrel_sql.client.session.ISQLEntryPanel;
import net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI;
import net.sourceforge.squirrel_sql.client.session.ISession;
import net.sourceforge.squirrel_sql.client.session.action.ISQLPanelAction;
import net.sourceforge.squirrel_sql.fw.util.StringManager;
import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
import net.sourceforge.squirrel_sql.plugins.syntax.rsyntax.RSyntaxSQLEntryPanel;
import net.sourceforge.squirrel_sql.plugins.syntax.rsyntax.SquirrelRSyntaxTextArea;
import javax.swing.*;
import java.awt.event.ActionEvent;
public class GoToLineAction extends SquirrelAction implements ISQLPanelAction
{
private static final StringManager s_stringMgr =
StringManagerFactory.getStringManager(GoToLineAction.class);
private ISession _session;
private ISQLEntryPanel _sqlEntryPanel;
public GoToLineAction(IApplication app, SyntaxPluginResources rsrc, ISQLEntryPanel sqlEntryPanel)
{
this(app, rsrc);
_sqlEntryPanel = sqlEntryPanel;
}
public GoToLineAction(IApplication app, SyntaxPluginResources rsrc)
{
super(app, rsrc);
}
public void actionPerformed(ActionEvent evt)
{
if(null != _sqlEntryPanel)
{
doActionPerformed(_sqlEntryPanel, evt);
}
else if(null != _session)
{
ISQLEntryPanel sqlEntryPanel = _session.getSQLPanelAPIOfActiveSessionWindow().getSQLEntryPanel();
doActionPerformed(sqlEntryPanel, evt);
}
}
private void doActionPerformed(ISQLEntryPanel sqlEntryPanel, ActionEvent evt)
{
if(sqlEntryPanel instanceof RSyntaxSQLEntryPanel)
{
SquirrelRSyntaxTextArea rsep = (SquirrelRSyntaxTextArea) sqlEntryPanel.getTextComponent();
rsep.showGoToLineDialog(evt);
}
else
{
String msg = s_stringMgr.getString("syntax.gotolineOnlyOnRecommendedEditors");
JOptionPane.showMessageDialog(_session.getApplication().getMainFrame(), msg);
}
}
public void setSQLPanel(ISQLPanelAPI panel)
{
if(null != panel)
{
_session = panel.getSession();
}
else
{
_session = null;
}
setEnabled(null != _session);
}
}
--- NEW FILE: FindSelectedAction.java ---
package net.sourceforge.squirrel_sql.plugins.syntax;
import net.sourceforge.squirrel_sql.client.IApplication;
import net.sourceforge.squirrel_sql.client.action.SquirrelAction;
import net.sourceforge.squirrel_sql.client.session.ISession;
import net.sourceforge.squirrel_sql.client.session.ISQLEntryPanel;
import net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI;
import net.sourceforge.squirrel_sql.client.session.action.ISQLPanelAction;
import net.sourceforge.squirrel_sql.plugins.syntax.SyntaxPluginResources;
import net.sourceforge.squirrel_sql.plugins.syntax.rsyntax.SquirrelRSyntaxTextArea;
import net.sourceforge.squirrel_sql.plugins.syntax.rsyntax.RSyntaxSQLEntryPanel;
import net.sourceforge.squirrel_sql.plugins.syntax.netbeans.NetbeansSQLEntryPanel;
import net.sourceforge.squirrel_sql.fw.util.StringManager;
import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
import javax.swing.*;
import java.awt.event.ActionEvent;
public class FindSelectedAction extends SquirrelAction implements ISQLPanelAction
{
private static final StringManager s_stringMgr =
StringManagerFactory.getStringManager(FindSelectedAction.class);
private ISession _session;
private ISQLEntryPanel _sqlEntryPanel;
public FindSelectedAction(IApplication app, SyntaxPluginResources rsrc, ISQLEntryPanel sqlEntryPanel)
{
this(app, rsrc);
_sqlEntryPanel = sqlEntryPanel;
}
public FindSelectedAction(IApplication app, SyntaxPluginResources rsrc)
{
super(app, rsrc);
}
public void actionPerformed(ActionEvent evt)
{
if(null != _sqlEntryPanel)
{
doActionPerformed(_sqlEntryPanel, evt);
}
else if(null != _session)
{
ISQLEntryPanel sqlEntryPanel = _session.getSQLPanelAPIOfActiveSessionWindow().getSQLEntryPanel();
doActionPerformed(sqlEntryPanel, evt);
}
}
private void doActionPerformed(ISQLEntryPanel sqlEntryPanel, ActionEvent evt)
{
if(sqlEntryPanel instanceof RSyntaxSQLEntryPanel)
{
SquirrelRSyntaxTextArea rsep = (SquirrelRSyntaxTextArea) sqlEntryPanel.getTextComponent();
rsep.findSelected(evt);
}
else
{
String msg = s_stringMgr.getString("syntax.findSelectedOnlyOnRecommendedEditors");
JOptionPane.showMessageDialog(_session.getApplication().getMainFrame(), msg);
}
}
public void setSQLPanel(ISQLPanelAPI panel)
{
if(null != panel)
{
_session = panel.getSession();
}
else
{
_session = null;
}
setEnabled(null != _session);
}
}
--- NEW FILE: FindAction.java ---
package net.sourceforge.squirrel_sql.plugins.syntax;
import net.sourceforge.squirrel_sql.client.IApplication;
import net.sourceforge.squirrel_sql.client.action.SquirrelAction;
import net.sourceforge.squirrel_sql.client.session.ISession;
import net.sourceforge.squirrel_sql.client.session.ISQLEntryPanel;
import net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI;
import net.sourceforge.squirrel_sql.client.session.action.ISQLPanelAction;
import net.sourceforge.squirrel_sql.plugins.syntax.SyntaxPluginResources;
import net.sourceforge.squirrel_sql.plugins.syntax.rsyntax.SquirrelRSyntaxTextArea;
import net.sourceforge.squirrel_sql.plugins.syntax.rsyntax.RSyntaxSQLEntryPanel;
import net.sourceforge.squirrel_sql.plugins.syntax.netbeans.NetbeansSQLEntryPanel;
import net.sourceforge.squirrel_sql.fw.util.StringManager;
import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
import javax.swing.*;
import java.awt.event.ActionEvent;
public class FindAction extends SquirrelAction implements ISQLPanelAction
{
private static final StringManager s_stringMgr =
StringManagerFactory.getStringManager(FindAction.class);
private ISession _session;
private ISQLEntryPanel _sqlEntryPanel;
public FindAction(IApplication app, SyntaxPluginResources rsrc, ISQLEntryPanel sqlEntryPanel)
{
this(app, rsrc);
_sqlEntryPanel = sqlEntryPanel;
}
public FindAction(IApplication app, SyntaxPluginResources rsrc)
{
super(app, rsrc);
}
public void actionPerformed(ActionEvent evt)
{
if(null != _sqlEntryPanel)
{
doActionPerformed(_sqlEntryPanel, evt);
}
else if(null != _session)
{
ISQLEntryPanel sqlEntryPanel = _session.getSQLPanelAPIOfActiveSessionWindow().getSQLEntryPanel();
doActionPerformed(sqlEntryPanel, evt);
}
}
private void doActionPerformed(ISQLEntryPanel sqlEntryPanel, ActionEvent evt)
{
if(sqlEntryPanel instanceof NetbeansSQLEntryPanel)
{
NetbeansSQLEntryPanel nsep = (NetbeansSQLEntryPanel) sqlEntryPanel;
nsep.showFindDialog(evt);
}
else if(sqlEntryPanel instanceof RSyntaxSQLEntryPanel)
{
SquirrelRSyntaxTextArea rsep = (SquirrelRSyntaxTextArea) sqlEntryPanel.getTextComponent();
rsep.showFindDialog(evt);
}
else
{
String msg = s_stringMgr.getString("syntax.findOnlyOnRecommendedEditors");
JOptionPane.showMessageDialog(_session.getApplication().getMainFrame(), msg);
}
}
public void setSQLPanel(ISQLPanelAPI panel)
{
if(null != panel)
{
_session = panel.getSession();
}
else
{
_session = null;
}
setEnabled(null != _session);
}
}
Index: KeyManager.java
===================================================================
RCS file: /cvsroot/squirrel-sql/sql12/plugins/syntax/src/net/sourceforge/squirrel_sql/plugins/syntax/KeyManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** KeyManager.java 14 Feb 2006 21:35:40 -0000 1.2
--- KeyManager.java 29 Nov 2009 21:17:53 -0000 1.3
***************
*** 2,5 ****
--- 2,6 ----
import javax.swing.*;
+ import javax.swing.text.JTextComponent;
import java.awt.*;
import java.awt.event.ActionEvent;
***************
*** 16,23 ****
public static final char[] STOP_AT = new char[]{'.', '(', ')' , '\'', '\n', ',', '=', '<', '>'};
! private JEditorPane _textPane;
! public KeyManager(JEditorPane textPane)
{
_textPane = textPane;
--- 17,24 ----
public static final char[] STOP_AT = new char[]{'.', '(', ')' , '\'', '\n', ',', '=', '<', '>'};
! private JTextComponent _textPane;
! public KeyManager(JTextComponent textPane)
{
_textPane = textPane;
--- NEW FILE: RepeatLastFindAction.java ---
package net.sourceforge.squirrel_sql.plugins.syntax;
import net.sourceforge.squirrel_sql.client.IApplication;
import net.sourceforge.squirrel_sql.client.action.SquirrelAction;
import net.sourceforge.squirrel_sql.client.session.ISQLEntryPanel;
import net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI;
import net.sourceforge.squirrel_sql.client.session.ISession;
import net.sourceforge.squirrel_sql.client.session.action.ISQLPanelAction;
import net.sourceforge.squirrel_sql.fw.util.StringManager;
import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
import net.sourceforge.squirrel_sql.plugins.syntax.rsyntax.RSyntaxSQLEntryPanel;
import net.sourceforge.squirrel_sql.plugins.syntax.rsyntax.SquirrelRSyntaxTextArea;
import javax.swing.*;
import java.awt.event.ActionEvent;
public class RepeatLastFindAction extends SquirrelAction implements ISQLPanelAction
{
private static final StringManager s_stringMgr =
StringManagerFactory.getStringManager(RepeatLastFindAction.class);
private ISession _session;
private ISQLEntryPanel _sqlEntryPanel;
public RepeatLastFindAction(IApplication app, SyntaxPluginResources rsrc, ISQLEntryPanel sqlEntryPanel)
{
this(app, rsrc);
_sqlEntryPanel = sqlEntryPanel;
}
public RepeatLastFindAction(IApplication app, SyntaxPluginResources rsrc)
{
super(app, rsrc);
}
public void actionPerformed(ActionEvent evt)
{
if(null != _sqlEntryPanel)
{
doActionPerformed(_sqlEntryPanel, evt);
}
else if(null != _session)
{
ISQLEntryPanel sqlEntryPanel = _session.getSQLPanelAPIOfActiveSessionWindow().getSQLEntryPanel();
doActionPerformed(sqlEntryPanel, evt);
}
}
private void doActionPerformed(ISQLEntryPanel sqlEntryPanel, ActionEvent evt)
{
if(sqlEntryPanel instanceof RSyntaxSQLEntryPanel)
{
SquirrelRSyntaxTextArea rsep = (SquirrelRSyntaxTextArea) sqlEntryPanel.getTextComponent();
rsep.repeatLastFind(evt);
}
else
{
String msg = s_stringMgr.getString("syntax.repeatLastfindOnlyOnRecommendedEditors");
JOptionPane.showMessageDialog(_session.getApplication().getMainFrame(), msg);
}
}
public void setSQLPanel(ISQLPanelAPI panel)
{
if(null != panel)
{
_session = panel.getSession();
}
else
{
_session = null;
}
setEnabled(null != _session);
}
}
Index: SyntaxPreferencesPanel.java
===================================================================
RCS file: /cvsroot/squirrel-sql/sql12/plugins/syntax/src/net/sourceforge/squirrel_sql/plugins/syntax/SyntaxPreferencesPanel.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** SyntaxPreferencesPanel.java 5 Jul 2006 04:44:33 -0000 1.7
--- SyntaxPreferencesPanel.java 29 Nov 2009 21:17:53 -0000 1.8
***************
*** 174,177 ****
--- 174,179 ----
// i18n[syntax.prefUseNetbeans=Use Netbeans editor (recommended)]
String NETBEANS = s_stringMgr.getString("syntax.prefUseNetbeans");
+ // i18n[syntax.prefUseNetbeans=Use Netbeans editor (recommended)]
+ String RSYNTAX = s_stringMgr.getString("syntax.prefUseRsyntax");
// i18n[syntax.prefUseOster=Use Ostermiller editor]
String OSTER = s_stringMgr.getString("syntax.prefUseOster");
***************
*** 184,190 ****
--- 186,199 ----
String TEXT_LIMIT_LINE_WIDTH = s_stringMgr.getString("syntax.textLimitLineWidth");
+ // i18n[syntax.highlightCurrentLine=Highlight current line]
+ String HIGHLIGHT_CURRENT_LINE = s_stringMgr.getString("syntax.highlightCurrentLine");
+
+ // i18n[syntax.lineNumbersEnabled=Enable line numbers]
+ String LINE_NUMBERS_ENABLES = s_stringMgr.getString("syntax.lineNumbersEnabled");
+
}
private final JRadioButton _netbeansActiveOpt = new JRadioButton(i18n.NETBEANS);
+ private final JRadioButton _rsyntaxActiveOpt = new JRadioButton(i18n.RSYNTAX);
private final JRadioButton _osterActiveOpt = new JRadioButton(i18n.OSTER);
private final JRadioButton _plainActiveOpt = new JRadioButton(i18n.PLAIN);
***************
*** 192,195 ****
--- 201,206 ----
private final JCheckBox _chkTextLimitLineVisible = new JCheckBox(i18n.TEXT_LIMIT_LINE_VISIBLE);
private final JTextField _txtTextLimitLineWidth = new JTextField();
+ private final JCheckBox _chkHighlightCurrentLine = new JCheckBox(i18n.HIGHLIGHT_CURRENT_LINE);
+ private final JCheckBox _chkLineNumbersEnabled = new JCheckBox(i18n.LINE_NUMBERS_ENABLES);
***************
*** 238,244 ****
--- 249,258 ----
_osterActiveOpt.setSelected(prefs.getUseOsterTextControl());
_netbeansActiveOpt.setSelected(prefs.getUseNetbeansTextControl());
+ _rsyntaxActiveOpt.setSelected(prefs.getUseRSyntaxTextArea());
_plainActiveOpt.setSelected(prefs.getUsePlainTextControl());
_chkTextLimitLineVisible.setSelected(prefs.isTextLimitLineVisible());
+ _chkHighlightCurrentLine.setSelected(prefs.isHighlightCurrentLine());
+ _chkLineNumbersEnabled.setSelected(prefs.isLineNumbersEnabled());
_txtTextLimitLineWidth.setText("" + prefs.getTextLimitLineWidth());
***************
*** 253,256 ****
--- 267,271 ----
void applyChanges(SyntaxPreferences prefs)
{
+ boolean oldUseRSyntaxTextArea = prefs.getUseRSyntaxTextArea();
boolean oldUseNetbeansTextControl = prefs.getUseNetbeansTextControl();
boolean oldUseOsterTextControl = prefs.getUseOsterTextControl();
***************
*** 260,263 ****
--- 275,279 ----
{
prefs.setUseNetbeansTextControl(_netbeansActiveOpt.isSelected());
+ prefs.setUseRSyntaxTextArea(_rsyntaxActiveOpt.isSelected());
prefs.setUseOsterTextControl(_osterActiveOpt.isSelected());
prefs.setUsePlainTextControl(_plainActiveOpt.isSelected());
***************
*** 266,269 ****
--- 282,286 ----
{
prefs.setUseNetbeansTextControl(oldUseNetbeansTextControl);
+ prefs.setUseRSyntaxTextArea(oldUseRSyntaxTextArea);
prefs.setUseOsterTextControl(oldUseOsterTextControl);
prefs.setUsePlainTextControl(oldUsePlainTextControl);
***************
*** 271,274 ****
--- 288,293 ----
prefs.setTextLimitLineVisible(_chkTextLimitLineVisible.isSelected());
+ prefs.setHighlightCurrentLine(_chkHighlightCurrentLine.isSelected());
+ prefs.setLineNumbersEnabled(_chkLineNumbersEnabled.isSelected());
int limit = 80;
***************
*** 312,327 ****
final boolean useOsterControl = _osterActiveOpt.isSelected();
final boolean useNetbeansControl = _netbeansActiveOpt.isSelected();
final boolean usePlainControl = _plainActiveOpt.isSelected();
! _stylesList.setEnabled(useOsterControl || useNetbeansControl);
! _styleMaintPnl.setEnabled(useOsterControl || useNetbeansControl);
! _chkTextLimitLineVisible.setEnabled(useNetbeansControl);
! _txtTextLimitLineWidth.setEnabled(useNetbeansControl);
! if(useNetbeansControl)
{
_txtTextLimitLineWidth.setEnabled(_chkTextLimitLineVisible.isSelected());
}
}
--- 331,350 ----
final boolean useOsterControl = _osterActiveOpt.isSelected();
final boolean useNetbeansControl = _netbeansActiveOpt.isSelected();
+ final boolean useRSyntaxControl = _rsyntaxActiveOpt.isSelected();
final boolean usePlainControl = _plainActiveOpt.isSelected();
! _stylesList.setEnabled(useOsterControl || useNetbeansControl || useRSyntaxControl);
! _styleMaintPnl.setEnabled(useOsterControl || useNetbeansControl || useRSyntaxControl);
! _chkTextLimitLineVisible.setEnabled(useNetbeansControl || useRSyntaxControl);
! _txtTextLimitLineWidth.setEnabled(useNetbeansControl || useRSyntaxControl);
! if(useNetbeansControl || useRSyntaxControl)
{
_txtTextLimitLineWidth.setEnabled(_chkTextLimitLineVisible.isSelected());
}
+
+ _chkHighlightCurrentLine.setEnabled(useRSyntaxControl);
+ _chkLineNumbersEnabled.setEnabled(useRSyntaxControl);
}
***************
*** 333,336 ****
--- 356,360 ----
ButtonGroup bg = new ButtonGroup();
+ bg.add(_rsyntaxActiveOpt);
bg.add(_netbeansActiveOpt);
bg.add(_osterActiveOpt);
***************
*** 353,356 ****
--- 377,388 ----
});
+ _rsyntaxActiveOpt.addChangeListener(new ChangeListener()
+ {
+ public void stateChanged(ChangeEvent evt)
+ {
+ updateControlStatus();
+ }
+ });
+
_plainActiveOpt.addChangeListener(new ChangeListener()
{
***************
*** 369,372 ****
--- 401,421 ----
});
+ _chkHighlightCurrentLine.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ updateControlStatus();
+ }
+ });
+
+ _chkLineNumbersEnabled.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ updateControlStatus();
+ }
+ });
+
+
***************
*** 405,421 ****
gbc = new GridBagConstraints(0,0,1,1,0,0,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5,5,5,5), 0,0);
! pnlRet.add(_netbeansActiveOpt, gbc);
gbc = new GridBagConstraints(0,1,1,1,0,0,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0,5,5,5), 0,0);
! pnlRet.add(_osterActiveOpt, gbc);
gbc = new GridBagConstraints(0,2,1,1,0,0,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0,5,5,5), 0,0);
pnlRet.add(_plainActiveOpt, gbc);
- JPanel pnlLineLimit = new JPanel(new GridBagLayout());
- gbc = new GridBagConstraints(0,3,1,1,0,0,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5,5,5,5), 0,0);
- pnlRet.add(pnlLineLimit, gbc);
gbc = new GridBagConstraints(0,0,1,1,0,0,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,5,5), 0,0);
pnlLineLimit.add(_chkTextLimitLineVisible, gbc);
--- 454,485 ----
gbc = new GridBagConstraints(0,0,1,1,0,0,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5,5,5,5), 0,0);
! pnlRet.add(_rsyntaxActiveOpt, gbc);
gbc = new GridBagConstraints(0,1,1,1,0,0,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0,5,5,5), 0,0);
! pnlRet.add(_netbeansActiveOpt, gbc);
gbc = new GridBagConstraints(0,2,1,1,0,0,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0,5,5,5), 0,0);
+ pnlRet.add(_osterActiveOpt, gbc);
+
+ gbc = new GridBagConstraints(0,3,1,1,0,0,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0,5,5,5), 0,0);
pnlRet.add(_plainActiveOpt, gbc);
+ gbc = new GridBagConstraints(0,4,1,1,0,0,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(40,5,0,5), 0,0);
+ pnlRet.add(createPnlLineLimit(), gbc);
+
+ gbc = new GridBagConstraints(0,5,1,1,0,0,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5,5,5,5), 0,0);
+ pnlRet.add(_chkHighlightCurrentLine, gbc);
+
+ gbc = new GridBagConstraints(0,6,1,1,0,0,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5,5,5,5), 0,0);
+ pnlRet.add(_chkLineNumbersEnabled, gbc);
+ return pnlRet;
+ }
+
+ private JPanel createPnlLineLimit()
+ {
+ GridBagConstraints gbc;
+ JPanel pnlLineLimit = new JPanel(new GridBagLayout());
gbc = new GridBagConstraints(0,0,1,1,0,0,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,5,5), 0,0);
pnlLineLimit.add(_chkTextLimitLineVisible, gbc);
***************
*** 427,432 ****
gbc = new GridBagConstraints(2,0,1,1,0,0,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,5,5), 0,0);
pnlLineLimit.add(_txtTextLimitLineWidth, gbc);
!
! return pnlRet;
}
--- 491,495 ----
gbc = new GridBagConstraints(2,0,1,1,0,0,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,5,5), 0,0);
pnlLineLimit.add(_txtTextLimitLineWidth, gbc);
! return pnlLineLimit;
}
--- NEW FILE: ReplaceAction.java ---
package net.sourceforge.squirrel_sql.plugins.syntax;
import net.sourceforge.squirrel_sql.client.IApplication;
import net.sourceforge.squirrel_sql.client.action.SquirrelAction;
import net.sourceforge.squirrel_sql.client.session.ISession;
import net.sourceforge.squirrel_sql.client.session.ISQLEntryPanel;
import net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI;
import net.sourceforge.squirrel_sql.client.session.action.ISQLPanelAction;
import net.sourceforge.squirrel_sql.plugins.syntax.SyntaxPluginResources;
import net.sourceforge.squirrel_sql.plugins.syntax.rsyntax.RSyntaxSQLEntryPanel;
import net.sourceforge.squirrel_sql.plugins.syntax.rsyntax.SquirrelRSyntaxTextArea;
import net.sourceforge.squirrel_sql.plugins.syntax.netbeans.NetbeansSQLEntryPanel;
import net.sourceforge.squirrel_sql.fw.util.StringManager;
import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
import javax.swing.*;
import java.awt.event.ActionEvent;
public class ReplaceAction extends SquirrelAction implements ISQLPanelAction
{
private static final StringManager s_stringMgr =
StringManagerFactory.getStringManager(ReplaceAction.class);
private ISession _session;
private ISQLEntryPanel _isqlEntryPanel;
public ReplaceAction(IApplication app, SyntaxPluginResources rsrc)
throws IllegalArgumentException
{
super(app, rsrc);
}
public ReplaceAction(IApplication app, SyntaxPluginResources rsrc, ISQLEntryPanel isqlEntryPanel)
{
this(app, rsrc);
_isqlEntryPanel = isqlEntryPanel;
}
public void actionPerformed(ActionEvent evt)
{
if(null != _isqlEntryPanel)
{
doActionPerformed(_isqlEntryPanel, evt);
}
if(null != _session)
{
ISQLEntryPanel sqlEntryPanel = _session.getSQLPanelAPIOfActiveSessionWindow().getSQLEntryPanel();
doActionPerformed(sqlEntryPanel, evt);
}
}
private void doActionPerformed(ISQLEntryPanel sqlEntryPanel, ActionEvent evt)
{
if(sqlEntryPanel instanceof NetbeansSQLEntryPanel)
{
NetbeansSQLEntryPanel nsep = (NetbeansSQLEntryPanel) sqlEntryPanel;
nsep.showReplaceDialog(evt);
}
else if(sqlEntryPanel instanceof RSyntaxSQLEntryPanel)
{
SquirrelRSyntaxTextArea rsep = (SquirrelRSyntaxTextArea) sqlEntryPanel.getTextComponent();
rsep.showReplaceDialog(evt);
}
else
{
String msg = s_stringMgr.getString("syntax.replaceOnlyOnRecommendedEditors");
JOptionPane.showMessageDialog(_session.getApplication().getMainFrame(), msg);
}
}
public void setSQLPanel(ISQLPanelAPI panel)
{
if(null != panel)
{
_session = panel.getSession();
}
else
{
_session = null;
}
setEnabled(null != _session);
}
}
Index: SyntaxPreferences.java
===================================================================
RCS file: /cvsroot/squirrel-sql/sql12/plugins/syntax/src/net/sourceforge/squirrel_sql/plugins/syntax/SyntaxPreferences.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** SyntaxPreferences.java 11 Aug 2007 17:22:51 -0000 1.7
--- SyntaxPreferences.java 29 Nov 2009 21:17:53 -0000 1.8
***************
*** 34,38 ****
! public interface IPropertyNames {
// String BLINK_CARET = "blinkCaret";
// String BLOCK_CARET_ENABLED = "blockCaretEnabled";
--- 34,38 ----
! public interface IPropertyNames {
// String BLINK_CARET = "blinkCaret";
// String BLOCK_CARET_ENABLED = "blockCaretEnabled";
***************
*** 60,68 ****
String USE_OSTER_CONTROL = "useOsterControl";
String USE_NETBEANS_CONTROL = "useNetbeansControl";
String USE_PLAIN_CONTROL = "usePlainControl";
String WHITE_SPACE_STYLE = "whiteSpaceStyle";
String TEXT_LIMIT_LINE_VISIBLE = "textLimitLineVisible";
String TEXT_LIMIT_LINE_WIDTH = "textLimitLineWidth";
! }
/** Object to handle property change events. */
--- 60,71 ----
String USE_OSTER_CONTROL = "useOsterControl";
String USE_NETBEANS_CONTROL = "useNetbeansControl";
+ String USE_RSYNTAX_CONTROL = "useRSyntaxControl";
String USE_PLAIN_CONTROL = "usePlainControl";
String WHITE_SPACE_STYLE = "whiteSpaceStyle";
String TEXT_LIMIT_LINE_VISIBLE = "textLimitLineVisible";
String TEXT_LIMIT_LINE_WIDTH = "textLimitLineWidth";
! String HIGHLIGHT_CURRENT_LINE = "highlightCurrentLine";
! String LINE_NUMBERS_ENABLED = "lineNumbersEnabled";
! }
/** Object to handle property change events. */
***************
*** 71,76 ****
/** If <TT>true</TT> use the Oster text control else use the standard Java control. */
private boolean _useOsterTextControl = false;
! private boolean _useNetbeansTextControl = true;
private boolean _usePlainTextControl = false;
/** If <TT>true</TT> use the block caret. */
--- 74,80 ----
/** If <TT>true</TT> use the Oster text control else use the standard Java control. */
private boolean _useOsterTextControl = false;
! private boolean _useNetbeansTextControl = false;
private boolean _usePlainTextControl = false;
+ private boolean _useRSyntaxTextArea = true;
/** If <TT>true</TT> use the block caret. */
***************
*** 115,118 ****
--- 119,125 ----
private int _textLimitLineWidth = 80;
+ private boolean _highlightCurrentLine = true;
+
+ private boolean _lineNumbersEnabled = false;
***************
*** 260,263 ****
--- 267,285 ----
}
+
+ public boolean getUseRSyntaxTextArea()
+ {
+ return _useRSyntaxTextArea;
+ }
+
+ public void setUseRSyntaxTextArea(boolean data)
+ {
+ if (_useRSyntaxTextArea != data)
+ {
+ getPropertyChangeReporter().firePropertyChange(IPropertyNames.USE_RSYNTAX_CONTROL, _useRSyntaxTextArea, data);
+ _useRSyntaxTextArea = data;
+ }
+ }
+
public boolean getUsePlainTextControl()
{
***************
*** 275,374 ****
- // public boolean getBracketHighlighting()
- // {
- // return _bracketHighlighting;
- // }
- //
- // public void setBracketHighlighting(boolean data)
- // {
- // if (_bracketHighlighting != data)
- // {
- // final boolean oldValue = _bracketHighlighting;
- // _bracketHighlighting = data;
- // getPropertyChangeReporter().firePropertyChange(IPropertyNames.BRACKET_HIGHLIGHTING,
- // oldValue, _bracketHighlighting);
- // }
- // }
- //
- // public boolean isBlockCaretEnabled()
- // {
- // return _blockCaretEnabled;
- // }
- //
- // public void setBlockCaretEnabled(boolean data)
- // {
- // if (_blockCaretEnabled != data)
- // {
- // final boolean oldValue = _blockCaretEnabled;
- // _blockCaretEnabled = data;
- // getPropertyChangeReporter().firePropertyChange(IPropertyNames.BLOCK_CARET_ENABLED,
- // oldValue, _blockCaretEnabled);
- // }
- // }
- //
- // public boolean getEOLMarkers()
- // {
- // return _showEndOfLineMarkers;
- // }
- //
- // public void setEOLMarkers(boolean data)
- // {
- // if (_showEndOfLineMarkers != data)
- // {
- // final boolean oldValue = _showEndOfLineMarkers;
- // _showEndOfLineMarkers = data;
- // getPropertyChangeReporter().firePropertyChange(IPropertyNames.EOL_MARKERS,
- // oldValue, _showEndOfLineMarkers);
- // }
- // }
- //
- // public boolean getCurrentLineHighlighting()
- // {
- // return _currentLineHighlighting;
- // }
- //
- // public void setCurrentLineHighlighting(boolean data)
- // {
- // if (_currentLineHighlighting != data)
- // {
- // final boolean oldValue = _currentLineHighlighting;
- // _currentLineHighlighting = data;
- // getPropertyChangeReporter().firePropertyChange(IPropertyNames.CURRENT_LINE_HIGHLIGHTING,
- // oldValue, _currentLineHighlighting);
- // }
- // }
- //
- // public boolean getBlinkCaret()
- // {
- // return _blinkCaret;
- // }
- //
- // public void setBlinkCaret(boolean data)
- // {
- // if (_blinkCaret != data)
- // {
- // final boolean oldValue = _blinkCaret;
- // _blinkCaret = data;
- // getPropertyChangeReporter().firePropertyChange(IPropertyNames.BLINK_CARET,
- // oldValue, _blinkCaret);
- // }
- // }
- //
- // public boolean getShowLineNumbers()
- // {
- // return _showLineNumbers;
- // }
- //
- // public void setShowLineNumbers(boolean data)
- // {
- // if (_showLineNumbers != data)
- // {
- // final boolean oldValue = _showLineNumbers;
- // _showLineNumbers = data;
- // getPropertyChangeReporter().firePropertyChange(IPropertyNames.SHOW_LINE_NBRS,
- // oldValue, _showLineNumbers);
- // }
- // }
-
public boolean isTextLimitLineVisible()
{
--- 297,300 ----
***************
*** 405,408 ****
--- 331,370 ----
+ public boolean isHighlightCurrentLine()
+ {
+ return _highlightCurrentLine;
+ }
+
+
+ public void setHighlightCurrentLine(boolean data)
+ {
+ if (_highlightCurrentLine != data)
+ {
+ final Boolean oldValue = Boolean.valueOf(_highlightCurrentLine);
+ _highlightCurrentLine = data;
+ getPropertyChangeReporter().firePropertyChange(IPropertyNames.HIGHLIGHT_CURRENT_LINE,
+ oldValue, Boolean.valueOf(_highlightCurrentLine));
+ }
+
+ }
+
+ public boolean isLineNumbersEnabled()
+ {
+ return _lineNumbersEnabled;
+ }
+
+ public void setLineNumbersEnabled(boolean data)
+ {
+ if (_lineNumbersEnabled != data)
+ {
+ final Boolean oldValue = Boolean.valueOf(_lineNumbersEnabled);
+ _lineNumbersEnabled = data;
+ getPropertyChangeReporter().firePropertyChange(IPropertyNames.LINE_NUMBERS_ENABLED,
+ oldValue, Boolean.valueOf(_lineNumbersEnabled));
+ }
+
+ }
+
+
public SyntaxStyle getCommentStyle()
{
Index: SyntaxPluginResources.properties
===================================================================
RCS file: /cvsroot/squirrel-sql/sql12/plugins/syntax/src/net/sourceforge/squirrel_sql/plugins/syntax/SyntaxPluginResources.properties,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** SyntaxPluginResources.properties 10 Oct 2005 05:51:38 -0000 1.8
--- SyntaxPluginResources.properties 29 Nov 2009 21:17:53 -0000 1.9
***************
*** 22,32 ****
! action.net.sourceforge.squirrel_sql.plugins.syntax.netbeans.FindAction.image=find.gif
! action.net.sourceforge.squirrel_sql.plugins.syntax.netbeans.FindAction.name=Find ...
! action.net.sourceforge.squirrel_sql.plugins.syntax.netbeans.FindAction.tooltip=Find
! action.net.sourceforge.squirrel_sql.plugins.syntax.netbeans.ReplaceAction.image=replace.gif
! action.net.sourceforge.squirrel_sql.plugins.syntax.netbeans.ReplaceAction.name=Replace ...
! action.net.sourceforge.squirrel_sql.plugins.syntax.netbeans.ReplaceAction.tooltip=Replace
action.net.sourceforge.squirrel_sql.plugins.syntax.DuplicateLineAction.image=
--- 22,53 ----
! action.net.sourceforge.squirrel_sql.plugins.syntax.FindAction.image=find.gif
! action.net.sourceforge.squirrel_sql.plugins.syntax.FindAction.name=Find ...
! action.net.sourceforge.squirrel_sql.plugins.syntax.FindAction.tooltip=Find
! action.net.sourceforge.squirrel_sql.plugins.syntax.FindSelectedAction.image=
! action.net.sourceforge.squirrel_sql.plugins.syntax.FindSelectedAction.name=Find selected
! action.net.sourceforge.squirrel_sql.plugins.syntax.FindSelectedAction.tooltip=Find selected
!
! action.net.sourceforge.squirrel_sql.plugins.syntax.RepeatLastFindAction.image=
! action.net.sourceforge.squirrel_sql.plugins.syntax.RepeatLastFindAction.name=Repeat last find
! action.net.sourceforge.squirrel_sql.plugins.syntax.RepeatLastFindAction.tooltip=Repeat last find
!
! action.net.sourceforge.squirrel_sql.plugins.syntax.GoToLineAction.image=
! action.net.sourceforge.squirrel_sql.plugins.syntax.GoToLineAction.name=Go to line ...
! action.net.sourceforge.squirrel_sql.plugins.syntax.GoToLineAction.tooltip=Go to line
!
! action.net.sourceforge.squirrel_sql.plugins.syntax.MarkSelectedAction.image=
! action.net.sourceforge.squirrel_sql.plugins.syntax.MarkSelectedAction.name=Mark selected
! action.net.sourceforge.squirrel_sql.plugins.syntax.MarkSelectedAction.tooltip=Mark selected
!
! action.net.sourceforge.squirrel_sql.plugins.syntax.UnmarkAction.image=
! action.net.sourceforge.squirrel_sql.plugins.syntax.UnmarkAction.name=Unmark all
! action.net.sourceforge.squirrel_sql.plugins.syntax.UnmarkAction.tooltip=Unmark all
!
!
! action.net.sourceforge.squirrel_sql.plugins.syntax.ReplaceAction.image=replace.gif
! action.net.sourceforge.squirrel_sql.plugins.syntax.ReplaceAction.name=Replace ...
! action.net.sourceforge.squirrel_sql.plugins.syntax.ReplaceAction.tooltip=Replace
action.net.sourceforge.squirrel_sql.plugins.syntax.DuplicateLineAction.image=
***************
*** 59,67 ****
menuitem.net.sourceforge.squirrel_sql.plugins.syntax.ConfigureAutoCorrectAction.mnemonic=C
! menuitem.net.sourceforge.squirrel_sql.plugins.syntax.netbeans.FindAction.accelerator=control F
! menuitem.net.sourceforge.squirrel_sql.plugins.syntax.netbeans.FindAction.mnemonic=
! menuitem.net.sourceforge.squirrel_sql.plugins.syntax.netbeans.ReplaceAction.accelerator=control H
! menuitem.net.sourceforge.squirrel_sql.plugins.syntax.netbeans.ReplaceAction.mnemonic=
menuitem.net.sourceforge.squirrel_sql.plugins.syntax.DuplicateLineAction.accelerator=control D
--- 80,103 ----
menuitem.net.sourceforge.squirrel_sql.plugins.syntax.ConfigureAutoCorrectAction.mnemonic=C
! menuitem.net.sourceforge.squirrel_sql.plugins.syntax.FindAction.accelerator=control F
! menuitem.net.sourceforge.squirrel_sql.plugins.syntax.FindAction.mnemonic=
! menuitem.net.sourceforge.squirrel_sql.plugins.syntax.FindSelectedAction.accelerator=shift F3
! menuitem.net.sourceforge.squirrel_sql.plugins.syntax.FindSelectedAction.mnemonic=
!
! menuitem.net.sourceforge.squirrel_sql.plugins.syntax.RepeatLastFindAction.accelerator=F3
! menuitem.net.sourceforge.squirrel_sql.plugins.syntax.RepeatLastFindAction.mnemonic=
!
! menuitem.net.sourceforge.squirrel_sql.plugins.syntax.GoToLineAction.accelerator=control G
! menuitem.net.sourceforge.squirrel_sql.plugins.syntax.GoToLineAction.mnemonic=
!
! menuitem.net.sourceforge.squirrel_sql.plugins.syntax.MarkSelectedAction.accelerator=control shift F3
! menuitem.net.sourceforge.squirrel_sql.plugins.syntax.MarkSelectedAction.mnemonic=
!
! menuitem.net.sourceforge.squirrel_sql.plugins.syntax.UnmarkAction.accelerator=ESCAPE
! menuitem.net.sourceforge.squirrel_sql.plugins.syntax.UnmarkAction.mnemonic=
!
! menuitem.net.sourceforge.squirrel_sql.plugins.syntax.ReplaceAction.accelerator=control H
! menuitem.net.sourceforge.squirrel_sql.plugins.syntax.ReplaceAction.mnemonic=
menuitem.net.sourceforge.squirrel_sql.plugins.syntax.DuplicateLineAction.accelerator=control D
--- NEW FILE: MarkSelectedAction.java ---
package net.sourceforge.squirrel_sql.plugins.syntax;
import net.sourceforge.squirrel_sql.client.IApplication;
import net.sourceforge.squirrel_sql.client.action.SquirrelAction;
import net.sourceforge.squirrel_sql.client.session.ISession;
import net.sourceforge.squirrel_sql.client.session.ISQLEntryPanel;
import net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI;
import net.sourceforge.squirrel_sql.client.session.action.ISQLPanelAction;
import net.sourceforge.squirrel_sql.plugins.syntax.SyntaxPluginResources;
import net.sourceforge.squirrel_sql.plugins.syntax.rsyntax.SquirrelRSyntaxTextArea;
import net.sourceforge.squirrel_sql.plugins.syntax.rsyntax.RSyntaxSQLEntryPanel;
import net.sourceforge.squirrel_sql.plugins.syntax.netbeans.NetbeansSQLEntryPanel;
import net.sourceforge.squirrel_sql.fw.util.StringManager;
import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
import javax.swing.*;
import java.awt.event.ActionEvent;
public class MarkSelectedAction extends SquirrelAction implements ISQLPanelAction
{
private static final StringManager s_stringMgr =
StringManagerFactory.getStringManager(MarkSelectedAction.class);
private ISession _session;
private ISQLEntryPanel _sqlEntryPanel;
public MarkSelectedAction(IApplication app, SyntaxPluginResources rsrc, ISQLEntryPanel sqlEntryPanel)
{
this(app, rsrc);
_sqlEntryPanel = sqlEntryPanel;
}
public MarkSelectedAction(IApplication app, SyntaxPluginResources rsrc)
{
super(app, rsrc);
}
public void actionPerformed(ActionEvent evt)
{
if(null != _sqlEntryPanel)
{
doActionPerformed(_sqlEntryPanel, evt);
}
else if(null != _session)
{
ISQLEntryPanel sqlEntryPanel = _session.getSQLPanelAPIOfActiveSessionWindow().getSQLEntryPanel();
doActionPerformed(sqlEntryPanel, evt);
}
}
private void doActionPerformed(ISQLEntryPanel sqlEntryPanel, ActionEvent evt)
{
if(sqlEntryPanel instanceof RSyntaxSQLEntryPanel)
{
SquirrelRSyntaxTextArea rsep = (SquirrelRSyntaxTextArea) sqlEntryPanel.getTextComponent();
rsep.markSelected(evt);
}
else
{
String msg = s_stringMgr.getString("syntax.markSelectedOnlyOnRecommendedEditors");
JOptionPane.showMessageDialog(_session.getApplication().getMainFrame(), msg);
}
}
public void setSQLPanel(ISQLPanelAPI panel)
{
if(null != panel)
{
_session = panel.getSession();
}
else
{
_session = null;
}
setEnabled(null != _session);
}
}
Index: I18NStrings.properties
===================================================================
RCS file: /cvsroot/squirrel-sql/sql12/plugins/syntax/src/net/sourceforge/squirrel_sql/plugins/syntax/I18NStrings.properties,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** I18NStrings.properties 4 Dec 2006 21:36:09 -0000 1.4
--- I18NStrings.properties 29 Nov 2009 21:17:53 -0000 1.5
***************
*** 4,18 ****
SyntaxPlugin.duplicateline=duplicateline
SyntaxPlugin.find=find
SyntaxPlugin.replace=replace
SyntaxPlugin.tolowercase=tolowercase
SyntaxPlugin.touppercase=touppercase
SyntaxPlugin.uncomment=uncomment
syntax.prefSyntax=Syntax
syntax.prefSyntaxHint=Syntax Highlighting
! syntax.prefUseNetbeans=Use Netbeans editor (recommended)
syntax.prefUseOster=Use Ostermiller editor
syntax.prefUsePlain=Use plain editor
! syntax.osterExplain=Note: The preferable editor is the Netbeans editor. The Netbeans editor\n- is less memory consuming,\n- its highlightning is more...
[truncated message content] |