mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-19 15:05:36 +02:00
Cosmetics.
This commit is contained in:
parent
03f2299797
commit
e781b4773a
6 changed files with 47 additions and 147 deletions
|
@ -42,9 +42,9 @@ public class ASTRewriteCorrectionProposal extends TUCorrectionProposal {
|
||||||
* @param name the display name of the proposal.
|
* @param name the display name of the proposal.
|
||||||
* @param tu the translation unit that is modified.
|
* @param tu the translation unit that is modified.
|
||||||
* @param rewrite the AST rewrite that is invoked when the proposal is applied or
|
* @param rewrite the AST rewrite that is invoked when the proposal is applied or
|
||||||
* <code>null</code> if {@link #getRewrite()} is overridden.
|
* {@code null} if {@link #getRewrite()} is overridden.
|
||||||
* @param relevance The relevance of this proposal.
|
* @param relevance The relevance of this proposal.
|
||||||
* @param image The image that is displayed for this proposal or <code>null</code> if no
|
* @param image The image that is displayed for this proposal or {@code null} if no
|
||||||
* image is desired.
|
* image is desired.
|
||||||
*/
|
*/
|
||||||
public ASTRewriteCorrectionProposal(String name, ITranslationUnit tu, ASTRewrite rewrite, int relevance, Image image) {
|
public ASTRewriteCorrectionProposal(String name, ITranslationUnit tu, ASTRewrite rewrite, int relevance, Image image) {
|
||||||
|
@ -52,9 +52,6 @@ public class ASTRewriteCorrectionProposal extends TUCorrectionProposal {
|
||||||
fRewrite= rewrite;
|
fRewrite= rewrite;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.internal.ui.text.correction.TUCorrectionProposal#addEdits(org.eclipse.jface.text.IDocument)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void addEdits(IDocument document, TextEdit editRoot) throws CoreException {
|
protected void addEdits(IDocument document, TextEdit editRoot) throws CoreException {
|
||||||
super.addEdits(document, editRoot);
|
super.addEdits(document, editRoot);
|
||||||
|
|
|
@ -12,31 +12,26 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.ui.text.correction.proposals;
|
package org.eclipse.cdt.internal.ui.text.correction.proposals;
|
||||||
|
|
||||||
import com.ibm.icu.text.MessageFormat;
|
|
||||||
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
|
|
||||||
import org.eclipse.swt.graphics.Image;
|
|
||||||
import org.eclipse.swt.graphics.Point;
|
|
||||||
|
|
||||||
import org.eclipse.jface.viewers.StyledString;
|
|
||||||
|
|
||||||
import org.eclipse.jface.text.IDocument;
|
import org.eclipse.jface.text.IDocument;
|
||||||
import org.eclipse.jface.text.IRewriteTarget;
|
import org.eclipse.jface.text.IRewriteTarget;
|
||||||
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension6;
|
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension6;
|
||||||
import org.eclipse.jface.text.contentassist.IContextInformation;
|
import org.eclipse.jface.text.contentassist.IContextInformation;
|
||||||
import org.eclipse.jface.text.link.LinkedModeModel;
|
import org.eclipse.jface.text.link.LinkedModeModel;
|
||||||
|
import org.eclipse.jface.viewers.StyledString;
|
||||||
import org.eclipse.ui.IEditorPart;
|
|
||||||
|
|
||||||
import org.eclipse.ltk.core.refactoring.Change;
|
import org.eclipse.ltk.core.refactoring.Change;
|
||||||
import org.eclipse.ltk.core.refactoring.IUndoManager;
|
import org.eclipse.ltk.core.refactoring.IUndoManager;
|
||||||
import org.eclipse.ltk.core.refactoring.NullChange;
|
import org.eclipse.ltk.core.refactoring.NullChange;
|
||||||
import org.eclipse.ltk.core.refactoring.RefactoringCore;
|
import org.eclipse.ltk.core.refactoring.RefactoringCore;
|
||||||
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
|
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
|
||||||
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
import org.eclipse.swt.graphics.Point;
|
||||||
|
import org.eclipse.ui.IEditorPart;
|
||||||
|
|
||||||
|
import com.ibm.icu.text.MessageFormat;
|
||||||
|
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
import org.eclipse.cdt.ui.text.ICCompletionProposal;
|
import org.eclipse.cdt.ui.text.ICCompletionProposal;
|
||||||
|
@ -65,10 +60,10 @@ public class ChangeCorrectionProposal implements ICCompletionProposal, ICommandA
|
||||||
* Constructs a change correction proposal.
|
* Constructs a change correction proposal.
|
||||||
*
|
*
|
||||||
* @param name The name that is displayed in the proposal selection dialog.
|
* @param name The name that is displayed in the proposal selection dialog.
|
||||||
* @param change The change that is executed when the proposal is applied or <code>null</code>
|
* @param change The change that is executed when the proposal is applied or {@code null}
|
||||||
* if the change will be created by implementors of {@link #createChange()}.
|
* if the change will be created by implementors of {@link #createChange()}.
|
||||||
* @param relevance The relevance of this proposal.
|
* @param relevance The relevance of this proposal.
|
||||||
* @param image The image that is displayed for this proposal or <code>null</code> if no
|
* @param image The image that is displayed for this proposal or {@code null} if no
|
||||||
* image is desired.
|
* image is desired.
|
||||||
*/
|
*/
|
||||||
public ChangeCorrectionProposal(String name, Change change, int relevance, Image image) {
|
public ChangeCorrectionProposal(String name, Change change, int relevance, Image image) {
|
||||||
|
@ -97,9 +92,9 @@ public class ChangeCorrectionProposal implements ICCompletionProposal, ICommandA
|
||||||
/**
|
/**
|
||||||
* Performs the change associated with this proposal.
|
* Performs the change associated with this proposal.
|
||||||
*
|
*
|
||||||
* @param activeEditor The editor currently active or <code>null</code> if no
|
* @param activeEditor The editor currently active or {@code null} if no
|
||||||
* editor is active.
|
* editor is active.
|
||||||
* @param document The document of the editor currently active or <code>null</code> if
|
* @param document The document of the editor currently active or {@code null} if
|
||||||
* no editor is visible.
|
* no editor is visible.
|
||||||
* @throws CoreException Thrown when the invocation of the change failed.
|
* @throws CoreException Thrown when the invocation of the change failed.
|
||||||
*/
|
*/
|
||||||
|
@ -147,9 +142,6 @@ public class ChangeCorrectionProposal implements ICCompletionProposal, ICommandA
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICompletionProposal#getAdditionalProposalInfo()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String getAdditionalProposalInfo() {
|
public String getAdditionalProposalInfo() {
|
||||||
StringBuffer buf= new StringBuffer();
|
StringBuffer buf= new StringBuffer();
|
||||||
|
@ -174,17 +166,11 @@ public class ChangeCorrectionProposal implements ICCompletionProposal, ICommandA
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICompletionProposal#getContextInformation()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IContextInformation getContextInformation() {
|
public IContextInformation getContextInformation() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICompletionProposal#getDisplayString()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String getDisplayString() {
|
public String getDisplayString() {
|
||||||
String shortCutString= CorrectionCommandHandler.getShortCutString(getCommandId());
|
String shortCutString= CorrectionCommandHandler.getShortCutString(getCommandId());
|
||||||
|
@ -194,9 +180,6 @@ public class ChangeCorrectionProposal implements ICCompletionProposal, ICommandA
|
||||||
return getName();
|
return getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension6#getStyledDisplayString()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public StyledString getStyledDisplayString() {
|
public StyledString getStyledDisplayString() {
|
||||||
StyledString str= new StyledString(getName());
|
StyledString str= new StyledString(getName());
|
||||||
|
@ -218,24 +201,18 @@ public class ChangeCorrectionProposal implements ICCompletionProposal, ICommandA
|
||||||
return fName;
|
return fName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICompletionProposal#getImage()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Image getImage() {
|
public Image getImage() {
|
||||||
return fImage;
|
return fImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICompletionProposal#getSelection(IDocument)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Point getSelection(IDocument document) {
|
public Point getSelection(IDocument document) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the proposal's image or <code>null</code> if no image is desired.
|
* Sets the proposal's image or {@code null} if no image is desired.
|
||||||
*
|
*
|
||||||
* @param image the desired image.
|
* @param image the desired image.
|
||||||
*/
|
*/
|
||||||
|
@ -280,9 +257,6 @@ public class ChangeCorrectionProposal implements ICCompletionProposal, ICommandA
|
||||||
fName= name;
|
fName= name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.ui.text.c.ICCompletionProposal#getRelevance()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int getRelevance() {
|
public int getRelevance() {
|
||||||
return fRelevance;
|
return fRelevance;
|
||||||
|
@ -290,24 +264,22 @@ public class ChangeCorrectionProposal implements ICCompletionProposal, ICommandA
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the relevance.
|
* Sets the relevance.
|
||||||
|
*
|
||||||
* @param relevance the relevance to set
|
* @param relevance the relevance to set
|
||||||
*/
|
*/
|
||||||
public void setRelevance(int relevance) {
|
public void setRelevance(int relevance) {
|
||||||
fRelevance= relevance;
|
fRelevance= relevance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.internal.ui.text.correction.IShortcutProposal#getProposalId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String getCommandId() {
|
public String getCommandId() {
|
||||||
return fCommandId;
|
return fCommandId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the proposal id to allow assigning a shortcut to the correction proposal.
|
* Sets the proposal id to allow assigning a shortcut to the correction proposal.
|
||||||
*
|
*
|
||||||
* @param commandId The proposal id for this proposal or <code>null</code> if no command
|
* @param commandId The proposal id for this proposal or {@code null} if no command
|
||||||
* should be assigned to this proposal.
|
* should be assigned to this proposal.
|
||||||
*/
|
*/
|
||||||
public void setCommandId(String commandId) {
|
public void setCommandId(String commandId) {
|
||||||
|
|
|
@ -26,15 +26,14 @@ import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
public class LinkedCorrectionProposal extends ASTRewriteCorrectionProposal {
|
public class LinkedCorrectionProposal extends ASTRewriteCorrectionProposal {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a linked correction proposal.
|
* Constructs a linked correction proposal.
|
||||||
* @param name The display name of the proposal.
|
* @param name The display name of the proposal.
|
||||||
* @param tu The translation unit that is modified.
|
* @param tu The translation unit that is modified.
|
||||||
* @param rewrite The AST rewrite that is invoked when the proposal is applied
|
* @param rewrite The AST rewrite that is invoked when the proposal is applied
|
||||||
* <code>null</code> can be passed if {@link #getRewrite()} is overridden.
|
* {@code null} can be passed if {@link #getRewrite()} is overridden.
|
||||||
* @param relevance The relevance of this proposal.
|
* @param relevance The relevance of this proposal.
|
||||||
* @param image The image that is displayed for this proposal or <code>null</code> if no
|
* @param image The image that is displayed for this proposal or {@code null} if no
|
||||||
* image is desired.
|
* image is desired.
|
||||||
*/
|
*/
|
||||||
public LinkedCorrectionProposal(String name, ITranslationUnit tu, ASTRewrite rewrite,
|
public LinkedCorrectionProposal(String name, ITranslationUnit tu, ASTRewrite rewrite,
|
||||||
|
@ -45,6 +44,7 @@ public class LinkedCorrectionProposal extends ASTRewriteCorrectionProposal {
|
||||||
/**
|
/**
|
||||||
* Adds a linked position to be shown when the proposal is applied. All position with the
|
* Adds a linked position to be shown when the proposal is applied. All position with the
|
||||||
* same group id are linked.
|
* same group id are linked.
|
||||||
|
*
|
||||||
* @param position The position to add.
|
* @param position The position to add.
|
||||||
* @param isFirst If set, the proposal is jumped to first.
|
* @param isFirst If set, the proposal is jumped to first.
|
||||||
* @param groupID The id of the group the proposal belongs to. All proposals in the same group
|
* @param groupID The id of the group the proposal belongs to. All proposals in the same group
|
||||||
|
@ -56,6 +56,7 @@ public class LinkedCorrectionProposal extends ASTRewriteCorrectionProposal {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the end position of the linked mode to the end of the passed range.
|
* Sets the end position of the linked mode to the end of the passed range.
|
||||||
|
*
|
||||||
* @param position The position that describes the end position of the linked mode.
|
* @param position The position that describes the end position of the linked mode.
|
||||||
*/
|
*/
|
||||||
public void setEndPosition(ITrackedNodePosition position) {
|
public void setEndPosition(ITrackedNodePosition position) {
|
||||||
|
@ -64,9 +65,10 @@ public class LinkedCorrectionProposal extends ASTRewriteCorrectionProposal {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a linked position proposal to the group with the given id.
|
* Adds a linked position proposal to the group with the given id.
|
||||||
|
*
|
||||||
* @param groupID The id of the group that should present the proposal
|
* @param groupID The id of the group that should present the proposal
|
||||||
* @param proposal The string to propose.
|
* @param proposal The string to propose.
|
||||||
* @param image The image to show for the position proposal or <code>null</code> if
|
* @param image The image to show for the position proposal or {@code null} if
|
||||||
* no image is desired.
|
* no image is desired.
|
||||||
*/
|
*/
|
||||||
public void addLinkedPositionProposal(String groupID, String proposal, Image image) {
|
public void addLinkedPositionProposal(String groupID, String proposal, Image image) {
|
||||||
|
|
|
@ -62,11 +62,10 @@ import org.eclipse.cdt.internal.ui.text.correction.ICommandAccess;
|
||||||
import org.eclipse.cdt.internal.ui.viewsupport.ColoringLabelProvider;
|
import org.eclipse.cdt.internal.ui.viewsupport.ColoringLabelProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A proposal.allowing user to edit in place all occurrences of a name.
|
* A proposal allowing user to edit in place all occurrences of a name.
|
||||||
*/
|
*/
|
||||||
public class LinkedNamesAssistProposal implements ICCompletionProposal, ICompletionProposalExtension2,
|
public class LinkedNamesAssistProposal implements ICCompletionProposal, ICompletionProposalExtension2,
|
||||||
ICompletionProposalExtension6, ICommandAccess {
|
ICompletionProposalExtension6, ICommandAccess {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An exit policy that skips Backspace and Delete at the beginning and at the end
|
* An exit policy that skips Backspace and Delete at the beginning and at the end
|
||||||
* of a linked position, respectively.
|
* of a linked position, respectively.
|
||||||
|
@ -125,9 +124,6 @@ public class LinkedNamesAssistProposal implements ICCompletionProposal, IComplet
|
||||||
fRelevance= 8;
|
fRelevance= 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension2#apply(org.eclipse.jface.text.ITextViewer, char, int, int)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(final ITextViewer viewer, char trigger, int stateMask, final int offset) {
|
public void apply(final ITextViewer viewer, char trigger, int stateMask, final int offset) {
|
||||||
try {
|
try {
|
||||||
|
@ -138,7 +134,6 @@ public class LinkedNamesAssistProposal implements ICCompletionProposal, IComplet
|
||||||
|
|
||||||
ASTProvider.getASTProvider().runOnAST(fTranslationUnit, ASTProvider.WAIT_ACTIVE_ONLY,
|
ASTProvider.getASTProvider().runOnAST(fTranslationUnit, ASTProvider.WAIT_ACTIVE_ONLY,
|
||||||
new NullProgressMonitor(), new ASTRunnable() {
|
new NullProgressMonitor(), new ASTRunnable() {
|
||||||
|
|
||||||
@Override
|
@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)
|
||||||
|
@ -159,14 +154,13 @@ public class LinkedNamesAssistProposal implements ICCompletionProposal, IComplet
|
||||||
|
|
||||||
// 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
|
@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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the absolute rank of a location. Location preceding <code>offset</code>
|
* Returns the absolute rank of a location. Location preceding {@code offset}
|
||||||
* are ranked last.
|
* are ranked last.
|
||||||
*
|
*
|
||||||
* @param location the location to compute the rank for
|
* @param location the location to compute the rank for
|
||||||
|
@ -174,11 +168,12 @@ public class LinkedNamesAssistProposal implements ICCompletionProposal, IComplet
|
||||||
*/
|
*/
|
||||||
private int rank(IRegion location) {
|
private int rank(IRegion location) {
|
||||||
int relativeRank= location.getOffset() + location.getLength() - offset;
|
int relativeRank= location.getOffset() + location.getLength() - offset;
|
||||||
if (relativeRank < 0)
|
if (relativeRank < 0) {
|
||||||
return Integer.MAX_VALUE + relativeRank;
|
return Integer.MAX_VALUE + relativeRank;
|
||||||
else
|
} else {
|
||||||
return relativeRank;
|
return relativeRank;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
IDocument document= viewer.getDocument();
|
IDocument document= viewer.getDocument();
|
||||||
|
@ -214,46 +209,34 @@ public class LinkedNamesAssistProposal implements ICCompletionProposal, IComplet
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the currently active C editor, or <code>null</code> if it
|
* Returns the currently active C editor, or {@code null} if it cannot be determined.
|
||||||
* cannot be determined.
|
|
||||||
*
|
*
|
||||||
* @return the currently active C editor, or <code>null</code>
|
* @return the currently active C editor, or {@code null}
|
||||||
*/
|
*/
|
||||||
private CEditor getCEditor() {
|
private CEditor getCEditor() {
|
||||||
IEditorPart part= CUIPlugin.getActivePage().getActiveEditor();
|
IEditorPart part= CUIPlugin.getActivePage().getActiveEditor();
|
||||||
if (part instanceof CEditor)
|
if (part instanceof CEditor) {
|
||||||
return (CEditor) part;
|
return (CEditor) part;
|
||||||
else
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICompletionProposal#apply(IDocument)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(IDocument document) {
|
public void apply(IDocument document) {
|
||||||
// can't do anything
|
// can't do anything
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICompletionProposal#getSelection(IDocument)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Point getSelection(IDocument document) {
|
public Point getSelection(IDocument document) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICompletionProposal#getAdditionalProposalInfo()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String getAdditionalProposalInfo() {
|
public String getAdditionalProposalInfo() {
|
||||||
return CorrectionMessages.LinkedNamesAssistProposal_proposalinfo;
|
return CorrectionMessages.LinkedNamesAssistProposal_proposalinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICompletionProposal#getDisplayString()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String getDisplayString() {
|
public String getDisplayString() {
|
||||||
String shortCutString= CorrectionCommandHandler.getShortCutString(getCommandId());
|
String shortCutString= CorrectionCommandHandler.getShortCutString(getCommandId());
|
||||||
|
@ -264,9 +247,6 @@ public class LinkedNamesAssistProposal implements ICCompletionProposal, IComplet
|
||||||
return fLabel;
|
return fLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension6#getStyledDisplayString()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public StyledString getStyledDisplayString() {
|
public StyledString getStyledDisplayString() {
|
||||||
StyledString str= new StyledString(fLabel);
|
StyledString str= new StyledString(fLabel);
|
||||||
|
@ -280,55 +260,34 @@ public class LinkedNamesAssistProposal implements ICCompletionProposal, IComplet
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICompletionProposal#getImage()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Image getImage() {
|
public Image getImage() {
|
||||||
return CDTSharedImages.getImage(CDTSharedImages.IMG_OBJS_CORRECTION_LINKED_RENAME);
|
return CDTSharedImages.getImage(CDTSharedImages.IMG_OBJS_CORRECTION_LINKED_RENAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICompletionProposal#getContextInformation()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IContextInformation getContextInformation() {
|
public IContextInformation getContextInformation() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICCompletionProposal#getRelevance()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int getRelevance() {
|
public int getRelevance() {
|
||||||
return fRelevance;
|
return fRelevance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension2#selected(org.eclipse.jface.text.ITextViewer, boolean)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void selected(ITextViewer textViewer, boolean smartToggle) {
|
public void selected(ITextViewer textViewer, boolean smartToggle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension2#unselected(org.eclipse.jface.text.ITextViewer)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void unselected(ITextViewer textViewer) {
|
public void unselected(ITextViewer textViewer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension2#validate(org.eclipse.jface.text.IDocument, int, org.eclipse.jface.text.DocumentEvent)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean validate(IDocument document, int offset, DocumentEvent event) {
|
public boolean validate(IDocument document, int offset, DocumentEvent event) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.internal.ui.text.correction.ICommandAccess#getCommandId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String getCommandId() {
|
public String getCommandId() {
|
||||||
return ASSIST_ID;
|
return ASSIST_ID;
|
||||||
|
|
|
@ -45,9 +45,6 @@ public class RenameRefactoringProposal implements ICCompletionProposal, IComplet
|
||||||
fRelevance= 8;
|
fRelevance= 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICompletionProposal#apply(IDocument)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(IDocument document) {
|
public void apply(IDocument document) {
|
||||||
CRenameAction action= new CRenameAction();
|
CRenameAction action= new CRenameAction();
|
||||||
|
@ -55,25 +52,16 @@ public class RenameRefactoringProposal implements ICCompletionProposal, IComplet
|
||||||
action.run();
|
action.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICompletionProposal#getSelection(IDocument)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Point getSelection(IDocument document) {
|
public Point getSelection(IDocument document) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICompletionProposal#getAdditionalProposalInfo()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String getAdditionalProposalInfo() {
|
public String getAdditionalProposalInfo() {
|
||||||
return CorrectionMessages.RenameRefactoringProposal_additionalInfo;
|
return CorrectionMessages.RenameRefactoringProposal_additionalInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICompletionProposal#getDisplayString()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String getDisplayString() {
|
public String getDisplayString() {
|
||||||
String shortCutString= CorrectionCommandHandler.getShortCutString(getCommandId());
|
String shortCutString= CorrectionCommandHandler.getShortCutString(getCommandId());
|
||||||
|
@ -84,9 +72,6 @@ public class RenameRefactoringProposal implements ICCompletionProposal, IComplet
|
||||||
return fLabel;
|
return fLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension6#getStyledDisplayString()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public StyledString getStyledDisplayString() {
|
public StyledString getStyledDisplayString() {
|
||||||
StyledString str= new StyledString(fLabel);
|
StyledString str= new StyledString(fLabel);
|
||||||
|
@ -100,41 +85,26 @@ public class RenameRefactoringProposal implements ICCompletionProposal, IComplet
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICompletionProposal#getImage()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Image getImage() {
|
public Image getImage() {
|
||||||
return CDTSharedImages.getImage(CDTSharedImages.IMG_OBJS_CORRECTION_LINKED_RENAME);
|
return CDTSharedImages.getImage(CDTSharedImages.IMG_OBJS_CORRECTION_LINKED_RENAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICompletionProposal#getContextInformation()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IContextInformation getContextInformation() {
|
public IContextInformation getContextInformation() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICCompletionProposal#getRelevance()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int getRelevance() {
|
public int getRelevance() {
|
||||||
return fRelevance;
|
return fRelevance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICCompletionProposal#getIdString()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String getIdString() {
|
public String getIdString() {
|
||||||
return getCommandId();
|
return getCommandId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICommandAccess#getCommandId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String getCommandId() {
|
public String getCommandId() {
|
||||||
return ICEditorActionDefinitionIds.RENAME_ELEMENT;
|
return ICEditorActionDefinitionIds.RENAME_ELEMENT;
|
||||||
|
|
|
@ -63,7 +63,7 @@ import org.eclipse.cdt.internal.ui.viewsupport.LinkedProposalModelPresenter;
|
||||||
* applied to the document when the proposal is evaluated.
|
* applied to the document when the proposal is evaluated.
|
||||||
* <p>
|
* <p>
|
||||||
* The proposal takes care of the preview of the changes as proposal information.
|
* The proposal takes care of the preview of the changes as proposal information.
|
||||||
* </p>
|
*
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
public class TUCorrectionProposal extends ChangeCorrectionProposal {
|
public class TUCorrectionProposal extends ChangeCorrectionProposal {
|
||||||
|
@ -75,11 +75,11 @@ public class TUCorrectionProposal extends ChangeCorrectionProposal {
|
||||||
*
|
*
|
||||||
* @param name the name that is displayed in the proposal selection dialog.
|
* @param name the name that is displayed in the proposal selection dialog.
|
||||||
* @param tu the compilation unit on that the change works.
|
* @param tu the compilation unit on that the change works.
|
||||||
* @param change the change that is executed when the proposal is applied or <code>null</code>
|
* @param change the change that is executed when the proposal is applied or {@code null}
|
||||||
* if implementors override {@link #addEdits(IDocument, TextEdit)} to provide
|
* if implementors override {@link #addEdits(IDocument, TextEdit)} to provide
|
||||||
* the text edits or {@link #createTextChange()} to provide a text change.
|
* the text edits or {@link #createTextChange()} to provide a text change.
|
||||||
* @param relevance the relevance of this proposal.
|
* @param relevance the relevance of this proposal.
|
||||||
* @param image the image that is displayed for this proposal or <code>null</code> if no
|
* @param image the image that is displayed for this proposal or {@code null} if no
|
||||||
* image is desired.
|
* image is desired.
|
||||||
*/
|
*/
|
||||||
public TUCorrectionProposal(String name, ITranslationUnit tu, TextChange change, int relevance, Image image) {
|
public TUCorrectionProposal(String name, ITranslationUnit tu, TextChange change, int relevance, Image image) {
|
||||||
|
@ -92,14 +92,14 @@ public class TUCorrectionProposal extends ChangeCorrectionProposal {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a correction proposal working on a compilation unit.
|
* Constructs a correction proposal working on a compilation unit.
|
||||||
* <p>Users have to override {@link #addEdits(IDocument, TextEdit)} to provide
|
* <p>
|
||||||
|
* Users have to override {@link #addEdits(IDocument, TextEdit)} to provide
|
||||||
* the text edits or {@link #createTextChange()} to provide a text change.
|
* the text edits or {@link #createTextChange()} to provide a text change.
|
||||||
* </p>
|
|
||||||
*
|
*
|
||||||
* @param name The name that is displayed in the proposal selection dialog.
|
* @param name The name that is displayed in the proposal selection dialog.
|
||||||
* @param tu The compilation unit on that the change works.
|
* @param tu The compilation unit on that the change works.
|
||||||
* @param relevance The relevance of this proposal.
|
* @param relevance The relevance of this proposal.
|
||||||
* @param image The image that is displayed for this proposal or <code>null</code> if no
|
* @param image The image that is displayed for this proposal or {@code null} if no
|
||||||
* image is desired.
|
* image is desired.
|
||||||
*/
|
*/
|
||||||
protected TUCorrectionProposal(String name, ITranslationUnit tu, int relevance, Image image) {
|
protected TUCorrectionProposal(String name, ITranslationUnit tu, int relevance, Image image) {
|
||||||
|
@ -380,7 +380,7 @@ public class TUCorrectionProposal extends ChangeCorrectionProposal {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the text change that is invoked when the change is applied.
|
* Returns the text change that is invoked when the change is applied.
|
||||||
*
|
*
|
||||||
* @return returns the text change that is invoked when the change is applied.
|
* @return returns the text change that is invoked when the change is applied.
|
||||||
* @throws CoreException throws an exception if accessing the change failed
|
* @throws CoreException throws an exception if accessing the change failed
|
||||||
|
|
Loading…
Add table
Reference in a new issue