|
From: <bl...@us...> - 2003-05-16 19:55:04
|
Update of /cvsroot/cpptool/rfta/src/eclipseplugin/CppBridge
In directory sc8-pr-cvs1:/tmp/cvs-serv32133/src/eclipseplugin/CppBridge
Modified Files:
EclipseDocumentHelper.cpp EclipseDocumentHelper.h
Log Message:
* Made the interface of TextDocument simpler. It now has only 3 methods: getAllText(), getTextRange() and replaceTextRange().
Index: EclipseDocumentHelper.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/eclipseplugin/CppBridge/EclipseDocumentHelper.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** EclipseDocumentHelper.cpp 15 Feb 2003 13:32:03 -0000 1.1
--- EclipseDocumentHelper.cpp 16 May 2003 19:55:01 -0000 1.2
***************
*** 55,63 ****
}
! /*! Gets the selected text.
! * \return Selected text. EOL are in the original text format.
! */
! const std::string EclipseDocumentHelper::getSelection() const
! {
// call the java class method:
jstring jres = (jstring)env->CallObjectMethod(targetDocument, mid_getSelection );
--- 55,64 ----
}
!
! std::string
! EclipseDocumentHelper::getTextRange( const Refactoring::SourceRange &range )
! {
! setSelectionRange( range );
!
// call the java class method:
jstring jres = (jstring)env->CallObjectMethod(targetDocument, mid_getSelection );
***************
*** 73,83 ****
}
! /*! Replace current selection text with the specified text.
! * \param text The selection is replaced with that text. If no
! * text is selected, then the specified text is
! * inserted at the selection location.
! */
! void EclipseDocumentHelper::replaceSelection( const std::string &text )
{
jstring par = env->NewStringUTF(text.c_str());
env->CallVoidMethod(targetDocument, mid_replaceSelection , par );
--- 74,84 ----
}
!
! void
! EclipseDocumentHelper::replaceTextRange( const Refactoring::SourceRange &range,
! const std::string &text )
{
+ setSelectionRange( range );
+
jstring par = env->NewStringUTF(text.c_str());
env->CallVoidMethod(targetDocument, mid_replaceSelection , par );
***************
*** 121,137 ****
env->ExceptionClear();
}
- }
-
-
- /*! Move to a specific location.
- * Set the selection to an empty selection at the specified location.
- * Equivalent to selectText( to, to ).
- * \param toLocation Location the next setSelectedText() operation will insert
- * text at.
- */
- void EclipseDocumentHelper::moveTo( int toLocation )
- {
- jint to=toLocation;
- // call the java class method:
- env->CallVoidMethod(targetDocument, mid_moveTo, to );
}
--- 122,124 ----
Index: EclipseDocumentHelper.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/eclipseplugin/CppBridge/EclipseDocumentHelper.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** EclipseDocumentHelper.h 15 Feb 2003 13:32:03 -0000 1.1
--- EclipseDocumentHelper.h 16 May 2003 19:55:01 -0000 1.2
***************
*** 35,61 ****
EclipseDocumentHelper(JNIEnv * _env, jobject _targetDocument);
/*! Gets the text of the document.
* \return Text of the document. EOL are in the original text format.
* \warning Discard current selection.
*/
! virtual const std::string getAllText() const;
! /*! Gets the selected text.
! * \return Selected text. EOL are in the original text format.
*/
! virtual const std::string getSelection() const;
! /*! Replace current selection text with the specified text.
! * \param text The selection is replaced with that text. If no
! * text is selected, then the specified text is
! * inserted at the selection location.
*/
! virtual void replaceSelection( const std::string &text );
! /*! Gets the selected range.
! * \return The location range of the selection.
! * \warning Discard current selection.
! */
! virtual Refactoring::SourceRange getSelectionRange() const;
/*! Select a specified range of text.
--- 35,69 ----
EclipseDocumentHelper(JNIEnv * _env, jobject _targetDocument);
+ /*! Gets the selected range.
+ * \return The location range of the selection.
+ * \warning Discard current selection.
+ */
+ Refactoring::SourceRange getSelectionRange() const;
+
+
+ // overridden from Refactoring::TextDocument
+
/*! Gets the text of the document.
* \return Text of the document. EOL are in the original text format.
* \warning Discard current selection.
*/
! const std::string getAllText() const;
! /*! Gets the text of the specified text range.
! * \param range Range of text to return.
! * \return Text of the specified text range.
*/
! std::string getTextRange( const Refactoring::SourceRange &range );
! /*! Replaces the text of a given text range with the specified text.
! * \param range Range of text to replace. Length may be null is text
! * is being inserted.
! * \param text Text that replace the specified range. May be empty if
! * the text range is being deleted.
*/
! void replaceTextRange( const Refactoring::SourceRange &range,
! const std::string &text );
! private:
/*! Select a specified range of text.
***************
*** 64,76 ****
* \param to Location the selection ends (not included).
*/
! virtual void setSelectionRange( const Refactoring::SourceRange &selection );
!
! /*! Move to a specific location.
! * Set the selection to an empty selection at the specified location.
! * Equivalent to selectText( to, to ).
! * \param toLocation Location the next setSelectedText() operation will insert
! * text at.
! */
! void moveTo( int toLocation );
};
--- 72,76 ----
* \param to Location the selection ends (not included).
*/
! void setSelectionRange( const Refactoring::SourceRange &selection );
};
|