1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 01:36:01 +02:00

Remove warnings caused by change to getAdaptable()

getAdaptable() in 4.5 M6 has changed to use generics, making casting its
result no longer necessary.

Change-Id: Idd943216a925576bb72c784b2c5a2a4b8e8b00d2
Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com>
This commit is contained in:
Marc Khouzam 2015-03-25 10:58:12 -04:00
parent ed97b40808
commit 37890019cb
270 changed files with 463 additions and 462 deletions

View file

@ -53,7 +53,7 @@ public class CygpathTranslator {
for (int i = 0; i < parserRef.length; i++) { for (int i = 0; i < parserRef.length; i++) {
try { try {
IBinaryParser parser = CoreModelUtil.getBinaryParser(parserRef[i]); IBinaryParser parser = CoreModelUtil.getBinaryParser(parserRef[i]);
ICygwinToolsFactroy cygwinToolFactory = (ICygwinToolsFactroy) parser.getAdapter(ICygwinToolsFactroy.class); ICygwinToolsFactroy cygwinToolFactory = parser.getAdapter(ICygwinToolsFactroy.class);
if (cygwinToolFactory != null) { if (cygwinToolFactory != null) {
cygPath = cygwinToolFactory.getCygPath(); cygPath = cygwinToolFactory.getCygPath();
} }

View file

@ -209,7 +209,7 @@ public class LocalTransferDropTargetListener extends AbstractContainerAreaDropAd
continue; continue;
} else if (isConvertibleToFile(element)) { } else if (isConvertibleToFile(element)) {
IAdaptable a = (IAdaptable)element; IAdaptable a = (IAdaptable)element;
IFile file = (IFile)a.getAdapter(IFile.class); IFile file = a.getAdapter(IFile.class);
String fileName = file.getName(); String fileName = file.getName();
String fileLocation = file.getLocation().toString(); String fileLocation = file.getLocation().toString();

View file

@ -44,7 +44,7 @@ public class BuildTargetAction extends AbstractTargetAction {
@Override @Override
public void init(IAction action) { public void init(IAction action) {
bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class); bindingService = PlatformUI.getWorkbench().getService(IBindingService.class);
if (bindingService != null) { if (bindingService != null) {
bindingService.addBindingManagerListener(bindingManagerListener); bindingService.addBindingManagerListener(bindingManagerListener);
String keyBinding = bindingService.getBestActiveBindingFormattedFor(TARGET_BUILD_COMMAND); String keyBinding = bindingService.getBestActiveBindingFormattedFor(TARGET_BUILD_COMMAND);

View file

@ -267,7 +267,7 @@ public class UpdateMakeProjectAction implements IWorkbenchWindowActionDelegate {
if (fSelection instanceof IStructuredSelection) { if (fSelection instanceof IStructuredSelection) {
Object sel = ((IStructuredSelection) fSelection).getFirstElement(); Object sel = ((IStructuredSelection) fSelection).getFirstElement();
if (sel instanceof IAdaptable) { if (sel instanceof IAdaptable) {
IResource res = (IResource) ((IAdaptable) sel).getAdapter(IResource.class); IResource res = ((IAdaptable) sel).getAdapter(IResource.class);
try { try {
if (res instanceof IProject && isOldProject((IProject) res)) { if (res instanceof IProject && isOldProject((IProject) res)) {
enabled = true; enabled = true;

View file

@ -152,7 +152,7 @@ public class MakeView extends ViewPart {
updateActions((IStructuredSelection)fViewer.getSelection()); updateActions((IStructuredSelection)fViewer.getSelection());
bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class); bindingService = PlatformUI.getWorkbench().getService(IBindingService.class);
if (bindingService != null) { if (bindingService != null) {
bindingService.addBindingManagerListener(bindingManagerListener); bindingService.addBindingManagerListener(bindingManagerListener);
} }

View file

@ -61,7 +61,7 @@ class CodanPartListener implements IPartListener2 {
}; };
} }
editor.addPostSaveListener(postSaveListener); editor.addPostSaveListener(postSaveListener);
IResource resource = (IResource) editor.getEditorInput().getAdapter(IResource.class); IResource resource = editor.getEditorInput().getAdapter(IResource.class);
processResource(resource, CheckerLaunchMode.RUN_ON_FILE_OPEN); processResource(resource, CheckerLaunchMode.RUN_ON_FILE_OPEN);
} }
} }

View file

@ -36,7 +36,7 @@ public class ToggleNatureAction implements IObjectActionDelegate {
if (element instanceof IProject) { if (element instanceof IProject) {
project = (IProject) element; project = (IProject) element;
} else if (element instanceof IAdaptable) { } else if (element instanceof IAdaptable) {
project = (IProject) ((IAdaptable) element).getAdapter(IProject.class); project = ((IAdaptable) element).getAdapter(IProject.class);
} }
if (project != null) { if (project != null) {
toggleNature(project, !hasCodanNature(project)); toggleNature(project, !hasCodanNature(project));

View file

@ -72,7 +72,7 @@ public class BuildPropertyPage extends FieldEditorPreferencePage implements IWor
@Override @Override
public IAdaptable getElement() { public IAdaptable getElement() {
if (element.getAdapter(IProject.class) != null) if (element.getAdapter(IProject.class) != null)
return (IProject) element.getAdapter(IProject.class); return element.getAdapter(IProject.class);
return null; return null;
} }

View file

@ -256,7 +256,7 @@ public class CodanPreferencePage extends FieldEditorOverlayPage implements IWork
for (IEditorReference partRef : page.getEditorReferences()) { for (IEditorReference partRef : page.getEditorReferences()) {
IEditorPart editor = partRef.getEditor(false); IEditorPart editor = partRef.getEditor(false);
if (editor instanceof ICEditor) { if (editor instanceof ICEditor) {
IFile file = (IFile) editor.getEditorInput().getAdapter(IFile.class); IFile file = editor.getEditorInput().getAdapter(IFile.class);
if (file != null && resource.getFullPath().isPrefixOf(file.getFullPath())) { if (file != null && resource.getFullPath().isPrefixOf(file.getFullPath())) {
filesToUpdate.add(file); filesToUpdate.add(file);
} }

View file

@ -125,7 +125,7 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage i
if (element == null) if (element == null)
return element; return element;
if (!(element instanceof IProject)) if (!(element instanceof IProject))
return (IAdaptable) element.getAdapter(IProject.class); return element.getAdapter(IProject.class);
return element; return element;
} }

View file

@ -105,7 +105,7 @@ public class ProblemDetails extends ViewPart {
description = new Link(area, SWT.WRAP); description = new Link(area, SWT.WRAP);
description.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); description.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
description.addSelectionListener(linkSelAdapter); description.addSelectionListener(linkSelAdapter);
ISelectionService ser = (ISelectionService) getSite().getService(ISelectionService.class); ISelectionService ser = getSite().getService(ISelectionService.class);
ser.addSelectionListener(new ISelectionListener() { ser.addSelectionListener(new ISelectionListener() {
@Override @Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) { public void selectionChanged(IWorkbenchPart part, ISelection selection) {
@ -125,7 +125,7 @@ public class ProblemDetails extends ViewPart {
Object firstElement = ((IStructuredSelection) selection).getFirstElement(); Object firstElement = ((IStructuredSelection) selection).getFirstElement();
IMarker marker = null; IMarker marker = null;
if (firstElement instanceof IAdaptable) { if (firstElement instanceof IAdaptable) {
marker = (IMarker) ((IAdaptable) firstElement).getAdapter(IMarker.class); marker = ((IAdaptable) firstElement).getAdapter(IMarker.class);
} else if (firstElement instanceof IMarker) { } else if (firstElement instanceof IMarker) {
marker = (IMarker) firstElement; marker = (IMarker) firstElement;
} }

View file

@ -802,7 +802,7 @@ public class IndexUpdateTests extends IndexTestBase {
assertEquals(0, tpars[0].getParameterID()); assertEquals(0, tpars[0].getParameterID());
assertEquals("T", tpars[0].getName()); assertEquals("T", tpars[0].getName());
assertNull(tpars[0].getDefaultValue()); assertNull(tpars[0].getDefaultValue());
pdomid= ((PDOMNode)((IAdaptable) tpars[0]).getAdapter(PDOMNode.class)).getRecord(); pdomid= ((IAdaptable) tpars[0]).getAdapter(PDOMNode.class).getRecord();
} finally { } finally {
fIndex.releaseReadLock(); fIndex.releaseReadLock();
} }
@ -902,7 +902,7 @@ public class IndexUpdateTests extends IndexTestBase {
assertTrue(tpars[0] instanceof ICPPTemplateTypeParameter); assertTrue(tpars[0] instanceof ICPPTemplateTypeParameter);
assertEquals(0, tpars[0].getParameterID()); assertEquals(0, tpars[0].getParameterID());
assertEquals("U", tpars[0].getName()); assertEquals("U", tpars[0].getName());
assertEquals(pdomid, ((PDOMNode)((IAdaptable) tpars[0]).getAdapter(PDOMNode.class)).getBindingID()); assertEquals(pdomid, ((IAdaptable) tpars[0]).getAdapter(PDOMNode.class).getBindingID());
} finally { } finally {
fIndex.releaseReadLock(); fIndex.releaseReadLock();
} }

View file

@ -63,7 +63,7 @@ public class AssemblyLanguage extends AbstractLanguage implements IAsmLanguage,
@Override @Override
public IContributedModelBuilder createModelBuilder(ITranslationUnit tu) { public IContributedModelBuilder createModelBuilder(ITranslationUnit tu) {
IContributedModelBuilder modelBuilder= null; IContributedModelBuilder modelBuilder= null;
IContributedModelBuilder.Factory modelBuilderFactory= (IContributedModelBuilder.Factory)getAdapter(IContributedModelBuilder.Factory.class); IContributedModelBuilder.Factory modelBuilderFactory= getAdapter(IContributedModelBuilder.Factory.class);
if (modelBuilderFactory != null) { if (modelBuilderFactory != null) {
modelBuilder= modelBuilderFactory.create(tu); modelBuilder= modelBuilderFactory.create(tu);
} }

View file

@ -71,7 +71,7 @@ public class Binary extends Openable implements IBinary {
} }
private boolean determineShowInBinaryContainer(IBinaryObject bin) { private boolean determineShowInBinaryContainer(IBinaryObject bin) {
BinaryFilePresentation presentation= (BinaryFilePresentation) bin.getAdapter(BinaryFilePresentation.class); BinaryFilePresentation presentation= bin.getAdapter(BinaryFilePresentation.class);
if (presentation != null) { if (presentation != null) {
return presentation.showInBinaryContainer(); return presentation.showInBinaryContainer();
} }
@ -314,7 +314,7 @@ public class Binary extends Openable implements IBinary {
// Try to get the list of source files used to build the binary from the // Try to get the list of source files used to build the binary from the
// symbol information. // symbol information.
ISymbolReader symbolreader = (ISymbolReader)obj.getAdapter(ISymbolReader.class); ISymbolReader symbolreader = obj.getAdapter(ISymbolReader.class);
if (symbolreader == null) if (symbolreader == null)
return false; return false;

View file

@ -100,10 +100,10 @@ public class CommitWorkingCopyOperation extends CModelOperation {
ITextFileBuffer tuFileBuffer= null; ITextFileBuffer tuFileBuffer= null;
ITextFileBuffer wcFileBuffer= null; ITextFileBuffer wcFileBuffer= null;
if (tuBuffer instanceof IAdaptable) { if (tuBuffer instanceof IAdaptable) {
tuFileBuffer= (ITextFileBuffer) ((IAdaptable) tuBuffer).getAdapter(ITextFileBuffer.class); tuFileBuffer= ((IAdaptable) tuBuffer).getAdapter(ITextFileBuffer.class);
} }
if (wcBuffer instanceof IAdaptable) { if (wcBuffer instanceof IAdaptable) {
wcFileBuffer= (ITextFileBuffer) ((IAdaptable) wcBuffer).getAdapter(ITextFileBuffer.class); wcFileBuffer= ((IAdaptable) wcBuffer).getAdapter(ITextFileBuffer.class);
} }
if (wcFileBuffer != null) { if (wcFileBuffer != null) {

View file

@ -27,7 +27,7 @@ public class TagService implements ITagService {
return null; return null;
// Let the binding adapt to its own tag reader // Let the binding adapt to its own tag reader
ITagReader tagReader = (ITagReader) binding.getAdapter(ITagReader.class); ITagReader tagReader = binding.getAdapter(ITagReader.class);
if (tagReader != null) if (tagReader != null)
return tagReader; return tagReader;

View file

@ -137,7 +137,7 @@ public abstract class ASTNode implements IASTNode {
if (length != 0) { if (length != 0) {
final IASTTranslationUnit tu= getTranslationUnit(); final IASTTranslationUnit tu= getTranslationUnit();
if (tu != null) { if (tu != null) {
ILocationResolver l= (ILocationResolver) tu.getAdapter(ILocationResolver.class); ILocationResolver l= tu.getAdapter(ILocationResolver.class);
if (l != null) { if (l != null) {
locations= l.getLocations(getOffset(), length); locations= l.getLocations(getOffset(), length);
} }
@ -152,7 +152,7 @@ public abstract class ASTNode implements IASTNode {
public IASTImageLocation getImageLocation() { public IASTImageLocation getImageLocation() {
final IASTTranslationUnit tu= getTranslationUnit(); final IASTTranslationUnit tu= getTranslationUnit();
if (tu != null) { if (tu != null) {
ILocationResolver l= (ILocationResolver) tu.getAdapter(ILocationResolver.class); ILocationResolver l= tu.getAdapter(ILocationResolver.class);
if (l != null) { if (l != null) {
return l.getImageLocation(getOffset(), length); return l.getImageLocation(getOffset(), length);
} }
@ -165,7 +165,7 @@ public abstract class ASTNode implements IASTNode {
final IASTFileLocation floc= originalNode.getFileLocation(); final IASTFileLocation floc= originalNode.getFileLocation();
final IASTTranslationUnit ast = originalNode.getTranslationUnit(); final IASTTranslationUnit ast = originalNode.getTranslationUnit();
if (floc != null && ast != null) { if (floc != null && ast != null) {
ILocationResolver lr= (ILocationResolver) ast.getAdapter(ILocationResolver.class); ILocationResolver lr= ast.getAdapter(ILocationResolver.class);
if (lr != null) { if (lr != null) {
return lr.getUnpreprocessedSignature(floc); return lr.getUnpreprocessedSignature(floc);
} }
@ -206,7 +206,7 @@ public abstract class ASTNode implements IASTNode {
} }
IASTTranslationUnit ast = getTranslationUnit(); IASTTranslationUnit ast = getTranslationUnit();
if (ast != null) { if (ast != null) {
ILocationResolver lr= (ILocationResolver) ast.getAdapter(ILocationResolver.class); ILocationResolver lr= ast.getAdapter(ILocationResolver.class);
if (lr != null) { if (lr != null) {
fileLocation= lr.getMappedFileLocation(offset, length); fileLocation= lr.getMappedFileLocation(offset, length);
} else { } else {
@ -221,7 +221,7 @@ public abstract class ASTNode implements IASTNode {
public boolean isPartOfTranslationUnitFile() { public boolean isPartOfTranslationUnitFile() {
IASTTranslationUnit ast = getTranslationUnit(); IASTTranslationUnit ast = getTranslationUnit();
if (ast != null) { if (ast != null) {
ILocationResolver lr= (ILocationResolver) ast.getAdapter(ILocationResolver.class); ILocationResolver lr= ast.getAdapter(ILocationResolver.class);
if (lr != null) { if (lr != null) {
return lr.isPartOfTranslationUnitFile(getOffset()); return lr.isPartOfTranslationUnitFile(getOffset());
} }
@ -232,7 +232,7 @@ public abstract class ASTNode implements IASTNode {
public boolean isPartOfSourceFile() { public boolean isPartOfSourceFile() {
IASTTranslationUnit ast = getTranslationUnit(); IASTTranslationUnit ast = getTranslationUnit();
if (ast != null) { if (ast != null) {
ILocationResolver lr= (ILocationResolver) ast.getAdapter(ILocationResolver.class); ILocationResolver lr= ast.getAdapter(ILocationResolver.class);
if (lr != null) { if (lr != null) {
return lr.isPartOfSourceFile(getOffset()); return lr.isPartOfSourceFile(getOffset());
} }
@ -310,7 +310,7 @@ public abstract class ASTNode implements IASTNode {
if (!(tu instanceof ASTNode)) if (!(tu instanceof ASTNode))
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
ILocationResolver lr= (ILocationResolver) tu.getAdapter(ILocationResolver.class); ILocationResolver lr= tu.getAdapter(ILocationResolver.class);
if (lr == null) if (lr == null)
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
@ -341,7 +341,7 @@ public abstract class ASTNode implements IASTNode {
} }
char[] txt= lr.getUnpreprocessedSignature(total); char[] txt= lr.getUnpreprocessedSignature(total);
Lexer lex= new Lexer(txt, (LexerOptions) tu.getAdapter(LexerOptions.class), ILexerLog.NULL, null); Lexer lex= new Lexer(txt, tu.getAdapter(LexerOptions.class), ILexerLog.NULL, null);
try { try {
Token result= null; Token result= null;
Token last= null; Token last= null;

View file

@ -517,7 +517,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
} }
protected final boolean isOnSameLine(int offset1, int offset2) { protected final boolean isOnSameLine(int offset1, int offset2) {
ILocationResolver lr= (ILocationResolver) getTranslationUnit().getAdapter(ILocationResolver.class); ILocationResolver lr= getTranslationUnit().getAdapter(ILocationResolver.class);
IASTFileLocation floc= lr.getMappedFileLocation(offset1, offset2-offset1+1); IASTFileLocation floc= lr.getMappedFileLocation(offset1, offset2-offset1+1);
return floc.getFileName().equals(lr.getContainingFilePath(offset1)) && return floc.getFileName().equals(lr.getContainingFilePath(offset1)) &&
floc.getStartingLineNumber() == floc.getEndingLineNumber(); floc.getStartingLineNumber() == floc.getEndingLineNumber();

View file

@ -1093,7 +1093,7 @@ public class CVisitor extends ASTQueries {
tu= ((IASTInternalScope) scope).getPhysicalNode().getTranslationUnit(); tu= ((IASTInternalScope) scope).getPhysicalNode().getTranslationUnit();
} }
if (tu != null) { if (tu != null) {
final IIndexFileSet fs= (IIndexFileSet) tu.getAdapter(IIndexFileSet.class); final IIndexFileSet fs= tu.getAdapter(IIndexFileSet.class);
if (fs != null) { if (fs != null) {
fileSet= fs; fileSet= fs;
} }

View file

@ -145,7 +145,7 @@ public class IndexFileSet implements IIndexFileSet {
if (binding instanceof IIndexFragmentBinding) { if (binding instanceof IIndexFragmentBinding) {
fb= (IIndexFragmentBinding) binding; fb= (IIndexFragmentBinding) binding;
} else { } else {
fb= (IIndexFragmentBinding) binding.getAdapter(IIndexFragmentBinding.class); fb= binding.getAdapter(IIndexFragmentBinding.class);
} }
try { try {
if (fb != null && fb.isFileLocal()) { if (fb != null && fb.isFileLocal()) {

View file

@ -229,7 +229,7 @@ class ASTMacroReferenceName extends ASTPreprocessorName {
if (fImageLocationInfo != null) { if (fImageLocationInfo != null) {
IASTTranslationUnit tu= getTranslationUnit(); IASTTranslationUnit tu= getTranslationUnit();
if (tu != null) { if (tu != null) {
LocationMap lr= (LocationMap) tu.getAdapter(LocationMap.class); LocationMap lr= tu.getAdapter(LocationMap.class);
if (lr != null) { if (lr != null) {
return fImageLocationInfo.createLocation(lr, fImageLocationInfo); return fImageLocationInfo.createLocation(lr, fImageLocationInfo);
} }

View file

@ -68,7 +68,7 @@ abstract class ASTPreprocessorNode extends ASTNode {
protected char[] getSource(int offset, int length) { protected char[] getSource(int offset, int length) {
final IASTTranslationUnit ast= getTranslationUnit(); final IASTTranslationUnit ast= getTranslationUnit();
if (ast != null) { if (ast != null) {
ILocationResolver lr= (ILocationResolver) ast.getAdapter(ILocationResolver.class); ILocationResolver lr= ast.getAdapter(ILocationResolver.class);
if (lr != null) { if (lr != null) {
final IASTFileLocation loc= lr.getMappedFileLocation(offset, length); final IASTFileLocation loc= lr.getMappedFileLocation(offset, length);
if (loc != null) { if (loc != null) {
@ -126,7 +126,7 @@ class ASTComment extends ASTPreprocessorNode implements IASTComment {
public int getOffset() { public int getOffset() {
if (fFilePath != null) { if (fFilePath != null) {
// Perform lazy conversion to sequence number. // Perform lazy conversion to sequence number.
ILocationResolver lr= (ILocationResolver) getTranslationUnit().getAdapter(ILocationResolver.class); ILocationResolver lr= getTranslationUnit().getAdapter(ILocationResolver.class);
if (lr != null) { if (lr != null) {
setOffset(lr.getSequenceNumberForFileOffset(fFilePath, super.getOffset())); setOffset(lr.getSequenceNumberForFileOffset(fFilePath, super.getOffset()));
fFilePath= null; fFilePath= null;
@ -552,7 +552,7 @@ class ASTMacroDefinition extends ASTPreprocessorNode implements IASTPreprocessor
if (fExpansionNumber >= 0) { if (fExpansionNumber >= 0) {
IASTTranslationUnit ast = getTranslationUnit(); IASTTranslationUnit ast = getTranslationUnit();
if (ast != null) { if (ast != null) {
ILocationResolver lr= (ILocationResolver) ast.getAdapter(ILocationResolver.class); ILocationResolver lr= ast.getAdapter(ILocationResolver.class);
if (lr != null) { if (lr != null) {
return lr.getMappedFileLocation(fExpansionNumber, getOffset() + getLength() - fExpansionNumber); return lr.getMappedFileLocation(fExpansionNumber, getOffset() + getLength() - fExpansionNumber);
} }

View file

@ -111,14 +111,14 @@ public class MultiMacroExpansionExplorer extends MacroExpansionExplorer {
fDelegates[++didx]= new SingleMacroExpansionExplorer(new String(fSource, from, to - from), fDelegates[++didx]= new SingleMacroExpansionExplorer(new String(fSource, from, to - from),
refs.toArray(new IASTName[refs.size()]), fMacroLocations, refs.toArray(new IASTName[refs.size()]), fMacroLocations,
fFilePath, refLoc.getStartingLineNumber(), isPPCond, fFilePath, refLoc.getStartingLineNumber(), isPPCond,
(LexerOptions) tu.getAdapter(LexerOptions.class)); tu.getAdapter(LexerOptions.class));
} }
} }
fBoundaries[++bidx]= fSource.length; fBoundaries[++bidx]= fSource.length;
} }
private ILocationResolver getResolver(IASTTranslationUnit tu) { private ILocationResolver getResolver(IASTTranslationUnit tu) {
final ILocationResolver resolver = (ILocationResolver) tu.getAdapter(ILocationResolver.class); final ILocationResolver resolver = tu.getAdapter(ILocationResolver.class);
if (resolver == null) { if (resolver == null) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }

View file

@ -1128,7 +1128,7 @@ public class PDOM extends PlatformObject implements IPDOM {
if (binding == null) { if (binding == null) {
return null; return null;
} }
PDOMNode pdomNode= (PDOMNode) binding.getAdapter(PDOMNode.class); PDOMNode pdomNode= binding.getAdapter(PDOMNode.class);
if (pdomNode instanceof IIndexFragmentBinding && pdomNode.getPDOM() == this) { if (pdomNode instanceof IIndexFragmentBinding && pdomNode.getPDOM() == this) {
return (IIndexFragmentBinding) pdomNode; return (IIndexFragmentBinding) pdomNode;
} }

View file

@ -491,7 +491,7 @@ public abstract class PDOMWriter implements IPDOMASTProcessor {
ast.accept(visitor); ast.accept(visitor);
if ((fSkipReferences & SKIP_MACRO_REFERENCES) == 0) { if ((fSkipReferences & SKIP_MACRO_REFERENCES) == 0) {
LocationMap lm= (LocationMap) ast.getAdapter(LocationMap.class); LocationMap lm= ast.getAdapter(LocationMap.class);
if (lm != null) { if (lm != null) {
IASTName[] refs= lm.getMacroReferences(); IASTName[] refs= lm.getMacroReferences();
for (IASTName name : refs) { for (IASTName name : refs) {

View file

@ -204,7 +204,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
} }
protected final PDOMBinding attemptFastAdaptBinding(final IBinding binding) throws CoreException { protected final PDOMBinding attemptFastAdaptBinding(final IBinding binding) throws CoreException {
PDOMBinding pdomBinding= (PDOMBinding) binding.getAdapter(PDOMBinding.class); PDOMBinding pdomBinding= binding.getAdapter(PDOMBinding.class);
// There is no guarantee, that the binding is from the same PDOM object. // There is no guarantee, that the binding is from the same PDOM object.
if (pdomBinding != null && pdomBinding.getPDOM() == getPDOM()) { if (pdomBinding != null && pdomBinding.getPDOM() == getPDOM()) {
return pdomBinding; return pdomBinding;

View file

@ -32,7 +32,7 @@ public class AdapterUtil {
return (T) object; return (T) object;
if (object instanceof IAdaptable) if (object instanceof IAdaptable)
return (T) ((IAdaptable) object).getAdapter(type); return ((IAdaptable) object).getAdapter(type);
return null; return null;
} }

View file

@ -100,7 +100,7 @@ public class CygwinPEBinaryObject extends PEBinaryObject {
} }
private Addr2line getAddr2line() { private Addr2line getAddr2line() {
ICygwinToolsFactroy factory = (ICygwinToolsFactroy)getBinaryParser().getAdapter(ICygwinToolsFactroy.class); ICygwinToolsFactroy factory = getBinaryParser().getAdapter(ICygwinToolsFactroy.class);
if (factory != null) { if (factory != null) {
return factory.getAddr2line(getPath()); return factory.getAddr2line(getPath());
} }
@ -113,7 +113,7 @@ public class CygwinPEBinaryObject extends PEBinaryObject {
* @see org.eclipse.cdt.utils.BinaryObjectAdapter#getCPPFilt() * @see org.eclipse.cdt.utils.BinaryObjectAdapter#getCPPFilt()
*/ */
protected CPPFilt getCPPFilt() { protected CPPFilt getCPPFilt() {
ICygwinToolsFactroy factory = (ICygwinToolsFactroy)getBinaryParser().getAdapter(ICygwinToolsFactroy.class); ICygwinToolsFactroy factory = getBinaryParser().getAdapter(ICygwinToolsFactroy.class);
if (factory != null) { if (factory != null) {
return factory.getCPPFilt(); return factory.getCPPFilt();
} }
@ -126,7 +126,7 @@ public class CygwinPEBinaryObject extends PEBinaryObject {
* @see org.eclipse.cdt.utils.BinaryObjectAdapter#getObjdump() * @see org.eclipse.cdt.utils.BinaryObjectAdapter#getObjdump()
*/ */
protected Objdump getObjdump() { protected Objdump getObjdump() {
ICygwinToolsFactroy factory = (ICygwinToolsFactroy)getBinaryParser().getAdapter(ICygwinToolsFactroy.class); ICygwinToolsFactroy factory = getBinaryParser().getAdapter(ICygwinToolsFactroy.class);
if (factory != null) { if (factory != null) {
return factory.getObjdump(getPath()); return factory.getObjdump(getPath());
} }
@ -134,7 +134,7 @@ public class CygwinPEBinaryObject extends PEBinaryObject {
} }
protected CygPath getCygPath() { protected CygPath getCygPath() {
ICygwinToolsFactroy factory = (ICygwinToolsFactroy)getBinaryParser().getAdapter(ICygwinToolsFactroy.class); ICygwinToolsFactroy factory = getBinaryParser().getAdapter(ICygwinToolsFactroy.class);
if (factory != null) { if (factory != null) {
return factory.getCygPath(); return factory.getCygPath();
} }
@ -144,7 +144,7 @@ public class CygwinPEBinaryObject extends PEBinaryObject {
/** /**
*/ */
protected NM getNM() { protected NM getNM() {
ICygwinToolsFactroy factory = (ICygwinToolsFactroy)getBinaryParser().getAdapter(ICygwinToolsFactroy.class); ICygwinToolsFactroy factory = getBinaryParser().getAdapter(ICygwinToolsFactroy.class);
if (factory != null) { if (factory != null) {
return factory.getNM(getPath()); return factory.getNM(getPath());
} }

View file

@ -97,7 +97,7 @@ public class GNUElfBinaryObject extends ElfBinaryObject {
} }
private Addr2line getAddr2line() { private Addr2line getAddr2line() {
IGnuToolFactory factory = (IGnuToolFactory)getBinaryParser().getAdapter(IGnuToolFactory.class); IGnuToolFactory factory = getBinaryParser().getAdapter(IGnuToolFactory.class);
if (factory != null) { if (factory != null) {
return factory.getAddr2line(getPath()); return factory.getAddr2line(getPath());
} }
@ -105,7 +105,7 @@ public class GNUElfBinaryObject extends ElfBinaryObject {
} }
protected CPPFilt getCPPFilt() { protected CPPFilt getCPPFilt() {
IGnuToolFactory factory = (IGnuToolFactory)getBinaryParser().getAdapter(IGnuToolFactory.class); IGnuToolFactory factory = getBinaryParser().getAdapter(IGnuToolFactory.class);
if (factory != null) { if (factory != null) {
return factory.getCPPFilt(); return factory.getCPPFilt();
} }
@ -113,7 +113,7 @@ public class GNUElfBinaryObject extends ElfBinaryObject {
} }
protected Objdump getObjdump() { protected Objdump getObjdump() {
IGnuToolFactory factory = (IGnuToolFactory)getBinaryParser().getAdapter(IGnuToolFactory.class); IGnuToolFactory factory = getBinaryParser().getAdapter(IGnuToolFactory.class);
if (factory != null) { if (factory != null) {
return factory.getObjdump(getPath()); return factory.getObjdump(getPath());
} }

View file

@ -287,7 +287,7 @@ public class SOMBinaryObject extends BinaryObjectAdapter {
* @return * @return
*/ */
private Addr2line getAddr2line() { private Addr2line getAddr2line() {
IGnuToolFactory factory = (IGnuToolFactory)getBinaryParser().getAdapter(IGnuToolFactory.class); IGnuToolFactory factory = getBinaryParser().getAdapter(IGnuToolFactory.class);
if (factory != null) { if (factory != null) {
return factory.getAddr2line(getPath()); return factory.getAddr2line(getPath());
} }
@ -295,7 +295,7 @@ public class SOMBinaryObject extends BinaryObjectAdapter {
} }
protected CPPFilt getCPPFilt() { protected CPPFilt getCPPFilt() {
IGnuToolFactory factory = (IGnuToolFactory)getBinaryParser().getAdapter(IGnuToolFactory.class); IGnuToolFactory factory = getBinaryParser().getAdapter(IGnuToolFactory.class);
if (factory != null) { if (factory != null) {
return factory.getCPPFilt(); return factory.getCPPFilt();
} }
@ -303,7 +303,7 @@ public class SOMBinaryObject extends BinaryObjectAdapter {
} }
protected Objdump getObjdump() { protected Objdump getObjdump() {
IGnuToolFactory factory = (IGnuToolFactory)getBinaryParser().getAdapter(IGnuToolFactory.class); IGnuToolFactory factory = getBinaryParser().getAdapter(IGnuToolFactory.class);
if (factory != null) { if (factory != null) {
return factory.getObjdump(getPath()); return factory.getObjdump(getPath());
} }

View file

@ -279,7 +279,7 @@ public class XCOFFBinaryObject extends BinaryObjectAdapter {
* @return * @return
*/ */
private Addr2line getAddr2line() { private Addr2line getAddr2line() {
IGnuToolFactory factory = (IGnuToolFactory)getBinaryParser().getAdapter(IGnuToolFactory.class); IGnuToolFactory factory = getBinaryParser().getAdapter(IGnuToolFactory.class);
if (factory != null) { if (factory != null) {
return factory.getAddr2line(getPath()); return factory.getAddr2line(getPath());
} }
@ -287,7 +287,7 @@ public class XCOFFBinaryObject extends BinaryObjectAdapter {
} }
private CPPFilt getCPPFilt() { private CPPFilt getCPPFilt() {
IGnuToolFactory factory = (IGnuToolFactory)getBinaryParser().getAdapter(IGnuToolFactory.class); IGnuToolFactory factory = getBinaryParser().getAdapter(IGnuToolFactory.class);
if (factory != null) { if (factory != null) {
return factory.getCPPFilt(); return factory.getCPPFilt();
} }
@ -295,7 +295,7 @@ public class XCOFFBinaryObject extends BinaryObjectAdapter {
} }
private Objdump getObjdump() { private Objdump getObjdump() {
IGnuToolFactory factory = (IGnuToolFactory)getBinaryParser().getAdapter(IGnuToolFactory.class); IGnuToolFactory factory = getBinaryParser().getAdapter(IGnuToolFactory.class);
if (factory != null) { if (factory != null) {
return factory.getObjdump(getPath()); return factory.getObjdump(getPath());
} }

View file

@ -30,7 +30,7 @@ public class CActionFilter implements IActionFilter {
ICElement element = (ICElement) target; ICElement element = (ICElement) target;
IResource resource = element.getResource(); IResource resource = element.getResource();
if (resource != null) { if (resource != null) {
IActionFilter filter = (IActionFilter) resource.getAdapter(IActionFilter.class); IActionFilter filter = resource.getAdapter(IActionFilter.class);
if (filter != null) { if (filter != null) {
return filter.testAttribute(resource, name, value); return filter.testAttribute(resource, name, value);
} }

View file

@ -198,7 +198,7 @@ public abstract class BlockCommentAction extends TextEditorAction {
else else
return; return;
IRewriteTarget target= (IRewriteTarget)editor.getAdapter(IRewriteTarget.class); IRewriteTarget target= editor.getAdapter(IRewriteTarget.class);
if (target != null) { if (target != null) {
target.beginCompoundChange(); target.beginCompoundChange();
} }

View file

@ -134,7 +134,7 @@ public class DeleteResConfigsHandler extends AbstractHandler {
if (editor != null) { if (editor != null) {
IEditorInput input = editor.getEditorInput(); IEditorInput input = editor.getEditorInput();
if (input != null) if (input != null)
return (IFile) input.getAdapter(IFile.class); return input.getAdapter(IFile.class);
} }
} }
} }

View file

@ -153,7 +153,7 @@ public class ExcludeFromBuildHandler extends AbstractHandler {
if (editor != null) { if (editor != null) {
IEditorInput input = editor.getEditorInput(); IEditorInput input = editor.getEditorInput();
if (input != null) if (input != null)
return (IFile) input.getAdapter(IFile.class); return input.getAdapter(IFile.class);
} }
} }
} }

View file

@ -73,7 +73,7 @@ public class FindWordAction extends TextEditorAction {
if (document == null) if (document == null)
return; return;
IResource resource = (IResource)(input).getAdapter(IResource.class); IResource resource = (input).getAdapter(IResource.class);
if (resource == null || !(resource instanceof IFile)) if (resource == null || !(resource instanceof IFile))
return; return;

View file

@ -77,7 +77,7 @@ public class GotoNextBookmarkAction extends TextEditorAction {
if (input == null) if (input == null)
return; return;
IResource resource = (IResource)(input).getAdapter(IResource.class); IResource resource = (input).getAdapter(IResource.class);
if (resource == null || !(resource instanceof IFile)) if (resource == null || !(resource instanceof IFile))
return; return;

View file

@ -115,7 +115,7 @@ public class IndentAction extends TextEditorAction {
Runnable runnable= new Runnable() { Runnable runnable= new Runnable() {
@Override @Override
public void run() { public void run() {
IRewriteTarget target= (IRewriteTarget) getTextEditor().getAdapter(IRewriteTarget.class); IRewriteTarget target= getTextEditor().getAdapter(IRewriteTarget.class);
if (target != null) if (target != null)
target.beginCompoundChange(); target.beginCompoundChange();

View file

@ -91,7 +91,7 @@ public class SelectionConverter {
if (e instanceof ICElement) { if (e instanceof ICElement) {
converted.add(e); converted.add(e);
} else if (e instanceof IAdaptable) { } else if (e instanceof IAdaptable) {
ICElement c = (ICElement) ((IAdaptable) e).getAdapter(ICElement.class); ICElement c = ((IAdaptable) e).getAdapter(ICElement.class);
if (c != null) { if (c != null) {
converted.add(c); converted.add(c);
} else if (keepNonCElements) } else if (keepNonCElements)
@ -112,7 +112,7 @@ public class SelectionConverter {
if (e instanceof IResource) { if (e instanceof IResource) {
converted.add(e); converted.add(e);
} else if (e instanceof IAdaptable) { } else if (e instanceof IAdaptable) {
IResource r = (IResource) ((IAdaptable) e).getAdapter(IResource.class); IResource r = ((IAdaptable) e).getAdapter(IResource.class);
if (r != null) { if (r != null) {
converted.add(r); converted.add(r);
} }
@ -128,7 +128,7 @@ public class SelectionConverter {
Object next = resources.next(); Object next = resources.next();
if (next instanceof IAdaptable) { if (next instanceof IAdaptable) {
IAdaptable element = (IAdaptable) next; IAdaptable element = (IAdaptable) next;
IResource resource = (IResource) element.getAdapter(IResource.class); IResource resource = element.getAdapter(IResource.class);
if (resource == null) { if (resource == null) {
return false; return false;
@ -160,7 +160,7 @@ public class SelectionConverter {
while (adaptables.hasNext()) { while (adaptables.hasNext()) {
Object next = adaptables.next(); Object next = adaptables.next();
if (next instanceof IAdaptable) { if (next instanceof IAdaptable) {
IResource resource = (IResource) ((IAdaptable) next).getAdapter(IResource.class); IResource resource = ((IAdaptable) next).getAdapter(IResource.class);
if (resource == null) { if (resource == null) {
return null; return null;
} else if (resourceIsType(resource, resourceMask)) { } else if (resourceIsType(resource, resourceMask)) {

View file

@ -468,7 +468,7 @@ public class BuildConsolePage extends Page
if (input instanceof IResource) { if (input instanceof IResource) {
resource = (IResource)input; resource = (IResource)input;
} else { } else {
resource = (IResource)input.getAdapter(IResource.class); resource = input.getAdapter(IResource.class);
} }
if (resource != null) { if (resource != null) {
project = resource.getProject(); project = resource.getProject();

View file

@ -60,7 +60,7 @@ public class CHDropTargetListener implements DropTargetListener {
return (ICElement) element; return (ICElement) element;
} }
if (element instanceof IAdaptable) { if (element instanceof IAdaptable) {
ICElement adapter= (ICElement) ((IAdaptable) element).getAdapter(ICElement.class); ICElement adapter= ((IAdaptable) element).getAdapter(ICElement.class);
if (adapter != null) { if (adapter != null) {
return adapter; return adapter;
} }

View file

@ -217,7 +217,7 @@ public class CHViewPart extends ViewPart {
createActions(); createActions();
createContextMenu(); createContextMenu();
bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class); bindingService = PlatformUI.getWorkbench().getService(IBindingService.class);
if (bindingService != null) { if (bindingService != null) {
bindingManagerListener = new IBindingManagerListener() { bindingManagerListener = new IBindingManagerListener() {
@Override @Override
@ -237,7 +237,7 @@ public class CHViewPart extends ViewPart {
initializeActionStates(); initializeActionStates();
IContextService ctxService = (IContextService) getSite().getService(IContextService.class); IContextService ctxService = getSite().getService(IContextService.class);
if (ctxService != null) { if (ctxService != null) {
fContextActivation= ctxService.activateContext(CUIPlugin.CVIEWS_SCOPE); fContextActivation= ctxService.activateContext(CUIPlugin.CVIEWS_SCOPE);
} }
@ -281,7 +281,7 @@ public class CHViewPart extends ViewPart {
@Override @Override
public void dispose() { public void dispose() {
if (fContextActivation != null) { if (fContextActivation != null) {
IContextService ctxService = (IContextService)getSite().getService(IContextService.class); IContextService ctxService = getSite().getService(IContextService.class);
if (ctxService != null) { if (ctxService != null) {
ctxService.deactivateContext(fContextActivation); ctxService.deactivateContext(fContextActivation);
} }

View file

@ -66,7 +66,7 @@ public class BuildGroup extends CViewActionGroup {
public void run() { public void run() {
// Ensure we correctly save files in all referenced projects before build // Ensure we correctly save files in all referenced projects before build
Set<IProject> prjs = new HashSet<IProject>(); Set<IProject> prjs = new HashSet<IProject>();
for (IResource resource : (List<IResource>)getSelectedResources()) { for (IResource resource : getSelectedResources()) {
IProject project = resource.getProject(); IProject project = resource.getProject();
if (project != null) { if (project != null) {
prjs.add(project); prjs.add(project);
@ -183,7 +183,7 @@ public class BuildGroup extends CViewActionGroup {
if (next instanceof IProject) { if (next instanceof IProject) {
project = (IProject) next; project = (IProject) next;
} else if (next instanceof IAdaptable) { } else if (next instanceof IAdaptable) {
IResource res = (IResource)((IAdaptable)next).getAdapter(IResource.class); IResource res = ((IAdaptable)next).getAdapter(IResource.class);
if (res instanceof IProject) { if (res instanceof IProject) {
project = (IProject) res; project = (IProject) res;
} }

View file

@ -577,7 +577,7 @@ public class CView extends ViewPart implements ISetSelectionTarget, IPropertyCha
} }
memento = null; memento = null;
IContextService ctxService = (IContextService) getSite().getService(IContextService.class); IContextService ctxService = getSite().getService(IContextService.class);
if (ctxService != null) { if (ctxService != null) {
fContextActivation= ctxService.activateContext(CUIPlugin.CVIEWS_SCOPE); fContextActivation= ctxService.activateContext(CUIPlugin.CVIEWS_SCOPE);
} }
@ -607,7 +607,7 @@ public class CView extends ViewPart implements ISetSelectionTarget, IPropertyCha
@Override @Override
public void dispose() { public void dispose() {
if (fContextActivation != null) { if (fContextActivation != null) {
IContextService ctxService = (IContextService)getSite().getService(IContextService.class); IContextService ctxService = getSite().getService(IContextService.class);
if (ctxService != null) { if (ctxService != null) {
ctxService.deactivateContext(fContextActivation); ctxService.deactivateContext(fContextActivation);
} }
@ -742,7 +742,7 @@ public class CView extends ViewPart implements ISetSelectionTarget, IPropertyCha
return ((IResource) o).getFullPath().makeRelative().toString(); return ((IResource) o).getFullPath().makeRelative().toString();
} else if (o instanceof ICElement) { } else if (o instanceof ICElement) {
ICElement celement = (ICElement) o; ICElement celement = (ICElement) o;
IResource res = (IResource) celement.getAdapter(IResource.class); IResource res = celement.getAdapter(IResource.class);
if (res != null) { if (res != null) {
return res.getFullPath().toString(); return res.getFullPath().toString();
} else if (celement.getElementType() == ICElement.C_VCONTAINER) { } else if (celement.getElementType() == ICElement.C_VCONTAINER) {
@ -1085,7 +1085,7 @@ public class CView extends ViewPart implements ISetSelectionTarget, IPropertyCha
} }
IEditorInput input = (IEditorInput) context.getInput(); IEditorInput input = (IEditorInput) context.getInput();
if (input != null) { if (input != null) {
IResource res = (IResource) input.getAdapter(IResource.class); IResource res = input.getAdapter(IResource.class);
if (res != null) { if (res != null) {
selectReveal(new StructuredSelection(res)); selectReveal(new StructuredSelection(res));
return true; return true;

View file

@ -99,7 +99,7 @@ public class GotoActionGroup extends CViewActionGroup {
if (selection.size() == 1) { if (selection.size() == 1) {
Object object = selection.getFirstElement(); Object object = selection.getFirstElement();
if (object instanceof IAdaptable) { if (object instanceof IAdaptable) {
IResource resource = (IResource)((IAdaptable)object).getAdapter(IResource.class); IResource resource = ((IAdaptable)object).getAdapter(IResource.class);
if (resource instanceof IProject) { if (resource instanceof IProject) {
enable = ((IProject) resource).isOpen(); enable = ((IProject) resource).isOpen();
} else if (resource instanceof IFolder) { } else if (resource instanceof IFolder) {

View file

@ -263,7 +263,7 @@ public class MainActionGroup extends CViewActionGroup {
Object obj = selection.getFirstElement(); Object obj = selection.getFirstElement();
if (obj instanceof IAdaptable) { if (obj instanceof IAdaptable) {
IAdaptable element = (IAdaptable) obj; IAdaptable element = (IAdaptable) obj;
IResource resource = (IResource) element.getAdapter(IResource.class); IResource resource = element.getAdapter(IResource.class);
if (resource instanceof IFile) { if (resource instanceof IFile) {
addBookmarkAction.selectionChanged(selection); addBookmarkAction.selectionChanged(selection);
menu.add(addBookmarkAction); menu.add(addBookmarkAction);

View file

@ -152,7 +152,7 @@ public class OpenFileGroup extends CViewActionGroup {
} catch (Exception e) { } catch (Exception e) {
} }
} else if (obj instanceof IAdaptable) { } else if (obj instanceof IAdaptable) {
IResource element = (IResource)((IAdaptable)obj).getAdapter(IResource.class); IResource element = ((IAdaptable)obj).getAdapter(IResource.class);
if (element instanceof IFile) { if (element instanceof IFile) {
openFileAction.selectionChanged(selection); openFileAction.selectionChanged(selection);
openFileAction.run(); openFileAction.run();

View file

@ -85,7 +85,7 @@ public class OpenProjectGroup extends CViewActionGroup {
if (next instanceof IProject) { if (next instanceof IProject) {
project = (IProject) next; project = (IProject) next;
} else if (next instanceof IAdaptable) { } else if (next instanceof IAdaptable) {
IResource res = (IResource) ((IAdaptable) next).getAdapter(IResource.class); IResource res = ((IAdaptable) next).getAdapter(IResource.class);
if (res instanceof IProject) { if (res instanceof IProject) {
project = (IProject)res; project = (IProject)res;
} }

View file

@ -364,8 +364,8 @@ public class TextFieldNavigationHandler {
fSubmissions= new ArrayList<Submission>(); fSubmissions= new ArrayList<Submission>();
ICommandService commandService= (ICommandService) PlatformUI.getWorkbench().getAdapter(ICommandService.class); ICommandService commandService= PlatformUI.getWorkbench().getAdapter(ICommandService.class);
IBindingService bindingService= (IBindingService) PlatformUI.getWorkbench().getAdapter(IBindingService.class); IBindingService bindingService= PlatformUI.getWorkbench().getAdapter(IBindingService.class);
if (commandService == null || bindingService == null) if (commandService == null || bindingService == null)
return fSubmissions; return fSubmissions;

View file

@ -406,7 +406,7 @@ class CPElementLabelProvider extends LabelProvider implements IColorProvider {
return CDTSharedImages.getImage(CDTSharedImages.IMG_OBJS_LIBRARY); return CDTSharedImages.getImage(CDTSharedImages.IMG_OBJS_LIBRARY);
case -1 : case -1 :
IResource res = ((CPElementGroup)element).getResource(); IResource res = ((CPElementGroup)element).getResource();
IWorkbenchAdapter adapter = (IWorkbenchAdapter)res.getAdapter(IWorkbenchAdapter.class); IWorkbenchAdapter adapter = res.getAdapter(IWorkbenchAdapter.class);
ImageDescriptor imageDescriptor = adapter.getImageDescriptor(res); ImageDescriptor imageDescriptor = adapter.getImageDescriptor(res);
if (!res.exists()) { if (!res.exists()) {
imageDescriptor = new CPListImageDescriptor(imageDescriptor, CPListImageDescriptor.WARNING, SMALL_SIZE); imageDescriptor = new CPListImageDescriptor(imageDescriptor, CPListImageDescriptor.WARNING, SMALL_SIZE);

View file

@ -149,7 +149,7 @@ public class CPathPropertyPage extends PropertyPage implements IStatusChangeList
private IProject getProject() { private IProject getProject() {
IAdaptable adaptable = getElement(); IAdaptable adaptable = getElement();
if (adaptable != null) { if (adaptable != null) {
ICElement elem = (ICElement)adaptable.getAdapter(ICElement.class); ICElement elem = adaptable.getAdapter(ICElement.class);
if (elem instanceof ICProject) { if (elem instanceof ICProject) {
return ((ICProject)elem).getProject(); return ((ICProject)elem).getProject();
} }

View file

@ -167,7 +167,7 @@ public class IncludesSymbolsPropertyPage extends PropertyPage implements IStatus
private IProject getProject() { private IProject getProject() {
IAdaptable adaptable = getElement(); IAdaptable adaptable = getElement();
if (adaptable != null) { if (adaptable != null) {
IResource resource = (IResource)adaptable.getAdapter(IResource.class); IResource resource = adaptable.getAdapter(IResource.class);
return resource.getProject(); return resource.getProject();
} }
return null; return null;
@ -176,7 +176,7 @@ public class IncludesSymbolsPropertyPage extends PropertyPage implements IStatus
protected ICElement getCElement() { protected ICElement getCElement() {
IAdaptable adaptable = getElement(); IAdaptable adaptable = getElement();
if (adaptable != null) { if (adaptable != null) {
ICElement elem = (ICElement)adaptable.getAdapter(ICElement.class); ICElement elem = adaptable.getAdapter(ICElement.class);
return elem; return elem;
} }
return null; return null;

View file

@ -136,7 +136,7 @@ public class FileTransferDragAdapter implements TransferDragSourceListener {
if (object instanceof IResource) { if (object instanceof IResource) {
resource = (IResource) object; resource = (IResource) object;
} else if (object instanceof IAdaptable) { } else if (object instanceof IAdaptable) {
resource = (IResource) ((IAdaptable) object).getAdapter(IResource.class); resource = ((IAdaptable) object).getAdapter(IResource.class);
} }
if (resource != null) if (resource != null)

View file

@ -114,7 +114,7 @@ public class ResourceTransferDragAdapter implements TransferDragSourceListener {
resource = (IResource)element; resource = (IResource)element;
} else if (element instanceof IAdaptable) { } else if (element instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) element; IAdaptable adaptable = (IAdaptable) element;
resource = (IResource) adaptable.getAdapter(IResource.class); resource = adaptable.getAdapter(IResource.class);
} }
if (resource != null) { if (resource != null) {
resources.add(resource); resources.add(resource);

View file

@ -146,7 +146,7 @@ public class ResourceTransferDropAdapter extends CDTViewerDropAdapter implements
} }
else if (o instanceof IAdaptable) { else if (o instanceof IAdaptable) {
IAdaptable a = (IAdaptable) o; IAdaptable a = (IAdaptable) o;
IResource r = (IResource) a.getAdapter(IResource.class); IResource r = a.getAdapter(IResource.class);
if (r != null) { if (r != null) {
selectedResources.add(r); selectedResources.add(r);
} }

View file

@ -237,7 +237,7 @@ public final class ASTProvider {
private void activeEditorChanged(IWorkbenchPart editor) { private void activeEditorChanged(IWorkbenchPart editor) {
ITranslationUnit tu = null; ITranslationUnit tu = null;
if (editor != null) { if (editor != null) {
ITranslationUnitHolder provider = (ITranslationUnitHolder) editor.getAdapter(ITranslationUnitHolder.class); ITranslationUnitHolder provider = editor.getAdapter(ITranslationUnitHolder.class);
if (provider != null) if (provider != null)
tu = provider.getTranslationUnit(); tu = provider.getTranslationUnit();
} }

View file

@ -526,7 +526,7 @@ public abstract class AbstractCModelOutlinePage extends Page
fTreeViewer.setInput(fInput); fTreeViewer.setInput(fInput);
PlatformUI.getWorkbench().getHelpSystem().setHelp(control, ICHelpContextIds.COUTLINE_VIEW); PlatformUI.getWorkbench().getHelpSystem().setHelp(control, ICHelpContextIds.COUTLINE_VIEW);
IHandlerService handlerService= (IHandlerService) site.getService(IHandlerService.class); IHandlerService handlerService= site.getService(IHandlerService.class);
handlerService.activateHandler(CollapseAllHandler.COMMAND_ID, new ActionHandler(fCollapseAllAction)); handlerService.activateHandler(CollapseAllHandler.COMMAND_ID, new ActionHandler(fCollapseAllAction));
} }

View file

@ -776,7 +776,7 @@ public class CDocumentProvider extends TextFileDocumentProvider {
original = input.getTranslationUnit(); original = input.getTranslationUnit();
} else if (element instanceof IAdaptable) { } else if (element instanceof IAdaptable) {
IAdaptable adaptable= (IAdaptable) element; IAdaptable adaptable= (IAdaptable) element;
ILocationProvider locationProvider= (ILocationProvider) adaptable.getAdapter(ILocationProvider.class); ILocationProvider locationProvider= adaptable.getAdapter(ILocationProvider.class);
if (locationProvider instanceof ILocationProviderExtension) { if (locationProvider instanceof ILocationProviderExtension) {
URI uri= ((ILocationProviderExtension) locationProvider).getURI(element); URI uri= ((ILocationProviderExtension) locationProvider).getURI(element);
original= createTranslationUnit(uri); original= createTranslationUnit(uri);

View file

@ -182,7 +182,7 @@ public class CElementHyperlinkDetector extends AbstractHyperlinkDetector {
} }
private static boolean isLanguageKeyword(ILanguage lang, String word) { private static boolean isLanguageKeyword(ILanguage lang, String word) {
ICLanguageKeywords keywords= (ICLanguageKeywords) lang.getAdapter(ICLanguageKeywords.class); ICLanguageKeywords keywords= lang.getAdapter(ICLanguageKeywords.class);
if (keywords != null) { if (keywords != null) {
for (String keyword : keywords.getKeywords()) { for (String keyword : keywords.getKeywords()) {
if (keyword.equals(word)) if (keyword.equals(word))

View file

@ -120,10 +120,10 @@ public class DefaultBinaryFileEditor extends AbstractTextEditor implements IReso
@Override @Override
public IStorage getStorage() throws CoreException { public IStorage getStorage() throws CoreException {
if (fStorage == null) { if (fStorage == null) {
IBinaryParser.IBinaryObject object = (IBinaryParser.IBinaryObject) fBinary IBinaryParser.IBinaryObject object = fBinary
.getAdapter(IBinaryParser.IBinaryObject.class); .getAdapter(IBinaryParser.IBinaryObject.class);
if (object != null) { if (object != null) {
IGnuToolFactory factory = (IGnuToolFactory) object.getBinaryParser().getAdapter( IGnuToolFactory factory = object.getBinaryParser().getAdapter(
IGnuToolFactory.class); IGnuToolFactory.class);
if (factory != null) { if (factory != null) {
Objdump objdump = factory.getObjdump(object.getPath()); Objdump objdump = factory.getObjdump(object.getPath());

View file

@ -83,7 +83,7 @@ public class ExternalSearchDocumentProvider extends TextFileDocumentProvider {
} }
if (element instanceof IAdaptable) { if (element instanceof IAdaptable) {
IAdaptable adaptable= (IAdaptable) element; IAdaptable adaptable= (IAdaptable) element;
ILocationProvider provider = (ILocationProvider) adaptable.getAdapter(ILocationProvider.class); ILocationProvider provider = adaptable.getAdapter(ILocationProvider.class);
if (provider != null) { if (provider != null) {
IPath location = provider.getPath(element); IPath location = provider.getPath(element);
if (location != null) { if (location != null) {

View file

@ -98,7 +98,7 @@ final class SpecificContentAssistAction extends Action implements IUpdate {
private boolean computeEnablement(ITextEditor editor) { private boolean computeEnablement(ITextEditor editor) {
if (editor == null) if (editor == null)
return false; return false;
ITextOperationTarget target= (ITextOperationTarget) editor.getAdapter(ITextOperationTarget.class); ITextOperationTarget target= editor.getAdapter(ITextOperationTarget.class);
boolean hasContentAssist= target != null && target.canDoOperation(ISourceViewer.CONTENTASSIST_PROPOSALS); boolean hasContentAssist= target != null && target.canDoOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
if (!hasContentAssist) if (!hasContentAssist)
return false; return false;

View file

@ -63,7 +63,7 @@ public final class SpecificContentAssistExecutor {
} }
try { try {
ITextOperationTarget target= (ITextOperationTarget) editor.getAdapter(ITextOperationTarget.class); ITextOperationTarget target= editor.getAdapter(ITextOperationTarget.class);
if (target != null && target.canDoOperation(ISourceViewer.CONTENTASSIST_PROPOSALS)) if (target != null && target.canDoOperation(ISourceViewer.CONTENTASSIST_PROPOSALS))
target.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS); target.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
} finally { } finally {

View file

@ -313,7 +313,7 @@ public final class ToggleCommentAction extends TextEditorAction {
ITextEditor editor= getTextEditor(); ITextEditor editor= getTextEditor();
if (fOperationTarget == null && editor != null) if (fOperationTarget == null && editor != null)
fOperationTarget= (ITextOperationTarget) editor.getAdapter(ITextOperationTarget.class); fOperationTarget= editor.getAdapter(ITextOperationTarget.class);
boolean isEnabled= (fOperationTarget != null && fOperationTarget.canDoOperation(ITextOperationTarget.PREFIX) && boolean isEnabled= (fOperationTarget != null && fOperationTarget.canDoOperation(ITextOperationTarget.PREFIX) &&
fOperationTarget.canDoOperation(ITextOperationTarget.STRIP_PREFIX)); fOperationTarget.canDoOperation(ITextOperationTarget.STRIP_PREFIX));

View file

@ -58,11 +58,11 @@ public class NamePatternFilter extends ViewerFilter {
matchName= ((ICElement) element).getElementName(); matchName= ((ICElement) element).getElementName();
} else if (element instanceof IAdaptable) { } else if (element instanceof IAdaptable) {
IAdaptable adaptable= (IAdaptable) element; IAdaptable adaptable= (IAdaptable) element;
ICElement javaElement= (ICElement)adaptable.getAdapter(ICElement.class); ICElement javaElement= adaptable.getAdapter(ICElement.class);
if (javaElement != null) if (javaElement != null)
matchName= javaElement.getElementName(); matchName= javaElement.getElementName();
else { else {
IResource resource= (IResource)adaptable.getAdapter(IResource.class); IResource resource= adaptable.getAdapter(IResource.class);
if (resource != null) if (resource != null)
matchName= resource.getName(); matchName= resource.getName();
} }

View file

@ -82,16 +82,16 @@ public class IBConversions {
} }
if (object instanceof IAdaptable) { if (object instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) object; IAdaptable adaptable = (IAdaptable) object;
ITranslationUnit result= (ITranslationUnit) adaptable.getAdapter(ITranslationUnit.class); ITranslationUnit result= adaptable.getAdapter(ITranslationUnit.class);
if (result != null) { if (result != null) {
return result; return result;
} }
IFile file= (IFile) adaptable.getAdapter(IFile.class); IFile file= adaptable.getAdapter(IFile.class);
if (file != null) { if (file != null) {
return CoreModelUtil.findTranslationUnit(file); return CoreModelUtil.findTranslationUnit(file);
} }
ILocationProvider locProvider= (ILocationProvider) adaptable.getAdapter(ILocationProvider.class); ILocationProvider locProvider= adaptable.getAdapter(ILocationProvider.class);
if (locProvider != null) { if (locProvider != null) {
IPath path= locProvider.getPath(locProvider); IPath path= locProvider.getPath(locProvider);
if (path != null) { if (path != null) {

View file

@ -291,7 +291,7 @@ public class IBViewPart extends ViewPart implements IShowInSource, IShowInTarget
createActions(); createActions();
createContextMenu(); createContextMenu();
bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class); bindingService = PlatformUI.getWorkbench().getService(IBindingService.class);
if (bindingService != null) { if (bindingService != null) {
bindingManagerListener = new IBindingManagerListener() { bindingManagerListener = new IBindingManagerListener() {
@Override @Override
@ -314,7 +314,7 @@ public class IBViewPart extends ViewPart implements IShowInSource, IShowInTarget
restoreInput(); restoreInput();
fMemento= null; fMemento= null;
IContextService ctxService = (IContextService) getSite().getService(IContextService.class); IContextService ctxService = getSite().getService(IContextService.class);
if (ctxService != null) { if (ctxService != null) {
fContextActivation= ctxService.activateContext(CUIPlugin.CVIEWS_SCOPE); fContextActivation= ctxService.activateContext(CUIPlugin.CVIEWS_SCOPE);
} }
@ -326,7 +326,7 @@ public class IBViewPart extends ViewPart implements IShowInSource, IShowInTarget
public void dispose() { public void dispose() {
putDialogSettings(); putDialogSettings();
if (fContextActivation != null) { if (fContextActivation != null) {
IContextService ctxService = (IContextService)getSite().getService(IContextService.class); IContextService ctxService = getSite().getService(IContextService.class);
if (ctxService != null) { if (ctxService != null) {
ctxService.deactivateContext(fContextActivation); ctxService.deactivateContext(fContextActivation);
} }

View file

@ -350,7 +350,7 @@ public class FileLanguageMappingPropertyPage extends PropertyPage {
} }
private IFile getFile() { private IFile getFile() {
return (IFile) getElement().getAdapter(IFile.class); return getElement().getAdapter(IFile.class);
} }
@Override @Override

View file

@ -190,6 +190,6 @@ public class ProjectLanguageMappingPropertyPage extends PropertyPage {
} }
private IProject getProject() { private IProject getProject() {
return (IProject) getElement().getAdapter(IProject.class); return getElement().getAdapter(IProject.class);
} }
} }

View file

@ -115,7 +115,7 @@ public class ProjectLanguageMappingWidget extends LanguageMappingWidget {
addButton.addListener(SWT.Selection, new Listener() { addButton.addListener(SWT.Selection, new Listener() {
@Override @Override
public void handleEvent(Event event) { public void handleEvent(Event event) {
IProject project = (IProject) getElement().getAdapter(IProject.class); IProject project = getElement().getAdapter(IProject.class);
ICProjectDescription description = CoreModel.getDefault().getProjectDescription(project, false); ICProjectDescription description = CoreModel.getDefault().getProjectDescription(project, false);
ICConfigurationDescription[] configurations = description.getConfigurations(); ICConfigurationDescription[] configurations = description.getConfigurations();
ProjectContentTypeMappingDialog dialog = new ProjectContentTypeMappingDialog(fContents.getShell(), configurations); ProjectContentTypeMappingDialog dialog = new ProjectContentTypeMappingDialog(fContents.getShell(), configurations);
@ -213,7 +213,7 @@ public class ProjectLanguageMappingWidget extends LanguageMappingWidget {
IContentTypeManager contentTypeManager = Platform.getContentTypeManager(); IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
IProject project = (IProject) getElement().getAdapter(IProject.class); IProject project = getElement().getAdapter(IProject.class);
ICProjectDescription description = CoreModel.getDefault().getProjectDescription(project, false); ICProjectDescription description = CoreModel.getDefault().getProjectDescription(project, false);
while (mappings.hasNext()) { while (mappings.hasNext()) {

View file

@ -96,7 +96,7 @@ public class CNavigatorBuildActionGroup extends AbstractCNavigatorActionGroup {
if (next instanceof IProject) { if (next instanceof IProject) {
project= (IProject) next; project= (IProject) next;
} else if (next instanceof IAdaptable) { } else if (next instanceof IAdaptable) {
IResource res= (IResource)((IAdaptable)next).getAdapter(IResource.class); IResource res= ((IAdaptable)next).getAdapter(IResource.class);
if (res instanceof IProject) { if (res instanceof IProject) {
project= (IProject) res; project= (IProject) res;
} }

View file

@ -280,7 +280,7 @@ public class CNavigatorContentProvider extends CViewContentProvider implements I
if (element instanceof IResource) { if (element instanceof IResource) {
resource= (IResource)element; resource= (IResource)element;
} else if (element instanceof IAdaptable) { } else if (element instanceof IAdaptable) {
resource= (IResource)((IAdaptable)element).getAdapter(IResource.class); resource= ((IAdaptable)element).getAdapter(IResource.class);
} }
if (resource != null) { if (resource != null) {
int i= elementList.indexOf(resource); int i= elementList.indexOf(resource);

View file

@ -520,7 +520,7 @@ public class CNavigatorDropAdapterAssistant extends CommonDropAdapterAssistant {
selectedResources.add(o); selectedResources.add(o);
} else if (o instanceof IAdaptable) { } else if (o instanceof IAdaptable) {
IAdaptable a = (IAdaptable) o; IAdaptable a = (IAdaptable) o;
IResource r = (IResource) a.getAdapter(IResource.class); IResource r = a.getAdapter(IResource.class);
if (r != null) { if (r != null) {
selectedResources.add(r); selectedResources.add(r);
} }

View file

@ -80,7 +80,7 @@ public class CNavigatorLabelProvider extends CViewLabelProvider implements IComm
return ((IResource) element).getFullPath().makeRelative().toString(); return ((IResource) element).getFullPath().makeRelative().toString();
} else if (element instanceof ICElement) { } else if (element instanceof ICElement) {
ICElement celement = (ICElement) element; ICElement celement = (ICElement) element;
IResource res = (IResource) celement.getAdapter(IResource.class); IResource res = celement.getAdapter(IResource.class);
if (res != null) { if (res != null) {
return res.getFullPath().toString(); return res.getFullPath().toString();
} else if (celement.getElementType() == ICElement.C_VCONTAINER) { } else if (celement.getElementType() == ICElement.C_VCONTAINER) {

View file

@ -50,7 +50,7 @@ public class CNavigatorRefactorActionProvider extends CommonActionProvider {
if (workbenchSite != null) { if (workbenchSite != null) {
final IWorkbenchPartSite partSite= workbenchSite.getSite(); final IWorkbenchPartSite partSite= workbenchSite.getSite();
resourceRefactorGroup= new CNavigatorRefactorActionGroup(partSite, (Tree)actionSite.getStructuredViewer().getControl()); resourceRefactorGroup= new CNavigatorRefactorActionGroup(partSite, (Tree)actionSite.getStructuredViewer().getControl());
IUndoContext workspaceContext= (IUndoContext) ResourcesPlugin.getWorkspace().getAdapter(IUndoContext.class); IUndoContext workspaceContext= ResourcesPlugin.getWorkspace().getAdapter(IUndoContext.class);
undoRedoGroup = new UndoRedoActionGroup(partSite, workspaceContext, true); undoRedoGroup = new UndoRedoActionGroup(partSite, workspaceContext, true);
cElementRefactorGroup= new CRefactoringActionGroup(workbenchSite.getPart()); cElementRefactorGroup= new CRefactoringActionGroup(workbenchSite.getPart());
} }

View file

@ -156,7 +156,7 @@ public class BuildLogPreferencePage extends PropertyPage implements ICOptionCont
if (elem instanceof IProject) { if (elem instanceof IProject) {
project= (IProject) elem; project= (IProject) elem;
} else if (elem != null) { } else if (elem != null) {
project= (IProject) elem.getAdapter(IProject.class); project= elem.getAdapter(IProject.class);
} }
return project; return project;
} }

View file

@ -209,7 +209,7 @@ public class CFileTypesPropertyPage extends PropertyPage {
if (element instanceof IProject) { if (element instanceof IProject) {
project = (IProject) element; project = (IProject) element;
} else if (element instanceof IAdaptable) { } else if (element instanceof IAdaptable) {
project= (IProject) ((IAdaptable)element).getAdapter(IProject.class); project= ((IAdaptable)element).getAdapter(IProject.class);
} }
return project; return project;
} }

View file

@ -266,7 +266,7 @@ final class CodeAssistAdvancedConfigurationBlock extends OptionsConfigurationBlo
ModelElement(CompletionProposalCategory category, PreferenceModel model) { ModelElement(CompletionProposalCategory category, PreferenceModel model) {
fCategory= category; fCategory= category;
ICommandService commandSvc= (ICommandService) PlatformUI.getWorkbench().getAdapter(ICommandService.class); ICommandService commandSvc= PlatformUI.getWorkbench().getAdapter(ICommandService.class);
fCommand= commandSvc.getCommand("org.eclipse.cdt.ui.specific_content_assist.command"); //$NON-NLS-1$ fCommand= commandSvc.getCommand("org.eclipse.cdt.ui.specific_content_assist.command"); //$NON-NLS-1$
IParameter type; IParameter type;
try { try {
@ -406,7 +406,7 @@ final class CodeAssistAdvancedConfigurationBlock extends OptionsConfigurationBlo
} }
private void createDefaultLabel(Composite composite, int h_span) { private void createDefaultLabel(Composite composite, int h_span) {
final ICommandService commandSvc= (ICommandService) PlatformUI.getWorkbench().getAdapter(ICommandService.class); final ICommandService commandSvc= PlatformUI.getWorkbench().getAdapter(ICommandService.class);
final Command command= commandSvc.getCommand(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); final Command command= commandSvc.getCommand(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
ParameterizedCommand pCmd= new ParameterizedCommand(command, null); ParameterizedCommand pCmd= new ParameterizedCommand(command, null);
String key= getKeyboardShortcut(pCmd); String key= getKeyboardShortcut(pCmd);
@ -727,7 +727,7 @@ final class CodeAssistAdvancedConfigurationBlock extends OptionsConfigurationBlo
private static BindingManager fgLocalBindingManager; private static BindingManager fgLocalBindingManager;
static { static {
fgLocalBindingManager= new BindingManager(new ContextManager(), new CommandManager()); fgLocalBindingManager= new BindingManager(new ContextManager(), new CommandManager());
final IBindingService bindingService= (IBindingService)PlatformUI.getWorkbench().getService(IBindingService.class); final IBindingService bindingService= PlatformUI.getWorkbench().getService(IBindingService.class);
final Scheme[] definedSchemes= bindingService.getDefinedSchemes(); final Scheme[] definedSchemes= bindingService.getDefinedSchemes();
if (definedSchemes != null) { if (definedSchemes != null) {
try { try {
@ -745,7 +745,7 @@ final class CodeAssistAdvancedConfigurationBlock extends OptionsConfigurationBlo
} }
private static String getKeyboardShortcut(ParameterizedCommand command) { private static String getKeyboardShortcut(ParameterizedCommand command) {
IBindingService bindingService= (IBindingService) PlatformUI.getWorkbench().getAdapter(IBindingService.class); IBindingService bindingService= PlatformUI.getWorkbench().getAdapter(IBindingService.class);
fgLocalBindingManager.setBindings(bindingService.getBindings()); fgLocalBindingManager.setBindings(bindingService.getBindings());
try { try {
Scheme activeScheme= bindingService.getActiveScheme(); Scheme activeScheme= bindingService.getActiveScheme();

View file

@ -479,7 +479,7 @@ public class EditTemplateDialog extends StatusDialog {
private void initializeActions() { private void initializeActions() {
final ArrayList<IHandlerActivation> handlerActivations= new ArrayList<IHandlerActivation>(3); final ArrayList<IHandlerActivation> handlerActivations= new ArrayList<IHandlerActivation>(3);
final IHandlerService handlerService= (IHandlerService) PlatformUI.getWorkbench().getAdapter(IHandlerService.class); final IHandlerService handlerService= PlatformUI.getWorkbench().getAdapter(IHandlerService.class);
getShell().addDisposeListener(new DisposeListener() { getShell().addDisposeListener(new DisposeListener() {
@Override @Override
public void widgetDisposed(DisposeEvent e) { public void widgetDisposed(DisposeEvent e) {

View file

@ -820,11 +820,11 @@ public class IncludeOrganizer {
IIndexName[] indexNames; IIndexName[] indexNames;
if (binding instanceof IMacroBinding) { if (binding instanceof IMacroBinding) {
indexNames = IIndexName.EMPTY_ARRAY; indexNames = IIndexName.EMPTY_ARRAY;
ILocationResolver resolver = (ILocationResolver) ast.getAdapter(ILocationResolver.class); ILocationResolver resolver = ast.getAdapter(ILocationResolver.class);
IASTName[] declarations = resolver.getDeclarations((IMacroBinding) binding); IASTName[] declarations = resolver.getDeclarations((IMacroBinding) binding);
for (IASTName name : declarations) { for (IASTName name : declarations) {
if (name instanceof IAdaptable) { if (name instanceof IAdaptable) {
IIndexName indexName = (IIndexName) ((IAdaptable) name).getAdapter(IIndexName.class); IIndexName indexName = ((IAdaptable) name).getAdapter(IIndexName.class);
if (indexName != null) { if (indexName != null) {
indexNames = Arrays.copyOf(indexNames, indexNames.length + 1); indexNames = Arrays.copyOf(indexNames, indexNames.length + 1);
indexNames[indexNames.length - 1] = indexName; indexNames[indexNames.length - 1] = indexName;

View file

@ -823,7 +823,7 @@ public class RenameInformationPopup implements IWidgetTokenKeeper, IWidgetTokenK
* @return the keybinding for Refactor &gt; Rename * @return the keybinding for Refactor &gt; Rename
*/ */
private static String getOpenDialogBinding() { private static String getOpenDialogBinding() {
IBindingService bindingService= (IBindingService)PlatformUI.getWorkbench().getAdapter(IBindingService.class); IBindingService bindingService= PlatformUI.getWorkbench().getAdapter(IBindingService.class);
if (bindingService == null) if (bindingService == null)
return ""; //$NON-NLS-1$ return ""; //$NON-NLS-1$
String binding= bindingService.getBestActiveBindingFormattedFor(ICEditorActionDefinitionIds.RENAME_ELEMENT); String binding= bindingService.getBestActiveBindingFormattedFor(ICEditorActionDefinitionIds.RENAME_ELEMENT);

View file

@ -69,7 +69,7 @@ public class TextSearchWrapper {
ArrayList<IResource> resources = new ArrayList<IResource>(); ArrayList<IResource> resources = new ArrayList<IResource>();
for (int i = 0; i < adaptables.length; i++) { for (int i = 0; i < adaptables.length; i++) {
IAdaptable adaptable = adaptables[i]; IAdaptable adaptable = adaptables[i];
IResource resource= (IResource) adaptable.getAdapter(IResource.class); IResource resource= adaptable.getAdapter(IResource.class);
if (resource != null) { if (resource != null) {
resources.add(resource); resources.add(resource);
} }

View file

@ -89,7 +89,7 @@ public class CSearchResult extends AbstractTextSearchResult implements IEditorMa
} else if (input instanceof IPathEditorInput) { } else if (input instanceof IPathEditorInput) {
path= ((IPathEditorInput) input).getPath(); path= ((IPathEditorInput) input).getPath();
} else { } else {
ILocationProvider provider= (ILocationProvider) input.getAdapter(ILocationProvider.class); ILocationProvider provider= input.getAdapter(ILocationProvider.class);
if (provider != null) { if (provider != null) {
path= provider.getPath(input); path= provider.getPath(input);
} }

View file

@ -74,7 +74,7 @@ public abstract class FindInWorkingSetAction extends FindAction {
for (int i = 0; i < fWorkingSets.length; ++i) { for (int i = 0; i < fWorkingSets.length; ++i) {
IAdaptable[] elements = fWorkingSets[i].getElements(); IAdaptable[] elements = fWorkingSets[i].getElements();
for (int j = 0; j < elements.length; ++j) { for (int j = 0; j < elements.length; ++j) {
ICElement element = (ICElement)elements[j].getAdapter(ICElement.class); ICElement element = elements[j].getAdapter(ICElement.class);
if (element != null) if (element != null)
scope.add(element); scope.add(element);
} }

View file

@ -157,13 +157,13 @@ public abstract class AbstractInformationControl extends PopupDialog implements
super(parent, shellStyle, true, true, true, true, true, null, null); super(parent, shellStyle, true, true, true, true, true, null, null);
if (invokingCommandId != null) { if (invokingCommandId != null) {
IWorkbench workbench = PlatformUI.getWorkbench(); IWorkbench workbench = PlatformUI.getWorkbench();
ICommandService commandSupport = (ICommandService)workbench.getAdapter(ICommandService.class); ICommandService commandSupport = workbench.getAdapter(ICommandService.class);
if (commandSupport != null) { if (commandSupport != null) {
fInvokingCommand = commandSupport.getCommand(invokingCommandId); fInvokingCommand = commandSupport.getCommand(invokingCommandId);
if (fInvokingCommand != null && !fInvokingCommand.isDefined()) if (fInvokingCommand != null && !fInvokingCommand.isDefined())
fInvokingCommand= null; fInvokingCommand= null;
else { else {
IBindingService bindingService = (IBindingService) workbench.getService(IBindingService.class); IBindingService bindingService = workbench.getService(IBindingService.class);
fInvokingTriggerSequence = bindingService.getBestActiveBindingFor(invokingCommandId); fInvokingTriggerSequence = bindingService.getBestActiveBindingFor(invokingCommandId);
} }
} }

View file

@ -82,7 +82,7 @@ public class CMacroExpansionControl extends AbstractSourceViewerInformationContr
return; return;
} }
if (fInput.fExplorer.getExpansionStepCount() > 1) { if (fInput.fExplorer.getExpansionStepCount() > 1) {
IBindingService bindingService= (IBindingService)PlatformUI.getWorkbench().getAdapter(IBindingService.class); IBindingService bindingService= PlatformUI.getWorkbench().getAdapter(IBindingService.class);
if (bindingService != null) { if (bindingService != null) {
String keySequence= bindingService.getBestActiveBindingFormattedFor(ITextEditorActionDefinitionIds.SHOW_INFORMATION); String keySequence= bindingService.getBestActiveBindingFormattedFor(ITextEditorActionDefinitionIds.SHOW_INFORMATION);
if (keySequence != null) { if (keySequence != null) {

View file

@ -314,8 +314,8 @@ public class CMacroExpansionExplorationControl extends AbstractCompareViewerInfo
}; };
IWorkbench workbench= PlatformUI.getWorkbench(); IWorkbench workbench= PlatformUI.getWorkbench();
fHandlerService= (IHandlerService) workbench.getService(IHandlerService.class); fHandlerService= workbench.getService(IHandlerService.class);
fContextService= (IContextService) workbench.getService(IContextService.class); fContextService= workbench.getService(IContextService.class);
fContextActivation= fContextService.activateContext(CONTEXT_ID_MACRO_EXPANSION_HOVER); fContextActivation= fContextService.activateContext(CONTEXT_ID_MACRO_EXPANSION_HOVER);
fHandlerActivations= new ArrayList<IHandlerActivation>(); fHandlerActivations= new ArrayList<IHandlerActivation>();
fHandlerActivations.add(fHandlerService.activateHandler(COMMAND_ID_EXPANSION_BACK, backwardHandler)); fHandlerActivations.add(fHandlerService.activateHandler(COMMAND_ID_EXPANSION_BACK, backwardHandler));
@ -399,7 +399,7 @@ public class CMacroExpansionExplorationControl extends AbstractCompareViewerInfo
*/ */
private String getInfoText() { private String getInfoText() {
IWorkbench workbench= PlatformUI.getWorkbench(); IWorkbench workbench= PlatformUI.getWorkbench();
IBindingService bindingService= (IBindingService) workbench.getService(IBindingService.class); IBindingService bindingService= workbench.getService(IBindingService.class);
String formattedBindingBack= bindingService.getBestActiveBindingFormattedFor(COMMAND_ID_EXPANSION_BACK); String formattedBindingBack= bindingService.getBestActiveBindingFormattedFor(COMMAND_ID_EXPANSION_BACK);
String formattedBindingForward= bindingService.getBestActiveBindingFormattedFor(COMMAND_ID_EXPANSION_FORWARD); String formattedBindingForward= bindingService.getBestActiveBindingFormattedFor(COMMAND_ID_EXPANSION_FORWARD);

View file

@ -555,7 +555,7 @@ public class ContentAssistProcessor implements IContentAssistProcessor {
} }
private KeySequence getIterationBinding() { private KeySequence getIterationBinding() {
final IBindingService bindingSvc= (IBindingService) PlatformUI.getWorkbench().getAdapter(IBindingService.class); final IBindingService bindingSvc= PlatformUI.getWorkbench().getAdapter(IBindingService.class);
TriggerSequence binding= bindingSvc.getBestActiveBindingFor(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); TriggerSequence binding= bindingSvc.getBestActiveBindingFor(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
if (binding instanceof KeySequence) if (binding instanceof KeySequence)
return (KeySequence) binding; return (KeySequence) binding;

View file

@ -67,7 +67,7 @@ public class KeywordCompletionProposalComputer extends ParsingBasedProposalCompu
if(tu != null) { if(tu != null) {
ILanguage language = tu.getLanguage(); ILanguage language = tu.getLanguage();
if(language != null) if(language != null)
languageKeywords = (ICLanguageKeywords) language.getAdapter(ICLanguageKeywords.class); languageKeywords = language.getAdapter(ICLanguageKeywords.class);
} }
if(languageKeywords == null) if(languageKeywords == null)

View file

@ -78,7 +78,7 @@ public class CSelectAnnotationRulerAction extends SelectMarkerRulerAction {
} }
if (fHasCorrection) { if (fHasCorrection) {
ITextOperationTarget operation= (ITextOperationTarget) fTextEditor.getAdapter(ITextOperationTarget.class); ITextOperationTarget operation= fTextEditor.getAdapter(ITextOperationTarget.class);
final int opCode= ISourceViewer.QUICK_ASSIST; final int opCode= ISourceViewer.QUICK_ASSIST;
if (operation != null && operation.canDoOperation(opCode)) { if (operation != null && operation.canDoOperation(opCode)) {
fTextEditor.selectAndReveal(fPosition.getOffset(), fPosition.getLength()); fTextEditor.selectAndReveal(fPosition.getOffset(), fPosition.getLength());

View file

@ -182,7 +182,7 @@ public class CorrectionCommandHandler extends AbstractHandler {
public static String getShortCutString(String proposalId) { public static String getShortCutString(String proposalId) {
if (proposalId != null) { if (proposalId != null) {
IBindingService bindingService= (IBindingService) PlatformUI.getWorkbench().getAdapter(IBindingService.class); IBindingService bindingService= PlatformUI.getWorkbench().getAdapter(IBindingService.class);
if (bindingService != null) { if (bindingService != null) {
TriggerSequence[] activeBindingsFor= bindingService.getActiveBindingsFor(proposalId); TriggerSequence[] activeBindingsFor= bindingService.getActiveBindingsFor(proposalId);
if (activeBindingsFor.length > 0) { if (activeBindingsFor.length > 0) {

View file

@ -46,8 +46,8 @@ public class CorrectionCommandInstaller {
public void registerCommands(CEditor editor) { public void registerCommands(CEditor editor) {
IWorkbench workbench= PlatformUI.getWorkbench(); IWorkbench workbench= PlatformUI.getWorkbench();
ICommandService commandService= (ICommandService) workbench.getAdapter(ICommandService.class); ICommandService commandService= workbench.getAdapter(ICommandService.class);
IHandlerService handlerService= (IHandlerService) workbench.getAdapter(IHandlerService.class); IHandlerService handlerService= workbench.getAdapter(IHandlerService.class);
if (commandService == null || handlerService == null) { if (commandService == null || handlerService == null) {
return; return;
} }
@ -71,7 +71,7 @@ public class CorrectionCommandInstaller {
} }
public void deregisterCommands() { public void deregisterCommands() {
IHandlerService handlerService= (IHandlerService) PlatformUI.getWorkbench().getAdapter(IHandlerService.class); IHandlerService handlerService= PlatformUI.getWorkbench().getAdapter(IHandlerService.class);
if (handlerService != null && fCorrectionHandlerActivations != null) { if (handlerService != null && fCorrectionHandlerActivations != null) {
handlerService.deactivateHandlers(fCorrectionHandlerActivations); handlerService.deactivateHandlers(fCorrectionHandlerActivations);
fCorrectionHandlerActivations= null; fCorrectionHandlerActivations= null;

View file

@ -113,7 +113,7 @@ public class ChangeCorrectionProposal implements ICCompletionProposal, ICommandA
LinkedModeModel.closeAllModels(document); LinkedModeModel.closeAllModels(document);
} }
if (activeEditor != null) { if (activeEditor != null) {
rewriteTarget= (IRewriteTarget) activeEditor.getAdapter(IRewriteTarget.class); rewriteTarget= activeEditor.getAdapter(IRewriteTarget.class);
if (rewriteTarget != null) { if (rewriteTarget != null) {
rewriteTarget.beginCompoundChange(); rewriteTarget.beginCompoundChange();
} }

View file

@ -1783,7 +1783,7 @@ public class DefaultCFoldingStructureProvider implements ICFoldingStructureProvi
} }
private ProjectionAnnotationModel getModel() { private ProjectionAnnotationModel getModel() {
return (ProjectionAnnotationModel) fEditor.getAdapter(ProjectionAnnotationModel.class); return fEditor.getAdapter(ProjectionAnnotationModel.class);
} }
private IDocument getDocument() { private IDocument getDocument() {

View file

@ -63,7 +63,7 @@ public class THDropTargetListener implements DropTargetListener {
return (ICElement) element; return (ICElement) element;
} }
if (element instanceof IAdaptable) { if (element instanceof IAdaptable) {
ICElement adapter= (ICElement) ((IAdaptable) element).getAdapter(ICElement.class); ICElement adapter= ((IAdaptable) element).getAdapter(ICElement.class);
if (adapter != null) { if (adapter != null) {
return adapter; return adapter;
} }

View file

@ -239,7 +239,7 @@ public class THViewPart extends ViewPart implements ITHModelPresenter {
setMessage(Messages.THViewPart_instruction); setMessage(Messages.THViewPart_instruction);
initializeActionStates(); initializeActionStates();
IContextService ctxService = (IContextService) getSite().getService(IContextService.class); IContextService ctxService = getSite().getService(IContextService.class);
if (ctxService != null) { if (ctxService != null) {
fContextActivation= ctxService.activateContext(CUIPlugin.CVIEWS_SCOPE); fContextActivation= ctxService.activateContext(CUIPlugin.CVIEWS_SCOPE);
} }
@ -250,7 +250,7 @@ public class THViewPart extends ViewPart implements ITHModelPresenter {
@Override @Override
public void dispose() { public void dispose() {
if (fContextActivation != null) { if (fContextActivation != null) {
IContextService ctxService = (IContextService)getSite().getService(IContextService.class); IContextService ctxService = getSite().getService(IContextService.class);
if (ctxService != null) { if (ctxService != null) {
ctxService.deactivateContext(fContextActivation); ctxService.deactivateContext(fContextActivation);
} }
@ -998,7 +998,7 @@ public class THViewPart extends ViewPart implements ITHModelPresenter {
return (ICElement) cand; return (ICElement) cand;
} }
if (cand instanceof IAdaptable) { if (cand instanceof IAdaptable) {
ICElement elem= (ICElement) ((IAdaptable) cand).getAdapter(ICElement.class); ICElement elem= ((IAdaptable) cand).getAdapter(ICElement.class);
if (elem != null) { if (elem != null) {
return elem; return elem;
} }
@ -1133,7 +1133,7 @@ public class THViewPart extends ViewPart implements ITHModelPresenter {
@Override @Override
public IWorkbenchSiteProgressService getProgressService() { public IWorkbenchSiteProgressService getProgressService() {
return (IWorkbenchSiteProgressService) getSite().getAdapter(IWorkbenchSiteProgressService.class); return getSite().getAdapter(IWorkbenchSiteProgressService.class);
} }
private static class CopyTypeHierarchyAction extends CopyTreeAction { private static class CopyTypeHierarchyAction extends CopyTreeAction {

View file

@ -120,7 +120,7 @@ public abstract class AbstractResourceActionHandler extends AbstractHandler {
if (activeWindow == null) { if (activeWindow == null) {
return null; return null;
} }
IHandlerService service = (IHandlerService) activeWindow.getService(IHandlerService.class); IHandlerService service = activeWindow.getService(IHandlerService.class);
return service.getCurrentState(); return service.getCurrentState();
} }

View file

@ -548,7 +548,7 @@ public class EditorUtility {
if (editorInput == null) { if (editorInput == null) {
return null; return null;
} }
return (ICElement) editorInput.getAdapter(ICElement.class); return editorInput.getAdapter(ICElement.class);
} }
/** /**
@ -857,7 +857,7 @@ public class EditorUtility {
* If <code>saveUnknownEditors</code> is <code>true</code>, save all editors * If <code>saveUnknownEditors</code> is <code>true</code>, save all editors
* whose implementation is probably not based on file buffers. * whose implementation is probably not based on file buffers.
*/ */
IResource resource= (IResource) input.getAdapter(IResource.class); IResource resource= input.getAdapter(IResource.class);
if (resource == null) if (resource == null)
return saveUnknownEditors; return saveUnknownEditors;

View file

@ -331,7 +331,7 @@ public class RemoteTreeViewer extends ProblemTreeViewer {
private void addAllParents(List<Object> list, Object element) { private void addAllParents(List<Object> list, Object element) {
if (element instanceof IAdaptable) { if (element instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) element; IAdaptable adaptable = (IAdaptable) element;
IWorkbenchAdapter adapter = (IWorkbenchAdapter) adaptable.getAdapter(IWorkbenchAdapter.class); IWorkbenchAdapter adapter = adaptable.getAdapter(IWorkbenchAdapter.class);
if (adapter != null) { if (adapter != null) {
Object parent = adapter.getParent(element); Object parent = adapter.getParent(element);
if (parent != null) { if (parent != null) {

View file

@ -133,7 +133,7 @@ public class CDTContextActivator implements IWindowListener, IPartListener2 {
if (page instanceof CContentOutlinePage) { if (page instanceof CContentOutlinePage) {
if (!fActivationPerOutline.containsKey(outline)){ if (!fActivationPerOutline.containsKey(outline)){
// cdt outline activated for the first time // cdt outline activated for the first time
IContextService ctxtService = (IContextService)outline.getViewSite().getService(IContextService.class); IContextService ctxtService = outline.getViewSite().getService(IContextService.class);
IContextActivation activateContext = ctxtService.activateContext(CUIPlugin.CVIEWS_SCOPE); IContextActivation activateContext = ctxtService.activateContext(CUIPlugin.CVIEWS_SCOPE);
fActivationPerOutline.put(outline,activateContext); fActivationPerOutline.put(outline,activateContext);
} }
@ -142,7 +142,7 @@ public class CDTContextActivator implements IWindowListener, IPartListener2 {
IContextActivation activation = fActivationPerOutline.remove(outline); IContextActivation activation = fActivationPerOutline.remove(outline);
if (activation != null) { if (activation != null) {
// other outline page brought to front // other outline page brought to front
IContextService ctxtService = (IContextService)outline.getViewSite().getService(IContextService.class); IContextService ctxtService = outline.getViewSite().getService(IContextService.class);
ctxtService.deactivateContext(activation); ctxtService.deactivateContext(activation);
} }
} }
@ -155,7 +155,7 @@ public class CDTContextActivator implements IWindowListener, IPartListener2 {
public SelectionListener(IWorkbenchPartSite site) { public SelectionListener(IWorkbenchPartSite site) {
fSite= site; fSite= site;
fCtxService= (IContextService)fSite.getService(IContextService.class); fCtxService= fSite.getService(IContextService.class);
ISelectionProvider sp= site.getSelectionProvider(); ISelectionProvider sp= site.getSelectionProvider();
if (sp != null && fCtxService != null) { if (sp != null && fCtxService != null) {

Some files were not shown because too many files have changed in this diff Show more