Skip to content

Commit

Permalink
Cleanups.
Browse files Browse the repository at this point in the history
Remove useless:
* casts.
* suppress warnings unchecked.
* @see comments 

Change-Id: I4713e9ddf90195cf1e465b3743f5f0bc7e41d338
Signed-off-by: Alexander Kurtakov <[email protected]>
  • Loading branch information
akurtakov committed Dec 14, 2015
1 parent 34281a9 commit 8a834d5
Show file tree
Hide file tree
Showing 10 changed files with 7 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public IToken evaluate(ICharacterScanner scanner) {
if (c == tagDetector.closedBracket) {
if (tagDetector.bracketNesting > 0) {
tagDetector.bracketNesting--;
return (IToken)fWords.get(endSeq);
return fWords.get(endSeq);
}
return fDefaultToken;
}
Expand All @@ -100,7 +100,7 @@ public IToken evaluate(ICharacterScanner scanner) {

String buffer= fBuffer.toString();

IToken token= (IToken)fWords.get(buffer);
IToken token= fWords.get(buffer);

if (token != null) {
if (buffer.equals(startSeq + GNUMakefileConstants.FUNCTION_CALL) || buffer.equals('$' + startSeq + GNUMakefileConstants.FUNCTION_CALL)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public CElementHyperlinkDetector() {

@Override
public IHyperlink[] detectHyperlinks(final ITextViewer textViewer, final IRegion region, boolean canShowMultipleHyperlinks) {
ITextEditor textEditor= (ITextEditor) getAdapter(ITextEditor.class);
ITextEditor textEditor= getAdapter(ITextEditor.class);
if (region == null || !(textEditor instanceof CEditor))
return null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public void configure(SourceViewerConfiguration configuration) {
if (fMacroExplorationPresenter != null) {
fMacroExplorationPresenter.install(this);
}
String[] defaultIndentPrefixes= (String[])fIndentChars.get(IDocument.DEFAULT_CONTENT_TYPE);
String[] defaultIndentPrefixes= fIndentChars.get(IDocument.DEFAULT_CONTENT_TYPE);
if (defaultIndentPrefixes != null && defaultIndentPrefixes.length > 0) {
final int indentWidth= cConfiguration.getIndentWidth(this);
final boolean useSpaces= cConfiguration.useSpacesOnly(this);
Expand Down Expand Up @@ -409,7 +409,7 @@ public boolean canDoOperation(int operation) {
public void prependTextPresentationListener(ITextPresentationListener listener) {
Assert.isNotNull(listener);

@SuppressWarnings("unchecked") // using list from base class
// using list from base class
List<ITextPresentationListener> textPresentationListeners= fTextPresentationListeners;

if (textPresentationListeners == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public IToken evaluate(ICharacterScanner scanner) {
}
scanner.unread();
}
IToken token = (IToken) fWords.get(fBuffer.toString());
IToken token = fWords.get(fBuffer.toString());
if (token != null)
return token;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int

int length= end - offset;

@SuppressWarnings("unchecked")
final Iterator<TemplateVariableResolver> resolvers = fContextType.resolvers();
while (resolvers.hasNext()) {
TemplateVariableResolver variable= resolvers.next();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1049,12 +1049,8 @@ public ITokenStore createTokenStore(String[] propertyColorNames) {
};
}

/*
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getHyperlinkDetectorTargets(org.eclipse.jface.text.source.ISourceViewer)
*/
@Override
protected Map<String, IAdaptable> getHyperlinkDetectorTargets(ISourceViewer sourceViewer) {
@SuppressWarnings("unchecked")
Map<String, IAdaptable> targets= super.getHyperlinkDetectorTargets(sourceViewer);
targets.put("org.eclipse.cdt.ui.cCode", fTextEditor); //$NON-NLS-1$
return targets;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ public static IBreakpoint getBreakpointFromEditor(ITextEditor editor, IVerticalR
IAnnotationModel annotationModel = editor.getDocumentProvider().getAnnotationModel(editor.getEditorInput());
IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
if (annotationModel != null) {
@SuppressWarnings("unchecked")
Iterator<Annotation> iterator = annotationModel.getAnnotationIterator();
while (iterator.hasNext()) {
Object object = iterator.next();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,6 @@ protected IBreakpoint getBreakpointFromEditor(ITextEditor editor, IVerticalRuler
IAnnotationModel annotationModel = editor.getDocumentProvider().getAnnotationModel(editor.getEditorInput());
IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
if (annotationModel != null) {
@SuppressWarnings("unchecked")
Iterator<Annotation> iterator = annotationModel.getAnnotationIterator();
while (iterator.hasNext()) {
Object object = iterator.next();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2829,11 +2829,7 @@ private void updateTitle() {
*/
protected abstract void closePart();

/*
* @see org.eclipse.jface.text.ITextPresentationListener#applyTextPresentation(org.eclipse.jface.text.TextPresentation)
*/
@Override
@SuppressWarnings("unchecked")
public void applyTextPresentation(TextPresentation textPresentation) {
IRegion coverage = textPresentation.getExtent();
if (coverage == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,33 +65,21 @@ public DsfStepIntoSelectionHyperlink(DsfSourceSelectionResolver selectionResolve
fSelectionResolver = selectionResolver;
}

/**
* @see org.eclipse.jface.text.hyperlink.IHyperlink#getHyperlinkRegion()
*/
@Override
public IRegion getHyperlinkRegion() {
return new Region(fSelection.getOffset(), fSelection.getLength());
}

/**
* @see org.eclipse.jface.text.hyperlink.IHyperlink#getHyperlinkText()
*/
@Override
public String getHyperlinkText() {
return Messages.DsfUIStepIntoEditorSelection;
}

/**
* @see org.eclipse.jface.text.hyperlink.IHyperlink#getTypeLabel()
*/
@Override
public String getTypeLabel() {
return null;
}

/**
* @see org.eclipse.jface.text.hyperlink.IHyperlink#open()
*/
@Override
public void open() {
// Resolve the debug context
Expand All @@ -111,15 +99,10 @@ public void open() {
}
}

/*
* (non-Javadoc)
*
* @see org.eclipse.jface.text.hyperlink.IHyperlinkDetector#detectHyperlinks(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion, boolean)
*/
@Override
public IHyperlink[] detectHyperlinks(ITextViewer textViewer, final IRegion region, boolean canShowMultipleHyperlinks) {
// Only valid in the context of a selection within the CEditor
ITextEditor editor = (ITextEditor) getAdapter(ITextEditor.class);
ITextEditor editor = getAdapter(ITextEditor.class);
if (editor == null || region == null || !(editor instanceof CEditor))
return null;

Expand Down

0 comments on commit 8a834d5

Please sign in to comment.