Update of /cvsroot/squirrel-sql/sql12/app/src/net/sourceforge/squirrel_sql/client/session/action
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv1806/app/src/net/sourceforge/squirrel_sql/client/session/action
Modified Files:
UndoAction.java ViewObjectAtCursorInObjectTreeAction.java
RedoAction.java
Log Message:
RSyntax editor integration
Index: RedoAction.java
===================================================================
RCS file: /cvsroot/squirrel-sql/sql12/app/src/net/sourceforge/squirrel_sql/client/session/action/RedoAction.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** RedoAction.java 5 Mar 2003 10:27:53 -0000 1.3
--- RedoAction.java 29 Nov 2009 21:17:54 -0000 1.4
***************
*** 1,45 ****
! package net.sourceforge.squirrel_sql.client.session.action;
! /*
! * Copyright (C) 2002-2003 Johan Compagner
! * jco...@j-...
! *
! * This library is free software; you can redistribute it and/or
! * modify it under the terms of the GNU Lesser General Public
! * License as published by the Free Software Foundation; either
! * version 2.1 of the License, or (at your option) any later version.
! *
! * This library 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
! * Lesser General Public License for more details.
! *
! * You should have received a copy of the GNU Lesser General Public
! * License along with this library; if not, write to the Free Software
! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
! */
! import java.awt.event.ActionEvent;
!
! import javax.swing.undo.UndoManager;
!
! import net.sourceforge.squirrel_sql.client.IApplication;
! import net.sourceforge.squirrel_sql.client.action.SquirrelAction;
!
! public class RedoAction extends SquirrelAction
! {
! private UndoManager _undo;
!
! public RedoAction(IApplication app, UndoManager undo)
! {
! super(app);
! if(undo == null) throw new IllegalArgumentException("UndoManager == null");
! _undo = undo;
! }
! /*
! * @see ActionListener#actionPerformed(ActionEvent)
! */
! public void actionPerformed(ActionEvent e)
! {
! if(_undo.canRedo()) _undo.redo();
! }
!
! }
--- 1,61 ----
! package net.sourceforge.squirrel_sql.client.session.action;
! /*
! * Copyright (C) 2002-2003 Johan Compagner
! * jco...@j-...
! *
! * This library is free software; you can redistribute it and/or
! * modify it under the terms of the GNU Lesser General Public
! * License as published by the Free Software Foundation; either
! * version 2.1 of the License, or (at your option) any later version.
! *
! * This library 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
! * Lesser General Public License for more details.
! *
! * You should have received a copy of the GNU Lesser General Public
! * License along with this library; if not, write to the Free Software
! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
! */
! import java.awt.event.ActionEvent;
!
! import javax.swing.undo.UndoManager;
! import javax.swing.*;
!
! import net.sourceforge.squirrel_sql.client.IApplication;
! import net.sourceforge.squirrel_sql.client.action.SquirrelAction;
!
! public class RedoAction extends SquirrelAction
! {
! private UndoManager _undo;
! private Action _delegate;
!
! public RedoAction(IApplication app, UndoManager undo)
! {
! super(app);
! if(undo == null) throw new IllegalArgumentException("UndoManager == null");
! _undo = undo;
! }
!
! public RedoAction(IApplication app, Action delegate)
! {
! super(app);
! _delegate = delegate;
! }
!
! /*
! * @see ActionListener#actionPerformed(ActionEvent)
! */
! public void actionPerformed(ActionEvent e)
! {
! if (null == _delegate)
! {
! if(_undo.canRedo()) _undo.redo();
! }
! else
! {
! _delegate.actionPerformed(e);
! }
! }
!
! }
Index: ViewObjectAtCursorInObjectTreeAction.java
===================================================================
RCS file: /cvsroot/squirrel-sql/sql12/app/src/net/sourceforge/squirrel_sql/client/session/action/ViewObjectAtCursorInObjectTreeAction.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** ViewObjectAtCursorInObjectTreeAction.java 27 Dec 2008 19:20:53 -0000 1.8
--- ViewObjectAtCursorInObjectTreeAction.java 29 Nov 2009 21:17:54 -0000 1.9
***************
*** 8,11 ****
--- 8,13 ----
import net.sourceforge.squirrel_sql.client.session.ObjectTreeSearch;
+ import javax.swing.text.JTextComponent;
+
public class ViewObjectAtCursorInObjectTreeAction extends SquirrelAction
***************
*** 47,87 ****
}
! String stringAtCursor = getStringAtCursor();
new ObjectTreeSearch().viewObjectInObjectTree(stringAtCursor, _panel.getSession());
}
-
- private String getStringAtCursor()
- {
- String text = _panel.getSQLEntryPanel().getText();
- int caretPos = _panel.getSQLEntryPanel().getCaretPosition();
-
- int lastIndexOfText = Math.max(0,text.length()-1);
- int beginPos = Math.min(caretPos, lastIndexOfText); // The Math.min is for the Caret at the end of the text
- while(0 < beginPos && false == isParseStop(text.charAt(beginPos), false))
- {
- --beginPos;
- }
-
- int endPos = caretPos;
- while(endPos < text.length() && false == isParseStop(text.charAt(endPos), true))
- {
- ++endPos;
- }
-
- return text.substring(beginPos, endPos).trim();
-
-
- }
-
- private boolean isParseStop(char c, boolean treatDotAsStop)
- {
- return
- '(' == c ||
- ')' == c ||
- '\'' == c ||
- Character.isWhitespace(c) ||
- (treatDotAsStop && '.' == c);
-
- }
}
--- 49,55 ----
}
! String stringAtCursor = _panel.getSQLEntryPanel().getWordAtCursor();
new ObjectTreeSearch().viewObjectInObjectTree(stringAtCursor, _panel.getSession());
}
}
Index: UndoAction.java
===================================================================
RCS file: /cvsroot/squirrel-sql/sql12/app/src/net/sourceforge/squirrel_sql/client/session/action/UndoAction.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** UndoAction.java 5 Mar 2003 10:27:53 -0000 1.3
--- UndoAction.java 29 Nov 2009 21:17:54 -0000 1.4
***************
*** 1,49 ****
! package net.sourceforge.squirrel_sql.client.session.action;
! /*
! * Copyright (C) 2001-2003 Johan Compagner
! *
! * This library is free software; you can redistribute it and/or
! * modify it under the terms of the GNU Lesser General Public
! * License as published by the Free Software Foundation; either
! * version 2.1 of the License, or (at your option) any later version.
! *
! * This library 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
! * Lesser General Public License for more details.
! *
! * You should have received a copy of the GNU Lesser General Public
! * License along with this library; if not, write to the Free Software
! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
! */
! import java.awt.event.ActionEvent;
!
! import javax.swing.undo.UndoManager;
!
! import net.sourceforge.squirrel_sql.client.IApplication;
! import net.sourceforge.squirrel_sql.client.action.SquirrelAction;
!
! public class UndoAction extends SquirrelAction
! {
! private UndoManager _undo;
!
! public UndoAction(IApplication app, UndoManager undo)
! {
! super(app);
! if (undo == null)
! {
! throw new IllegalArgumentException("UndoManager == null");
! }
! _undo = undo;
! }
! /*
! * @see ActionListener#actionPerformed(ActionEvent)
! */
! public void actionPerformed(ActionEvent e)
! {
! if (_undo.canUndo())
! {
! _undo.undo();
! }
! }
! }
--- 1,66 ----
! package net.sourceforge.squirrel_sql.client.session.action;
! /*
! * Copyright (C) 2001-2003 Johan Compagner
! *
! * This library is free software; you can redistribute it and/or
! * modify it under the terms of the GNU Lesser General Public
! * License as published by the Free Software Foundation; either
! * version 2.1 of the License, or (at your option) any later version.
! *
! * This library 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
! * Lesser General Public License for more details.
! *
! * You should have received a copy of the GNU Lesser General Public
! * License along with this library; if not, write to the Free Software
! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
! */
! import java.awt.event.ActionEvent;
!
! import javax.swing.undo.UndoManager;
! import javax.swing.*;
!
! import net.sourceforge.squirrel_sql.client.IApplication;
! import net.sourceforge.squirrel_sql.client.action.SquirrelAction;
!
! public class UndoAction extends SquirrelAction
! {
! private UndoManager _undo;
! private Action _delegate;
!
! public UndoAction(IApplication app, UndoManager undo)
! {
! super(app);
! if (undo == null)
! {
! throw new IllegalArgumentException("UndoManager == null");
! }
! _undo = undo;
! }
!
! public UndoAction(IApplication app, Action delegate)
! {
! super(app);
! _delegate = delegate;
! }
!
!
! /*
! * @see ActionListener#actionPerformed(ActionEvent)
! */
! public void actionPerformed(ActionEvent e)
! {
! if (null == _delegate)
! {
! if (_undo.canUndo())
! {
! _undo.undo();
! }
! }
! else
! {
! _delegate.actionPerformed(e);
! }
! }
! }
|