mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 14:55:41 +02:00
@Override annotations.
This commit is contained in:
parent
227294f49a
commit
8c7b24b130
7 changed files with 48 additions and 13 deletions
|
@ -805,6 +805,7 @@ public class ASTManager implements IDisposable {
|
||||||
/**
|
/**
|
||||||
* @see IDisposable#dispose()
|
* @see IDisposable#dispose()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
Assert.isTrue(!fDisposed, "ASTManager.dispose() called more than once"); //$NON-NLS-1$
|
Assert.isTrue(!fDisposed, "ASTManager.dispose() called more than once"); //$NON-NLS-1$
|
||||||
fDisposed = true;
|
fDisposed = true;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.refactoring.rename;
|
package org.eclipse.cdt.internal.ui.refactoring.rename;
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@ import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
|
||||||
|
|
||||||
public class CRefactoringMatchStore {
|
public class CRefactoringMatchStore {
|
||||||
private Map<IFile, IPath> fFileToPathMap= new HashMap<IFile, IPath>();
|
private Map<IFile, IPath> fFileToPathMap= new HashMap<IFile, IPath>();
|
||||||
private Map<IPath, SortedMap<CRefactoringMatch, CRefactoringMatch>> fPathToMatches= new HashMap<IPath, SortedMap<CRefactoringMatch, CRefactoringMatch>>();
|
private Map<IPath, SortedMap<CRefactoringMatch, CRefactoringMatch>> fPathToMatches= new HashMap<IPath, SortedMap<CRefactoringMatch, CRefactoringMatch>>();
|
||||||
|
@ -33,7 +32,8 @@ public class CRefactoringMatchStore {
|
||||||
|
|
||||||
public CRefactoringMatchStore() {
|
public CRefactoringMatchStore() {
|
||||||
fOffsetComparator= new Comparator<CRefactoringMatch>() {
|
fOffsetComparator= new Comparator<CRefactoringMatch>() {
|
||||||
public int compare(CRefactoringMatch o1, CRefactoringMatch o2) {
|
@Override
|
||||||
|
public int compare(CRefactoringMatch o1, CRefactoringMatch o2) {
|
||||||
return o1.getOffset() - o2.getOffset();
|
return o1.getOffset() - o2.getOffset();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -323,7 +323,8 @@ public abstract class CRenameProcessorDelegate {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Collections.sort(fMatches, new Comparator<CRefactoringMatch>() {
|
Collections.sort(fMatches, new Comparator<CRefactoringMatch>() {
|
||||||
public int compare(CRefactoringMatch m1, CRefactoringMatch m2) {
|
@Override
|
||||||
|
public int compare(CRefactoringMatch m1, CRefactoringMatch m2) {
|
||||||
IFile f1= m1.getFile();
|
IFile f1= m1.getFile();
|
||||||
IFile f2= m2.getFile();
|
IFile f2= m2.getFile();
|
||||||
int cmp= f1.getName().compareTo(f2.getName());
|
int cmp= f1.getName().compareTo(f2.getName());
|
||||||
|
|
|
@ -73,8 +73,8 @@ public class CRenameRefactoringInputPage extends UserInputWizardPage {
|
||||||
return (fOptions & options) == options;
|
return (fOptions & options) == options;
|
||||||
}
|
}
|
||||||
|
|
||||||
// overrider
|
@Override
|
||||||
public void createControl(Composite parent) {
|
public void createControl(Composite parent) {
|
||||||
CRenameProcessor processor= getRenameProcessor();
|
CRenameProcessor processor= getRenameProcessor();
|
||||||
fSearchString= processor.getArgument().getName();
|
fSearchString= processor.getArgument().getName();
|
||||||
fOptions= processor.getAvailableOptions();
|
fOptions= processor.getAvailableOptions();
|
||||||
|
@ -226,7 +226,7 @@ public class CRenameRefactoringInputPage extends UserInputWizardPage {
|
||||||
|
|
||||||
private void hookSelectionListeners() {
|
private void hookSelectionListeners() {
|
||||||
fNewName.addModifyListener(new ModifyListener() {
|
fNewName.addModifyListener(new ModifyListener() {
|
||||||
|
@Override
|
||||||
public void modifyText(ModifyEvent e) {
|
public void modifyText(ModifyEvent e) {
|
||||||
onKeyReleaseInNameField();
|
onKeyReleaseInNameField();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* Sergey Prigogin (Google)
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.ui.refactoring.rename;
|
package org.eclipse.cdt.internal.ui.refactoring.rename;
|
||||||
|
|
||||||
import org.eclipse.osgi.util.NLS;
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
@ -93,7 +92,8 @@ import org.eclipse.cdt.internal.ui.preferences.CPluginPreferencePage;
|
||||||
|
|
||||||
public class RenameInformationPopup implements IWidgetTokenKeeper, IWidgetTokenKeeperExtension {
|
public class RenameInformationPopup implements IWidgetTokenKeeper, IWidgetTokenKeeperExtension {
|
||||||
|
|
||||||
private class PopupVisibilityManager implements IPartListener2, ControlListener, MouseListener, KeyListener, ITextListener, IViewportListener {
|
private class PopupVisibilityManager implements IPartListener2, ControlListener, MouseListener,
|
||||||
|
KeyListener, ITextListener, IViewportListener {
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
fEditor.getSite().getWorkbenchWindow().getPartService().addPartListener(this);
|
fEditor.getSite().getWorkbenchWindow().getPartService().addPartListener(this);
|
||||||
|
@ -106,6 +106,7 @@ public class RenameInformationPopup implements IWidgetTokenKeeper, IWidgetTokenK
|
||||||
viewer.addTextListener(this);
|
viewer.addTextListener(this);
|
||||||
viewer.addViewportListener(this);
|
viewer.addViewportListener(this);
|
||||||
fPopup.addDisposeListener(new DisposeListener() {
|
fPopup.addDisposeListener(new DisposeListener() {
|
||||||
|
@Override
|
||||||
public void widgetDisposed(DisposeEvent e) {
|
public void widgetDisposed(DisposeEvent e) {
|
||||||
fEditor.getSite().getWorkbenchWindow().getPartService().removePartListener(PopupVisibilityManager.this);
|
fEditor.getSite().getWorkbenchWindow().getPartService().removePartListener(PopupVisibilityManager.this);
|
||||||
if (!textWidget.isDisposed()) {
|
if (!textWidget.isDisposed()) {
|
||||||
|
@ -129,6 +130,7 @@ public class RenameInformationPopup implements IWidgetTokenKeeper, IWidgetTokenK
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void partActivated(IWorkbenchPartReference partRef) {
|
public void partActivated(IWorkbenchPartReference partRef) {
|
||||||
IWorkbenchPart fPart= fEditor.getEditorSite().getPart();
|
IWorkbenchPart fPart= fEditor.getEditorSite().getPart();
|
||||||
if (partRef.getPart(false) == fPart) {
|
if (partRef.getPart(false) == fPart) {
|
||||||
|
@ -136,12 +138,15 @@ public class RenameInformationPopup implements IWidgetTokenKeeper, IWidgetTokenK
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void partBroughtToTop(IWorkbenchPartReference partRef) {
|
public void partBroughtToTop(IWorkbenchPartReference partRef) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void partClosed(IWorkbenchPartReference partRef) {
|
public void partClosed(IWorkbenchPartReference partRef) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void partDeactivated(IWorkbenchPartReference partRef) {
|
public void partDeactivated(IWorkbenchPartReference partRef) {
|
||||||
IWorkbenchPart fPart= fEditor.getEditorSite().getPart();
|
IWorkbenchPart fPart= fEditor.getEditorSite().getPart();
|
||||||
if (fPopup != null && !fPopup.isDisposed() && partRef.getPart(false) == fPart) {
|
if (fPopup != null && !fPopup.isDisposed() && partRef.getPart(false) == fPart) {
|
||||||
|
@ -149,47 +154,59 @@ public class RenameInformationPopup implements IWidgetTokenKeeper, IWidgetTokenK
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void partHidden(IWorkbenchPartReference partRef) {
|
public void partHidden(IWorkbenchPartReference partRef) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void partInputChanged(IWorkbenchPartReference partRef) {
|
public void partInputChanged(IWorkbenchPartReference partRef) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void partOpened(IWorkbenchPartReference partRef) {
|
public void partOpened(IWorkbenchPartReference partRef) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void partVisible(IWorkbenchPartReference partRef) {
|
public void partVisible(IWorkbenchPartReference partRef) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void controlMoved(ControlEvent e) {
|
public void controlMoved(ControlEvent e) {
|
||||||
updatePopupLocation(true);
|
updatePopupLocation(true);
|
||||||
updateVisibility(); //only for hiding outside editor area
|
updateVisibility(); //only for hiding outside editor area
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void controlResized(ControlEvent e) {
|
public void controlResized(ControlEvent e) {
|
||||||
updatePopupLocation(true);
|
updatePopupLocation(true);
|
||||||
updateVisibility(); //only for hiding outside editor area
|
updateVisibility(); //only for hiding outside editor area
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void mouseDoubleClick(MouseEvent e) {
|
public void mouseDoubleClick(MouseEvent e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void mouseDown(MouseEvent e) {
|
public void mouseDown(MouseEvent e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void mouseUp(MouseEvent e) {
|
public void mouseUp(MouseEvent e) {
|
||||||
updatePopupLocation(false);
|
updatePopupLocation(false);
|
||||||
updateVisibility();
|
updateVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void keyPressed(KeyEvent e) {
|
public void keyPressed(KeyEvent e) {
|
||||||
updatePopupLocation(false);
|
updatePopupLocation(false);
|
||||||
updateVisibility();
|
updateVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void keyReleased(KeyEvent e) {
|
public void keyReleased(KeyEvent e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void textChanged(TextEvent event) {
|
public void textChanged(TextEvent event) {
|
||||||
if (!event.getViewerRedrawState())
|
if (!event.getViewerRedrawState())
|
||||||
return;
|
return;
|
||||||
|
@ -197,6 +214,7 @@ public class RenameInformationPopup implements IWidgetTokenKeeper, IWidgetTokenK
|
||||||
updateVisibility(); //only for hiding outside editor area
|
updateVisibility(); //only for hiding outside editor area
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void viewportChanged(int verticalOffset) {
|
public void viewportChanged(int verticalOffset) {
|
||||||
updatePopupLocation(true);
|
updatePopupLocation(true);
|
||||||
updateVisibility(); //only for hiding outside editor area
|
updateVisibility(); //only for hiding outside editor area
|
||||||
|
@ -309,7 +327,8 @@ public class RenameInformationPopup implements IWidgetTokenKeeper, IWidgetTokenK
|
||||||
|
|
||||||
final Shell editorShell= fEditor.getSite().getShell();
|
final Shell editorShell= fEditor.getSite().getShell();
|
||||||
display.asyncExec(new Runnable() {
|
display.asyncExec(new Runnable() {
|
||||||
// post to UI thread since editor shell only gets activated after popup has lost focus
|
// Post to UI thread since editor shell only gets activated after popup has lost focus
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Shell activeShell= display.getActiveShell();
|
Shell activeShell= display.getActiveShell();
|
||||||
if (activeShell != editorShell) {
|
if (activeShell != editorShell) {
|
||||||
|
@ -322,6 +341,7 @@ public class RenameInformationPopup implements IWidgetTokenKeeper, IWidgetTokenK
|
||||||
|
|
||||||
if (!MAC) { // carbon and cocoa draw their own border...
|
if (!MAC) { // carbon and cocoa draw their own border...
|
||||||
fPopup.addPaintListener(new PaintListener() {
|
fPopup.addPaintListener(new PaintListener() {
|
||||||
|
@Override
|
||||||
public void paintControl(PaintEvent pe) {
|
public void paintControl(PaintEvent pe) {
|
||||||
pe.gc.drawPolygon(getPolygon(true));
|
pe.gc.drawPolygon(getPolygon(true));
|
||||||
}
|
}
|
||||||
|
@ -722,9 +742,12 @@ public class RenameInformationPopup implements IWidgetTokenKeeper, IWidgetTokenK
|
||||||
fMenuManager.setRemoveAllWhenShown(true);
|
fMenuManager.setRemoveAllWhenShown(true);
|
||||||
|
|
||||||
fMenuManager.addMenuListener(new IMenuListener2() {
|
fMenuManager.addMenuListener(new IMenuListener2() {
|
||||||
|
@Override
|
||||||
public void menuAboutToHide(IMenuManager manager) {
|
public void menuAboutToHide(IMenuManager manager) {
|
||||||
fIsMenuUp= false;
|
fIsMenuUp= false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void menuAboutToShow(IMenuManager manager) {
|
public void menuAboutToShow(IMenuManager manager) {
|
||||||
boolean canRefactor= !fRenameLinkedMode.isOriginalName();
|
boolean canRefactor= !fRenameLinkedMode.isOriginalName();
|
||||||
|
|
||||||
|
@ -840,14 +863,17 @@ public class RenameInformationPopup implements IWidgetTokenKeeper, IWidgetTokenK
|
||||||
fEditor.getSite().getShell().setActive();
|
fEditor.getSite().getShell().setActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean requestWidgetToken(IWidgetTokenOwner owner) {
|
public boolean requestWidgetToken(IWidgetTokenOwner owner) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean requestWidgetToken(IWidgetTokenOwner owner, int priority) {
|
public boolean requestWidgetToken(IWidgetTokenOwner owner, int priority) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean setFocus(IWidgetTokenOwner owner) {
|
public boolean setFocus(IWidgetTokenOwner owner) {
|
||||||
if (fToolBar != null && !fToolBar.isDisposed())
|
if (fToolBar != null && !fToolBar.isDisposed())
|
||||||
showMenu(fToolBar);
|
showMenu(fToolBar);
|
||||||
|
|
|
@ -83,6 +83,7 @@ import org.eclipse.cdt.internal.ui.text.correction.proposals.LinkedNamesAssistPr
|
||||||
public class RenameLinkedMode {
|
public class RenameLinkedMode {
|
||||||
|
|
||||||
private class FocusEditingSupport implements IEditingSupport {
|
private class FocusEditingSupport implements IEditingSupport {
|
||||||
|
@Override
|
||||||
public boolean ownsFocusShell() {
|
public boolean ownsFocusShell() {
|
||||||
if (fInfoPopup == null)
|
if (fInfoPopup == null)
|
||||||
return false;
|
return false;
|
||||||
|
@ -97,12 +98,14 @@ public class RenameLinkedMode {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isOriginator(DocumentEvent event, IRegion subjectRegion) {
|
public boolean isOriginator(DocumentEvent event, IRegion subjectRegion) {
|
||||||
return false; //leave on external modification outside positions
|
return false; //leave on external modification outside positions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class EditorSynchronizer implements ILinkedModeListener {
|
private class EditorSynchronizer implements ILinkedModeListener {
|
||||||
|
@Override
|
||||||
public void left(LinkedModeModel model, int flags) {
|
public void left(LinkedModeModel model, int flags) {
|
||||||
linkedModeLeft();
|
linkedModeLeft();
|
||||||
if ((flags & ILinkedModeListener.UPDATE_CARET) != 0) {
|
if ((flags & ILinkedModeListener.UPDATE_CARET) != 0) {
|
||||||
|
@ -110,9 +113,11 @@ public class RenameLinkedMode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void resume(LinkedModeModel model, int flags) {
|
public void resume(LinkedModeModel model, int flags) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void suspend(LinkedModeModel model) {
|
public void suspend(LinkedModeModel model) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -194,7 +199,7 @@ public class RenameLinkedMode {
|
||||||
|
|
||||||
ASTProvider.getASTProvider().runOnAST(fEditor.getInputCElement(), ASTProvider.WAIT_ACTIVE_ONLY,
|
ASTProvider.getASTProvider().runOnAST(fEditor.getInputCElement(), ASTProvider.WAIT_ACTIVE_ONLY,
|
||||||
new NullProgressMonitor(), new ASTRunnable() {
|
new NullProgressMonitor(), new ASTRunnable() {
|
||||||
|
@Override
|
||||||
public IStatus runOnAST(ILanguage lang, IASTTranslationUnit astRoot) throws CoreException {
|
public IStatus runOnAST(ILanguage lang, IASTTranslationUnit astRoot) throws CoreException {
|
||||||
if (astRoot == null)
|
if (astRoot == null)
|
||||||
return Status.CANCEL_STATUS;
|
return Status.CANCEL_STATUS;
|
||||||
|
@ -225,7 +230,7 @@ public class RenameLinkedMode {
|
||||||
|
|
||||||
// Sort the locations starting with the one @ offset.
|
// Sort the locations starting with the one @ offset.
|
||||||
Arrays.sort(fLocations, new Comparator<IRegion>() {
|
Arrays.sort(fLocations, new Comparator<IRegion>() {
|
||||||
|
@Override
|
||||||
public int compare(IRegion n1, IRegion n2) {
|
public int compare(IRegion n1, IRegion n2) {
|
||||||
return rank(n1) - rank(n2);
|
return rank(n1) - rank(n2);
|
||||||
}
|
}
|
||||||
|
@ -384,6 +389,7 @@ public class RenameLinkedMode {
|
||||||
try {
|
try {
|
||||||
if (!fOriginalName.equals(newName)) {
|
if (!fOriginalName.equals(newName)) {
|
||||||
fEditor.getSite().getWorkbenchWindow().run(false, true, new IRunnableWithProgress() {
|
fEditor.getSite().getWorkbenchWindow().run(false, true, new IRunnableWithProgress() {
|
||||||
|
@Override
|
||||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||||
if (viewer instanceof ITextViewerExtension6) {
|
if (viewer instanceof ITextViewerExtension6) {
|
||||||
IUndoManager undoManager= ((ITextViewerExtension6) viewer).getUndoManager();
|
IUndoManager undoManager= ((ITextViewerExtension6) viewer).getUndoManager();
|
||||||
|
|
|
@ -313,7 +313,8 @@ public class TextSearchWrapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
final static Comparator<int[]> COMPARE_FIRST_INTEGER= new Comparator<int[]>() {
|
final static Comparator<int[]> COMPARE_FIRST_INTEGER= new Comparator<int[]>() {
|
||||||
public int compare(int[] o1, int[] o2) {
|
@Override
|
||||||
|
public int compare(int[] o1, int[] o2) {
|
||||||
return (o1)[0] - (o2)[0];
|
return (o1)[0] - (o2)[0];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue