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++) {
try {
IBinaryParser parser = CoreModelUtil.getBinaryParser(parserRef[i]);
ICygwinToolsFactroy cygwinToolFactory = (ICygwinToolsFactroy) parser.getAdapter(ICygwinToolsFactroy.class);
ICygwinToolsFactroy cygwinToolFactory = parser.getAdapter(ICygwinToolsFactroy.class);
if (cygwinToolFactory != null) {
cygPath = cygwinToolFactory.getCygPath();
}

View file

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

View file

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

View file

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

View file

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

View file

@ -61,7 +61,7 @@ class CodanPartListener implements IPartListener2 {
};
}
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);
}
}

View file

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

View file

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

View file

@ -256,7 +256,7 @@ public class CodanPreferencePage extends FieldEditorOverlayPage implements IWork
for (IEditorReference partRef : page.getEditorReferences()) {
IEditorPart editor = partRef.getEditor(false);
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())) {
filesToUpdate.add(file);
}

View file

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

View file

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

View file

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

View file

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

View file

@ -71,7 +71,7 @@ public class Binary extends Openable implements IBinary {
}
private boolean determineShowInBinaryContainer(IBinaryObject bin) {
BinaryFilePresentation presentation= (BinaryFilePresentation) bin.getAdapter(BinaryFilePresentation.class);
BinaryFilePresentation presentation= bin.getAdapter(BinaryFilePresentation.class);
if (presentation != null) {
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
// symbol information.
ISymbolReader symbolreader = (ISymbolReader)obj.getAdapter(ISymbolReader.class);
ISymbolReader symbolreader = obj.getAdapter(ISymbolReader.class);
if (symbolreader == null)
return false;

View file

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

View file

@ -27,7 +27,7 @@ public class TagService implements ITagService {
return null;
// 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)
return tagReader;

View file

@ -137,7 +137,7 @@ public abstract class ASTNode implements IASTNode {
if (length != 0) {
final IASTTranslationUnit tu= getTranslationUnit();
if (tu != null) {
ILocationResolver l= (ILocationResolver) tu.getAdapter(ILocationResolver.class);
ILocationResolver l= tu.getAdapter(ILocationResolver.class);
if (l != null) {
locations= l.getLocations(getOffset(), length);
}
@ -152,7 +152,7 @@ public abstract class ASTNode implements IASTNode {
public IASTImageLocation getImageLocation() {
final IASTTranslationUnit tu= getTranslationUnit();
if (tu != null) {
ILocationResolver l= (ILocationResolver) tu.getAdapter(ILocationResolver.class);
ILocationResolver l= tu.getAdapter(ILocationResolver.class);
if (l != null) {
return l.getImageLocation(getOffset(), length);
}
@ -165,7 +165,7 @@ public abstract class ASTNode implements IASTNode {
final IASTFileLocation floc= originalNode.getFileLocation();
final IASTTranslationUnit ast = originalNode.getTranslationUnit();
if (floc != null && ast != null) {
ILocationResolver lr= (ILocationResolver) ast.getAdapter(ILocationResolver.class);
ILocationResolver lr= ast.getAdapter(ILocationResolver.class);
if (lr != null) {
return lr.getUnpreprocessedSignature(floc);
}
@ -206,7 +206,7 @@ public abstract class ASTNode implements IASTNode {
}
IASTTranslationUnit ast = getTranslationUnit();
if (ast != null) {
ILocationResolver lr= (ILocationResolver) ast.getAdapter(ILocationResolver.class);
ILocationResolver lr= ast.getAdapter(ILocationResolver.class);
if (lr != null) {
fileLocation= lr.getMappedFileLocation(offset, length);
} else {
@ -221,7 +221,7 @@ public abstract class ASTNode implements IASTNode {
public boolean isPartOfTranslationUnitFile() {
IASTTranslationUnit ast = getTranslationUnit();
if (ast != null) {
ILocationResolver lr= (ILocationResolver) ast.getAdapter(ILocationResolver.class);
ILocationResolver lr= ast.getAdapter(ILocationResolver.class);
if (lr != null) {
return lr.isPartOfTranslationUnitFile(getOffset());
}
@ -232,7 +232,7 @@ public abstract class ASTNode implements IASTNode {
public boolean isPartOfSourceFile() {
IASTTranslationUnit ast = getTranslationUnit();
if (ast != null) {
ILocationResolver lr= (ILocationResolver) ast.getAdapter(ILocationResolver.class);
ILocationResolver lr= ast.getAdapter(ILocationResolver.class);
if (lr != null) {
return lr.isPartOfSourceFile(getOffset());
}
@ -310,7 +310,7 @@ public abstract class ASTNode implements IASTNode {
if (!(tu instanceof ASTNode))
throw new UnsupportedOperationException();
ILocationResolver lr= (ILocationResolver) tu.getAdapter(ILocationResolver.class);
ILocationResolver lr= tu.getAdapter(ILocationResolver.class);
if (lr == null)
throw new UnsupportedOperationException();
@ -341,7 +341,7 @@ public abstract class ASTNode implements IASTNode {
}
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 {
Token result= null;
Token last= null;

View file

@ -517,7 +517,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
}
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);
return floc.getFileName().equals(lr.getContainingFilePath(offset1)) &&
floc.getStartingLineNumber() == floc.getEndingLineNumber();

View file

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

View file

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

View file

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

View file

@ -68,7 +68,7 @@ abstract class ASTPreprocessorNode extends ASTNode {
protected char[] getSource(int offset, int length) {
final IASTTranslationUnit ast= getTranslationUnit();
if (ast != null) {
ILocationResolver lr= (ILocationResolver) ast.getAdapter(ILocationResolver.class);
ILocationResolver lr= ast.getAdapter(ILocationResolver.class);
if (lr != null) {
final IASTFileLocation loc= lr.getMappedFileLocation(offset, length);
if (loc != null) {
@ -126,7 +126,7 @@ class ASTComment extends ASTPreprocessorNode implements IASTComment {
public int getOffset() {
if (fFilePath != null) {
// Perform lazy conversion to sequence number.
ILocationResolver lr= (ILocationResolver) getTranslationUnit().getAdapter(ILocationResolver.class);
ILocationResolver lr= getTranslationUnit().getAdapter(ILocationResolver.class);
if (lr != null) {
setOffset(lr.getSequenceNumberForFileOffset(fFilePath, super.getOffset()));
fFilePath= null;
@ -552,7 +552,7 @@ class ASTMacroDefinition extends ASTPreprocessorNode implements IASTPreprocessor
if (fExpansionNumber >= 0) {
IASTTranslationUnit ast = getTranslationUnit();
if (ast != null) {
ILocationResolver lr= (ILocationResolver) ast.getAdapter(ILocationResolver.class);
ILocationResolver lr= ast.getAdapter(ILocationResolver.class);
if (lr != null) {
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),
refs.toArray(new IASTName[refs.size()]), fMacroLocations,
fFilePath, refLoc.getStartingLineNumber(), isPPCond,
(LexerOptions) tu.getAdapter(LexerOptions.class));
tu.getAdapter(LexerOptions.class));
}
}
fBoundaries[++bidx]= fSource.length;
}
private ILocationResolver getResolver(IASTTranslationUnit tu) {
final ILocationResolver resolver = (ILocationResolver) tu.getAdapter(ILocationResolver.class);
final ILocationResolver resolver = tu.getAdapter(ILocationResolver.class);
if (resolver == null) {
throw new IllegalArgumentException();
}

View file

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

View file

@ -491,7 +491,7 @@ public abstract class PDOMWriter implements IPDOMASTProcessor {
ast.accept(visitor);
if ((fSkipReferences & SKIP_MACRO_REFERENCES) == 0) {
LocationMap lm= (LocationMap) ast.getAdapter(LocationMap.class);
LocationMap lm= ast.getAdapter(LocationMap.class);
if (lm != null) {
IASTName[] refs= lm.getMacroReferences();
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 {
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.
if (pdomBinding != null && pdomBinding.getPDOM() == getPDOM()) {
return pdomBinding;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -134,7 +134,7 @@ public class DeleteResConfigsHandler extends AbstractHandler {
if (editor != null) {
IEditorInput input = editor.getEditorInput();
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) {
IEditorInput input = editor.getEditorInput();
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)
return;
IResource resource = (IResource)(input).getAdapter(IResource.class);
IResource resource = (input).getAdapter(IResource.class);
if (resource == null || !(resource instanceof IFile))
return;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -526,7 +526,7 @@ public abstract class AbstractCModelOutlinePage extends Page
fTreeViewer.setInput(fInput);
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));
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -190,6 +190,6 @@ public class ProjectLanguageMappingPropertyPage extends PropertyPage {
}
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() {
@Override
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);
ICConfigurationDescription[] configurations = description.getConfigurations();
ProjectContentTypeMappingDialog dialog = new ProjectContentTypeMappingDialog(fContents.getShell(), configurations);
@ -213,7 +213,7 @@ public class ProjectLanguageMappingWidget extends LanguageMappingWidget {
IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
IProject project = (IProject) getElement().getAdapter(IProject.class);
IProject project = getElement().getAdapter(IProject.class);
ICProjectDescription description = CoreModel.getDefault().getProjectDescription(project, false);
while (mappings.hasNext()) {

View file

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

View file

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

View file

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

View file

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

View file

@ -50,7 +50,7 @@ public class CNavigatorRefactorActionProvider extends CommonActionProvider {
if (workbenchSite != null) {
final IWorkbenchPartSite partSite= workbenchSite.getSite();
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);
cElementRefactorGroup= new CRefactoringActionGroup(workbenchSite.getPart());
}

View file

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

View file

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

View file

@ -266,7 +266,7 @@ final class CodeAssistAdvancedConfigurationBlock extends OptionsConfigurationBlo
ModelElement(CompletionProposalCategory category, PreferenceModel model) {
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$
IParameter type;
try {
@ -406,7 +406,7 @@ final class CodeAssistAdvancedConfigurationBlock extends OptionsConfigurationBlo
}
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);
ParameterizedCommand pCmd= new ParameterizedCommand(command, null);
String key= getKeyboardShortcut(pCmd);
@ -727,7 +727,7 @@ final class CodeAssistAdvancedConfigurationBlock extends OptionsConfigurationBlo
private static BindingManager fgLocalBindingManager;
static {
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();
if (definedSchemes != null) {
try {
@ -745,7 +745,7 @@ final class CodeAssistAdvancedConfigurationBlock extends OptionsConfigurationBlo
}
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());
try {
Scheme activeScheme= bindingService.getActiveScheme();

View file

@ -479,7 +479,7 @@ public class EditTemplateDialog extends StatusDialog {
private void initializeActions() {
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() {
@Override
public void widgetDisposed(DisposeEvent e) {

View file

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

View file

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

View file

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

View file

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

View file

@ -74,7 +74,7 @@ public abstract class FindInWorkingSetAction extends FindAction {
for (int i = 0; i < fWorkingSets.length; ++i) {
IAdaptable[] elements = fWorkingSets[i].getElements();
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)
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);
if (invokingCommandId != null) {
IWorkbench workbench = PlatformUI.getWorkbench();
ICommandService commandSupport = (ICommandService)workbench.getAdapter(ICommandService.class);
ICommandService commandSupport = workbench.getAdapter(ICommandService.class);
if (commandSupport != null) {
fInvokingCommand = commandSupport.getCommand(invokingCommandId);
if (fInvokingCommand != null && !fInvokingCommand.isDefined())
fInvokingCommand= null;
else {
IBindingService bindingService = (IBindingService) workbench.getService(IBindingService.class);
IBindingService bindingService = workbench.getService(IBindingService.class);
fInvokingTriggerSequence = bindingService.getBestActiveBindingFor(invokingCommandId);
}
}

View file

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

View file

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

View file

@ -555,7 +555,7 @@ public class ContentAssistProcessor implements IContentAssistProcessor {
}
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);
if (binding instanceof KeySequence)
return (KeySequence) binding;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -548,7 +548,7 @@ public class EditorUtility {
if (editorInput == 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
* 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)
return saveUnknownEditors;

View file

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

View file

@ -133,7 +133,7 @@ public class CDTContextActivator implements IWindowListener, IPartListener2 {
if (page instanceof CContentOutlinePage) {
if (!fActivationPerOutline.containsKey(outline)){
// 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);
fActivationPerOutline.put(outline,activateContext);
}
@ -142,7 +142,7 @@ public class CDTContextActivator implements IWindowListener, IPartListener2 {
IContextActivation activation = fActivationPerOutline.remove(outline);
if (activation != null) {
// other outline page brought to front
IContextService ctxtService = (IContextService)outline.getViewSite().getService(IContextService.class);
IContextService ctxtService = outline.getViewSite().getService(IContextService.class);
ctxtService.deactivateContext(activation);
}
}
@ -155,7 +155,7 @@ public class CDTContextActivator implements IWindowListener, IPartListener2 {
public SelectionListener(IWorkbenchPartSite site) {
fSite= site;
fCtxService= (IContextService)fSite.getService(IContextService.class);
fCtxService= fSite.getService(IContextService.class);
ISelectionProvider sp= site.getSelectionProvider();
if (sp != null && fCtxService != null) {

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