You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(37) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(15) |
Feb
(26) |
Mar
(97) |
Apr
(224) |
May
(226) |
Jun
|
Jul
(3) |
Aug
(22) |
Sep
(48) |
Oct
|
Nov
|
Dec
(38) |
2004 |
Jan
(28) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(37) |
Jul
|
Aug
(73) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <net...@us...> - 2003-02-15 13:39:14
|
Update of /cvsroot/cpptool/rfta/src In directory sc8-pr-cvs1:/tmp/cvs-serv31976 Modified Files: rfta.dsw Log Message: Added Eclipse Plugin Project Index: rfta.dsw =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta.dsw,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** rfta.dsw 31 Jan 2003 21:37:01 -0000 1.4 --- rfta.dsw 15 Feb 2003 13:39:11 -0000 1.5 *************** *** 46,49 **** --- 46,67 ---- ############################################################################### + Project: "eclipseplugin"=.\eclipseplugin\eclipseplugin.dsp - Package Owner=<4> + + Package=<5> + {{{ + }}} + + Package=<4> + {{{ + Begin Project Dependency + Project_Dep_Name rfta + End Project Dependency + Begin Project Dependency + Project_Dep_Name rftaparser + End Project Dependency + }}} + + ############################################################################### + Project: "rfta"=.\rfta\rfta.dsp - Package Owner=<4> |
From: <net...@us...> - 2003-02-15 13:38:29
|
Update of /cvsroot/cpptool/rfta/src/eclipseplugin/PluginCode/icons In directory sc8-pr-cvs1:/tmp/cvs-serv31733 Added Files: RenameVariable.gif Log Message: Icon shown for the Plugin Function --- NEW FILE: RenameVariable.gif --- (This appears to be a binary file; contents omitted.) |
From: <net...@us...> - 2003-02-15 13:37:47
|
Update of /cvsroot/cpptool/rfta/src/eclipseplugin/PluginCode/src/org/eclipse/cpprefactoring/actions In directory sc8-pr-cvs1:/tmp/cvs-serv31495/org/eclipse/cpprefactoring/actions Added Files: RenameLocaleVariableAction.java Log Message: Eclipse Plugin JAVA code --- NEW FILE: RenameLocaleVariableAction.java --- package org.eclipse.cpprefactoring.actions; import org.eclipse.cpprefactoring.internal.EclipseBridge; import org.eclipse.cpprefactoring.ui.RenameLocalVariableDialog; import org.eclipse.jface.action.IAction; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.text.IRewriteTarget; import org.eclipse.jface.text.ITextSelection; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.ui.IEditorActionDelegate; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindowActionDelegate; import org.eclipse.ui.texteditor.AbstractTextEditor; /** * @author Andre Baresel * * To change this generated comment edit the template variable "typecomment": * Window>Preferences>Java>Templates. * To enable and disable the creation of type comments go to * Window>Preferences>Java>Code Generation. */ public class RenameLocaleVariableAction implements IEditorActionDelegate, IWorkbenchWindowActionDelegate { private static final String ACTION_RENAMELOCALEVARIABLE_MENU = "org.eclipse.cpprefactoring.actions.RenameLocaleVariableAction.Menu"; private static final String ACTION_RENAMELOCALEVARIABLE_POPUP = "org.eclipse.cpprefactoring.actions.RenameLocaleVariableAction.Popup"; private IEditorPart targetEditor; private IWorkbenchWindow window; /** * @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(IAction, IEditorPart) */ public void setActiveEditor(IAction action, IEditorPart targetEditor) { this.targetEditor = targetEditor; } /** * @see org.eclipse.ui.IActionDelegate#run(IAction) */ public void run(IAction action) { // initialize active editor for Menu-Actions: if (action.getId().equals(ACTION_RENAMELOCALEVARIABLE_MENU)) { IWorkbenchPage page = window.getActivePage(); targetEditor = page.getActiveEditor(); } // if ( action.getId().equals(ACTION_RENAMELOCALEVARIABLE_POPUP) || action.getId().equals(ACTION_RENAMELOCALEVARIABLE_MENU) ) { handleRenameLocalVariable(); } else { MessageDialog.openError( targetEditor.getSite().getShell(), "Cpp-Refactoring Plugin Error", "This refactoring-action-item has not yet been implemented: ID="+action.getId()); } } /** * Method is responsible to handle 'RenameLocalVariable' action */ public void handleRenameLocalVariable() { if (! (targetEditor instanceof AbstractTextEditor) ) { MessageDialog.openError( targetEditor.getSite().getShell(), "Cpp-Refactoring Plugin Error", "The refactoring methods can only be activated in a text editor."); } AbstractTextEditor textEditor = (AbstractTextEditor)targetEditor; IRewriteTarget targetDoc = (IRewriteTarget)targetEditor.getAdapter(IRewriteTarget.class); ISelectionProvider selectionHlp = (ISelectionProvider)textEditor.getSelectionProvider(); ITextSelection selection = (ITextSelection)selectionHlp.getSelection(); try { EclipseBridge bridge = new EclipseBridge(selectionHlp,targetDoc); targetDoc.beginCompoundChange(); bridge.applyRftaRenameLocaleVariable(RenameLocalVariableDialog.class); targetDoc.endCompoundChange(); } catch (Exception e) { e.printStackTrace(); MessageDialog.openError( targetEditor.getSite().getShell(), "Cpp-Refactoring Plugin Error", e.getMessage()); } catch (UnsatisfiedLinkError e1) { MessageDialog.openError( targetEditor.getSite().getShell(), "Dynamic Linkage Error", "Some code is missing in Refactoring-DLLs or DLLs are missing. Exception: "+ e1.toString() ); e1.printStackTrace(); throw e1; } /*MessageDialog.openInformation( targetEditor.getSite().getShell(), "done?", "done?"); */ } /** * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection) */ public void selectionChanged(IAction action, ISelection selection) { } public void init(IWorkbenchWindow window) { this.window = window; } public void dispose() { } } |
From: <net...@us...> - 2003-02-15 13:37:47
|
Update of /cvsroot/cpptool/rfta/src/eclipseplugin/PluginCode/src/org/eclipse/cpprefactoring/ui In directory sc8-pr-cvs1:/tmp/cvs-serv31495/org/eclipse/cpprefactoring/ui Added Files: RenameLocalVariableDialog.java Log Message: Eclipse Plugin JAVA code --- NEW FILE: RenameLocalVariableDialog.java --- package org.eclipse.cpprefactoring.ui; import org.eclipse.core.runtime.Path; import org.eclipse.cpprefactoring.RefactorPluginMain; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.text.IRewriteTarget; import org.eclipse.jface.viewers.ISelectionProvider; /** * @author Andre Baresel * * Dialog to enable user to enter the new name of a * local variable. */ public class RenameLocalVariableDialog extends Dialog { public RenameLocalVariableDialog() { super(null); } /** * Callback function executed from 'applyRftaRenameLocaleVariable' for * user interaction. When the function returns, the refactoring will * be done. */ static public boolean callback_userrequest(String oldname,StringBuffer newname) { if (newname==null) { System.out.println("DEBUG: Caller has to initialize second parameter."); return false; } InputDialog dialog = new InputDialog(null,"Rename Local Variable","Select the new name for variable '"+oldname+"'",newname.toString(),null); dialog.setBlockOnOpen(true); if (dialog.open()==dialog.OK) { if (newname.length()>0) newname.delete(0,newname.length()-1); newname.append(dialog.getValue()); System.out.println("OK - do refactoring"); return true; } else return false; } } |
From: <net...@us...> - 2003-02-15 13:37:47
|
Update of /cvsroot/cpptool/rfta/src/eclipseplugin/PluginCode/src/org/eclipse/cpprefactoring In directory sc8-pr-cvs1:/tmp/cvs-serv31495/org/eclipse/cpprefactoring Added Files: RefactorPluginMain.java Log Message: Eclipse Plugin JAVA code --- NEW FILE: RefactorPluginMain.java --- package org.eclipse.cpprefactoring; import org.eclipse.ui.plugin.*; import org.eclipse.core.runtime.*; import org.eclipse.core.resources.*; import java.util.*; /** * The main plugin class to be used in the desktop. */ public class RefactorPluginMain extends AbstractUIPlugin { //The shared instance. private static RefactorPluginMain plugin; //Resource bundle. private ResourceBundle resourceBundle; /** * The constructor. */ public RefactorPluginMain(IPluginDescriptor descriptor) { super(descriptor); plugin = this; try { resourceBundle= ResourceBundle.getBundle("org.eclipse.cpprefactoring.PluginResources"); } catch (MissingResourceException x) { resourceBundle = null; } } /** * Returns the shared instance. */ public static RefactorPluginMain getDefault() { return plugin; } /** * Returns the workspace instance. */ public static IWorkspace getWorkspace() { return ResourcesPlugin.getWorkspace(); } /** * Returns the string from the plugin's resource bundle, * or 'key' if not found. */ public static String getResourceString(String key) { ResourceBundle bundle= RefactorPluginMain.getDefault().getResourceBundle(); try { return bundle.getString(key); } catch (MissingResourceException e) { return key; } } /** * Returns the plugin's resource bundle, */ public ResourceBundle getResourceBundle() { return resourceBundle; } } |
Update of /cvsroot/cpptool/rfta/src/eclipseplugin/PluginCode/src/org/eclipse/cpprefactoring/internal In directory sc8-pr-cvs1:/tmp/cvs-serv31495/org/eclipse/cpprefactoring/internal Added Files: RefactoringTextDocumentProvider.java RefactoringSourceRange.java EclipseBridge.java Log Message: Eclipse Plugin JAVA code --- NEW FILE: RefactoringTextDocumentProvider.java --- package org.eclipse.cpprefactoring.internal; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ITextSelection; import org.eclipse.jface.text.TextSelection; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionProvider; /** * @author Andre Baresel * * */ public class RefactoringTextDocumentProvider { /** * Constructor RefactoringTextDocumentProvider. * @param iDocument * @param selectionProvider */ public RefactoringTextDocumentProvider( IDocument iDocument, ISelectionProvider selectionProvider) { this.doc = iDocument; this.selectionProvider = selectionProvider; } public String getAllText() { return doc.get(); } /*! Gets the selected text. * \return Selected text. EOL are in the original text format. */ public String getSelection() { ISelection sel = selectionProvider.getSelection(); if (sel instanceof ITextSelection) { ITextSelection textsel = (ITextSelection)sel; return textsel.getText(); } else return ""; } /*! 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. */ public void replaceSelection( String text ) { try { ISelection sel = selectionProvider.getSelection(); if (sel instanceof ITextSelection) { ITextSelection textsel = (ITextSelection)sel; doc.replace(textsel.getOffset(),textsel.getLength(),text); } } catch (BadLocationException e) { System.out.println("Debugging: BadLocationException is not handled yet.\n"); } } /*! Gets the selected range. * \return The location range of the selection. */ public RefactoringSourceRange getSelectionRange() { ISelection sel = selectionProvider.getSelection(); if (sel instanceof ITextSelection) { ITextSelection textsel = (ITextSelection)sel; return new RefactoringSourceRange(textsel.getOffset(),textsel.getLength()); // sourcerange ! } else return new RefactoringSourceRange(); // sourcerange ! } /*! Select a specified range of text. * Line and column are zero-based. * \param selection start and length of the selection. */ public void setSelectionRange( RefactoringSourceRange selection ) { TextSelection sel = new TextSelection(doc,selection.startIndex_,selection.length_); selectionProvider.setSelection(sel); } /*! Move to a specific location. * Set the selection to an empty selection at the specified location. * Equivalent to selectText( range(to, 0) ). * \param toLocation Location the next setSelectedText() operation will insert * text at. */ public void moveTo( int toLocation ) { TextSelection sel = new TextSelection(doc,toLocation,0); selectionProvider.setSelection(sel); } private IDocument doc; private ISelectionProvider selectionProvider; } --- NEW FILE: RefactoringSourceRange.java --- package org.eclipse.cpprefactoring.internal; /** * @author Andre Baresel * * this is a very simple data type for the 'RefactoringTextDocumentProvider'. * we allow public access and no getter and setter will be written because * this class is only used to pass a structured data type between java and c++. */ public class RefactoringSourceRange { /** * Constructor RefactoringSourceRange. * @param start * @param len */ public RefactoringSourceRange(int start, int len) { startIndex_ = start; length_ = len; } /** * Constructor RefactoringSourceRange. */ public RefactoringSourceRange() { startIndex_ = -1; length_ = -1; } public int startIndex_; public int length_; } --- NEW FILE: EclipseBridge.java --- package org.eclipse.cpprefactoring.internal; import org.eclipse.core.runtime.Path; import org.eclipse.cpprefactoring.RefactorPluginMain; import org.eclipse.cpprefactoring.ui.RenameLocalVariableDialog; import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.text.IRewriteTarget; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.window.Window; /** * @author Andre Baresel * * To change this generated comment edit the template variable "typecomment": * Window>Preferences>Java>Templates. * To enable and disable the creation of type comments go to * Window>Preferences>Java>Code Generation. */ public class EclipseBridge { static { // currently class loader does load the release version // of all DLLs. Maybe we should add a plugin class variable // the enables debug version to be executed. However I don't // know yet, if it's possible to debug a DLL started from the // JAVA VM. try { RefactorPluginMain dft = RefactorPluginMain.getDefault(); /** * TO DEBUG THE CPP-CODE: * String eclipseplugin = "eclipseplugin_d"; String rfta_file = dft.find(new Path("rfta_mdd.ext")).getFile(); String rftaparser_file = dft.find(new Path("rftaparser_mdd.ext")).getFile(); String cppunit_file = dft.find(new Path("cppunitd_dll.dll")).getFile(); System.load(cppunit_file); * **/ /** * TO RUN THE RELEASE VERSION OF CPP CODE: */ String eclipseplugin = "eclipseplugin"; String rfta_file = dft.find(new Path("rfta_mdr.ext")).getFile(); String rftaparser_file = dft.find(new Path("rftaparser_mdr.ext")).getFile(); // load the DLLs in the correct ordering, so that windows // does not try to find any depended DLL in the path. this will fail, // because the plugin directory (where the files are placed) is // not in the path. System.load(rftaparser_file); System.load(rfta_file); System.loadLibrary(eclipseplugin); // dll created by C++ project } catch (UnsatisfiedLinkError e1) { System.out.println("Path: "+ System.getProperty("java.library.path")); e1.printStackTrace(); throw e1; } } /** * does provide access to the selection in active editor */ private ISelectionProvider selectionProvider; private RefactoringTextDocumentProvider docProvider; /** * does provide write access to the editor contents. */ private IRewriteTarget targetDoc; public EclipseBridge(ISelectionProvider selectionProvider,IRewriteTarget targetDoc) { this.selectionProvider = selectionProvider; this.targetDoc = targetDoc; docProvider = new RefactoringTextDocumentProvider(targetDoc.getDocument(),selectionProvider); LogMessage("Refactoring-PlugIn is starting...\n"); } public void LogMessage(String message) { System.out.println(message); } /** * Implemented in C++ this member accesses 'selectionProvider' and 'targetDoc' * if refactoring was successful */ public native void applyRftaRenameLocaleVariable(Class dialogclass); } |
From: <net...@us...> - 2003-02-15 13:37:03
|
Update of /cvsroot/cpptool/rfta/src/eclipseplugin/PluginCode/src/org/eclipse/cpprefactoring/actions In directory sc8-pr-cvs1:/tmp/cvs-serv31305/actions Log Message: Directory /cvsroot/cpptool/rfta/src/eclipseplugin/PluginCode/src/org/eclipse/cpprefactoring/actions added to the repository |
From: <net...@us...> - 2003-02-15 13:36:53
|
Update of /cvsroot/cpptool/rfta/src/eclipseplugin/PluginCode/src/org/eclipse/cpprefactoring/internal In directory sc8-pr-cvs1:/tmp/cvs-serv31259/internal Log Message: Directory /cvsroot/cpptool/rfta/src/eclipseplugin/PluginCode/src/org/eclipse/cpprefactoring/internal added to the repository |
From: <net...@us...> - 2003-02-15 13:36:39
|
Update of /cvsroot/cpptool/rfta/src/eclipseplugin/PluginCode/src/org/eclipse/cpprefactoring/ui In directory sc8-pr-cvs1:/tmp/cvs-serv31203/ui Log Message: Directory /cvsroot/cpptool/rfta/src/eclipseplugin/PluginCode/src/org/eclipse/cpprefactoring/ui added to the repository |
From: <net...@us...> - 2003-02-15 13:36:24
|
Update of /cvsroot/cpptool/rfta/src/eclipseplugin/PluginCode/src/org/eclipse/cpprefactoring In directory sc8-pr-cvs1:/tmp/cvs-serv31093/cpprefactoring Log Message: Directory /cvsroot/cpptool/rfta/src/eclipseplugin/PluginCode/src/org/eclipse/cpprefactoring added to the repository |
From: <net...@us...> - 2003-02-15 13:36:13
|
Update of /cvsroot/cpptool/rfta/src/eclipseplugin/PluginCode/src/org/eclipse In directory sc8-pr-cvs1:/tmp/cvs-serv31025/eclipse Log Message: Directory /cvsroot/cpptool/rfta/src/eclipseplugin/PluginCode/src/org/eclipse added to the repository |
From: <net...@us...> - 2003-02-15 13:35:53
|
Update of /cvsroot/cpptool/rfta/src/eclipseplugin/PluginCode/src/org In directory sc8-pr-cvs1:/tmp/cvs-serv30906/org Log Message: Directory /cvsroot/cpptool/rfta/src/eclipseplugin/PluginCode/src/org added to the repository |
From: <net...@us...> - 2003-02-15 13:35:42
|
Update of /cvsroot/cpptool/rfta/src/eclipseplugin/PluginCode/icons In directory sc8-pr-cvs1:/tmp/cvs-serv30834/icons Log Message: Directory /cvsroot/cpptool/rfta/src/eclipseplugin/PluginCode/icons added to the repository |
From: <net...@us...> - 2003-02-15 13:35:30
|
Update of /cvsroot/cpptool/rfta/src/eclipseplugin/PluginCode/src In directory sc8-pr-cvs1:/tmp/cvs-serv30769/src Log Message: Directory /cvsroot/cpptool/rfta/src/eclipseplugin/PluginCode/src added to the repository |
From: <net...@us...> - 2003-02-15 13:35:16
|
Update of /cvsroot/cpptool/rfta/src/eclipseplugin/PluginCode In directory sc8-pr-cvs1:/tmp/cvs-serv30700 Added Files: PlugIn-HowTos.txt Log Message: description how to add plugins to eclipse (http links) --- NEW FILE: PlugIn-HowTos.txt --- Your First Plugin: http://www.eclipse.org/articles/Article-Your%20First%20Plug-in/YourFirstPlugin.html Contributing Actions to Eclipse: http://www.eclipse.org/articles/Article-action-contribution/Contributing%20Actions%20to%20the%20Eclipse%20Workbench.html Writing Dialogs: http://www.eclipse.org/articles/Understanding%20Layouts/Understanding%20Layouts.htm Java Native Interface Usage: http://java.sun.com/docs/books/tutorial/native1.1/index.html JNI FAQ: http://www.jguru.com/faq/JNI API Documentation of eclipse: http://dev.eclipse.org:8080/help/ --> See PlugIn development Using Cygwin To Develop Windows JNI Methods: http://www.inonit.com/cygwin/jni/helloWorld/ How to Debug ? Unfortunatly native code is a little bit critical since, the cpp code is running as DLL loaded by the JAVA-VM. If the DLL crashes, the complete JAVA-VM will be destroyed. For this reason "DebugBreak" does also not work at the moment. (It seems for me that java.exe has called some win-api function to redirect this exception handling. Can we change this for debugging ?) At the moment we need a very restrictive catching of all exceptions in C++. A not catched exception means destroying a running exclipse workbench (which is worse of cause). We can throw Java-Exception using the JNI-Interface, so that the Plugin-Code can display error messages to the user. Currently I'm using a simple java/lang/exception to do this. Maybe we introduce a specialized exception class later on. By the way: The Plugin and the DLL are loaded when the user activates a refactoring action the first time. What to do to run the debug mode showing a console: - load the eclipse-plugin project into the workbench (call this debugging workbench) - don't activate the plugin in this workbench ! - enable tracing in the dialog "Run->Run..." preference dialog - Select Menu: "Run->RunAs->Runtime Workbench" (you need to wait now for a couple seconds until a second workbench opens ... this takes up to 10 seconds on my pc) - in the second workbench you can try out the plug in, all java output (system.out.print) can be seen in the console in the debugging workbench. C++ printouts need to be redirected to calls of "system.out.print" routines. Article: http://www.eclipse.org/articles/Article-Your%20First%20Plug-in/YourFirstPlugin.html see chapter "Debugging your plug-in" after Step 7 How to activate C++ Refactoring Menu/Toolbar ? go to menu "Window->Customize Perspective..." enable tree element "Other->C++ Refactoring" |
Update of /cvsroot/cpptool/rfta/src/eclipseplugin/PluginCode In directory sc8-pr-cvs1:/tmp/cvs-serv30463 Added Files: pluginbuild.jardesc plugin.xml build.xml build.properties .template .project .cvsignore .classpath Log Message: eclipse project files --- NEW FILE: pluginbuild.jardesc --- <?xml version="1.0" encoding="UTF-8"?> <jardesc> <jar path="D:/Projects/Cpptool/rfta/src/eclipseplugin/PluginCode/bin/cpprefactoring.jar"/> <options overwrite="true" compress="true" exportErrors="true" exportWarnings="true" saveDescription="true" descriptionLocation="/org.eclipse.cpprefactoring/pluginbuild.jardesc" useSourceFolders="false" buildIfNeeded="true"/> <manifest manifestVersion="1.0" usesManifest="true" reuseManifest="false" saveManifest="false" generateManifest="true" manifestLocation=""> <sealing sealJar="false"> <packagesToSeal/> <packagesToUnSeal/> </sealing> </manifest> <selectedElements exportClassFiles="true" exportJavaFiles="false"> <javaElement handleIdentifier="=org.eclipse.cpprefactoring/src"/> </selectedElements> </jardesc> --- NEW FILE: plugin.xml --- <?xml version="1.0" encoding="UTF-8"?> <plugin id="org.eclipse.cpprefactoring" name="Helloworld Plug-in" version="0.0.0" provider-name="My" class="org.eclipse.cpprefactoring.RefactorPluginMain"> <runtime> <library name="cpprefactoring.jar"/> </runtime> <requires> <import plugin="org.eclipse.core.resources"/> <import plugin="org.eclipse.ui"/> </requires> <extension point="org.eclipse.ui.actionSets"> <actionSet label="Cpp Refactoring Actions" visible="true" id="org.eclipse.cpprefactoring.actionSet"> <menu label="CppRefactoring" id="CppRefactoringMenu"> <separator name="refactoringGroup"> </separator> </menu> <action label="&RenameLocaleVariableAction" icon="icons/RenameVariable.gif" tooltip="Rename a local variable" class="org.eclipse.cpprefactoring.actions.RenameLocaleVariableAction" menubarPath="CppRefactoringMenu/refactoringGroup" toolbarPath="Normal" id="org.eclipse.cpprefactoring.actions.RenameLocaleVariableAction.Menu"> </action> </actionSet> </extension> <extension point="org.eclipse.ui.perspectiveExtensions"> <perspectiveExtension targetID="org.eclipse.ui.resourcePerspective"> <actionSet id="org.eclipse.cpprefactoring.actionSet"> </actionSet> </perspectiveExtension> </extension> <extension point="org.eclipse.ui.popupMenus"> <viewerContribution targetID="#CEditorContext" id="RenameLocaleVariableAction"> <action label="Rename Local Variable" icon="icons/RenameVariable.gif" class="org.eclipse.cpprefactoring.actions.RenameLocaleVariableAction" menubarPath="CppRefactoring" id="org.eclipse.cpprefactoring.actions.RenameLocaleVariableAction.Popup"> </action> </viewerContribution> </extension> </plugin> --- NEW FILE: build.xml --- <project name="MyProject" default="dist" basedir="."> <description> simple example build file </description> <!-- set global properties for this build --> <property name="src" location="src"/> <property name="bin" location="bin"/> <property name="build" location="..\..\..\build\eclipseplugin"/> <property name="deplib" location="..\..\..\deplib"/> <property name="signatures" location="..\GeneratedCode"/> <target name="build-jni-header" description="calls javah to generate the jni header of the class 'EclipseBridge'" > <exec executable="J:\Programmer\java\j2sdk1.4.0_02\bin\javah.exe" > <arg line="-d ${signatures} -classpath ${bin} org.eclipse.cpprefactoring.internal.EclipseBridge" /> </exec> </target> <target name="output-signatures" description="calls javap to create a file containing the signatures of classes accessed by native code" > <!-- <exec executable="J:\Programmer\java\j2sdk1.4.0_02\bin\javap.exe" output="${signatures}\RefactoringTextDocumentProvider.signatures.txt"> <arg line="-s -p -classpath ${bin} org.eclipse.cpprefactoring.internal.RefactoringTextDocumentProvider" /> </exec> <exec executable="J:\Programmer\java\j2sdk1.4.0_02\bin\javap.exe" output="${signatures}\RefactoringSourceRange.signatures.txt"> <arg line="-s -p -classpath ${bin} org.eclipse.cpprefactoring.internal.RefactoringSourceRange" /> </exec> <exec executable="J:\Programmer\java\j2sdk1.4.0_02\bin\javap.exe" output="${signatures}\EclipseBridge.signatures.txt"> <arg line="-s -p -classpath ${bin} org.eclipse.cpprefactoring.internal.EclipseBridge" /> </exec> <exec executable="J:\Programmer\java\j2sdk1.4.0_02\bin\javap.exe" output="${signatures}\StringBuffer.signatures.txt"> <arg line="-s -p -classpath ${bin} java.lang.StringBuffer" /> </exec>--> <exec executable="J:\Programmer\java\j2sdk1.4.0_02\bin\javap.exe" output="${signatures}\RenameLocalVariableDialog.signatures.txt"> <arg line="-s -p -classpath ${bin};d:\programme\Eclipse-FULL-2.0.2\plugins\org.eclipse.ui_2.0.2/workbench.jar org.eclipse.cpprefactoring.ui.RenameLocalVariableDialog" /> </exec> </target> <target name="distribute" description="copies a distributable plugin in the build directory" > <copy file="${bin}\cpprefactoring.jar" todir="${build}\org.eclipse.cpprefactoring" /> <copy file="${build}\Release\eclipseplugin.dll" todir="${build}\org.eclipse.cpprefactoring" /> <copy file="${build}\..\rfta\Release\rfta_mdr.ext" todir="${build}\org.eclipse.cpprefactoring" /> <copy file="${build}\..\rftaparser\Release\rftaparser_mdr.ext" todir="${build}\org.eclipse.cpprefactoring" /> <copy file="${deplib}\cppunit\lib\cppunit_dll.dll" todir="${build}\org.eclipse.cpprefactoring" /> <copy file="icons\RenameVariable.gif" todir="${build}\org.eclipse.cpprefactoring\icons" /> <copy file="plugin.xml" todir="${build}\org.eclipse.cpprefactoring" /> </target> </project> --- NEW FILE: build.properties --- source.helloworld.jar = src/ --- NEW FILE: .template --- <?xml version="1.0" encoding="UTF-8"?> <form> <p><b>Generated content</b></p><p>This plug-in has been created using content templates. The following templates were used:</p> <li style="text" value="1."><b>Sample Action Set.</b>This template creates a simple action set that adds <b>Sample Menu</b> to the menu bar and a button to the tool bar. Both the menu item in the new menu and the button invoke the same <b>Sample Action</b>. Its role is to open a simple message dialog with a message of your choice.</li> <p/><p><b>Tips on working with this plug-in project</b></p><li>For the view of the new plug-in at a glance, go to the <img href="pageImage"/><a href="OverviewPage">Overview</a>.</li><li>You can test the contributions of this plug-in by launching another instance of the workbench. On the <b>Run</b> menu, click <b>Run As</b> and choose <img href="runTimeWorkbenchImage"/><a href="action.run">Run-time Workbench</a> from the available choices.</li><li>You can add more functionality to this plug-in by adding extensions using the <a href="action.newExtension">New Extension Wizard</a>.</li><li>The plug-in project contains Java code that you can debug. Place breakpoints in Java classes. On the <b>Run</b> menu, select <b>Debug As</b> and choose <img href="runTimeWorkbenchImage"/><a href="action.debug">Run-time Workbench</a> from the available choices.</li> </form> --- NEW FILE: .project --- <?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>org.eclipse.cpprefactoring</name> <comment></comment> <projects> </projects> <buildSpec> <buildCommand> <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>org.eclipse.pde.ManifestBuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>org.eclipse.pde.SchemaBuilder</name> <arguments> </arguments> </buildCommand> </buildSpec> <natures> <nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.pde.PluginNature</nature> </natures> </projectDescription> --- NEW FILE: .cvsignore --- bin *.dll *.ext --- NEW FILE: .classpath --- <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src/"/> <classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.core.resources_2.0.1/resources.jar" sourcepath="_ORG_ECLIPSE_PLATFORM_SOURCE/org.eclipse.core.resources_2.0.1/resourcessrc.zip"/> <classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.ui_2.0.2/workbench.jar" sourcepath="_ORG_ECLIPSE_PLATFORM_SOURCE/org.eclipse.ui_2.0.2/workbenchsrc.zip"/> <classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.ui.win32_2.0.0/workbenchwin32.jar" sourcepath="_ORG_ECLIPSE_PLATFORM_WIN32_SOURCE/org.eclipse.ui.win32_2.0.0/workbenchwin32src.zip"/> <classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.swt.win32_2.0.2/ws/win32/swt.jar" sourcepath="_ORG_ECLIPSE_PLATFORM_WIN32_SOURCE/org.eclipse.swt.win32_2.0.2/ws/win32/swtsrc.zip"/> <classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.core.runtime_2.0.2/runtime.jar" sourcepath="_ORG_ECLIPSE_PLATFORM_SOURCE/org.eclipse.core.runtime_2.0.2/runtimesrc.zip"/> <classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.core.boot_2.0.2/boot.jar" sourcepath="_ORG_ECLIPSE_PLATFORM_SOURCE/org.eclipse.core.boot_2.0.2/bootsrc.zip"/> <classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/> <classpathentry kind="lib" path="D:/Programme/eclipse-FULL-2.0.2/plugins/org.eclipse.cdt.ui_1.0.1/cdtui.jar"/> <classpathentry kind="output" path="bin"/> </classpath> |
From: <net...@us...> - 2003-02-15 13:33:25
|
Update of /cvsroot/cpptool/rfta/src/eclipseplugin/PluginCode In directory sc8-pr-cvs1:/tmp/cvs-serv30182/PluginCode Log Message: Directory /cvsroot/cpptool/rfta/src/eclipseplugin/PluginCode added to the repository |
From: <net...@us...> - 2003-02-15 13:33:15
|
Update of /cvsroot/cpptool/rfta/src/eclipseplugin/GeneratedCode In directory sc8-pr-cvs1:/tmp/cvs-serv30007 Added Files: .cvsignore Log Message: directory for generated code (native code bridge) --- NEW FILE: .cvsignore --- *.txt *.h |
From: <net...@us...> - 2003-02-15 13:32:24
|
Update of /cvsroot/cpptool/rfta/src/eclipseplugin/GeneratedCode In directory sc8-pr-cvs1:/tmp/cvs-serv29757/GeneratedCode Log Message: Directory /cvsroot/cpptool/rfta/src/eclipseplugin/GeneratedCode added to the repository |
From: <net...@us...> - 2003-02-15 13:32:06
|
Update of /cvsroot/cpptool/rfta/src/eclipseplugin/CppBridge In directory sc8-pr-cvs1:/tmp/cvs-serv29669 Added Files: EclipsePluginError.h EclipsePluginError.cpp EclipseHandler.h EclipseHandler.cpp EclipseDocumentHelper.h EclipseDocumentHelper.cpp EclipseBridge_RenameLocaleVariable.cpp Log Message: eclipse plugin native code sources --- NEW FILE: EclipsePluginError.h --- #include <stdexcept> class EclipsePluginError : public std::runtime_error { public: EclipsePluginError(std::string reason); const char *what() const throw(); private: std::string reason; }; --- NEW FILE: EclipsePluginError.cpp --- #include "EclipsePluginError.h" EclipsePluginError::EclipsePluginError(std::string reason):runtime_error(reason) { this->reason = reason; } const char * EclipsePluginError::what() const throw() { return reason.c_str(); } --- NEW FILE: EclipseHandler.h --- // ////////////////////////////////////////////////////////////////////////// // (c)Copyright 2003, Andre Baresel // Created: 2003/02/08 // ////////////////////////////////////////////////////////////////////////// class EclipseHandler; #ifndef __ECLIPSEHANDLER_H__ #define __ECLIPSEHANDLER_H__ #include <jni.h> #include <string> #include "EclipseDocumentHelper.h" /** * class is responsible to store and control an eclipse plugin connection * an object of this class should be created right after the native code * routine is called * (e.g. Java_org_eclipse_cpprefactoring_internal_EclipseBridge_applyRftaRenameLocaleVariable) */ class EclipseHandler { public: /** * creates the singleton eclipse handler connected to the given JNI * environment and the eclipse bridge object. It's possible to use this * handler during one native call 'session'. Don't forget to dispose the * handler before returing from the native routine. */ static EclipseHandler * createEclipseHandler(JNIEnv * env,jobject bridge); /** * does destroy an initialized eclipse handler, so that next sessions * can be handled correctly. This has to be the last call before returning * to java, because exception throwing is based on the handler information. */ static void disposeEclipseHandler(); /** * returns the singleton handler object * throws plugin-exception if handler is not initialized */ static EclipseHandler * getEclipseHandler(); ~EclipseHandler(); /** * function does write log information which can be seen in the * debugging environment of eclipse. */ void LogMessage(std::string msg); /** * function does return the methodID and catching any JAVA-Exception * (e.g. method not found) and converting java-exceptions into CplusPlus * PluginExceptions. */ jmethodID SafeGetMethodID(jclass clazz, const char * methodname, const char * sig); /** * function does return the methodID and catching any JAVA-Exception * (e.g. method not found) and converting java-exceptions into CplusPlus * PluginExceptions. */ jmethodID SafeGetStaticMethodID(jclass clazz, const char * methodname, const char * sig); /** * function does return the jclass object for the requested class name and * catches any JAVA-Exception (e.g. class not found) and converting the * java-exceptions into CplusPlus PluginExceptions. */ jclass SafeGetClass(const char * clazzname); /** * function does return the fieldID and catching any JAVA-Exception * (e.g. field not found) and converting java-exceptions into CplusPlus * PluginExceptions. */ jfieldID SafeGetFieldID(jclass clazz, const char * fieldname, const char * sig); jobject SafeGetObjectField(jobject obj, jfieldID classmember); EclipseDocumentHelper getActiveDocument(); jclass getJavaExceptionClass(); JNIEnv* getJNIEnv(); jobject getJavaStringBufferObject(); std::string getStringBufferContent(jobject buffer); protected: // EclipseHandler is a Singleton... EclipseHandler(JNIEnv * env,jobject bridge); JNIEnv* env; // current jni-environment jobject bridge; // object that has called the native routine jclass JavaException; // java exception class for throwing in java environment jclass bridgeclass; // class of the object that has called the native routine jobject docProviderRef; // eclipse document provider interface for the active editor jmethodID mid_logmessage; // method-id for calling LogMessage() a java routine jmethodID mid_stringbuffer_init; // method-id for constructing a stringbuffer object jmethodID mid_stringbuffer_tostring; // method-id for converting a stringbuffer into a string jclass jStringBufferClass; // string buffer class object }; #endif --- NEW FILE: EclipseHandler.cpp --- #include "EclipseHandler.h" #include "EclipsePluginError.h" /** * class is responsible to store and control an eclipse plugin connection * an object of this class should be created right after the native code * routine is called * (e.g. Java_org_eclipse_cpprefactoring_internal_EclipseBridge_applyRftaRenameLocaleVariable) */ EclipseHandler::EclipseHandler(JNIEnv * env,jobject bridge) { if (env==NULL) throw EclipsePluginError("Invalid Java-Native-Interface-Environment passed."); this->env = env; this->bridge = bridge; // find exception class for throwing java exceptions: JavaException = env->FindClass("java/lang/Exception"); // findout string buffer class for parameter passing jStringBufferClass = SafeGetClass("java/lang/StringBuffer"); mid_stringbuffer_init = SafeGetMethodID(jStringBufferClass, "<init>", "()V"); mid_stringbuffer_tostring = SafeGetMethodID(jStringBufferClass, "toString", "()Ljava/lang/String;"); // find out bridge methods & fields: bridgeclass = env->GetObjectClass(bridge); mid_logmessage = SafeGetMethodID(bridgeclass, "LogMessage", "(Ljava/lang/String;)V"); jfieldID fid = SafeGetFieldID (bridgeclass, "docProvider", "Lorg/eclipse/cpprefactoring/internal/RefactoringTextDocumentProvider;"); docProviderRef = SafeGetObjectField(bridge, fid); } EclipseHandler::~EclipseHandler() { } static EclipseHandler * singleton = NULL; EclipseHandler * EclipseHandler::createEclipseHandler(JNIEnv * env,jobject bridge) { // dispose a session that was not closed if (singleton!=NULL) { singleton->disposeEclipseHandler(); } // create the handler: try { singleton= new EclipseHandler(env,bridge); return singleton; } catch (EclipsePluginError e) { throw e; } catch (...) { throw EclipsePluginError("Not identified exception has occured in EclipseHandler::EclipseHandler"); } } void EclipseHandler::disposeEclipseHandler() { if (singleton==NULL) return; delete singleton; singleton=NULL; } EclipseHandler * EclipseHandler::getEclipseHandler() { if (singleton==NULL) { throw EclipsePluginError("EclipseHandler was not initialized correctly at native routine."); } return singleton; } /** * function does send log messages to the java environment * (the messages can be seen in debugging console) */ void EclipseHandler::LogMessage(std::string msg) { if (mid_logmessage==0) return; try { jstring par = env->NewStringUTF(msg.c_str()); env->CallVoidMethod(bridge, mid_logmessage , par ); } catch (...) { } } /** * function does return the methodID and catching any JAVA-Exception * (e.g. method not found) and converting java-exceptions into CplusPlus * PluginExceptions. */ jmethodID EclipseHandler::SafeGetMethodID(jclass clazz, const char * methodname, const char * sig) { jmethodID res=0; res = env->GetMethodID(clazz, methodname, sig); if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear(); throw EclipsePluginError(std::string("Method '")+methodname+"' not found. Signature: "+sig); } return res; } /** * function does return the methodID and catching any JAVA-Exception * (e.g. method not found) and converting java-exceptions into CplusPlus * PluginExceptions. */ jmethodID EclipseHandler::SafeGetStaticMethodID(jclass clazz, const char * methodname, const char * sig) { jmethodID res=0; res = env->GetStaticMethodID(clazz, methodname, sig); if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear(); throw EclipsePluginError(std::string("Method '")+methodname+"' not found. Signature: "+sig); } return res; } /** * function does return the jclass object for the requested class name and * catches any JAVA-Exception (e.g. class not found) and converting the * java-exceptions into CplusPlus PluginExceptions. */ jclass EclipseHandler::SafeGetClass(const char * clazzname) { jclass clazz = env->FindClass(clazzname); if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear(); throw EclipsePluginError("class '"+std::string(clazzname)+"' not found."); } return clazz; } /** * function does return the fieldID and catching any JAVA-Exception * (e.g. field not found) and converting java-exceptions into CplusPlus * PluginExceptions. */ jfieldID EclipseHandler::SafeGetFieldID(jclass clazz, const char * fieldname, const char * sig) { jfieldID res=0; res = env->GetFieldID(clazz, fieldname, sig); if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear(); throw EclipsePluginError(std::string("Field '")+fieldname+std::string("' not found. Signatur: ")+sig); } return res; } /** * function does return the value of the class member stored in java object 'obj' * any java exception (e.g. field not accessible) will be catched and mapped to * a PluginException. */ jobject EclipseHandler::SafeGetObjectField(jobject obj, jfieldID classmember) { jobject result = env->GetObjectField(obj,classmember); if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear(); // don't know yet how to display more throw EclipsePluginError(std::string("Accessing a field of a java object has cause a java exception.")); } return result; } jclass EclipseHandler::getJavaExceptionClass() { return this->JavaException; } JNIEnv* EclipseHandler::getJNIEnv() { return env; } jobject EclipseHandler::getJavaStringBufferObject() { return env->NewObject(jStringBufferClass,mid_stringbuffer_init); } std::string EclipseHandler::getStringBufferContent(jobject buffer) { jstring newstr = (jstring)env->CallObjectMethod(buffer,mid_stringbuffer_tostring); std::string res; res.assign(env->GetStringUTFChars(newstr,0)); env->ReleaseStringUTFChars(newstr,0); return res; } EclipseDocumentHelper EclipseHandler::getActiveDocument() { EclipseDocumentHelper doc(env,docProviderRef); return doc; } --- NEW FILE: EclipseDocumentHelper.h --- // ////////////////////////////////////////////////////////////////////////// // (c)Copyright 2003, Andre Baresel // Created: 2003/01/28 // ////////////////////////////////////////////////////////////////////////// class EclipseDocumentHelper; #ifndef __ECLIPSEDOCUMENTHELPER_H__ #define __ECLIPSEDOCUMENTHELPER_H__ #include <jni.h> #include <string> #include <rfta/refactoring/TextDocument.h> class EclipseDocumentHelper: public Refactoring::TextDocument { protected: jobject targetDocument; jclass targetDocumentClass; jclass jSourceRangeClass; JNIEnv * env; // method IDs to call corresponding java functions in 'RefactoringTextDocumentProvider' class jmethodID mid_getAllText; jmethodID mid_getSelection; jmethodID mid_replaceSelection; jmethodID mid_getSelectionRange; jmethodID mid_setSelectionRange; jmethodID mid_moveTo; jmethodID mid_sourcerange_init; jfieldID fid_range_start; jfieldID fid_range_end; public: 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. * Line and column are zero-based. * \param from Location the selection begins at. * \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 ); }; #endif // __ECLIPSEDOCUMENTHELPER_H__ --- NEW FILE: EclipseDocumentHelper.cpp --- // ////////////////////////////////////////////////////////////////////////// // (c)Copyright 2003, Andre Baresel // Created: 2003/01/28 // ////////////////////////////////////////////////////////////////////////// #include "EclipseHandler.h" #include "EclipseDocumentHelper.h" #include <rfta/refactoring/RenameTempRefactoring.h> #include "EclipsePluginError.h" EclipseDocumentHelper::EclipseDocumentHelper(JNIEnv * _env, jobject _targetDocument) { EclipseHandler* hdl = EclipseHandler::getEclipseHandler(); targetDocument = _targetDocument; env = _env; // Ljava/lang/String; jclass documentProvider = hdl->SafeGetClass("org/eclipse/cpprefactoring/internal/RefactoringTextDocumentProvider"); if (!env->IsInstanceOf(targetDocument,documentProvider)) throw EclipsePluginError("Passed argument is not an instance of 'RefactoringTextDocumentProvider'."); targetDocumentClass = env->GetObjectClass(targetDocument); // get reference to source-range class on java side: jSourceRangeClass = hdl->SafeGetClass("org/eclipse/cpprefactoring/internal/RefactoringSourceRange"); mid_sourcerange_init = hdl->SafeGetMethodID(jSourceRangeClass, "<init>", "(II)V"); fid_range_start = hdl->SafeGetFieldID(jSourceRangeClass,"startIndex_","I"); fid_range_end = hdl->SafeGetFieldID(jSourceRangeClass,"length_","I"); // try to get the methodIDs of the corresponding java class... mid_getAllText = hdl->SafeGetMethodID(targetDocumentClass, "getAllText", "()Ljava/lang/String;"); mid_getSelection = hdl->SafeGetMethodID(targetDocumentClass, "getSelection", "()Ljava/lang/String;"); mid_replaceSelection = hdl->SafeGetMethodID(targetDocumentClass, "replaceSelection","(Ljava/lang/String;)V"); mid_getSelectionRange = hdl->SafeGetMethodID(targetDocumentClass, "getSelectionRange", "()Lorg/eclipse/cpprefactoring/internal/RefactoringSourceRange;"); mid_setSelectionRange = hdl->SafeGetMethodID(targetDocumentClass, "setSelectionRange","(Lorg/eclipse/cpprefactoring/internal/RefactoringSourceRange;)V"); mid_moveTo = hdl->SafeGetMethodID(targetDocumentClass, "moveTo","(I)V"); } /*! 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 EclipseDocumentHelper::getAllText() const { // call the java class method: jstring jres = (jstring)env->CallObjectMethod(targetDocument, mid_getAllText ); // convert the string: const char * cp = env->GetStringUTFChars(jres,0); std::string result; if (cp != NULL) result = cp; env->ReleaseStringUTFChars(jres,0); return result; } /*! 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 ); // convert the string: const char * cp = env->GetStringUTFChars(jres,0); std::string result; if (cp != NULL) result = cp; env->ReleaseStringUTFChars(jres,0); return result; } /*! 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 ); } /*! Gets the selected range. * \return The location range of the selection. * \warning Discard current selection. */ Refactoring::SourceRange EclipseDocumentHelper::getSelectionRange() const { // call the java class method: jobject jres = (jobject)env->CallObjectMethod(targetDocument, mid_getSelectionRange ); if (!env->IsInstanceOf(jres,jSourceRangeClass)) { throw EclipsePluginError("returned value of 'getSelectionRange' is not an instance of 'RefactoringSourceRange'."); } jint i1 = env->GetIntField(jres,fid_range_start); jint i2 = env->GetIntField(jres,fid_range_end); //return result; return Refactoring::SourceRange(i1,i2); } /*! Select a specified range of text. * Line and column are zero-based. * \param from Location the selection begins at. * \param to Location the selection ends (not included). */ void EclipseDocumentHelper::setSelectionRange( const Refactoring::SourceRange &selection ) { jint start=selection.getStartIndex(),len=selection.getLength(); // create a new object of source range class: jobject jrange = env->NewObject(jSourceRangeClass,mid_sourcerange_init,start,len); // call the java class method: env->CallVoidMethod(targetDocument, mid_setSelectionRange, jrange ); if (env->ExceptionOccurred()) { env->ExceptionDescribe(); 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 ); } --- NEW FILE: EclipseBridge_RenameLocaleVariable.cpp --- // ////////////////////////////////////////////////////////////////////////// // (c)Copyright 2003, Andre Baresel // Created: 2003/01/28 // ////////////////////////////////////////////////////////////////////////// #include <windows.h> #include <jni.h> #include <rfta/refactoring/RefactoringError.h> #include <rfta/refactoring/RenameTempRefactoring.h> #include "..\generatedcode\org_eclipse_cpprefactoring_internal_EclipseBridge.h" #include "EclipseHandler.h" #include "EclipseDocumentHelper.h" #include "EclipsePluginError.h" /** * callback routine to open the 'rename local variable' dialog in eclipse ide. */ bool OpenRenameLocalVariableDialog(jclass dialogclass, std::string var2rename,std::string& newname); #ifdef _DEBUG LONG _stdcall testexc(struct _EXCEPTION_POINTERS *ExceptionInfo) { MessageBox(NULL,"Userdefined C++ Exception Handler. Choose CANCEL in next dialog to debug.","C++ Exception Catched",MB_OK); return EXCEPTION_CONTINUE_SEARCH; } #endif #ifdef _DEBUG #define RESTORE_EXCEPTIONFILTER SetUnhandledExceptionFilter(flt); #else #define RESTORE_EXCEPTIONFILTER #endif /** * function is called from eclipse environment and does * apply RenameLocalVar-Refactoring. */ JNIEXPORT void JNICALL Java_org_eclipse_cpprefactoring_internal_EclipseBridge_applyRftaRenameLocaleVariable (JNIEnv * env, jobject this_, jclass dialogclass) { #ifdef _DEBUG SetErrorMode(0); LPTOP_LEVEL_EXCEPTION_FILTER flt = SetUnhandledExceptionFilter(testexc); DebugBreak(); #endif jclass JavaException = 0; EclipseHandler * hdl = 0; try { std::string oldname; hdl = EclipseHandler::createEclipseHandler(env,this_); JavaException = hdl->getJavaExceptionClass(); try { EclipseDocumentHelper& doc = hdl->getActiveDocument(); Refactoring::RenameTempRefactoring refactoring( doc, doc.getSelectionRange().getStartIndex() ); oldname = refactoring.getOldVariableName().c_str(); std::string newname; if (OpenRenameLocalVariableDialog(dialogclass,oldname,newname)) { refactoring.apply( newname ); } EclipseHandler::disposeEclipseHandler(); RESTORE_EXCEPTIONFILTER; return; // back to JAVA } catch ( Refactoring::RefactoringError &e ) { RESTORE_EXCEPTIONFILTER; std::string message( "An error occurred during refactoring:\n" ); message += e.what(); if (JavaException == 0) { /* Unable to find the new exception class, give up. */ hdl->LogMessage(message); return; } EclipseHandler::disposeEclipseHandler(); env->ThrowNew(JavaException, message.c_str() ); return; } } catch (EclipsePluginError& pluginerror) { RESTORE_EXCEPTIONFILTER; hdl = EclipseHandler::getEclipseHandler(); if (hdl==NULL) { JavaException = env->FindClass("java/lang/Exception"); } env->ThrowNew(JavaException, (std::string("Plugin-Error: ")+pluginerror.what()).c_str() ); return; } catch (...) { try { RESTORE_EXCEPTIONFILTER; hdl = EclipseHandler::getEclipseHandler(); if (hdl==NULL) { // TODO: report a problem without the handler return; } env->ExceptionDescribe(); env->ExceptionClear(); hdl->LogMessage("An unexpected exception has occured in CPP-code.\n"); env->ExceptionDescribe(); env->ExceptionClear(); return; } catch (...) { // excection within exception handler -- no chance, // get back to java silently return; } } } /** * function does use the call back routine to open a dialog in eclipse * asking the user for the new variable name * * @return true, if the renaming was ackknowledged by the user */ bool OpenRenameLocalVariableDialog(jclass dialogclass, std::string var2rename,std::string& newname) { EclipseHandler * hdl = EclipseHandler::getEclipseHandler(); jmethodID mid_callback_RenameLocalVariableDialog=0; mid_callback_RenameLocalVariableDialog = hdl->SafeGetStaticMethodID(dialogclass, "callback_userrequest", "(Ljava/lang/String;Ljava/lang/StringBuffer;)Z"); if (mid_callback_RenameLocalVariableDialog==0) return false; try { JNIEnv * env = hdl->getJNIEnv(); jstring oldval = env->NewStringUTF(var2rename.c_str()); jobject newval = hdl->getJavaStringBufferObject(); jboolean ok = env->CallStaticBooleanMethod(dialogclass, mid_callback_RenameLocalVariableDialog, oldval, newval ); newname = hdl->getStringBufferContent(newval); return (ok!=JNI_FALSE); } catch (...) { return false; } } |
From: <net...@us...> - 2003-02-15 13:31:27
|
Update of /cvsroot/cpptool/rfta/src/eclipseplugin/CppBridge In directory sc8-pr-cvs1:/tmp/cvs-serv29481/CppBridge Log Message: Directory /cvsroot/cpptool/rfta/src/eclipseplugin/CppBridge added to the repository |
From: <net...@us...> - 2003-02-15 13:30:55
|
Update of /cvsroot/cpptool/rfta/src/eclipseplugin In directory sc8-pr-cvs1:/tmp/cvs-serv29323 Added Files: .cvsignore eclipseplugin.dsp Log Message: eclipse plugin sources --- NEW FILE: .cvsignore --- *.Tags.WW *.plg *.ncb --- NEW FILE: eclipseplugin.dsp --- # Microsoft Developer Studio Project File - Name="eclipseplugin" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 CFG=eclipseplugin - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "eclipseplugin.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "eclipseplugin.mak" CFG="eclipseplugin - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "eclipseplugin - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "eclipseplugin - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe MTL=midl.exe RSC=rc.exe !IF "$(CFG)" == "eclipseplugin - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "..\..\build\eclipseplugin\Release" # PROP Intermediate_Dir "..\..\build\eclipseplugin\Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ECLIPSEPLUGIN_EXPORTS" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /I "../../include" /I "../../deplib/cppunit/include" /I "../../deplib/boostcvs" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ECLIPSEPLUGIN_EXPORTS" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x407 /d "NDEBUG" # ADD RSC /l 0x407 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 # Begin Special Build Tool ProjDir=. TargetDir=\Projects\Cpptool\rfta\build\eclipseplugin\Release SOURCE="$(InputPath)" PostBuild_Cmds=copy $(TargetDir)\eclipseplugin.dll $(ProjDir)\plugincode\ # End Special Build Tool !ELSEIF "$(CFG)" == "eclipseplugin - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "..\..\build\eclipseplugin\Debug" # PROP Intermediate_Dir "..\..\build\eclipseplugin\Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ECLIPSEPLUGIN_EXPORTS" /YX /FD /GZ /c # ADD CPP /nologo /MTd /W3 /Gm /GR /GX /ZI /Od /I "../../include" /I "../../deplib/cppunit/include" /I "../../deplib/boostcvs" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ECLIPSEPLUGIN_EXPORTS" /YX /FD /GZ /c # SUBTRACT CPP /Fr # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x407 /d "_DEBUG" # ADD RSC /l 0x407 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept # ADD LINK32 rftaparser_mdd.lib rfta_mdd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\build\eclipseplugin\Debug/eclipseplugin_d.dll" /pdbtype:sept /libpath:"../../lib" # Begin Special Build Tool ProjDir=. TargetDir=\Projects\Cpptool\rfta\build\eclipseplugin\Debug SOURCE="$(InputPath)" PostBuild_Cmds=copy $(TargetDir)\eclipseplugin_d.dll $(ProjDir)\plugincode # End Special Build Tool !ENDIF # Begin Target # Name "eclipseplugin - Win32 Release" # Name "eclipseplugin - Win32 Debug" # Begin Group "GeneratedCode" # PROP Default_Filter "" # Begin Group "signatures" # PROP Default_Filter "" # Begin Source File SOURCE=.\GeneratedCode\EclipseBridge.signatures.txt # End Source File # Begin Source File SOURCE=.\GeneratedCode\RefactoringSourceRange.signatures.txt # End Source File # Begin Source File SOURCE=.\GeneratedCode\RefactoringTextDocumentProvider.signatures.txt # End Source File # Begin Source File SOURCE=.\GeneratedCode\RenameLocalVariableDialog.signatures.txt # End Source File # Begin Source File SOURCE=.\GeneratedCode\StringBuffer.signatures.txt # End Source File # End Group # Begin Source File SOURCE=.\GeneratedCode\org_eclipse_cpprefactoring_internal_EclipseBridge.h # End Source File # End Group # Begin Group "Source" # PROP Default_Filter "" # Begin Source File SOURCE=.\CppBridge\EclipseBridge_RenameLocaleVariable.cpp # End Source File # Begin Source File SOURCE=.\CppBridge\EclipseDocumentHelper.cpp # End Source File # Begin Source File SOURCE=.\CppBridge\EclipseDocumentHelper.h # End Source File # Begin Source File SOURCE=.\CppBridge\EclipseHandler.cpp # End Source File # Begin Source File SOURCE=.\CppBridge\EclipseHandler.h # End Source File # Begin Source File SOURCE=.\CppBridge\EclipsePluginError.cpp # End Source File # Begin Source File SOURCE=.\CppBridge\EclipsePluginError.h # End Source File # End Group # End Target # End Project |
From: <net...@us...> - 2003-02-15 13:30:10
|
Update of /cvsroot/cpptool/rfta/src/eclipseplugin In directory sc8-pr-cvs1:/tmp/cvs-serv29032/eclipseplugin Log Message: Directory /cvsroot/cpptool/rfta/src/eclipseplugin added to the repository |
From: <bl...@us...> - 2003-01-31 21:37:57
|
Update of /cvsroot/cpptool/rfta/src/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv4672/src/rfta Modified Files: IdentifierResolverTest.cpp IdentifierResolverTest.h Log Message: * added unit test to demonstrate bug (commented out, need to be fixed) Index: IdentifierResolverTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/IdentifierResolverTest.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IdentifierResolverTest.cpp 20 Dec 2002 19:38:03 -0000 1.4 --- IdentifierResolverTest.cpp 31 Jan 2003 21:37:54 -0000 1.5 *************** *** 241,243 **** --- 241,277 ---- + void + IdentifierResolverTest::testBug1() + { + /* // The last occurrence bigBuffer is not recognized as a local variable (found using the add-in). + { + std::vector<int> bigBuffer; + + { + KTEST_ASSERT_EQUAL( index, bigBuffer[index] ); + } + + } + */ + + + builder_->addKeyingMid( "std::vector<int> ", "bigBuffer", ";", "bigBuffer.0" ); + builder_->add( "{" ); + builder_->addKeyingMid( " KTEST_ASSERT_EQUAL( ", "index", ", ", "index.1" ); + builder_->addKeyingMid( "", "bigBuffer", "[index] );", "bigBuffer.1" ); + builder_->add( "}" ); + + parse(); + strategy_->setRecordMode(); + strategy_->declareLocalVariable( getVariableNode( "bigBuffer.0" ) ); + + strategy_->enterNewLocalVariableScope(); + strategy_->resolveUnqualifiedIdentifier( getIdentifierNode( "index.1" ) ); + strategy_->resolveUnqualifiedIdentifier( getIdentifierNode( "bigBuffer.1" ) ); + strategy_->exitLocalVariableScope(); + + checkResolution(); + } + + } // namespace Refactoring Index: IdentifierResolverTest.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/IdentifierResolverTest.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** IdentifierResolverTest.h 19 Dec 2002 20:17:33 -0000 1.3 --- IdentifierResolverTest.h 31 Jan 2003 21:37:54 -0000 1.4 *************** *** 27,30 **** --- 27,31 ---- CPPUNIT_TEST( testForScope ); CPPUNIT_TEST( testSwitchScope ); + // CPPUNIT_TEST( testBug1 ); CPPUNIT_TEST_SUITE_END(); *************** *** 45,48 **** --- 46,51 ---- void testForScope(); void testSwitchScope(); + + void testBug1(); private: |
From: <bl...@us...> - 2003-01-31 21:37:09
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv4218/src/rftaparser Modified Files: rftaparser.dsp Log Message: * generate symbol in release configuration Index: rftaparser.dsp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/rftaparser.dsp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** rftaparser.dsp 9 Jan 2003 19:43:06 -0000 1.27 --- rftaparser.dsp 31 Jan 2003 21:37:03 -0000 1.28 *************** *** 54,58 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 ! # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\build\rftaparser\Release/rftaparser_mdr.ext" /libpath:"../../deplib/cppunit/lib" # Begin Special Build Tool TargetDir=\prg\vc\Rfta\build\rftaparser\Release --- 54,58 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 ! # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\build\rftaparser\Release/rftaparser_mdr.ext" /libpath:"../../deplib/cppunit/lib" # Begin Special Build Tool TargetDir=\prg\vc\Rfta\build\rftaparser\Release |