IDE More items to Refactor Menu.

git-svn-id: trunk@29728 -
This commit is contained in:
juha 2011-03-05 08:51:53 +00:00
parent edf11b5291
commit e39c717de7
6 changed files with 77 additions and 26 deletions

View File

@ -230,10 +230,6 @@ resourcestring
lisUnitPaths = 'Unit paths';
lisIncludePaths = 'Include paths';
lisSourcePaths = 'Source paths';
lisMenuCompleteCode = 'Complete Code';
lisMenuExtractProc = 'Extract procedure ...';
lisMenuFindIdentifierRefs = 'Find Identifier References ...';
lisMenuRenameIdentifier = 'Rename Identifier ...';
lisMenuInsertGPLNotice = 'GPL notice';
lisMenuInsertLGPLNotice = 'LGPL notice';
@ -2283,11 +2279,6 @@ resourcestring
uemMovePageLeftmost='Move page leftmost';
uemMovePageRightmost='Move page rightmost';
uemRefactor = 'Refactoring';
uemCompleteCode = 'Complete Code';
uemExtractProc = 'Extract Procedure';
uemInvertAssignment = 'Invert Assignment';
uemFindIdentifierReferences = 'Find Identifier References';
uemRenameIdentifier = 'Rename Identifier';
uemEditorproperties='Editor properties';
ueNotImplCap='Not implemented yet';
ueNotImplText='If You can help us to implement this feature, mail to '
@ -2306,8 +2297,6 @@ resourcestring
+'system seems to use it.%sThat means non ASCII characters will probably '
+'be shown incorrect.%sYou can select another font in the editor options.';
lisUEDoNotSho = 'Do not show this message again.';
lisCodeHelpShowEmptyMethods = 'Show empty methods';
lisCodeHelpShowUnusedUnits = 'Show unused units';
uemHighlighter = 'Highlighter';
uemEncoding = 'Encoding';
uemLineEnding = 'Line ending';
@ -2581,7 +2570,7 @@ resourcestring
srkmecFindPrevious = 'Find previous';
srkmecFindInFiles = 'Find in files';
srkmecReplace = 'Replace text';
lisKMFindIncremental = 'Find incremental';
lisKMFindIncremental = 'Find incremental';
srkmecFindProcedureDefinition = 'Find procedure definiton';
srkmecFindProcedureMethod = 'Find procedure method';
srkmecGotoLineNumber = 'Go to line number';
@ -2621,21 +2610,30 @@ resourcestring
// codetools
srkmecWordCompletion = 'Word completion';
srkmecCompletecode = 'Complete code';
lisMenuCompleteCode = 'Complete Code';
srkmecShowCodeContext = 'Show code context';
srkmecExtractProc = 'Extract procedure';
lisMenuExtractProc = 'Extract procedure ...';
srkmecFindIdentifierRefs = 'Find identifier references';
lisMenuFindIdentifierRefs = 'Find Identifier References ...';
srkmecRenameIdentifier = 'Rename identifier';
lisMenuRenameIdentifier = 'Rename Identifier ...';
srkmecInvertAssignment = 'Invert assignment';
uemInvertAssignment = 'Invert Assignment';
srkmecSyntaxCheck = 'Syntax check';
srkmecGuessMisplacedIFDEF = 'Guess misplaced $IFDEF';
srkmecFindDeclaration = 'Find declaration';
srkmecFindBlockOtherEnd = 'Find block other end';
srkmecFindBlockStart = 'Find block start';
srkmecAbstractMethods = 'Abstract methods ...';
srkmecShowAbstractMethods = 'Show abstract methods';
srkmecEmptyMethods = 'Empty methods ...';
srkmecRemoveEmptyMethods = 'Remove empty methods';
srkmecUnusedUnits = 'Unused units ...';
srkmecRemoveUnusedUnits = 'Remove unused units';
srkmecUseProjectUnit = 'Add unit to uses section';
srkmecFindOverloads = 'Find overloads';
srkmecFindOverloadsCapt = 'Find overloads ...';
//Plugin template Edit
srkmecSynPTmplEdNextCell = 'Next Cell';

View File

@ -265,6 +265,10 @@ type
procedure mnuRefactorEncloseBlockClicked(Sender: TObject);
procedure mnuRefactorExtractProcClicked(Sender: TObject);
procedure mnuRefactorInvertAssignmentClicked(Sender: TObject);
procedure mnuRefactorShowAbstractMethodsClicked(Sender: TObject);
procedure mnuRefactorShowEmptyMethodsClicked(Sender: TObject);
procedure mnuRefactorShowUnusedUnitsClicked(Sender: TObject);
procedure mnuRefactorFindOverloadsClicked(Sender: TObject);
// view menu
procedure mnuViewInspectorClicked(Sender: TObject);
@ -2447,6 +2451,13 @@ begin
itmRefactorEncloseBlock.OnClick:=@mnuRefactorEncloseBlockClicked;
itmRefactorExtractProc.OnClick:=@mnuRefactorExtractProcClicked;
itmRefactorInvertAssignment.OnClick:=@mnuRefactorInvertAssignmentClicked;
// itmRefactorMenuAdvanced
itmRefactorShowAbstractMethods.OnClick:=@mnuRefactorShowAbstractMethodsClicked;
itmRefactorShowEmptyMethods.OnClick:=@mnuRefactorShowEmptyMethodsClicked;
itmRefactorShowUnusedUnits.OnClick:=@mnuRefactorShowUnusedUnitsClicked;
{$IFDEF EnableFindOverloads}
itmRefactorFindOverloads.OnClick:=@mnuRefactorFindOverloadsClicked;
{$ENDIF}
end;
end;
@ -3323,8 +3334,7 @@ begin
OnProcessIDECommand(Sender,Command,Result);
end;
function TMainIDE.OnSelectDirectory(const Title, InitialDir: string
): string;
function TMainIDE.OnSelectDirectory(const Title, InitialDir: string): string;
var
Dialog: TSelectDirectoryDialog;
DummyResult: Boolean;
@ -3808,12 +3818,14 @@ begin
SelAvail:=(ASrcEdit<>nil) and (ASrcEdit.SelectionAvailable);
SelEditable:=Editable and SelAvail;
with MainIDEBar do begin
//itmRefactorMenuCodeTools: TIDEMenuSection;
//itmRefactorMenuCodeTools
itmRefactorCompleteCode.Enabled:=Editable;
itmRefactorRenameIdentifier.Enabled:=Editable;
itmRefactorEncloseBlock.Enabled:=SelEditable;
itmRefactorExtractProc.Enabled:=SelEditable;
itmRefactorInvertAssignment.Enabled:=SelEditable;
//itmRefactorMenuAdvanced
//...
end;
end;
@ -17716,6 +17728,26 @@ begin
DoSourceEditorCommand(ecInvertAssignment);
end;
procedure TMainIDE.mnuRefactorShowAbstractMethodsClicked(Sender: TObject);
begin
DoSourceEditorCommand(ecShowAbstractMethods);
end;
procedure TMainIDE.mnuRefactorShowEmptyMethodsClicked(Sender: TObject);
begin
DoSourceEditorCommand(ecRemoveEmptyMethods);
end;
procedure TMainIDE.mnuRefactorShowUnusedUnitsClicked(Sender: TObject);
begin
DoSourceEditorCommand(ecRemoveUnusedUnits);
end;
procedure TMainIDE.mnuRefactorFindOverloadsClicked(Sender: TObject);
begin
DoSourceEditorCommand(ecFindOverloads);
end;
procedure TMainIDE.DoCommand(ACommand: integer);
var
ActiveSourceEditor: TSourceEditor;

View File

@ -187,12 +187,17 @@ type
// refactor menu
//mnuRefactor: TIDEMenuSection;
//itmEditMenuCodeTools: TIDEMenuSection;
//itmRefactorMenuCodeTools: TIDEMenuSection;
itmRefactorCompleteCode: TIDEMenuCommand;
itmRefactorRenameIdentifier: TIDEMenuCommand;
itmRefactorEncloseBlock: TIDEMenuCommand;
itmRefactorExtractProc: TIDEMenuCommand;
itmRefactorInvertAssignment: TIDEMenuCommand;
//itmRefactorMenuAdvanced: TIDEMenuSection;
itmRefactorShowAbstractMethods: TIDEMenuCommand;
itmRefactorShowEmptyMethods: TIDEMenuCommand;
itmRefactorShowUnusedUnits: TIDEMenuCommand;
itmRefactorFindOverloads: TIDEMenuCommand;
// view menu
//mnuView: TIDEMenuSection;

View File

@ -554,7 +554,16 @@ begin
CreateMenuItem(ParentMI,itmRefactorRenameIdentifier,'itmRefactorRenameIdentifier',lisMenuRenameIdentifier);
CreateMenuItem(ParentMI,itmRefactorEncloseBlock,'itmSourceEncloseBlock',lisMenuEncloseSelection);
CreateMenuItem(ParentMI,itmRefactorExtractProc,'itmRefactorExtractProc',lisMenuExtractProc);
CreateMenuItem(ParentMI,itmRefactorInvertAssignment,'InvertAssignment',uemInvertAssignment);
CreateMenuItem(ParentMI,itmRefactorInvertAssignment,'itmInvertAssignment',uemInvertAssignment);
CreateMenuSeparatorSection(mnuRefactor,itmRefactorMenuAdvanced,'itmRefactorMenuAdvanced');
ParentMI:=itmRefactorMenuAdvanced;
CreateMenuItem(ParentMI,itmRefactorShowAbstractMethods,'itmShowAbstractMethods',srkmecAbstractMethods);
CreateMenuItem(ParentMI,itmRefactorShowEmptyMethods,'itmShowEmptyMethods',srkmecEmptyMethods);
CreateMenuItem(ParentMI,itmRefactorShowUnusedUnits,'itmShowUnusedUnits',srkmecUnusedUnits);
{$IFDEF EnableFindOverloads}
CreateMenuItem(ParentMI,itmRefactorFindOverloads,'itmFindOverloads',srkmecFindOverloadsCapt);
{$ENDIF}
end;
end;
@ -932,6 +941,12 @@ begin
itmRefactorEncloseBlock.Command:=GetCommand(ecSelectionEnclose);
itmRefactorExtractProc.Command:=GetCommand(ecExtractProc);
itmRefactorInvertAssignment.Command:=GetCommand(ecInvertAssignment);
itmRefactorShowAbstractMethods.Command:=GetCommand(ecShowAbstractMethods);
itmRefactorShowEmptyMethods.Command:=GetCommand(ecRemoveEmptyMethods);
itmRefactorShowUnusedUnits.Command:=GetCommand(ecRemoveUnusedUnits);
{$IFDEF EnableFindOverloads}
itmRefactorFindOverloads.Command:=GetCommand(ecFindOverloads);
{$ENDIF}
// view menu
itmViewInspector.Command:=GetCommand(ecToggleObjectInsp);

View File

@ -1448,26 +1448,26 @@ begin
AParent:=SrcEditSubMenuRefactor;
SrcEditMenuCompleteCode := RegisterIDEMenuCommand
(AParent,'CompleteCode', uemCompleteCode, nil, @ExecuteIdeMenuClick);
(AParent,'CompleteCode', lisMenuCompleteCode, nil, @ExecuteIdeMenuClick);
SrcEditMenuEncloseSelection := RegisterIDEMenuCommand
(AParent, 'EncloseSelection',lisKMEncloseSelection);
SrcEditMenuRenameIdentifier := RegisterIDEMenuCommand
(AParent, 'RenameIdentifier',uemRenameIdentifier, nil, @ExecuteIdeMenuClick);
(AParent, 'RenameIdentifier',lisMenuRenameIdentifier, nil, @ExecuteIdeMenuClick);
SrcEditMenuFindIdentifierReferences := RegisterIDEMenuCommand
(AParent, 'FindIdentifierReferences',uemFindIdentifierReferences, nil, @ExecuteIdeMenuClick);
(AParent, 'FindIdentifierReferences',lisMenuFindIdentifierRefs, nil, @ExecuteIdeMenuClick);
SrcEditMenuExtractProc := RegisterIDEMenuCommand
(AParent, 'ExtractProc',uemExtractProc, nil, @ExecuteIdeMenuClick);
(AParent, 'ExtractProc',lisMenuExtractProc, nil, @ExecuteIdeMenuClick);
SrcEditMenuInvertAssignment := RegisterIDEMenuCommand
(AParent, 'InvertAssignment',uemInvertAssignment, nil, @ExecuteIdeMenuClick);
SrcEditMenuShowAbstractMethods := RegisterIDEMenuCommand
(AParent, 'ShowAbstractMethods',srkmecShowAbstractMethods, nil, @ExecuteIdeMenuClick);
(AParent, 'ShowAbstractMethods',srkmecAbstractMethods, nil, @ExecuteIdeMenuClick);
SrcEditMenuShowEmptyMethods := RegisterIDEMenuCommand
(AParent, 'ShowEmptyMethods', lisCodeHelpShowEmptyMethods, nil, @ExecuteIdeMenuClick);
(AParent, 'ShowEmptyMethods', srkmecEmptyMethods, nil, @ExecuteIdeMenuClick);
SrcEditMenuShowUnusedUnits := RegisterIDEMenuCommand
(AParent, 'ShowUnusedUnits', lisCodeHelpShowUnusedUnits, nil, @ExecuteIdeMenuClick);
(AParent, 'ShowUnusedUnits', srkmecUnusedUnits, nil, @ExecuteIdeMenuClick);
SrcEditMenuFindOverloads := RegisterIDEMenuCommand
(AParent, 'FindOverloads', srkmecFindOverloads, nil, @ExecuteIdeMenuClick);
{$IFNDEF EnableFindOverloads}
(AParent, 'FindOverloads', srkmecFindOverloadsCapt, nil, @ExecuteIdeMenuClick);
{$IFnDEF EnableFindOverloads}
SrcEditMenuFindOverloads.Visible:=false;
{$ENDIF}
{%endregion}

View File

@ -319,6 +319,7 @@ var
// refactor menu
mnuRefactor: TIDEMenuSection;
itmRefactorMenuCodeTools: TIDEMenuSection;
itmRefactorMenuAdvanced: TIDEMenuSection;
// view menu
mnuView: TIDEMenuSection;