|
From: <bl...@us...> - 2003-05-15 19:14:15
|
Update of /cvsroot/cpptool/rfta/src/rftavc7addin
In directory sc8-pr-cvs1:/tmp/cvs-serv10451/src/rftavc7addin
Modified Files:
Connect.cpp rftavc7addin.vcproj
Log Message:
* added support for inline locale variable and split temporary refactoring.
Index: Connect.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rftavc7addin/Connect.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Connect.cpp 15 May 2003 07:31:43 -0000 1.6
--- Connect.cpp 15 May 2003 19:14:12 -0000 1.7
***************
*** 4,7 ****
--- 4,9 ----
#include "Connect.h"
#include "RenameLocaleVariableDialog.h"
+ #include "RftaInlineLocalVarDialog.h"
+ #include "SplitLocaleVariableDialog.h"
#include "TextSelectionHelper.h"
#include "CommandGroup.h"
***************
*** 128,132 ****
L"Split the selected locale variable declaration",
IDB_SPLITLOCALEVARIABLE );
!
CComPtr<EnvDTE::Command> cmdReduce =
addCommand( *pCommands,
--- 130,134 ----
L"Split the selected locale variable declaration",
IDB_SPLITLOCALEVARIABLE );
! /* // not supported yet
CComPtr<EnvDTE::Command> cmdReduce =
addCommand( *pCommands,
***************
*** 135,139 ****
L"Reduce the scope of the selected local variable",
IDB_REDUCELOCALEVARIABLESCOPE );
!
CComPtr<Office::CommandBar> pToolBar = ensureToolBarExist( *pCommands,
L"C++ Refactoring Assistant",
--- 137,141 ----
L"Reduce the scope of the selected local variable",
IDB_REDUCELOCALEVARIABLESCOPE );
! */
CComPtr<Office::CommandBar> pToolBar = ensureToolBarExist( *pCommands,
L"C++ Refactoring Assistant",
***************
*** 148,184 ****
associateCommand( cmdInline, pToolBar, pMenuBar, index++ );
associateCommand( cmdSplit, pToolBar, pMenuBar, index++ );
! associateCommand( cmdReduce, pToolBar, pMenuBar, index++ );
! /* // The stuff below register the command in a menu named "Tool". We might want to do that too.
!
! CComPtr<Office::_CommandBars> pCommandBars;
! CComPtr<Office::CommandBarControl> pCommandBarControl;
! CComPtr<Office::CommandBar> pMenuBarCommandBar;
!
! // When run, the Add-in wizard prepared the registry for the Add-in.
! // At a later time, the Add-in or its commands may become unavailable for reasons such as:
! // 1) You moved this project to a computer other than which is was originally created on.
! // 2) You chose 'Yes' when presented with a message asking if you wish to remove the Add-in.
! // 3) You add new commands or modify commands already defined.
! // You will need to re-register the Add-in by building the rftavc7addinSetup project,
! // right-clicking the project in the Solution Explorer, and then choosing install.
! // Alternatively, you could execute the ReCreateCommands.reg file the Add-in Wizard generated in
! // the project directory, or run 'devenv /setup' from a command prompt.
! IfFailGoCheck(m_pDTE->get_Commands(&pCommands), pCommands);
! if(SUCCEEDED(pCommands->AddNamedCommand(m_pAddInInstance,
! CComBSTR("RFTARenameLocaleVariable"),
! CComBSTR("RFTARenameLocaleVariable"),
! CComBSTR("Rename the selected locale variable"),
! VARIANT_TRUE,
! 59,
! NULL,
! EnvDTE::vsCommandStatusSupported+EnvDTE::vsCommandStatusEnabled,
! &pCreatedCommand)) && (pCreatedCommand))
! {
! //Add a button to the tools menu bar.
! IfFailGoCheck(m_pDTE->get_CommandBars(&pCommandBars), pCommandBars);
! IfFailGoCheck(pCommandBars->get_Item(CComVariant(L"Tools"), &pMenuBarCommandBar), pMenuBarCommandBar);
! IfFailGoCheck(pCreatedCommand->AddControl(pMenuBarCommandBar, 1, &pCommandBarControl), pCommandBarControl);
! }
! */
return S_OK;
}
--- 150,154 ----
associateCommand( cmdInline, pToolBar, pMenuBar, index++ );
associateCommand( cmdSplit, pToolBar, pMenuBar, index++ );
! // associateCommand( cmdReduce, pToolBar, pMenuBar, index++ );
return S_OK;
}
***************
*** 400,433 ****
AfxMessageBox( message );
- CString msg;
- msg.Format( "Selected range: %s\nSelected Text: %s\nAll Text: %s",
- selectedRange.toString().c_str(),
- document.getTextRange( selectedRange ).c_str(),
- document.getAllText().c_str() );
- AfxMessageBox( msg );
}
-
-
- /*
- CString msg;
- msg.Format( "Selected range: %s\nSelected Text: %s\nAll Text: %s",
- selectedRange.toString().c_str(),
- document.getTextRange( selectedRange ).c_str(),
- document.getAllText().c_str() );
- AfxMessageBox( msg );
-
- Refactoring::SourceRange range( 2, 5 );
- document.replaceTextRange( range, "ABCDE" );
-
- */
- /*
- RenameLocaleVariableDialog dialog;
- dialog.oldName_ = "OldVariableName";
- dialog.newName_ = "NewVariableName";
-
- if ( dialog.DoModal() == IDOK )
- dialog.newName_;
- */
-
}
--- 370,374 ----
***************
*** 436,440 ****
const Refactoring::SourceRange &selectedRange )
{
! AfxMessageBox( "Selected range: " + CString(selectedRange.toString().c_str() ) );
}
--- 377,407 ----
const Refactoring::SourceRange &selectedRange )
{
! try
! {
! Refactoring::InlineTempRefactoring refactoring( document,
! selectedRange.getStartIndex() );
!
! bool addBraces = refactoring.areBracesSuggested();
! RftaInlineLocalVarDialog dialog;
! dialog.m_VariableName = refactoring.getVariableName().c_str();
! dialog.m_AddBraces = addBraces;
!
! if ( dialog.DoModal() == IDOK )
! {
! CString undoName;
! undoName.Format( "Inline locale variable '%s'",
! (LPCTSTR)refactoring.getVariableName().c_str() );
! CommandGroup commands( undoName, m_pDTE );
! refactoring.apply( dialog.m_AddBraces == TRUE );
! commands.validate();
! }
! }
! catch ( Refactoring::RefactoringError &e )
! {
! CString message( "An error occurred during refactoring:\n" );
! message += e.what();
!
! AfxMessageBox( message );
! }
}
***************
*** 443,448 ****
const Refactoring::SourceRange &selectedRange )
{
! AfxMessageBox( "Selected range: " + CString(selectedRange.toString().c_str() ) );
}
void
--- 410,438 ----
const Refactoring::SourceRange &selectedRange )
{
! try
! {
! Refactoring::SplitTempRefactoring refactoring( document,
! selectedRange.getStartIndex() );
!
! SplitLocaleVariableDialog dialog;
! if ( dialog.DoModal() == IDOK )
! {
! CString undoName;
! undoName.Format( "Split locale variable declaration to '%s'",
! LPCTSTR(dialog.m_NewVariableName) );
! CommandGroup commands( undoName, m_pDTE );
! refactoring.apply( LPCTSTR(dialog.m_NewVariableName) );
! commands.validate();
! }
! }
! catch ( Refactoring::RefactoringError &e )
! {
! CString message( "An error occurred during refactoring:\n" );
! message += e.what();
!
! AfxMessageBox( message );
! }
}
+
void
Index: rftavc7addin.vcproj
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rftavc7addin/rftavc7addin.vcproj,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** rftavc7addin.vcproj 15 May 2003 07:31:43 -0000 1.3
--- rftavc7addin.vcproj 15 May 2003 19:14:12 -0000 1.4
***************
*** 160,169 ****
</File>
<File
- RelativePath="Connect.cpp">
- </File>
- <File
- RelativePath="Connect.h">
- </File>
- <File
RelativePath="Resource.h">
</File>
--- 160,163 ----
***************
*** 188,210 ****
</Filter>
<Filter
! Name="Refactoring"
Filter="">
<File
! RelativePath="RenameLocaleVariableDialog.cpp">
</File>
<File
! RelativePath="RenameLocaleVariableDialog.h">
</File>
<File
! RelativePath="RftaInlineLocalVarDialog.cpp">
</File>
<File
! RelativePath="RftaInlineLocalVarDialog.h">
</File>
<File
! RelativePath="SplitLocaleVariableDialog.cpp">
</File>
<File
! RelativePath="SplitLocaleVariableDialog.h">
</File>
</Filter>
--- 182,210 ----
</Filter>
<Filter
! Name="Helpers"
Filter="">
<File
! RelativePath="CommandGroup.cpp">
</File>
<File
! RelativePath="CommandGroup.h">
</File>
<File
! RelativePath="TextDocumentHelper.cpp">
</File>
<File
! RelativePath="TextDocumentHelper.h">
</File>
<File
! RelativePath="TextSelectionHelper.cpp">
</File>
<File
! RelativePath="TextSelectionHelper.h">
! </File>
! <File
! RelativePath="VC7TextDocument.cpp">
! </File>
! <File
! RelativePath="VC7TextDocument.h">
</File>
</Filter>
***************
*** 231,258 ****
</File>
</Filter>
! <File
! RelativePath="CommandGroup.cpp">
! </File>
! <File
! RelativePath="CommandGroup.h">
! </File>
! <File
! RelativePath="TextDocumentHelper.cpp">
! </File>
! <File
! RelativePath="TextDocumentHelper.h">
! </File>
! <File
! RelativePath="TextSelectionHelper.cpp">
! </File>
! <File
! RelativePath="TextSelectionHelper.h">
! </File>
! <File
! RelativePath="VC7TextDocument.cpp">
! </File>
! <File
! RelativePath="VC7TextDocument.h">
! </File>
</Files>
<Globals>
--- 231,266 ----
</File>
</Filter>
! <Filter
! Name="GUI"
! Filter="">
! <File
! RelativePath="RenameLocaleVariableDialog.cpp">
! </File>
! <File
! RelativePath="RenameLocaleVariableDialog.h">
! </File>
! <File
! RelativePath="RftaInlineLocalVarDialog.cpp">
! </File>
! <File
! RelativePath="RftaInlineLocalVarDialog.h">
! </File>
! <File
! RelativePath="SplitLocaleVariableDialog.cpp">
! </File>
! <File
! RelativePath="SplitLocaleVariableDialog.h">
! </File>
! </Filter>
! <Filter
! Name="Commands"
! Filter="">
! <File
! RelativePath="Connect.cpp">
! </File>
! <File
! RelativePath="Connect.h">
! </File>
! </Filter>
</Files>
<Globals>
|