mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 14:12:10 +02:00
Fix warnings
This commit is contained in:
parent
88c2f4a063
commit
eaeddf5e8b
4 changed files with 18 additions and 32 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007, 2008 Wind River Systems and others.
|
||||
* Copyright (c) 2007, 2009 Wind River Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -107,10 +107,10 @@ public class DisassemblyViewerConfiguration extends TextSourceViewerConfiguratio
|
|||
public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) {
|
||||
IHyperlinkDetector[] inheritedDetectors= super.getHyperlinkDetectors(sourceViewer);
|
||||
|
||||
if (fPart == null)
|
||||
if (fPart == null || inheritedDetectors == null)
|
||||
return inheritedDetectors;
|
||||
|
||||
int inheritedDetectorsLength= inheritedDetectors != null ? inheritedDetectors.length : 0;
|
||||
int inheritedDetectorsLength= inheritedDetectors.length;
|
||||
IHyperlinkDetector[] detectors= new IHyperlinkDetector[inheritedDetectorsLength + 1];
|
||||
detectors[0]= new DisassemblyHyperlinkDetector(fPart);
|
||||
for (int i= 0; i < inheritedDetectorsLength; i++) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007, 2008 Wind River Systems and others.
|
||||
* Copyright (c) 2007, 2009 Wind River Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -55,6 +55,8 @@ public class DisassemblyDocument extends REDDocument {
|
|||
private int fNumberOfInstructions;
|
||||
private double fMeanSizeOfInstructions = 4;
|
||||
|
||||
private long fErrorAlignment = 0x1L;
|
||||
|
||||
public DisassemblyDocument() {
|
||||
super();
|
||||
}
|
||||
|
@ -1020,7 +1022,7 @@ public class DisassemblyDocument extends REDDocument {
|
|||
public AddressRangePosition insertErrorLine(AddressRangePosition pos, BigInteger address, BigInteger length, String line)
|
||||
throws BadLocationException {
|
||||
int hashCode = line.hashCode();
|
||||
final long alignment = 0x1L;
|
||||
final long alignment = fErrorAlignment;
|
||||
if (alignment > 1 && !(pos instanceof ErrorPosition)) {
|
||||
AddressRangePosition before = getPositionOfAddress(address.subtract(BigInteger.ONE));
|
||||
if (before instanceof ErrorPosition && before.hashCode() == hashCode && before.offset + before.length == pos.offset) {
|
||||
|
@ -1050,7 +1052,7 @@ public class DisassemblyDocument extends REDDocument {
|
|||
}
|
||||
}
|
||||
AddressRangePosition after = getPositionOfAddress(address.add(length));
|
||||
if (after instanceof ErrorPosition && after.hashCode() == hashCode && pos.offset + pos.length == after.offset) {
|
||||
if (after instanceof ErrorPosition && after.hashCode() == hashCode && pos != null && pos.offset + pos.length == after.offset) {
|
||||
assert after.fAddressOffset == address.add(length);
|
||||
assert pos.fAddressOffset.add(pos.fAddressLength).compareTo(after.fAddressOffset) == 0;
|
||||
// merge with next error position
|
||||
|
@ -1079,16 +1081,6 @@ public class DisassemblyDocument extends REDDocument {
|
|||
while (length.compareTo(BigInteger.ZERO) > 0) {
|
||||
AddressRangePosition errorPos = new ErrorPosition(0, 0, address, posLen, hashCode);
|
||||
String errorLine = buildDisassemblyLine(address, null, line);
|
||||
// TLEHACK: check for error messages, which occur only temporarily:
|
||||
// "Target is busy. Try again later"
|
||||
// "Cannot Perform requested Operation"
|
||||
if (line.startsWith("Target is busy") || line.startsWith("Cannot perform")) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||
// try again only once...
|
||||
if (!(pos instanceof ErrorPosition)) {
|
||||
errorLine = "...\n"; //$NON-NLS-1$
|
||||
errorPos.fValid = false;
|
||||
}
|
||||
}
|
||||
errorPos.length = errorLine.length();
|
||||
pos = insertAddressRange(pos, errorPos, errorLine, true);
|
||||
addDisassemblyPosition(errorPos);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007, 2008 Wind River Systems and others.
|
||||
* Copyright (c) 2007, 2009 Wind River Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -17,9 +17,7 @@ import org.eclipse.cdt.core.model.ICModel;
|
|||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.ILanguage;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.internal.ui.editor.ITranslationUnitEditorInput;
|
||||
import org.eclipse.cdt.internal.ui.text.CTextTools;
|
||||
import org.eclipse.cdt.internal.ui.util.EditorUtility;
|
||||
import org.eclipse.cdt.ui.CDTUITools;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.cdt.ui.text.AsmSourceViewerConfiguration;
|
||||
import org.eclipse.cdt.ui.text.CSourceViewerConfiguration;
|
||||
|
@ -53,7 +51,6 @@ import org.eclipse.ui.IEditorInput;
|
|||
/**
|
||||
* A presentation creator based on CDT syntax highlighting.
|
||||
*/
|
||||
@SuppressWarnings("restriction")
|
||||
public class CSourcePresentationCreator extends PresentationReconciler implements ISourcePresentationCreator, IPropertyChangeListener {
|
||||
|
||||
/**
|
||||
|
@ -245,10 +242,10 @@ public class CSourcePresentationCreator extends PresentationReconciler implement
|
|||
if (language != null) {
|
||||
fViewer= textViewer;
|
||||
fPreferenceStore= CUIPlugin.getDefault().getCombinedPreferenceStore();
|
||||
CTextTools textTools = CUIPlugin.getDefault().getTextTools();
|
||||
fSourceViewerConfiguration= new CustomCSourceViewerConfiguration(textTools.getColorManager(), fPreferenceStore, language);
|
||||
final IColorManager colorManager= CDTUITools.getColorManager();
|
||||
fSourceViewerConfiguration= new CustomCSourceViewerConfiguration(colorManager, fPreferenceStore, language);
|
||||
setDocumentPartitioning(fSourceViewerConfiguration.getConfiguredDocumentPartitioning(null));
|
||||
initializeDamagerRepairer(storage, textTools.getColorManager(), fPreferenceStore);
|
||||
initializeDamagerRepairer(storage, colorManager, fPreferenceStore);
|
||||
fPreferenceStore.addPropertyChangeListener(this);
|
||||
}
|
||||
}
|
||||
|
@ -364,9 +361,9 @@ public class CSourcePresentationCreator extends PresentationReconciler implement
|
|||
} catch (CModelException e) {
|
||||
}
|
||||
} else {
|
||||
IEditorInput input= EditorUtility.getEditorInputForLocation(storage.getFullPath(), null);
|
||||
if (input instanceof ITranslationUnitEditorInput) {
|
||||
tUnit= ((ITranslationUnitEditorInput)input).getTranslationUnit();
|
||||
IEditorInput input= CDTUITools.getEditorInputForLocation(storage.getFullPath(), null);
|
||||
if (input != null) {
|
||||
tUnit= (ITranslationUnit) input.getAdapter(ITranslationUnit.class);
|
||||
}
|
||||
}
|
||||
if (tUnit != null) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007, 2008 Wind River Systems and others.
|
||||
* Copyright (c) 2007, 2009 Wind River Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -53,7 +53,6 @@ public final class REDTextStore implements ITextStore {
|
|||
fText = text;
|
||||
setName("Swapping editor buffer to disk"); //$NON-NLS-1$
|
||||
setPriority(Job.LONG);
|
||||
// setSystem(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -449,7 +448,6 @@ public final class REDTextStore implements ITextStore {
|
|||
*/
|
||||
private final static class RunSpec {
|
||||
public LinkedRun fRun = null;
|
||||
public int fOrg = -1;
|
||||
public int fOff = -1;
|
||||
public boolean isValid() {
|
||||
return fRun != null;
|
||||
|
@ -529,7 +527,7 @@ public final class REDTextStore implements ITextStore {
|
|||
cur = cur.fNext;
|
||||
}
|
||||
if (pos != 0) {
|
||||
while (pos - curPos <= 0) {
|
||||
while (pos - curPos <= 0 && cur != null) {
|
||||
cur = cur.fPrev;
|
||||
curPos -= cur.fLength;
|
||||
}
|
||||
|
@ -542,7 +540,6 @@ public final class REDTextStore implements ITextStore {
|
|||
spec = fRunSpec;
|
||||
}
|
||||
spec.fRun = cur;
|
||||
spec.fOrg = curPos;
|
||||
spec.fOff = pos - curPos;
|
||||
|
||||
return spec;
|
||||
|
|
Loading…
Add table
Reference in a new issue