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();
}
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();
@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);
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;
updateActions((IStructuredSelection)fViewer.getSelection());
- bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
+ bindingService = PlatformUI.getWorkbench().getService(IBindingService.class);
if (bindingService != null) {
bindingService.addBindingManagerListener(bindingManagerListener);
}
};
}
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);
}
}
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));
@Override
public IAdaptable getElement() {
if (element.getAdapter(IProject.class) != null)
- return (IProject) element.getAdapter(IProject.class);
+ return element.getAdapter(IProject.class);
return null;
}
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);
}
if (element == null)
return element;
if (!(element instanceof IProject))
- return (IAdaptable) element.getAdapter(IProject.class);
+ return element.getAdapter(IProject.class);
return element;
}
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) {
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;
}
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();
}
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();
}
@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);
}
}
private boolean determineShowInBinaryContainer(IBinaryObject bin) {
- BinaryFilePresentation presentation= (BinaryFilePresentation) bin.getAdapter(BinaryFilePresentation.class);
+ BinaryFilePresentation presentation= bin.getAdapter(BinaryFilePresentation.class);
if (presentation != null) {
return presentation.showInBinaryContainer();
}
// 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;
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) {
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;
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);
}
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);
}
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);
}
}
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 {
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());
}
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());
}
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();
}
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;
}
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();
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;
}
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()) {
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);
}
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) {
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;
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);
}
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();
}
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;
}
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) {
}
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;
return (T) object;
if (object instanceof IAdaptable)
- return (T) ((IAdaptable) object).getAdapter(type);
+ return ((IAdaptable) object).getAdapter(type);
return null;
}
}
private Addr2line getAddr2line() {
- ICygwinToolsFactroy factory = (ICygwinToolsFactroy)getBinaryParser().getAdapter(ICygwinToolsFactroy.class);
+ ICygwinToolsFactroy factory = getBinaryParser().getAdapter(ICygwinToolsFactroy.class);
if (factory != null) {
return factory.getAddr2line(getPath());
}
* @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();
}
* @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());
}
}
protected CygPath getCygPath() {
- ICygwinToolsFactroy factory = (ICygwinToolsFactroy)getBinaryParser().getAdapter(ICygwinToolsFactroy.class);
+ ICygwinToolsFactroy factory = getBinaryParser().getAdapter(ICygwinToolsFactroy.class);
if (factory != null) {
return factory.getCygPath();
}
/**
*/
protected NM getNM() {
- ICygwinToolsFactroy factory = (ICygwinToolsFactroy)getBinaryParser().getAdapter(ICygwinToolsFactroy.class);
+ ICygwinToolsFactroy factory = getBinaryParser().getAdapter(ICygwinToolsFactroy.class);
if (factory != null) {
return factory.getNM(getPath());
}
}
private Addr2line getAddr2line() {
- IGnuToolFactory factory = (IGnuToolFactory)getBinaryParser().getAdapter(IGnuToolFactory.class);
+ IGnuToolFactory factory = getBinaryParser().getAdapter(IGnuToolFactory.class);
if (factory != null) {
return factory.getAddr2line(getPath());
}
}
protected CPPFilt getCPPFilt() {
- IGnuToolFactory factory = (IGnuToolFactory)getBinaryParser().getAdapter(IGnuToolFactory.class);
+ IGnuToolFactory factory = getBinaryParser().getAdapter(IGnuToolFactory.class);
if (factory != null) {
return factory.getCPPFilt();
}
}
protected Objdump getObjdump() {
- IGnuToolFactory factory = (IGnuToolFactory)getBinaryParser().getAdapter(IGnuToolFactory.class);
+ IGnuToolFactory factory = getBinaryParser().getAdapter(IGnuToolFactory.class);
if (factory != null) {
return factory.getObjdump(getPath());
}
* @return
*/
private Addr2line getAddr2line() {
- IGnuToolFactory factory = (IGnuToolFactory)getBinaryParser().getAdapter(IGnuToolFactory.class);
+ IGnuToolFactory factory = getBinaryParser().getAdapter(IGnuToolFactory.class);
if (factory != null) {
return factory.getAddr2line(getPath());
}
}
protected CPPFilt getCPPFilt() {
- IGnuToolFactory factory = (IGnuToolFactory)getBinaryParser().getAdapter(IGnuToolFactory.class);
+ IGnuToolFactory factory = getBinaryParser().getAdapter(IGnuToolFactory.class);
if (factory != null) {
return factory.getCPPFilt();
}
}
protected Objdump getObjdump() {
- IGnuToolFactory factory = (IGnuToolFactory)getBinaryParser().getAdapter(IGnuToolFactory.class);
+ IGnuToolFactory factory = getBinaryParser().getAdapter(IGnuToolFactory.class);
if (factory != null) {
return factory.getObjdump(getPath());
}
* @return
*/
private Addr2line getAddr2line() {
- IGnuToolFactory factory = (IGnuToolFactory)getBinaryParser().getAdapter(IGnuToolFactory.class);
+ IGnuToolFactory factory = getBinaryParser().getAdapter(IGnuToolFactory.class);
if (factory != null) {
return factory.getAddr2line(getPath());
}
}
private CPPFilt getCPPFilt() {
- IGnuToolFactory factory = (IGnuToolFactory)getBinaryParser().getAdapter(IGnuToolFactory.class);
+ IGnuToolFactory factory = getBinaryParser().getAdapter(IGnuToolFactory.class);
if (factory != null) {
return factory.getCPPFilt();
}
}
private Objdump getObjdump() {
- IGnuToolFactory factory = (IGnuToolFactory)getBinaryParser().getAdapter(IGnuToolFactory.class);
+ IGnuToolFactory factory = getBinaryParser().getAdapter(IGnuToolFactory.class);
if (factory != null) {
return factory.getObjdump(getPath());
}
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);
}
else
return;
- IRewriteTarget target= (IRewriteTarget)editor.getAdapter(IRewriteTarget.class);
+ IRewriteTarget target= editor.getAdapter(IRewriteTarget.class);
if (target != null) {
target.beginCompoundChange();
}
if (editor != null) {
IEditorInput input = editor.getEditorInput();
if (input != null)
- return (IFile) input.getAdapter(IFile.class);
+ return input.getAdapter(IFile.class);
}
}
}
if (editor != null) {
IEditorInput input = editor.getEditorInput();
if (input != null)
- return (IFile) input.getAdapter(IFile.class);
+ return input.getAdapter(IFile.class);
}
}
}
if (document == null)
return;
- IResource resource = (IResource)(input).getAdapter(IResource.class);
+ IResource resource = (input).getAdapter(IResource.class);
if (resource == null || !(resource instanceof IFile))
return;
if (input == null)
return;
- IResource resource = (IResource)(input).getAdapter(IResource.class);
+ IResource resource = (input).getAdapter(IResource.class);
if (resource == null || !(resource instanceof IFile))
return;
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();
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)
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);
}
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;
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)) {
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();
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;
}
createActions();
createContextMenu();
- bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
+ bindingService = PlatformUI.getWorkbench().getService(IBindingService.class);
if (bindingService != null) {
bindingManagerListener = new IBindingManagerListener() {
@Override
initializeActionStates();
- IContextService ctxService = (IContextService) getSite().getService(IContextService.class);
+ IContextService ctxService = getSite().getService(IContextService.class);
if (ctxService != null) {
fContextActivation= ctxService.activateContext(CUIPlugin.CVIEWS_SCOPE);
}
@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);
}
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);
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;
}
}
memento = null;
- IContextService ctxService = (IContextService) getSite().getService(IContextService.class);
+ IContextService ctxService = getSite().getService(IContextService.class);
if (ctxService != null) {
fContextActivation= ctxService.activateContext(CUIPlugin.CVIEWS_SCOPE);
}
@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);
}
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) {
}
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;
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) {
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);
} 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();
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;
}
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;
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);
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();
}
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;
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;
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)
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);
}
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);
}
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();
}
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));
}
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);
}
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))
@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());
}
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) {
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;
}
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 {
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));
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();
}
}
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) {
createActions();
createContextMenu();
- bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
+ bindingService = PlatformUI.getWorkbench().getService(IBindingService.class);
if (bindingService != null) {
bindingManagerListener = new IBindingManagerListener() {
@Override
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);
}
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);
}
}
private IFile getFile() {
- return (IFile) getElement().getAdapter(IFile.class);
+ return getElement().getAdapter(IFile.class);
}
@Override
}
private IProject getProject() {
- return (IProject) getElement().getAdapter(IProject.class);
+ return getElement().getAdapter(IProject.class);
}
}
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);
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()) {
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;
}
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);
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);
}
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) {
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());
}
if (elem instanceof IProject) {
project= (IProject) elem;
} else if (elem != null) {
- project= (IProject) elem.getAdapter(IProject.class);
+ project= elem.getAdapter(IProject.class);
}
return project;
}
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;
}
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 {
}
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);
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 {
}
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();
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) {
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;
* @return the keybinding for Refactor > 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);
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);
}
} 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);
}
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);
}
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);
}
}
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) {
};
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));
*/
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);
}
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;
if(tu != null) {
ILanguage language = tu.getLanguage();
if(language != null)
- languageKeywords = (ICLanguageKeywords) language.getAdapter(ICLanguageKeywords.class);
+ languageKeywords = language.getAdapter(ICLanguageKeywords.class);
}
if(languageKeywords == null)
}
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());
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) {
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;
}
}
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;
LinkedModeModel.closeAllModels(document);
}
if (activeEditor != null) {
- rewriteTarget= (IRewriteTarget) activeEditor.getAdapter(IRewriteTarget.class);
+ rewriteTarget= activeEditor.getAdapter(IRewriteTarget.class);
if (rewriteTarget != null) {
rewriteTarget.beginCompoundChange();
}
}
private ProjectionAnnotationModel getModel() {
- return (ProjectionAnnotationModel) fEditor.getAdapter(ProjectionAnnotationModel.class);
+ return fEditor.getAdapter(ProjectionAnnotationModel.class);
}
private IDocument getDocument() {
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;
}
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);
}
@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);
}
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;
}
@Override
public IWorkbenchSiteProgressService getProgressService() {
- return (IWorkbenchSiteProgressService) getSite().getAdapter(IWorkbenchSiteProgressService.class);
+ return getSite().getAdapter(IWorkbenchSiteProgressService.class);
}
private static class CopyTypeHierarchyAction extends CopyTreeAction {
if (activeWindow == null) {
return null;
}
- IHandlerService service = (IHandlerService) activeWindow.getService(IHandlerService.class);
+ IHandlerService service = activeWindow.getService(IHandlerService.class);
return service.getCurrentState();
}
if (editorInput == null) {
return null;
}
- return (ICElement) editorInput.getAdapter(ICElement.class);
+ return editorInput.getAdapter(ICElement.class);
}
/**
* 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;
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) {
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);
}
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);
}
}
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) {
* Returns <code>null</code> if no image could be found.
*/
public ImageDescriptor getWorkbenchImageDescriptor(IAdaptable adaptable, int flags) {
- IWorkbenchAdapter wbAdapter= (IWorkbenchAdapter) adaptable.getAdapter(IWorkbenchAdapter.class);
+ IWorkbenchAdapter wbAdapter= adaptable.getAdapter(IWorkbenchAdapter.class);
if (wbAdapter == null) {
return null;
}
public ImageDescriptor getBaseImageDescriptor(ICElement celement, int renderFlags) {
// Allow contributed languages to provide icons for their extensions to the ICElement hierarchy
if (celement instanceof IContributedCElement)
- return (ImageDescriptor)((IContributedCElement)celement).getAdapter(ImageDescriptor.class);
+ return ((IContributedCElement)celement).getAdapter(ImageDescriptor.class);
int type = celement.getElementType();
switch (type) {
ICProject cp= (ICProject)celement;
if (cp.getProject().isOpen()) {
IProject project= cp.getProject();
- IWorkbenchAdapter adapter= (IWorkbenchAdapter)project.getAdapter(IWorkbenchAdapter.class);
+ IWorkbenchAdapter adapter= project.getAdapter(IWorkbenchAdapter.class);
if (adapter != null) {
ImageDescriptor result= adapter.getImageDescriptor(project);
if (result != null)
return BasicElementLabels.getResourceName(((IStorage) obj).getName());
} else if (obj instanceof IAdaptable) {
- IWorkbenchAdapter wbadapter= (IWorkbenchAdapter) ((IAdaptable)obj).getAdapter(IWorkbenchAdapter.class);
+ IWorkbenchAdapter wbadapter= ((IAdaptable)obj).getAdapter(IWorkbenchAdapter.class);
if (wbadapter != null) {
return Strings.markLTR(wbadapter.getLabel(obj));
}
return getStyledStorageLabel((IStorage) obj);
} else if (obj instanceof IAdaptable) {
- IWorkbenchAdapter wbadapter= (IWorkbenchAdapter) ((IAdaptable)obj).getAdapter(IWorkbenchAdapter.class);
+ IWorkbenchAdapter wbadapter= ((IAdaptable)obj).getAdapter(IWorkbenchAdapter.class);
if (wbadapter != null) {
return Strings.markLTR(new StyledString(wbadapter.getLabel(obj)));
}
fResourceFilter = new HashMap<IPath, Object>();
for (int i = 0; i < input.length; i++) {
IAdaptable adaptable = input[i];
- IResource res = (IResource) adaptable.getAdapter(IResource.class);
+ IResource res = adaptable.getAdapter(IResource.class);
if (res != null) {
fResourceFilter.put(res.getFullPath(), ACCEPT);
}
if (selectedElement instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) selectedElement;
- celem = (ICElement) adaptable.getAdapter(ICElement.class);
+ celem = adaptable.getAdapter(ICElement.class);
if (celem == null) {
- IResource resource = (IResource) adaptable.getAdapter(IResource.class);
+ IResource resource = adaptable.getAdapter(IResource.class);
if (resource != null && resource.getType() != IResource.ROOT) {
while (celem == null && resource.getType() != IResource.PROJECT) {
- celem = (ICElement) resource.getAdapter(ICElement.class);
+ celem = resource.getAdapter(ICElement.class);
resource = resource.getParent();
}
if (celem == null) {
if (celem == null && part instanceof CEditor) {
IEditorInput input = ((IEditorPart)part).getEditorInput();
if (input != null) {
- final IResource res = (IResource) input.getAdapter(IResource.class);
+ final IResource res = input.getAdapter(IResource.class);
if (res != null && res instanceof IFile) {
celem = CoreModel.getDefault().create((IFile)res);
}
if (selectedElement instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) selectedElement;
- celem = (ICElement) adaptable.getAdapter(ICElement.class);
+ celem = adaptable.getAdapter(ICElement.class);
if (celem == null) {
- IResource resource = (IResource) adaptable.getAdapter(IResource.class);
+ IResource resource = adaptable.getAdapter(IResource.class);
if (resource != null && resource.getType() != IResource.ROOT) {
while (celem == null && resource.getType() != IResource.PROJECT) {
- celem = (ICElement) resource.getAdapter(ICElement.class);
+ celem = resource.getAdapter(ICElement.class);
resource = resource.getParent();
}
if (celem == null) {
if (celem == null && part instanceof CEditor) {
IEditorInput input = ((IEditorPart)part).getEditorInput();
if (input != null) {
- final IResource res = (IResource) input.getAdapter(IResource.class);
+ final IResource res = input.getAdapter(IResource.class);
if (res != null && res instanceof IFile) {
celem = CoreModel.getDefault().create((IFile)res);
}
if (oldItem instanceof IResource) {
oldResource= (IResource)oldItem;
} else {
- oldResource= (IResource)oldItem.getAdapter(IResource.class);
+ oldResource= oldItem.getAdapter(IResource.class);
}
if (oldResource != null && oldResource.isAccessible() == false) {
IProject project= oldResource.getProject();
if (child == null)
return;
if (child instanceof IAdaptable) {
- IResource resource= (IResource)((IAdaptable)child).getAdapter(IResource.class);
+ IResource resource= ((IAdaptable)child).getAdapter(IResource.class);
if (resource != null && !resource.isAccessible())
return;
}
elements= SelectionConverter.getStructuredSelection(part).toArray();
for (int i= 0; i < elements.length; i++) {
if (elements[i] instanceof IResource) {
- ICElement ce= (ICElement)((IResource)elements[i]).getAdapter(ICElement.class);
+ ICElement ce= ((IResource)elements[i]).getAdapter(ICElement.class);
if (ce != null && ce.exists() && ce.getCProject().isOnSourceRoot((IResource)elements[i]))
elements[i]= ce;
}
setSubtreeChecked(element, true, true);
if (element instanceof IAdaptable) {
- IResource resource= (IResource) ((IAdaptable)element).getAdapter(IResource.class);
+ IResource resource= ((IAdaptable)element).getAdapter(IResource.class);
if (resource != null && !resource.isAccessible())
continue;
}
private void setSubtreeChecked(Object parent, boolean state, boolean checkExpandedState) {
if (!(parent instanceof IAdaptable))
return;
- IContainer container= (IContainer)((IAdaptable)parent).getAdapter(IContainer.class);
+ IContainer container= ((IAdaptable)parent).getAdapter(IContainer.class);
if ((!fTree.getExpandedState(parent) && checkExpandedState) || (container != null && !container.isAccessible()))
return;
private IWorkingSetProxy.ISnapshot getWorkingSet(WorkspaceSnapshot workspace) {
IWorkingSetProxy.ISnapshot result = null;
- IWorkingSet realWorkingSet = (IWorkingSet) getElement().getAdapter(IWorkingSet.class);
+ IWorkingSet realWorkingSet = getElement().getAdapter(IWorkingSet.class);
if (realWorkingSet != null) {
result = workspace.getWorkingSet(realWorkingSet.getName());
if (object instanceof IWorkingSet) {
result = (IWorkingSet) object;
} else if (object instanceof IAdaptable) {
- result = (IWorkingSet) ((IAdaptable) object).getAdapter(IWorkingSet.class);
+ result = ((IAdaptable) object).getAdapter(IWorkingSet.class);
}
return result;
IAdaptable[] members = workingSet.getElements();
for (IAdaptable next : members) {
- IProject project = (IProject) next.getAdapter(IProject.class);
+ IProject project = next.getAdapter(IProject.class);
if ((project != null) && CoreModel.hasCNature(project)) {
result = true;
IWorkingSet resolvedWS = resolve();
if (resolvedWS != null) {
for (IAdaptable next : resolvedWS.getElements()) {
- IProject proj = (IProject) next.getAdapter(IProject.class);
+ IProject proj = next.getAdapter(IProject.class);
if (proj != null) {
result.add(proj);
if (tu != null)
return tu;
- return (ICElement)editorInput.getAdapter(ICElement.class);
+ return editorInput.getAdapter(ICElement.class);
}
/**
@SuppressWarnings("unchecked")
final Comparator<Object> comparator = getComparator();
if (cat1 == PROJECTS) {
- IWorkbenchAdapter a1= (IWorkbenchAdapter)((IAdaptable)e1).getAdapter(IWorkbenchAdapter.class);
- IWorkbenchAdapter a2= (IWorkbenchAdapter)((IAdaptable)e2).getAdapter(IWorkbenchAdapter.class);
+ IWorkbenchAdapter a1= ((IAdaptable)e1).getAdapter(IWorkbenchAdapter.class);
+ IWorkbenchAdapter a2= ((IAdaptable)e2).getAdapter(IWorkbenchAdapter.class);
return comparator.compare(a1.getLabel(e1), a2.getLabel(e2));
}
IWorkbenchPart part = page.getActivePart();
if (part instanceof IEditorPart) {
IEditorPart epart = (IEditorPart) part;
- IResource resource = (IResource) epart.getEditorInput().getAdapter(IResource.class);
+ IResource resource = epart.getEditorInput().getAdapter(IResource.class);
if (resource != null)
{
IProject project = resource.getProject();
}
private void installQuickAccessAction() {
- fHandlerService= (IHandlerService)fSite.getService(IHandlerService.class);
+ fHandlerService= fSite.getService(IHandlerService.class);
if (fHandlerService != null) {
IHandler handler= new CDTQuickMenuCreator(fEditor) {
@Override
if (element instanceof IResource) {
return (IResource)element;
}
- return (IResource)element.getAdapter(IResource.class);
+ return element.getAdapter(IResource.class);
}
@Override
if (elem instanceof IProject) {
project= (IProject) elem;
} else if (elem != null) {
- project= (IProject) elem.getAdapter(IProject.class);
+ project= elem.getAdapter(IProject.class);
}
return project;
}
else if (el instanceof IResource)
internalElement = (IResource)el;
else
- internalElement = (IResource) el.getAdapter(IResource.class);
+ internalElement = el.getAdapter(IResource.class);
if (internalElement == null) return false;
isProject = internalElement instanceof IProject;
isFolder = internalElement instanceof IFolder;
if (elem instanceof IProject) {
project= (IProject) elem;
} else if (elem != null) {
- project= (IProject) elem.getAdapter(IProject.class);
+ project= elem.getAdapter(IProject.class);
}
return project;
}
IAsmLanguage asmLang= (IAsmLanguage)language;
scanner = new AsmCodeScanner(getTokenStoreFactory(), asmLang);
} else if (language != null) {
- ILanguageUI languageUI = (ILanguageUI)language.getAdapter(ILanguageUI.class);
+ ILanguageUI languageUI = language.getAdapter(ILanguageUI.class);
if (languageUI != null)
scanner = languageUI.getCodeScanner();
}
IPath path = ((IPathEditorInput)input).getPath();
contentType = CCorePlugin.getContentType(path.lastSegment());
} else {
- ILocationProvider locationProvider = (ILocationProvider)input.getAdapter(ILocationProvider.class);
+ ILocationProvider locationProvider = input.getAdapter(ILocationProvider.class);
if (locationProvider != null) {
IPath path = locationProvider.getPath(input);
contentType = CCorePlugin.getContentType(path.lastSegment());
RuleBasedScanner scanner= null;
if(language != null) {
- ICLanguageKeywords keywords = (ICLanguageKeywords) language.getAdapter(ICLanguageKeywords.class);
+ ICLanguageKeywords keywords = language.getAdapter(ICLanguageKeywords.class);
if(keywords != null) {
scanner = new CCodeScanner(getTokenStoreFactory(), keywords);
}
else {
- ILanguageUI languageUI = (ILanguageUI)language.getAdapter(ILanguageUI.class);
+ ILanguageUI languageUI = language.getAdapter(ILanguageUI.class);
if (languageUI != null)
scanner = languageUI.getCodeScanner();
}
IPath path = ((IPathEditorInput)input).getPath();
contentType = CCorePlugin.getContentType(path.lastSegment());
} else {
- ILocationProvider locationProvider = (ILocationProvider)input.getAdapter(ILocationProvider.class);
+ ILocationProvider locationProvider = input.getAdapter(ILocationProvider.class);
if (locationProvider != null) {
IPath path = locationProvider.getPath(input);
if (path != null) {
if (part != null) {
IEditorInput editorInput= part.getEditorInput();
if (editorInput != null) {
- return (ICElement)editorInput.getAdapter(ICElement.class);
+ return editorInput.getAdapter(ICElement.class);
}
}
}
// Add command handlers for undo to the control
try {
- IFocusService fs = (IFocusService)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ IFocusService fs = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.getActivePart().getSite().getService(IFocusService.class);
fs.addFocusTracker(list, "org.eclipse.cdt.ui.FileListControl"); //$NON-NLS-1$
} catch (Exception e) {
if (!subsystem.isConnected())
throw new Exception(Messages.RemoteRunLaunchDelegate_5);
- return (IShellService) subsystem.getSubSystemConfiguration()
+ return subsystem.getSubSystemConfiguration()
.getService(currentConnection).getAdapter(
IShellService.class);
} else {
public static IShellService getShellService(IHost host) {
ISubSystem ss = getSubSystemWithShellService(host);
if (ss != null) {
- return (IShellService) ss.getSubSystemConfiguration().getService(
+ return ss.getSubSystemConfiguration().getService(
host).getAdapter(IShellService.class);
}
return null;
IService svc = subSystems[i].getSubSystemConfiguration()
.getService(host);
if (svc != null) {
- ssvc = (IShellService) svc.getAdapter(IShellService.class);
+ ssvc = svc.getAdapter(IShellService.class);
if (ssvc != null) {
return subSystems[i];
}
ISharedImages sharedImages = getWindow().getWorkbench()
.getSharedImages();
- IActionCommandMappingService acms = (IActionCommandMappingService) getWindow()
+ IActionCommandMappingService acms = getWindow()
.getService(IActionCommandMappingService.class);
acms.map(actionId, commandId);
GNUElfParser binParser = new GNUElfParser();
IBinaryFile bf = binParser
.getBinary(new Path(executable));
- ISymbolReader reader = (ISymbolReader)bf.getAdapter(ISymbolReader.class);
+ ISymbolReader reader = bf.getAdapter(ISymbolReader.class);
String[] sourceFiles = reader
.getSourceFiles();
monitor.beginTask(Messages.GetCompilerOptions, sourceFiles.length * 2 + 1);
}
private ICBreakpointFilterExtension getFilterExtension(ICBreakpoint bp) throws CoreException{
- return (ICBreakpointFilterExtension)bp.getExtension(
+ return bp.getExtension(
CDIDebugModel.getPluginIdentifier(), ICBreakpointFilterExtension.class);
}
}
if ( event.getKind() == DebugEvent.TERMINATE ) {
Object element = event.getSource();
if ( element instanceof IDebugTarget && ((IDebugTarget)element).getAdapter( ICDITarget.class ) != null ) {
- handleTerminateEvent( ((IDebugTarget)element).getLaunch(), ((ICDITarget)((IDebugTarget)element).getAdapter( ICDITarget.class )).getSession() );
+ handleTerminateEvent( ((IDebugTarget)element).getLaunch(), ((IDebugTarget)element).getAdapter( ICDITarget.class ).getSession() );
}
}
}
IDebugTarget[] targets = launch.getDebugTargets();
boolean terminate = true;
for( int i = 0; i < targets.length; ++i ) {
- if ( targets[i].getAdapter( ICDITarget.class ) != null && session.equals( ((ICDITarget)targets[i].getAdapter( ICDITarget.class )).getSession() ) && !targets[i].isTerminated() && !targets[i].isDisconnected() )
+ if ( targets[i].getAdapter( ICDITarget.class ) != null && session.equals( targets[i].getAdapter( ICDITarget.class ).getSession() ) && !targets[i].isTerminated() && !targets[i].isDisconnected() )
terminate = false;
}
if ( terminate ) {
ISourceFinder srcFinder;
public StandardSourceFileRemapping(IBinary binary) {
- srcFinder = (ISourceFinder) binary.getAdapter(ISourceFinder.class);
+ srcFinder = binary.getAdapter(ISourceFinder.class);
}
@Override
IBinaryFile bin = createBinaryFile(executable);
if (bin != null) {
- ISymbolReader symbolreader = (ISymbolReader) bin.getAdapter(ISymbolReader.class);
+ ISymbolReader symbolreader = bin.getAdapter(ISymbolReader.class);
if (symbolreader != null) {
return symbolreader.getSourceFiles(monitor);
}
* @return the underlying CDI target
*/
public ICDITarget getCDITarget() {
- return (ICDITarget)getDebugTarget().getAdapter( ICDITarget.class );
+ return getDebugTarget().getAdapter( ICDITarget.class );
}
/**
protected void initializeSourceManager() {
ISourceLocator locator = getLaunch().getSourceLocator();
if (locator instanceof IAdaptable) {
- ICSourceLocator clocator = (ICSourceLocator)((IAdaptable)locator).getAdapter(ICSourceLocator.class);
+ ICSourceLocator clocator = ((IAdaptable)locator).getAdapter(ICSourceLocator.class);
if (clocator instanceof IAdaptable) {
- CSourceManager sm = (CSourceManager)((IAdaptable)clocator).getAdapter(CSourceManager.class);
+ CSourceManager sm = ((IAdaptable)clocator).getAdapter(CSourceManager.class);
if (sm != null)
sm.setDebugTarget(this);
}
- IResourceChangeListener listener = (IResourceChangeListener)((IAdaptable)locator).getAdapter(IResourceChangeListener.class);
+ IResourceChangeListener listener = ((IAdaptable)locator).getAdapter(IResourceChangeListener.class);
if (listener != null)
CCorePlugin.getWorkspace().addResourceChangeListener(listener);
}
protected void disposeSourceManager() {
ISourceLocator locator = getSourceLocator();
if (locator instanceof IAdaptable) {
- IResourceChangeListener listener = (IResourceChangeListener)((IAdaptable)locator).getAdapter(IResourceChangeListener.class);
+ IResourceChangeListener listener = ((IAdaptable)locator).getAdapter(IResourceChangeListener.class);
if (listener != null)
CCorePlugin.getWorkspace().removeResourceChangeListener(listener);
}
}
private boolean isBigEndian() {
- IExecFileInfo info = (IExecFileInfo)getDebugTarget().getAdapter( IExecFileInfo.class );
+ IExecFileInfo info = getDebugTarget().getAdapter( IExecFileInfo.class );
if ( info != null ) {
return !info.isLittleEndian();
}
*/
@Override
public IMemoryBlockRetrieval getMemoryBlockRetrieval() {
- return (IMemoryBlockRetrieval)getDebugTarget().getAdapter( IMemoryBlockRetrieval.class );
+ return getDebugTarget().getAdapter( IMemoryBlockRetrieval.class );
}
/* (non-Javadoc)
}
private CRegisterManager getRegisterManager() {
- return (CRegisterManager)getDebugTarget().getAdapter( CRegisterManager.class );
+ return getDebugTarget().getAdapter( CRegisterManager.class );
}
private void invalidate() {
if ( isSuspended() ) {
ISourceLocator locator = ((CDebugTarget)getDebugTarget()).getSourceLocator();
if ( locator != null && locator instanceof IAdaptable && ((IAdaptable)locator).getAdapter( ICSourceLocator.class ) != null )
- return ((ICSourceLocator)((IAdaptable)locator).getAdapter( ICSourceLocator.class )).getLineNumber( this );
+ return ((IAdaptable)locator).getAdapter( ICSourceLocator.class ).getLineNumber( this );
final ICDIStackFrame cdiFrame = getCDIStackFrame();
if ( cdiFrame != null && cdiFrame.getLocator() != null )
protected synchronized void preserveStackFrames() {
Iterator it = fStackFrames.iterator();
while( it.hasNext() ) {
- CStackFrame frame = (CStackFrame)(((IAdaptable)it.next()).getAdapter( CStackFrame.class ));
+ CStackFrame frame = (((IAdaptable)it.next()).getAdapter( CStackFrame.class ));
if ( frame != null ) {
frame.preserve();
}
Iterator it = fStackFrames.iterator();
int counter = 0;
while( it.hasNext() ) {
- CStackFrame frame = (CStackFrame)(((IAdaptable)it.next()).getAdapter( CStackFrame.class ));
+ CStackFrame frame = (((IAdaptable)it.next()).getAdapter( CStackFrame.class ));
if ( frame != null && counter >= index && counter < index + length ) {
frame.dispose();
removeList.add( frame );
}
private DisassemblyBlock createBlock( ICStackFrame frame ) throws DebugException {
- ICDITarget target = (ICDITarget)getDebugTarget().getAdapter( ICDITarget.class );
+ ICDITarget target = getDebugTarget().getAdapter( ICDITarget.class );
if ( target != null ) {
String fileName = frame.getFile();
int lineNumber = frame.getLineNumber();
}
private DisassemblyBlock createBlock( IAddress startAddress, IAddress endAddress) throws DebugException {
- ICDITarget target = (ICDITarget)getDebugTarget().getAdapter( ICDITarget.class );
+ ICDITarget target = getDebugTarget().getAdapter( ICDITarget.class );
if ( target != null ) {
ICDIMixedInstruction[] mixedInstrs = new ICDIMixedInstruction[0];
if ( mixedInstrs.length == 0 ||
public String getModuleFile() {
IDisassembly d = getDisassembly();
if ( d != null ) {
- IExecFileInfo info = (IExecFileInfo)d.getAdapter( IExecFileInfo.class );
+ IExecFileInfo info = d.getAdapter( IExecFileInfo.class );
if ( info != null && info.getExecFile() != null ) {
return info.getExecFile().getPath().toOSString();
}
private IDisassemblyLine[] disassemble( BigInteger startAddress, BigInteger endAddress, boolean mixed ) throws DebugException {
List<IDisassemblyLine> list = new ArrayList<IDisassemblyLine>();
- ICDITarget cdiTarget = (ICDITarget)getDebugTarget().getAdapter( ICDITarget.class );
+ ICDITarget cdiTarget = getDebugTarget().getAdapter( ICDITarget.class );
try {
ICDIMixedInstruction[] mixedInstructions = null;
ICDIInstruction[] asmInstructions = null;
return (String)object;
}
if (object instanceof IAdaptable) {
- ICStackFrame frame = (ICStackFrame)((IAdaptable)object).getAdapter(ICStackFrame.class);
+ ICStackFrame frame = ((IAdaptable)object).getAdapter(ICStackFrame.class);
if (frame != null) {
String name = frame.getFile();
return (name != null && name.trim().length() > 0) ? name : null;
String name = null;
IBreakpoint breakpoint = null;
if (object instanceof IAdaptable) {
- ICStackFrame frame = (ICStackFrame)((IAdaptable)object).getAdapter(ICStackFrame.class);
+ ICStackFrame frame = ((IAdaptable)object).getAdapter(ICStackFrame.class);
if (frame != null) {
name = frame.getFile().trim();
if (name == null || name.length() == 0)
}
}
// See if findSourceElements(...) is the result of a Breakpoint Hit Event
- ICDebugTarget target = (ICDebugTarget)((IAdaptable)object).getAdapter(ICDebugTarget.class);
+ ICDebugTarget target = ((IAdaptable)object).getAdapter(ICDebugTarget.class);
if (target != null) {
- CBreakpointManager bmanager = (CBreakpointManager)target.getAdapter(CBreakpointManager.class);
+ CBreakpointManager bmanager = target.getAdapter(CBreakpointManager.class);
Object stateInfo = target.getCurrentStateInfo();
if (bmanager != null && stateInfo instanceof ICDIBreakpointHit) {
breakpoint = bmanager.getBreakpoint(((ICDIBreakpointHit)stateInfo).getBreakpoint());
* @return a description string or null if not available
*/
public String getDescription() {
- ICSourceNotFoundDescription description = (ICSourceNotFoundDescription) element.getAdapter(ICSourceNotFoundDescription.class);
+ ICSourceNotFoundDescription description = element.getAdapter(ICSourceNotFoundDescription.class);
if (description != null)
return description.getDescription();
else
public String toLocalPath(IAdaptable _launch, String compilationPath) {
Object foundElement = null;
- ILaunch launch = (ILaunch)_launch.getAdapter(ILaunch.class);
+ ILaunch launch = _launch.getAdapter(ILaunch.class);
if (launch != null) {
ISourceLocator locator = launch.getSourceLocator();
// in practice, a launch locator is always an ISourceLookupDirector
* @return true if the launch config targets our binary, false otherwise
*/
private boolean isMatch(ILaunchConfiguration config) {
- IResource resource = (IResource)fBinary.getAdapter(IResource.class);
+ IResource resource = fBinary.getAdapter(IResource.class);
if (resource != null) {
String binaryPath = resource.getFullPath().toString();
try {
private SharedLibraryManager getSharedLibraryManager( IAdaptable element ) {
if ( element != null ) {
- ICDISession session = (ICDISession)element.getAdapter( ICDISession.class );
+ ICDISession session = element.getAdapter( ICDISession.class );
if ( session instanceof Session )
return ((Session)session).getSharedLibraryManager();
}
private Target getTarget( IAdaptable element ) {
if (element != null) {
- ICDITarget target = (ICDITarget)element.getAdapter( ICDITarget.class );
+ ICDITarget target = element.getAdapter( ICDITarget.class );
if (target instanceof Target) {
return (Target)target;
}
private void initialize() {
boolean solibUpdate = true;
- ICDISession session = (ICDISession)getElement().getAdapter( ICDISession.class );
+ ICDISession session = getElement().getAdapter( ICDISession.class );
if ( session instanceof Session ) {
solibUpdate = ((Session)session).getSharedLibraryManager().isAutoUpdate();
}
}
private void storeValues() {
- ICDISession session = (ICDISession)getElement().getAdapter( ICDISession.class );
- final ICDITarget target = (ICDITarget)getElement().getAdapter( ICDITarget.class );
+ ICDISession session = getElement().getAdapter( ICDISession.class );
+ final ICDITarget target = getElement().getAdapter( ICDITarget.class );
if ( session instanceof Session ) {
final boolean solibUpdate = fRefreshSolibsButton.getSelection();
final Session miSession = ((Session)session);
if (marker == null || !marker.exists())
return null;
// If the BP's marker is on an IFile, job done
- IFile file = (IFile)marker.getResource().getAdapter(IFile.class);
+ IFile file = marker.getResource().getAdapter(IFile.class);
if (file == null) {
try {
// Not backed by an IFile, try its source handle (may be workspace / project based)
if ( file != null )
return new FileEditorInput( file );
// There is no file associated with this breakpoint. See if another editor is available from an adapter
- ISourcePresentation srcPres = (ISourcePresentation) Platform.getAdapterManager().getAdapter(b, ISourcePresentation.class);
+ ISourcePresentation srcPres = Platform.getAdapterManager().getAdapter(b, ISourcePresentation.class);
if ( srcPres != null ) {
IEditorInput editor = srcPres.getEditorInput(b);
if ( editor != null ) {
}
else if ( element instanceof ICBreakpoint ) {
// There is no associated editor ID for this breakpoint, see if an alternative can be supplied from an adapter.
- ISourcePresentation sourcePres = (ISourcePresentation) Platform.getAdapterManager().getAdapter(element, ISourcePresentation.class);
+ ISourcePresentation sourcePres = Platform.getAdapterManager().getAdapter(element, ISourcePresentation.class);
if ( sourcePres != null ) {
String lid = sourcePres.getEditorId(input, element);
if ( lid != null ) {
}
protected Image getRegisterGroupImage( IRegisterGroup element ) {
- IEnableDisableTarget target = (IEnableDisableTarget)element.getAdapter( IEnableDisableTarget.class );
+ IEnableDisableTarget target = element.getAdapter( IEnableDisableTarget.class );
if ( target != null && !target.isEnabled() )
return fDebugImageRegistry.get( CDebugImages.DESC_OBJS_REGISTER_GROUP_DISABLED );
return fDebugImageRegistry.get( CDebugImages.DESC_OBJS_REGISTER_GROUP );
protected Image getBreakpointImage( ICBreakpoint breakpoint ) {
// if adapter installed for breakpoint, call the adapter
- ILabelProvider adapter = (ILabelProvider) Platform.getAdapterManager().getAdapter(breakpoint, ILabelProvider.class);
+ ILabelProvider adapter = Platform.getAdapterManager().getAdapter(breakpoint, ILabelProvider.class);
if (adapter!=null) {
Image image = adapter.getImage(breakpoint);
if (image!=null) return image;
}
if ( element instanceof IBreakpoint ) {
// if adapter installed for breakpoint, call adapter
- ILabelProvider adapter = (ILabelProvider) Platform.getAdapterManager().getAdapter(element, ILabelProvider.class);
+ ILabelProvider adapter = Platform.getAdapterManager().getAdapter(element, ILabelProvider.class);
if (adapter!=null) {
String text = adapter.getText(element);
if (text!=null) return text;
}
protected String getTargetText( IDebugTarget target, boolean qualified ) throws DebugException {
- ICDebugTarget t = (ICDebugTarget)target.getAdapter( ICDebugTarget.class );
+ ICDebugTarget t = target.getAdapter( ICDebugTarget.class );
if ( t != null ) {
if ( !t.isPostMortem() ) {
CDebugElementState state = t.getState();
}
protected String getThreadText( IThread thread, boolean qualified ) throws DebugException {
- ICDebugTarget target = (ICDebugTarget)thread.getDebugTarget().getAdapter( ICDebugTarget.class );
+ ICDebugTarget target = thread.getDebugTarget().getAdapter( ICDebugTarget.class );
if ( target.isPostMortem() ) {
return getFormattedString( CDebugUIMessages.getString( "CDTDebugModelPresentation.8" ), thread.getName() ); //$NON-NLS-1$
}
}
if ( thread.isSuspended() ) {
String reason = ""; //$NON-NLS-1$
- ICDebugElement element = (ICDebugElement)thread.getAdapter( ICDebugElement.class );
+ ICDebugElement element = thread.getAdapter( ICDebugElement.class );
if ( element != null ) {
Object info = element.getCurrentStateInfo();
if ( info instanceof ICDISignalReceived ) {
@Override
public Color getForeground(Object element) {
- IColorProvider colorProv = (IColorProvider) Platform.getAdapterManager().getAdapter(element, IColorProvider.class);
+ IColorProvider colorProv = Platform.getAdapterManager().getAdapter(element, IColorProvider.class);
if ( colorProv != null ) {
return colorProv.getForeground(element);
}
@Override
public Color getBackground(Object element) {
- IColorProvider colorProv = (IColorProvider) Platform.getAdapterManager().getAdapter(element, IColorProvider.class);
+ IColorProvider colorProv = Platform.getAdapterManager().getAdapter(element, IColorProvider.class);
if ( colorProv != null ) {
return colorProv.getBackground(element);
}
baseText.append( MessageFormat.format( " <{0}>", new Object[] { ((ICDebugElementStatus)element).getMessage() } ) ); //$NON-NLS-1$
}
if ( element instanceof IAdaptable ) {
- IEnableDisableTarget target = (IEnableDisableTarget)((IAdaptable)element).getAdapter( IEnableDisableTarget.class );
+ IEnableDisableTarget target = ((IAdaptable)element).getAdapter( IEnableDisableTarget.class );
if ( target != null ) {
if ( !target.isEnabled() ) {
baseText.append( ' ' );
if (ss.size() == 1) {
Object element = ss.getFirstElement();
if (element instanceof IAdaptable) {
- ICDebugTarget target = (ICDebugTarget)((IAdaptable)element).getAdapter(ICDebugTarget.class);
+ ICDebugTarget target = ((IAdaptable)element).getAdapter(ICDebugTarget.class);
if (target != null) {
setContext(page, target);
return;
if ( getView() == null )
return;
if ( element != null && element instanceof IDebugElement ) {
- IExecFileInfo info = (IExecFileInfo)((IDebugElement)element).getDebugTarget().getAdapter( IExecFileInfo.class );
- ICGlobalVariableManager gvm = (ICGlobalVariableManager)((IDebugElement)element).getDebugTarget().getAdapter( ICGlobalVariableManager.class );
+ IExecFileInfo info = ((IDebugElement)element).getDebugTarget().getAdapter( IExecFileInfo.class );
+ ICGlobalVariableManager gvm = ((IDebugElement)element).getDebugTarget().getAdapter( ICGlobalVariableManager.class );
if ( info != null && gvm != null ) {
fGlobals = info.getGlobals();
ListSelectionDialog dlg = createDialog();
protected IEnableDisableTarget getEnableDisableTarget( Object obj ) {
IEnableDisableTarget target = null;
if ( obj instanceof IAdaptable ) {
- target = (IEnableDisableTarget)((IAdaptable)obj).getAdapter( IEnableDisableTarget.class );
+ target = ((IAdaptable)obj).getAdapter( IEnableDisableTarget.class );
}
return target;
}
protected void doAction() throws DebugException {
ICDebugTarget target = getDebugTarget( getView().getViewer().getInput() );
if ( target != null ) {
- final IModuleRetrieval mr = (IModuleRetrieval)target.getAdapter( IModuleRetrieval.class );
+ final IModuleRetrieval mr = target.getAdapter( IModuleRetrieval.class );
if ( mr != null ) {
DebugPlugin.getDefault().asyncExec(
new Runnable() {
private ICDebugTarget getDebugTarget( Object element ) {
if ( element instanceof IAdaptable ) {
- return (ICDebugTarget)((IAdaptable)element).getAdapter( ICDebugTarget.class );
+ return ((IAdaptable)element).getAdapter( ICDebugTarget.class );
}
return null;
}
IWorkbenchWindow workbenchWindow = part.getSite().getWorkbenchWindow();
IDebugContextService service = manager.getContextService(workbenchWindow);
service.addDebugContextListener(fContextListener);
- fPartTarget = (IMoveToLineTarget) part.getAdapter(IMoveToLineTarget.class);
+ fPartTarget = part.getAdapter(IMoveToLineTarget.class);
if (fPartTarget == null) {
IAdapterManager adapterManager = Platform.getAdapterManager();
// TODO: we could restrict loading to cases when the debugging context is on
final int lineNumber = textSelection.getStartLine() + 1;
if ( target instanceof IAdaptable ) {
final IPath path = convertPath( fileName, debugTarget );
- final IMoveToLine moveToLine = (IMoveToLine)((IAdaptable)target).getAdapter( IMoveToLine.class );
+ final IMoveToLine moveToLine = ((IAdaptable)target).getAdapter( IMoveToLine.class );
if ( moveToLine != null && moveToLine.canMoveToLine( path.toPortableString(), lineNumber ) ) {
Runnable r = new Runnable() {
@Override
public boolean canMoveToLine( IWorkbenchPart part, ISelection selection, ISuspendResume target ) {
if ( target instanceof IAdaptable ) {
if ( part instanceof IEditorPart ) {
- IMoveToLine moveToLine = (IMoveToLine)((IAdaptable)target).getAdapter( IMoveToLine.class );
+ IMoveToLine moveToLine = ((IAdaptable)target).getAdapter( IMoveToLine.class );
if ( moveToLine == null)
return false;
IEditorPart editorPart = (IEditorPart)part;
@Override
protected IContributionItem[] getContributionItems() {
- ISelectionService service = (ISelectionService) fServiceLocator.getService(ISelectionService.class);
+ ISelectionService service = fServiceLocator.getService(ISelectionService.class);
ISelection selection = service.getSelection();
public void run( IAction action ) {
IAdaptable context = DebugUITools.getDebugContext();
if ( context instanceof IDebugElement ) {
- final ICGlobalVariableManager gvm = (ICGlobalVariableManager)((IDebugElement)context).getDebugTarget().getAdapter( ICGlobalVariableManager.class );
+ final ICGlobalVariableManager gvm = ((IDebugElement)context).getDebugTarget().getAdapter( ICGlobalVariableManager.class );
if ( gvm != null ) {
DebugPlugin.getDefault().asyncExec(
new Runnable() {
final IAdaptable context = DebugUITools.getDebugContext();
boolean enabled = false;
if (context instanceof IDebugElement) {
- final ICGlobalVariableManager gvm = (ICGlobalVariableManager) ((IDebugElement) context)
+ final ICGlobalVariableManager gvm = ((IDebugElement) context)
.getDebugTarget().getAdapter(
ICGlobalVariableManager.class);
if (gvm != null) {
if ( list.size() == 0 )
return;
final ICGlobalVariable[] globals = (ICGlobalVariable[])list.toArray( new ICGlobalVariable[list.size()] );
- final ICGlobalVariableManager gvm = (ICGlobalVariableManager)globals[0].getDebugTarget().getAdapter( ICGlobalVariableManager.class );
+ final ICGlobalVariableManager gvm = globals[0].getDebugTarget().getAdapter( ICGlobalVariableManager.class );
if ( gvm == null )
return;
Runnable r = new Runnable() {
IWorkbenchWindow workbenchWindow = part.getSite().getWorkbenchWindow();
IDebugContextService service = manager.getContextService(workbenchWindow);
service.addDebugContextListener(fContextListener);
- fPartTarget = (IResumeAtLineTarget) part.getAdapter(IResumeAtLineTarget.class);
+ fPartTarget = part.getAdapter(IResumeAtLineTarget.class);
if (fPartTarget == null) {
IAdapterManager adapterManager = Platform.getAdapterManager();
// TODO: we could restrict loading to cases when the debugging context is on
ITextSelection textSelection = (ITextSelection)selection;
final int lineNumber = textSelection.getStartLine() + 1;
if ( target instanceof IAdaptable ) {
- final IResumeAtLine resumeAtLine = (IResumeAtLine)((IAdaptable)target).getAdapter( IResumeAtLine.class );
+ final IResumeAtLine resumeAtLine = ((IAdaptable)target).getAdapter( IResumeAtLine.class );
if ( resumeAtLine != null && resumeAtLine.canResumeAtLine( path.toPortableString(), lineNumber ) ) {
Runnable r = new Runnable() {
@Override
public boolean canResumeAtLine( IWorkbenchPart part, ISelection selection, ISuspendResume target ) {
if ( target instanceof IAdaptable ) {
if ( part instanceof IEditorPart ) {
- IResumeAtLine resumeAtLine = (IResumeAtLine)((IAdaptable)target).getAdapter( IResumeAtLine.class );
+ IResumeAtLine resumeAtLine = ((IAdaptable)target).getAdapter( IResumeAtLine.class );
if ( resumeAtLine == null)
return false;
IEditorPart editorPart = (IEditorPart)part;
@Override
public void partActivated(IWorkbenchPart part) {
fActivePart = part;
- IResource resource = (IResource) part.getAdapter(IResource.class);
+ IResource resource = part.getAdapter(IResource.class);
if (resource == null && part instanceof IEditorPart) {
- resource = (IResource) ((IEditorPart)part).getEditorInput().getAdapter(IResource.class);
+ resource = ((IEditorPart)part).getEditorInput().getAdapter(IResource.class);
}
if (resource != null) {
fTargetAdapter = getAdapter(resource);
ITextSelection textSelection = (ITextSelection)selection;
final int lineNumber = textSelection.getStartLine() + 1;
if ( target instanceof IAdaptable ) {
- final IRunToLine runToLine = (IRunToLine)((IAdaptable)target).getAdapter( IRunToLine.class );
+ final IRunToLine runToLine = ((IAdaptable)target).getAdapter( IRunToLine.class );
if ( runToLine != null && runToLine.canRunToLine( path.toPortableString(), lineNumber ) ) {
Runnable r = new Runnable() {
public boolean canRunToLine( IWorkbenchPart part, ISelection selection, ISuspendResume target ) {
if ( target instanceof IAdaptable ) {
if ( part instanceof IEditorPart ) {
- IRunToLine runToLine = (IRunToLine)((IAdaptable)target).getAdapter( IRunToLine.class );
+ IRunToLine runToLine = ((IAdaptable)target).getAdapter( IRunToLine.class );
if ( runToLine == null )
return false;
IEditorPart editorPart = (IEditorPart)part;
@Override
public void run( IAction action ) {
final StructuredViewer viewer = getStructuredViewer();
- IDebugView view = (IDebugView)getView().getAdapter( IDebugView.class );
+ IDebugView view = getView().getAdapter( IDebugView.class );
if (view != null) {
IDebugModelPresentation pres = view.getPresentation( CDIDebugModel.getPluginIdentifier() );
if ( pres != null ) {
/** @since 7.0 */
@Override
public void selectionChanged(IAction action, ISelection selection) {
- IDebugView view = (IDebugView)getView().getAdapter(IDebugView.class);
+ IDebugView view = getView().getAdapter(IDebugView.class);
// Debug view
if (view instanceof LaunchView) {
}
if (target == null) {
if (element instanceof IAdaptable) {
- target= (ISteppingModeTarget) ((IAdaptable)element).getAdapter(ISteppingModeTarget.class);
+ target= ((IAdaptable)element).getAdapter(ISteppingModeTarget.class);
}
}
return target;
@Override
public void selectionChanged(IAction action, ISelection selection) {
boolean enable = false;
- IDebugView view = (IDebugView)getView().getAdapter(IDebugView.class);
+ IDebugView view = getView().getAdapter(IDebugView.class);
// Debug view
if (view instanceof LaunchView) {
}
protected StructuredViewer getStructuredViewer() {
- IDebugView view = (IDebugView)getView().getAdapter(IDebugView.class);
+ IDebugView view = getView().getAdapter(IDebugView.class);
if (view != null) {
Viewer viewer = view.getViewer();
if (viewer instanceof StructuredViewer) {
return provider.getDocument(editor.getEditorInput());
}
- IDocument doc = (IDocument) fPart.getAdapter(IDocument.class);
+ IDocument doc = fPart.getAdapter(IDocument.class);
if (doc != null) {
return doc;
}
return provider.getDocument(editor.getEditorInput());
}
- IDocument doc = (IDocument) fPart.getAdapter(IDocument.class);
+ IDocument doc = fPart.getAdapter(IDocument.class);
if (doc != null) {
return doc;
}
ICDIMemorySpaceManagement memMgr = null;
if ( debugViewElement != null ) {
- ICDebugTarget debugTarget = (ICDebugTarget)debugViewElement.getAdapter(ICDebugTarget.class);
+ ICDebugTarget debugTarget = debugViewElement.getAdapter(ICDebugTarget.class);
if ( debugTarget != null ){
- ICDITarget target = (ICDITarget)debugTarget.getAdapter(ICDITarget.class);
+ ICDITarget target = debugTarget.getAdapter(ICDITarget.class);
if (target instanceof ICDIMemorySpaceManagement)
memMgr = (ICDIMemorySpaceManagement)target;
Object element = getDebugContext(part).getFirstElement();
if (element instanceof IAdaptable) {
IDebugModelProvider modelProvider =
- (IDebugModelProvider)((IAdaptable)element).getAdapter(IDebugModelProvider.class);
+ ((IAdaptable)element).getAdapter(IDebugModelProvider.class);
if (modelProvider != null) {
String[] models = modelProvider.getModelIdentifiers();
for (String model : models) {
Object debugElement = ((IStructuredSelection)debugContext).getFirstElement();
if (debugElement instanceof IAdaptable) {
IDebugModelProvider debugModelProvider =
- (IDebugModelProvider)((IAdaptable)debugElement).getAdapter(IDebugModelProvider.class);
+ ((IAdaptable)debugElement).getAdapter(IDebugModelProvider.class);
if (debugModelProvider != null) {
return debugModelProvider.getModelIdentifiers();
} else if (debugElement instanceof IDebugElement) {
}
public ICBreakpoint getBreakpoint() {
- return (ICBreakpoint)getElement().getAdapter(ICBreakpoint.class);
+ return getElement().getAdapter(ICBreakpoint.class);
}
public ICBreakpointFilterExtension getFilterExtension() {
ICDebugTarget debugTarget = (ICDebugTarget)DebugPlugin.getAdapter(debugViewElement, ICDebugTarget.class);
if ( debugTarget != null ){
- ICDITarget target = (ICDITarget)debugTarget.getAdapter(ICDITarget.class);
+ ICDITarget target = debugTarget.getAdapter(ICDITarget.class);
if (target instanceof ICDIMemorySpaceManagement)
memMgr = (ICDIMemorySpaceManagement)target;
}
}
- IWorkbenchAdapter labelProvider = (IWorkbenchAdapter)getElement().getAdapter(IWorkbenchAdapter.class);
+ IWorkbenchAdapter labelProvider = getElement().getAdapter(IWorkbenchAdapter.class);
if (labelProvider != null) {
return labelProvider.getLabel(getElement());
}
} else if (element instanceof ICBreakpointContext) {
return ((ICBreakpointContext)element).getBreakpoint();
} else {
- return (ICBreakpoint)element.getAdapter(ICBreakpoint.class);
+ return element.getAdapter(ICBreakpoint.class);
}
}
protected Object getDebugContext() {
- IDebugContextProvider provider = (IDebugContextProvider)getElement().getAdapter(IDebugContextProvider.class);
+ IDebugContextProvider provider = getElement().getAdapter(IDebugContextProvider.class);
if (provider != null) {
ISelection selection = provider.getActiveContext();
if (selection instanceof IStructuredSelection) {
@Override
public Object[] getChildren( Object parent ) {
if ( parent instanceof IDebugTarget ) {
- ICDebugTarget target = (ICDebugTarget)((IDebugTarget)parent).getAdapter( ICDebugTarget.class );
+ ICDebugTarget target = ((IDebugTarget)parent).getAdapter( ICDebugTarget.class );
if ( target != null ) {
try {
return ((ICDebugTarget)parent).getThreads();
for( int i = 0, numLaunches = launches.length; i < numLaunches; i++ ) {
targets = launches[i].getDebugTargets();
for( int j = 0, numTargets = targets.length; j < numTargets; j++ ) {
- target = (ICDebugTarget)targets[j].getAdapter( ICDebugTarget.class );
+ target = targets[j].getAdapter( ICDebugTarget.class );
if ( target != null && !target.isDisconnected() && !target.isTerminated() ) {
children.add( target );
}
Object element = selection.getFirstElement();
if (element instanceof IDebugElement) {
- return (ICDebugTarget) ((IDebugElement) element).getDebugTarget().getAdapter(ICDebugTarget.class);
+ return ((IDebugElement) element).getDebugTarget().getAdapter(ICDebugTarget.class);
}
return null;
}
}
}
- ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
+ ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class);
if (commandService != null) {
commandService.refreshElements(REVERSE_TOGGLE_COMMAND_ID, null);
}
}
private IReverseToggleHandler getAdapter(IAdaptable adaptable) {
- IReverseToggleHandler adapter = (IReverseToggleHandler)adaptable.getAdapter(IReverseToggleHandler.class);
+ IReverseToggleHandler adapter = adaptable.getAdapter(IReverseToggleHandler.class);
if (adapter == null) {
IAdapterManager adapterManager = Platform.getAdapterManager();
if (adapterManager.hasAdapter(adaptable, getCommandType().getName())) {
public IStatus runInUIThread(IProgressMonitor monitor) {
// Request re-evaluation of property "org.eclipse.cdt.debug.ui.isReverseDebuggingEnabled" to update
// visibility of reverse stepping commands.
- IEvaluationService exprService = (IEvaluationService) PlatformUI.getWorkbench().getService(IEvaluationService.class);
+ IEvaluationService exprService = PlatformUI.getWorkbench().getService(IEvaluationService.class);
if (exprService != null) {
exprService.requestEvaluation("org.eclipse.cdt.debug.ui.isReverseDebuggingEnabled"); //$NON-NLS-1$
}
// Refresh reverse toggle commands with the new state of reverse enabled.
// This is in order to keep multiple toggle actions in UI in sync.
- ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
+ ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class);
if (commandService != null) {
commandService.refreshElements(REVERSE_TOGGLE_COMMAND_ID, null);
}
@Override
@SuppressWarnings("unchecked")
public void updateElement( UIElement element, Map parameters ) {
- IWorkbenchPartSite site = (IWorkbenchPartSite)element.getServiceLocator().getService( IWorkbenchPartSite.class );
+ IWorkbenchPartSite site = element.getServiceLocator().getService( IWorkbenchPartSite.class );
if ( site != null ) {
IWorkbenchPart part = site.getPart();
if ( part instanceof ITextEditor ) {
CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_STEP_MODE, fCurrentValue );
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked( event );
- ICommandService service = (ICommandService)window.getService( ICommandService.class );
+ ICommandService service = window.getService( ICommandService.class );
service.refreshElements( event.getCommand().getId(), null );
return null;
if ( selection instanceof IStructuredSelection ) {
Object element = ((IStructuredSelection)selection).getFirstElement();
if ( element instanceof IAdaptable )
- return (ISteppingModeTarget)((IAdaptable)element).getAdapter( ISteppingModeTarget.class );
+ return ((IAdaptable)element).getAdapter( ISteppingModeTarget.class );
}
return null;
}
Runnable op= new Runnable() {
@Override
public void run() {
- ICDITarget cdiTarget= (ICDITarget) fDebugTarget.getAdapter(ICDITarget.class);
+ ICDITarget cdiTarget= fDebugTarget.getAdapter(ICDITarget.class);
try {
ICDIMixedInstruction[] mixedInstructions= null;
ICDIInstruction[] asmInstructions= null;
}
else if ( element instanceof IAdaptable ) {
IAdaptable adaptable = (IAdaptable)element;
- adapter = (IDisassemblyContextProvider)adaptable.getAdapter( IDisassemblyContextProvider.class );
+ adapter = adaptable.getAdapter( IDisassemblyContextProvider.class );
}
return adapter;
}
}
else if ( element instanceof IAdaptable ) {
IAdaptable adaptable = (IAdaptable)element;
- adapter = (IDisassemblyContextProvider)adaptable.getAdapter( IDisassemblyContextProvider.class );
+ adapter = adaptable.getAdapter( IDisassemblyContextProvider.class );
}
return adapter;
}
if ( debugContext instanceof ISteppingModeTarget )
return (ISteppingModeTarget)debugContext;
if ( debugContext instanceof IAdaptable )
- return (ISteppingModeTarget)((IAdaptable)debugContext).getAdapter( ISteppingModeTarget.class );
+ return ((IAdaptable)debugContext).getAdapter( ISteppingModeTarget.class );
return null;
}
}
if ( fBlock != null ) {
IDisassembly dis = fBlock.getDisassembly();
if ( dis != null ) {
- ICDebugTarget target = (ICDebugTarget)dis.getDebugTarget().getAdapter( ICDebugTarget.class );
+ ICDebugTarget target = dis.getDebugTarget().getAdapter( ICDebugTarget.class );
if ( target != null ) {
try {
IAddress address = target.getBreakpointAddress( breakpoint );
Assert.isTrue( address != null );
IDisassembly dis = getDisassembly();
if ( dis != null ) {
- ICDebugTarget bt = (ICDebugTarget)dis.getDebugTarget().getAdapter( ICDebugTarget.class );
+ ICDebugTarget bt = dis.getDebugTarget().getAdapter( ICDebugTarget.class );
if ( bt != null ) {
String modelId = CDIDebugModel.getPluginIdentifier();
IBreakpoint[] bps = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints( modelId );
}
else if ( element instanceof IAdaptable ) {
IAdaptable adaptable = (IAdaptable)element;
- adapter = (IDisassemblyContextProvider)adaptable.getAdapter( IDisassemblyContextProvider.class );
+ adapter = adaptable.getAdapter( IDisassemblyContextProvider.class );
}
return adapter;
}
}
else if ( element instanceof IAdaptable ) {
IAdaptable adaptable = (IAdaptable)element;
- adapter = (IDocumentElementAnnotationProvider)adaptable.getAdapter( IDocumentElementAnnotationProvider.class );
+ adapter = adaptable.getAdapter( IDocumentElementAnnotationProvider.class );
}
return adapter;
}
}
else if ( element instanceof IAdaptable ) {
IAdaptable adaptable = (IAdaptable)element;
- adapter = (IDocumentElementContentProvider)adaptable.getAdapter( IDocumentElementContentProvider.class );
+ adapter = adaptable.getAdapter( IDocumentElementContentProvider.class );
}
return adapter;
}
}
else if ( element instanceof IAdaptable ) {
IAdaptable adaptable = (IAdaptable)element;
- adapter = (IModelProxyFactory)adaptable.getAdapter( IModelProxyFactory.class );
+ adapter = adaptable.getAdapter( IModelProxyFactory.class );
}
return adapter;
}
}
else if ( element instanceof IAdaptable ) {
IAdaptable adaptable = (IAdaptable)element;
- adapter = (IDocumentElementLabelProvider)adaptable.getAdapter( IDocumentElementLabelProvider.class );
+ adapter = adaptable.getAdapter( IDocumentElementLabelProvider.class );
}
return adapter;
}
protected ICStackFrame getFrame() {
IAdaptable adaptable = getSelectionAdaptable();
if (adaptable != null) {
- return (ICStackFrame) adaptable.getAdapter(ICStackFrame.class);
+ return adaptable.getAdapter(ICStackFrame.class);
}
return null;
}
private ICEditorTextHover getDelegate() {
IAdaptable context = DebugUITools.getDebugContext();
if (context != null) {
- ICEditorTextHover hover = (ICEditorTextHover) context.getAdapter(ICEditorTextHover.class);
+ ICEditorTextHover hover = context.getAdapter(ICEditorTextHover.class);
if (hover != null) {
hover.setEditor(fEditor);
}
if ( IDebugUIConstants.ID_MODULE_VIEW.equals( context.getId() ) ) {
IModuleRetrieval mr = null;
if ( element instanceof IAdaptable ) {
- ICDebugTarget target = (ICDebugTarget)((IAdaptable)element).getAdapter( ICDebugTarget.class );
+ ICDebugTarget target = ((IAdaptable)element).getAdapter( ICDebugTarget.class );
if ( target != null )
- mr = (IModuleRetrieval)target.getAdapter( IModuleRetrieval.class );
+ mr = target.getAdapter( IModuleRetrieval.class );
}
if ( mr != null ) {
return new ModulesViewModelProxy( mr );
IProgressMonitor sub = new SubProgressMonitor(pm, 1);
for (int i = 0; i < nElements; i++) {
if (elements[i] instanceof IAdaptable) {
- IResource r = (IResource) ((IAdaptable) elements[i]).getAdapter(IResource.class);
+ IResource r = ((IAdaptable) elements[i]).getAdapter(IResource.class);
if (r != null) {
ICProject cproject = CoreModel.getDefault().create(r.getProject());
if (cproject != null) {
private boolean isExecutable(Object receiver) {
ICElement celement = null;
if (receiver instanceof IAdaptable) {
- IResource res = (IResource) ((IAdaptable) receiver).getAdapter(IResource.class);
+ IResource res = ((IAdaptable) receiver).getAdapter(IResource.class);
if (res != null) {
celement = CoreModel.getDefault().create(res);
}
for (Object element : ((IStructuredSelection)selection).toList()) {
IPinProvider pinProvider = null;
if (element instanceof IAdaptable) {
- pinProvider = (IPinProvider) ((IAdaptable)element).getAdapter(IPinProvider.class);
+ pinProvider = ((IAdaptable)element).getAdapter(IPinProvider.class);
}
if (pinProvider != null) {
/* IPinProvider */
if (element instanceof IAdaptable) {
- IPinProvider pinProvider = (IPinProvider) ((IAdaptable)element).getAdapter(IPinProvider.class);
+ IPinProvider pinProvider = ((IAdaptable)element).getAdapter(IPinProvider.class);
if (pinProvider != null) {
if (pinProvider.isPinnable(part, element))
pinnable = true;
for (IPinElementHandle handle : handles) {
if (debugContext instanceof IAdaptable) {
- IPinProvider pinProvider = (IPinProvider) ((IAdaptable) debugContext).getAdapter(IPinProvider.class);
+ IPinProvider pinProvider = ((IAdaptable) debugContext).getAdapter(IPinProvider.class);
if (pinProvider != null) {
if (pinProvider.isPinnedTo(debugContext, handle)) {
colorDesc = handle.getPinElementColorDescriptor();
public static boolean isPinnedTo(Set<IPinElementHandle> handles, Object debugContext) {
for (IPinElementHandle handle : handles) {
if (debugContext instanceof IAdaptable) {
- IPinProvider pinProvider = (IPinProvider) ((IAdaptable) debugContext).getAdapter(IPinProvider.class);
+ IPinProvider pinProvider = ((IAdaptable) debugContext).getAdapter(IPinProvider.class);
if (pinProvider != null) {
if (pinProvider.isPinnedTo(debugContext, handle)) {
return true;
protected void refreshViews( IWorkbenchPage page, String viewID ) {
IViewPart part = page.findView( viewID );
if ( part != null ) {
- IDebugView adapter = (IDebugView)part.getAdapter( IDebugView.class );
+ IDebugView adapter = part.getAdapter( IDebugView.class );
if ( adapter != null ) {
Viewer viewer = adapter.getViewer();
if ( viewer instanceof StructuredViewer ) {
if (context == null)
return super.getText();
String contextDescription;
- ICSourceNotFoundDescription description = (ICSourceNotFoundDescription) context.getAdapter(ICSourceNotFoundDescription.class);
+ ICSourceNotFoundDescription description = context.getAdapter(ICSourceNotFoundDescription.class);
if (description != null)
contextDescription = description.getDescription();
else
IWorkbenchPage page = getEditorSite().getPage();
if (isDebugElement) {
- ISourceDisplay adapter = (ISourceDisplay)context.getAdapter(ISourceDisplay.class);
+ ISourceDisplay adapter = context.getAdapter(ISourceDisplay.class);
if (adapter != null) {
adapter.displaySource(context, page, true);
}
}
protected ImageDescriptor getImageDescriptor(ICElement element) {
- IWorkbenchAdapter adapter = (IWorkbenchAdapter)element.getAdapter(IWorkbenchAdapter.class);
+ IWorkbenchAdapter adapter = element.getAdapter(IWorkbenchAdapter.class);
if (adapter != null) {
return adapter.getImageDescriptor(element);
}
displayDisassembly(page, frame);
} else {
DelegatingStackFrame delegatingFrame = new DelegatingStackFrame((ICStackFrame)element);
- ISourceDisplay sd = (ISourceDisplay)Platform.getAdapterManager().getAdapter(delegatingFrame, ISourceDisplay.class);
+ ISourceDisplay sd = Platform.getAdapterManager().getAdapter(delegatingFrame, ISourceDisplay.class);
if (sd != null)
sd.displaySource(element, page, forceSourceLookup);
}
final IAdaptable debugViewElement = DebugUITools.getDebugContext();
- IMemoryBlockRetrieval retrieval = (IMemoryBlockRetrieval)debugViewElement.getAdapter(IMemoryBlockRetrieval.class);
+ IMemoryBlockRetrieval retrieval = debugViewElement.getAdapter(IMemoryBlockRetrieval.class);
if (retrieval == null && debugViewElement instanceof IDebugElement) {
// Added logic for CDI (which is based on the standard debug model)
retrieval = ((IDebugElement)debugViewElement).getDebugTarget();
CMemoryBlockRetrievalExtension cdtRetrieval = null;
{
- IMemoryBlockRetrieval retrieval = (IMemoryBlockRetrieval)debugViewElement.getAdapter(IMemoryBlockRetrieval.class);
+ IMemoryBlockRetrieval retrieval = debugViewElement.getAdapter(IMemoryBlockRetrieval.class);
if (retrieval == null && debugViewElement instanceof IDebugElement)
retrieval = ((IDebugElement)debugViewElement).getDebugTarget();
return ((IModuleRetrieval)parent).getModules();
}
else if ( parent instanceof ICThread || parent instanceof ICStackFrame ) {
- IModuleRetrieval mr = (IModuleRetrieval)((IAdaptable)parent).getAdapter( IModuleRetrieval.class );
+ IModuleRetrieval mr = ((IAdaptable)parent).getAdapter( IModuleRetrieval.class );
if ( mr != null ) {
return mr.getModules();
}
}
else if ( parent instanceof ICModule ) {
- IBinary binary = (IBinary)((ICModule)parent).getAdapter( IBinary.class );
+ IBinary binary = ((ICModule)parent).getAdapter( IBinary.class );
if ( binary != null ) {
try {
return binary.getChildren();
return presentation.getText( element );
}
if ( element instanceof IAdaptable ) {
- IWorkbenchAdapter adapter = (IWorkbenchAdapter)(((IAdaptable)element).getAdapter( IWorkbenchAdapter.class ));
+ IWorkbenchAdapter adapter = (((IAdaptable)element).getAdapter( IWorkbenchAdapter.class ));
if ( adapter != null )
return adapter.getLabel( element );
}
}
}
if ( element instanceof ICElement ) {
- IWorkbenchAdapter adapter = (IWorkbenchAdapter)(((IAdaptable)element).getAdapter( IWorkbenchAdapter.class ));
+ IWorkbenchAdapter adapter = (((IAdaptable)element).getAdapter( IWorkbenchAdapter.class ));
if ( adapter != null )
return adapter.getImageDescriptor( element );
}
@Override
protected boolean encodeElement( Object element, IMemento memento, IPresentationContext context ) throws CoreException {
if ( element instanceof ICDebugTarget || element instanceof ICThread || element instanceof ICStackFrame ) {
- IModuleRetrieval mr = (IModuleRetrieval)((IAdaptable)element).getAdapter( IModuleRetrieval.class );
+ IModuleRetrieval mr = ((IAdaptable)element).getAdapter( IModuleRetrieval.class );
if ( mr != null ) {
memento.putString( ELEMENT_NAME, mr.toString() );
}
if ( mementoName != null ) {
String elementName = null;
if ( element instanceof ICDebugTarget || element instanceof ICThread || element instanceof ICStackFrame ) {
- IModuleRetrieval mr = (IModuleRetrieval)((IAdaptable)element).getAdapter( IModuleRetrieval.class );
+ IModuleRetrieval mr = ((IAdaptable)element).getAdapter( IModuleRetrieval.class );
elementName = ( mr != null ) ? mr.toString() : CDIDebugModel.getPluginIdentifier();
}
else if ( element instanceof ICModule ) {
@Override
public void viewerUpdatesBegin() {
IWorkbenchSiteProgressService progressService =
- (IWorkbenchSiteProgressService)getSite().getAdapter(IWorkbenchSiteProgressService.class);
+ getSite().getAdapter(IWorkbenchSiteProgressService.class);
if (progressService != null) {
progressService.incrementBusy();
}
@Override
public void viewerUpdatesComplete() {
IWorkbenchSiteProgressService progressService =
- (IWorkbenchSiteProgressService)getSite().getAdapter(IWorkbenchSiteProgressService.class);
+ getSite().getAdapter(IWorkbenchSiteProgressService.class);
if (progressService != null) {
progressService.decrementBusy();
}
public Control createContents(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
- IBreakpoint breakpoint = (IBreakpoint) this.getElement().getAdapter(org.eclipse.debug.core.model.IBreakpoint.class);
+ IBreakpoint breakpoint = this.getElement().getAdapter(org.eclipse.debug.core.model.IBreakpoint.class);
breakpointMarker = breakpoint.getMarker();
savedActionNames = breakpointMarker.getAttribute(BreakpointActionManager.BREAKPOINT_ACTION_ATTRIBUTE, ""); //$NON-NLS-1$
String logMessage = getMessage();
if (isEvaluateExpression()) {
- ILogActionEnabler enabler = (ILogActionEnabler) context.getAdapter(ILogActionEnabler.class);
+ ILogActionEnabler enabler = context.getAdapter(ILogActionEnabler.class);
if (enabler != null)
logMessage = enabler.evaluateExpression(logMessage);
}
public IStatus execute(IBreakpoint breakpoint, IAdaptable context, IProgressMonitor monitor) {
IStatus errorStatus = null;
long endTime = System.currentTimeMillis() + getPauseTime()*1000;
- IResumeActionEnabler enabler = (IResumeActionEnabler) context.getAdapter(IResumeActionEnabler.class);
+ IResumeActionEnabler enabler = context.getAdapter(IResumeActionEnabler.class);
if (enabler != null) {
try {
public IStatus execute(IBreakpoint breakpoint, IAdaptable context, IProgressMonitor monitor) {
IStatus errorStatus = null;
- IReverseDebugEnabler enabler = (IReverseDebugEnabler) context.getAdapter(IReverseDebugEnabler.class);
+ IReverseDebugEnabler enabler = context.getAdapter(IReverseDebugEnabler.class);
if (enabler != null) {
try {
switch (fOperation) {
private boolean hasBreakpoint(IWorkbenchPart part) {
if (part instanceof ITextEditor) {
ITextEditor textEditor = (ITextEditor) part;
- IVerticalRulerInfo rulerInfo = (IVerticalRulerInfo) textEditor.getAdapter(IVerticalRulerInfo.class);
+ IVerticalRulerInfo rulerInfo = textEditor.getAdapter(IVerticalRulerInfo.class);
IBreakpoint breakpoint = CDebugUIUtils.getBreakpointFromEditor(textEditor, rulerInfo);
return breakpoint != null;
}
Object obj = ((IStructuredSelection)selection).getFirstElement();
if (obj != null) {
if (obj instanceof IAdaptable) {
- return (IRepositionableMemoryRendering) ((IAdaptable)obj).getAdapter(IRepositionableMemoryRendering.class);
+ return ((IAdaptable)obj).getAdapter(IRepositionableMemoryRendering.class);
}
}
}
Object obj = ((IStructuredSelection)selection).getFirstElement();
if (obj != null) {
if (obj instanceof IAdaptable) {
- ICWatchpointTarget target = (ICWatchpointTarget) ((IAdaptable)obj).getAdapter(ICWatchpointTarget.class);
+ ICWatchpointTarget target = ((IAdaptable)obj).getAdapter(ICWatchpointTarget.class);
if (target == null) {
- target = (ICWatchpointTarget) ((IAdaptable)obj).getAdapter(
+ target = ((IAdaptable)obj).getAdapter(
org.eclipse.cdt.debug.internal.core.ICWatchpointTarget.class);
}
return target;
* @param part Workbench part where action was invoked.
*/
protected void report( String message, IWorkbenchPart part ) {
- IEditorStatusLine statusLine = (IEditorStatusLine)part.getAdapter( IEditorStatusLine.class );
+ IEditorStatusLine statusLine = part.getAdapter( IEditorStatusLine.class );
if ( statusLine != null ) {
if ( message != null ) {
statusLine.setMessage( true, message, null );
if ( resource != null )
return resource;
/* This file is not in a project, let default case handle it */
- ILocationProvider provider = (ILocationProvider)editorInput.getAdapter( ILocationProvider.class );
+ ILocationProvider provider = editorInput.getAdapter( ILocationProvider.class );
if ( provider != null ) {
IPath location = provider.getPath( editorInput );
if ( location != null ) {
private boolean toggleBreakpointEnable(IWorkbenchPart part) {
ITextEditor textEditor = getTextEditor(part);
if(textEditor != null) {
- IVerticalRulerInfo info = (IVerticalRulerInfo) textEditor.getAdapter(IVerticalRulerInfo.class);
+ IVerticalRulerInfo info = textEditor.getAdapter(IVerticalRulerInfo.class);
if(info != null) {
EnableDisableBreakpointRulerAction enableAction = new EnableDisableBreakpointRulerAction(part, info);
enableAction.update();
if (part instanceof ITextEditor) {
return (ITextEditor) part;
}
- return (ITextEditor) part.getAdapter(ITextEditor.class);
+ return part.getAdapter(ITextEditor.class);
}
/**
IDMContext dmc = null;
if (debugContext instanceof IAdaptable) {
- dmc = (IDMContext) ((IAdaptable) debugContext).getAdapter(IDMContext.class);
+ dmc = ((IAdaptable) debugContext).getAdapter(IDMContext.class);
if (dmc != null) {
sessionId = dmc.getSessionId() + "."; //$NON-NLS-1$
// dispatch the event to update the handle DM context
Object debugContext = handle.getDebugContext();
if (debugContext instanceof IAdaptable) {
- IDMContext dmc = (IDMContext) ((IAdaptable) debugContext).getAdapter(IDMContext.class);
+ IDMContext dmc = ((IAdaptable) debugContext).getAdapter(IDMContext.class);
GdbPinColorTracker.INSTANCE.removeRef(dmc.getSessionId() + "." + handle.getLabel()); //$NON-NLS-1$
dispatchChangedEvent(dmc);
Object handleDebugContext = handle.getDebugContext();
if (debugContext instanceof IAdaptable && handleDebugContext instanceof IAdaptable) {
- IDMContext dmc = (IDMContext) ((IAdaptable) debugContext).getAdapter(IDMContext.class);
- IDMContext hDmc = (IDMContext) ((IAdaptable) handleDebugContext).getAdapter(IDMContext.class);
+ IDMContext dmc = ((IAdaptable) debugContext).getAdapter(IDMContext.class);
+ IDMContext hDmc = ((IAdaptable) handleDebugContext).getAdapter(IDMContext.class);
if (dmc != null && hDmc != null) {
if (dmc.getSessionId().equals(hDmc.getSessionId())) {
PinElementHandle handle = ((PinElementHandle)h);
Object handleDebugContext = handle.getDebugContext();
if (handleDebugContext instanceof IAdaptable) {
- IDMContext handleDmc = (IDMContext) ((IAdaptable) handleDebugContext).getAdapter(IDMContext.class);
+ IDMContext handleDmc = ((IAdaptable) handleDebugContext).getAdapter(IDMContext.class);
if (handleDmc != null) {
DsfSession session = DsfSession.getSession(handleDmc.getSessionId());
if (session == null || !session.isActive()) {
@ConfinedToDsfExecutor("session.getExecutor()")
private void queueLoadAllSymbols(final DsfSession session) {
IAdaptable debugContext = DebugUITools.getDebugContext();
- IDMContext dmcontext = (IDMContext) debugContext.getAdapter(IDMContext.class);
+ IDMContext dmcontext = debugContext.getAdapter(IDMContext.class);
ISymbolDMContext symDmc = DMContexts.getAncestorOfType(dmcontext, ISymbolDMContext.class);
if (symDmc != null) {
DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
boolean result = false;
ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(context.getDMContext(), ICommandControlDMContext.class);
if (controlDmc != null) {
- IReverseToggleHandler toggle = (IReverseToggleHandler)(controlDmc.getAdapter(IReverseToggleHandler.class));
+ IReverseToggleHandler toggle = (controlDmc.getAdapter(IReverseToggleHandler.class));
if (toggle != null) {
result = toggle.isReverseToggled(controlDmc);
}
}
public ICBreakpoint getBreakpoint() {
- return (ICBreakpoint)getElement().getAdapter(ICBreakpoint.class);
+ return getElement().getAdapter(ICBreakpoint.class);
}
public IDsfBreakpointExtension getFilterExtension() {
}
private String getDynamicPrintfMainLabel(ICDynamicPrintf dprintf) {
- IWorkbenchAdapter labelProvider = (IWorkbenchAdapter)getElement().getAdapter(IWorkbenchAdapter.class);
+ IWorkbenchAdapter labelProvider = getElement().getAdapter(IWorkbenchAdapter.class);
if (labelProvider != null) {
return labelProvider.getLabel(getElement());
}
assert false : "Should always have a dprintf"; //$NON-NLS-1$
}
- return (ICDynamicPrintf)element.getAdapter(ICDynamicPrintf.class);
+ return element.getAdapter(ICDynamicPrintf.class);
}
protected Object getDebugContext() {
- IDebugContextProvider provider = (IDebugContextProvider)getElement().getAdapter(IDebugContextProvider.class);
+ IDebugContextProvider provider = getElement().getAdapter(IDebugContextProvider.class);
if (provider != null) {
ISelection selection = provider.getActiveContext();
if (selection instanceof IStructuredSelection) {
}
private String getTracepointMainLabel(ICTracepoint tracepoint) {
- IWorkbenchAdapter labelProvider = (IWorkbenchAdapter)getElement().getAdapter(IWorkbenchAdapter.class);
+ IWorkbenchAdapter labelProvider = getElement().getAdapter(IWorkbenchAdapter.class);
if (labelProvider != null) {
return labelProvider.getLabel(getElement());
}
assert false : "Should always have a tracepoint"; //$NON-NLS-1$
}
- return (ICTracepoint)element.getAdapter(ICTracepoint.class);
+ return element.getAdapter(ICTracepoint.class);
}
protected Object getDebugContext() {
- IDebugContextProvider provider = (IDebugContextProvider)getElement().getAdapter(IDebugContextProvider.class);
+ IDebugContextProvider provider = getElement().getAdapter(IDebugContextProvider.class);
if (provider != null) {
ISelection selection = provider.getActiveContext();
if (selection instanceof IStructuredSelection) {
public IStatus runInUIThread(IProgressMonitor monitor) {
// Request re-evaluation of property "org.eclipse.cdt.debug.ui.isReverseDebuggingEnabled" to update
// visibility of reverse stepping commands.
- IEvaluationService exprService = (IEvaluationService) PlatformUI.getWorkbench().getService(IEvaluationService.class);
+ IEvaluationService exprService = PlatformUI.getWorkbench().getService(IEvaluationService.class);
if (exprService != null) {
exprService.requestEvaluation("org.eclipse.cdt.debug.ui.isReverseDebuggingEnabled"); //$NON-NLS-1$
}
// Refresh reverse toggle commands with the new state of reverse enabled.
// This is in order to keep multiple toggle actions in UI in sync.
- ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
+ ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class);
if (commandService != null) {
commandService.refreshElements("org.eclipse.cdt.debug.ui.command.reverseToggle", null); //$NON-NLS-1$
}
if (context != null) {
// Look for the process that this context refers to, so we can select its console
- IDMContext dmc = (IDMContext)context.getAdapter(IDMContext.class);
+ IDMContext dmc = context.getAdapter(IDMContext.class);
IMIContainerDMContext container = DMContexts.getAncestorOfType(dmc, IMIContainerDMContext.class);
if (container != null) {
- ILaunch launch = (ILaunch)context.getAdapter(ILaunch.class);
+ ILaunch launch = context.getAdapter(ILaunch.class);
if (launch != null) {
IProcess[] processes = launch.getProcesses();
if (processes != null && processes.length > 0) {
public Control createContents(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
- IBreakpoint tracepoint = (IBreakpoint) this.getElement().getAdapter(org.eclipse.debug.core.model.IBreakpoint.class);
+ IBreakpoint tracepoint = this.getElement().getAdapter(org.eclipse.debug.core.model.IBreakpoint.class);
tracepointMarker = tracepoint.getMarker();
savedActionNames = tracepointMarker.getAttribute(BreakpointActionManager.BREAKPOINT_ACTION_ATTRIBUTE, ""); //$NON-NLS-1$
@Override
public void widgetSelected(SelectionEvent e) {
// Run action
- IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
+ IHandlerService handlerService = getSite().getService(IHandlerService.class);
if (handlerService == null) {
GdbUIPlugin.log(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, "Missing command handler service")); //$NON-NLS-1$
return;
@Override
public void widgetSelected(SelectionEvent e) {
- IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
+ IHandlerService handlerService = getSite().getService(IHandlerService.class);
if (e.detail == SWT.ARROW_DOWN) {
try {
handlerService.executeCommand("org.eclipse.cdt.dsf.gdb.ui.command.selectNextTraceRecord", null); //$NON-NLS-1$
setBaseEnabled(enabled);
if (fCommandId != null) {
- ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
+ ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class);
if (commandService != null) {
commandService.refreshElements(fCommandId, null);
}
dmc = (IDMContext) context;
} else {
if (context instanceof IAdaptable) {
- dmc = (IDMContext)((IAdaptable)context).getAdapter(IDMContext.class);
+ dmc = ((IAdaptable)context).getAdapter(IDMContext.class);
}
}
IMemoryDMContext memoryDmc = null;
IDMContext dmc = null;
if (context instanceof IAdaptable) {
- dmc = (IDMContext)((IAdaptable)context).getAdapter(IDMContext.class);
+ dmc = ((IAdaptable)context).getAdapter(IDMContext.class);
if (dmc != null) {
memoryDmc = DMContexts.getAncestorOfType(dmc, IMemoryDMContext.class);
}
public void run() {
IDMContext dmc = null;
if (context instanceof IAdaptable) {
- dmc = (IDMContext)((IAdaptable)context).getAdapter(IDMContext.class);
+ dmc = ((IAdaptable)context).getAdapter(IDMContext.class);
if (dmc != null) {
IMemorySpaces service = fMemorySpaceServiceTracker.getService();
if (service != null) {
public void execute(RequestMonitor rm) {
IReverseRunControl reverseService = getServicesTracker().getService(IReverseRunControl.class);
if (reverseService != null) {
- ILaunch launch = (ILaunch)procCtx.getAdapter(ILaunch.class);
+ ILaunch launch = procCtx.getAdapter(ILaunch.class);
if (launch != null) {
try {
boolean reverseEnabled =
public void execute(RequestMonitor rm) {
IReverseRunControl reverseService = getServicesTracker().getService(IReverseRunControl.class);
if (reverseService != null) {
- ILaunch launch = (ILaunch)procCtx.getAdapter(ILaunch.class);
+ ILaunch launch = procCtx.getAdapter(ILaunch.class);
if (launch != null) {
try {
boolean reverseEnabled =
}
private void connectToTarget(IProcessDMContext procCtx, RequestMonitor rm) {
- ILaunch launch = (ILaunch)procCtx.getAdapter(ILaunch.class);
+ ILaunch launch = procCtx.getAdapter(ILaunch.class);
assert launch != null;
if (launch != null) {
Map<String, Object> attributes = null;
}
final Process inferior = inferiorProcess;
- final ILaunch launch = (ILaunch)getContainerContext().getAdapter(ILaunch.class);
+ final ILaunch launch = getContainerContext().getAdapter(ILaunch.class);
// This is the groupId of the new process that will be started, even in the
// case of a restart.
Object element = getDebugContext(part).getFirstElement();
if (element instanceof IAdaptable) {
IDebugModelProvider modelProvider =
- (IDebugModelProvider)((IAdaptable)element).getAdapter(IDebugModelProvider.class);
+ ((IAdaptable)element).getAdapter(IDebugModelProvider.class);
if (modelProvider != null) {
String[] models = modelProvider.getModelIdentifiers();
for (String model : models) {
final IAddress address = disassemblySelection.getStartAddress();
if (address != null && target instanceof IAdaptable) {
- final IMoveToAddress moveToAddress = (IMoveToAddress)((IAdaptable)target).getAdapter(IMoveToAddress.class);
+ final IMoveToAddress moveToAddress = ((IAdaptable)target).getAdapter(IMoveToAddress.class);
if (moveToAddress != null && moveToAddress.canMoveToAddress(address)) {
try {
moveToAddress.moveToAddress(address);
@Override
public boolean canMoveToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) {
if (target instanceof IAdaptable && part instanceof IDisassemblyPart && selection instanceof ITextSelection) {
- IMoveToAddress moveToAddress = (IMoveToAddress)((IAdaptable)target).getAdapter(IMoveToAddress.class);
+ IMoveToAddress moveToAddress = ((IAdaptable)target).getAdapter(IMoveToAddress.class);
if (moveToAddress == null) {
return false;
}
final IAddress address = disassemblySelection.getStartAddress();
if (address != null && target instanceof IAdaptable) {
- final IResumeAtAddress resumeAtAddress = (IResumeAtAddress)((IAdaptable)target).getAdapter(IResumeAtAddress.class);
+ final IResumeAtAddress resumeAtAddress = ((IAdaptable)target).getAdapter(IResumeAtAddress.class);
if (resumeAtAddress != null && resumeAtAddress.canResumeAtAddress(address)) {
try {
resumeAtAddress.resumeAtAddress(address);
@Override
public boolean canResumeAtLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) {
if (target instanceof IAdaptable && part instanceof IDisassemblyPart && selection instanceof ITextSelection) {
- IResumeAtAddress resumeAtAddress = (IResumeAtAddress)((IAdaptable)target).getAdapter(IResumeAtAddress.class);
+ IResumeAtAddress resumeAtAddress = ((IAdaptable)target).getAdapter(IResumeAtAddress.class);
if (resumeAtAddress == null) {
return false;
}
final IAddress address = disassemblySelection.getStartAddress();
if (address != null && target instanceof IAdaptable) {
- final IRunToAddress runToAddress = (IRunToAddress)((IAdaptable)target).getAdapter(IRunToAddress.class);
+ final IRunToAddress runToAddress = ((IAdaptable)target).getAdapter(IRunToAddress.class);
if (runToAddress != null && runToAddress.canRunToAddress(address)) {
try {
boolean skipBreakpoints = DebugUITools.getPreferenceStore().getBoolean(IDebugUIConstants.PREF_SKIP_BREAKPOINTS_DURING_RUN_TO_LINE);
@Override
public boolean canRunToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) {
if (target instanceof IAdaptable && part instanceof IDisassemblyPart && selection instanceof ITextSelection) {
- IRunToAddress runToAddress = (IRunToAddress)((IAdaptable)target).getAdapter(IRunToAddress.class);
+ IRunToAddress runToAddress = ((IAdaptable)target).getAdapter(IRunToAddress.class);
if (runToAddress == null) {
return false;
}
}
public static boolean supportsDebugContext_(IAdaptable context) {
- IDMVMContext dmvmContext = (IDMVMContext) context.getAdapter(IDMVMContext.class);
+ IDMVMContext dmvmContext = context.getAdapter(IDMVMContext.class);
return dmvmContext != null && hasDisassemblyService(dmvmContext.getDMContext());
}
@Override
public SetDebugContextResult setDebugContext(IAdaptable context) {
assert supportsDebugContext(context) : "caller should not have invoked us"; //$NON-NLS-1$
- IDMVMContext vmContext = (IDMVMContext) context.getAdapter(IDMVMContext.class);
+ IDMVMContext vmContext = context.getAdapter(IDMVMContext.class);
IDMContext dmContext = vmContext.getDMContext();
SetDebugContextResult result = new SetDebugContextResult();
fDebugContextListener = null;
}
if (fHandlerActivations != null) {
- IHandlerService handlerService = (IHandlerService)site.getService(IHandlerService.class);
+ IHandlerService handlerService = site.getService(IHandlerService.class);
handlerService.deactivateHandlers(fHandlerActivations);
fHandlerActivations = null;
}
@Override
public void mouseDoubleClick(final MouseEvent e) {
// invoke toggle breakpoint
- IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
+ IHandlerService handlerService = getSite().getService(IHandlerService.class);
if (handlerService != null) {
try {
Event event= new Event();
if (fHandlerActivations == null) {
fHandlerActivations = new ArrayList<IHandlerActivation>(5);
}
- IHandlerService handlerService = (IHandlerService)getSite().getService(IHandlerService.class);
+ IHandlerService handlerService = getSite().getService(IHandlerService.class);
fHandlerActivations.add(handlerService.activateHandler(action.getActionDefinitionId(), new ActionHandler(action)));
}
fDebugSessionId = null;
boolean needUpdate = false;
if (fDebugContext != null) {
- IDisassemblyBackend contextBackend = (IDisassemblyBackend)fDebugContext.getAdapter(IDisassemblyBackend.class);
+ IDisassemblyBackend contextBackend = fDebugContext.getAdapter(IDisassemblyBackend.class);
// Need to compare the backend classes to prevent reusing the same backend object.
// sub class can overwrite the standard disassembly backend to provide its own customization.
if ((prevBackend != null) && (contextBackend != null) && prevBackend.getClass().equals(contextBackend.getClass()) && prevBackend.supportsDebugContext(fDebugContext)) {
newBackend = prevBackend;
} else {
needUpdate = true;
- newBackend = (IDisassemblyBackend)fDebugContext.getAdapter(IDisassemblyBackend.class);
+ newBackend = fDebugContext.getAdapter(IDisassemblyBackend.class);
if (newBackend != null) {
if (newBackend.supportsDebugContext(fDebugContext)) {
newBackend.init(this);
}
public void activateDisassemblyContext() {
- IContextService ctxService = (IContextService)getSite().getService(IContextService.class);
+ IContextService ctxService = getSite().getService(IContextService.class);
if (ctxService!=null)
fContextActivation = ctxService.activateContext(KEY_BINDING_CONTEXT_DISASSEMBLY);
}
public void deactivateDisassemblyContext() {
if (fContextActivation != null) {
- IContextService ctxService = (IContextService)getSite().getService(IContextService.class);
+ IContextService ctxService = getSite().getService(IContextService.class);
ctxService.deactivateContext(fContextActivation);
}
}
IAdaptable element = DebugUITools.getPartDebugContext(view.getSite());
if (element != null) {
- IDebugModelProvider modelProvider = (IDebugModelProvider)element.getAdapter(IDebugModelProvider.class);
+ IDebugModelProvider modelProvider = element.getAdapter(IDebugModelProvider.class);
if (modelProvider != null) {
String[] models = modelProvider.getModelIdentifiers();
for (String model : models) {
*/
@Override
public void run() {
- IWorkbenchSiteProgressService progressService = (IWorkbenchSiteProgressService)fDisassemblyPart.getSite().getAdapter(IWorkbenchSiteProgressService.class);
+ IWorkbenchSiteProgressService progressService = fDisassemblyPart.getSite().getAdapter(IWorkbenchSiteProgressService.class);
if(progressService != null) {
progressService.schedule(this, 0, true);
} else {
private void setTargetPart(IAction callerAction, IWorkbenchPart targetPart) {
if (fDisassemblyPart != null) {
- IVerticalRulerInfo rulerInfo= (IVerticalRulerInfo) fDisassemblyPart.getAdapter(IVerticalRulerInfo.class);
+ IVerticalRulerInfo rulerInfo= fDisassemblyPart.getAdapter(IVerticalRulerInfo.class);
if (rulerInfo != null) {
Control control= rulerInfo.getControl();
if (control != null && !control.isDisposed())
fDisassemblyPart.removeRulerContextMenuListener(this);
}
- fDisassemblyPart= (IDisassemblyPart)(targetPart == null ? null : targetPart.getAdapter(IDisassemblyPart.class));
+ fDisassemblyPart= targetPart == null ? null : targetPart.getAdapter(IDisassemblyPart.class);
fCallerAction= callerAction;
fAction= null;
if (fDisassemblyPart != null) {
fDisassemblyPart.addRulerContextMenuListener(this);
- IVerticalRulerInfo rulerInfo= (IVerticalRulerInfo) fDisassemblyPart.getAdapter(IVerticalRulerInfo.class);
+ IVerticalRulerInfo rulerInfo= fDisassemblyPart.getAdapter(IVerticalRulerInfo.class);
if (rulerInfo != null) {
fAction= createAction(fDisassemblyPart, rulerInfo);
update();
if (part instanceof IDisassemblyPart) {
IDisassemblyPart disassemblyPart = (IDisassemblyPart) part;
IDocument document = disassemblyPart.getTextViewer().getDocument();
- final IVerticalRulerInfo rulerInfo= (IVerticalRulerInfo) part.getAdapter(IVerticalRulerInfo.class);
+ final IVerticalRulerInfo rulerInfo= part.getAdapter(IVerticalRulerInfo.class);
if (rulerInfo != null) {
final ToggleBreakpointAction toggleBpAction= new ToggleBreakpointAction(part, document, rulerInfo);
try {
}
private Position createPositionFromBreakpoint(IBreakpoint breakpoint) throws CoreException {
- IBreakpointLocationProvider locationProvider = (IBreakpointLocationProvider) breakpoint.getAdapter(IBreakpointLocationProvider.class);
+ IBreakpointLocationProvider locationProvider = breakpoint.getAdapter(IBreakpointLocationProvider.class);
/* if there is a location provider, than use the provider to retrieve the location */
if (locationProvider != null) {
} else {
IEditorInput input= CDTUITools.getEditorInputForLocation(storage.getFullPath(), null);
if (input != null) {
- tUnit= (ITranslationUnit) input.getAdapter(ITranslationUnit.class);
+ tUnit= input.getAdapter(ITranslationUnit.class);
}
}
if (tUnit != null) {
@Override
public IFile getSourceFile() {
if (fSourceFile != null) {
- IResource resource = (IResource) fSourceFile.getAdapter(IResource.class);
+ IResource resource = fSourceFile.getAdapter(IResource.class);
if (resource instanceof IFile) {
return (IFile) resource;
}
@Override
public URI getSourceLocationURI() {
if (fSourceFile != null) {
- IResource resource = (IResource) fSourceFile.getAdapter(IResource.class);
+ IResource resource = fSourceFile.getAdapter(IResource.class);
if (resource instanceof IFile) {
return resource.getLocationURI();
} else {
Object firstElement = selection.getFirstElement();
if (firstElement instanceof IAdaptable) {
IDebugModelProvider debugModelProvider =
- (IDebugModelProvider)((IAdaptable)firstElement).getAdapter(IDebugModelProvider.class);
+ ((IAdaptable)firstElement).getAdapter(IDebugModelProvider.class);
if (debugModelProvider != null) {
String[] ids = debugModelProvider.getModelIdentifiers();
if (ids != null && ids.length > 0) {
protected IFrameDMContext getFrame() {
IAdaptable adaptable = getSelectionAdaptable();
if (adaptable != null) {
- return (IFrameDMContext) adaptable.getAdapter(IFrameDMContext.class);
+ return adaptable.getAdapter(IFrameDMContext.class);
}
return null;
}
IAdaptable adaptable = getSelectionAdaptable();
if (adaptable != null) {
- IDebugModelProvider modelProvider = (IDebugModelProvider)adaptable.getAdapter(IDebugModelProvider.class);
+ IDebugModelProvider modelProvider = adaptable.getAdapter(IDebugModelProvider.class);
if (modelProvider != null) {
String[] models = modelProvider.getModelIdentifiers();
String myModel = getModelId();
*/
public SteppingController getSteppingController() {
if (fContexts != null && fContexts.length > 0) {
- return (SteppingController) fContexts[0].getAdapter(SteppingController.class);
+ return fContexts[0].getAdapter(SteppingController.class);
}
return null;
}
}
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))
presentation = (ISourcePresentation) fSourceLookup;
} else {
if (dmc != null) {
- presentation = (ISourcePresentation) dmc.getAdapter(ISourcePresentation.class);
+ presentation = dmc.getAdapter(ISourcePresentation.class);
}
}
if (presentation != null) {
if (editor instanceof ITextEditor) {
textEditor = (ITextEditor)editor;
} else {
- textEditor = (ITextEditor) editor.getAdapter(ITextEditor.class);
+ textEditor = editor.getAdapter(ITextEditor.class);
}
if (textEditor != null) {
if (positionEditor(textEditor, fFrameData)) {
IPresentationContext presentationContext = getPresentationContext();
if (viewerInput instanceof IAdaptable && presentationContext != null) {
- IVMAdapter adapter = (IVMAdapter) ((IAdaptable)viewerInput).getAdapter(IVMAdapter.class);
+ IVMAdapter adapter = ((IAdaptable)viewerInput).getAdapter(IVMAdapter.class);
if ( adapter != null ) {
return adapter.getVMProvider(presentationContext);
if (debugContext instanceof IStructuredSelection) {
Object activeElement = ((IStructuredSelection)debugContext).getFirstElement();
if (activeElement instanceof IAdaptable) {
- return (IVMAdapter)((IAdaptable)activeElement).getAdapter(IVMAdapter.class);
+ return ((IAdaptable)activeElement).getAdapter(IVMAdapter.class);
}
}
return null;
ISelection selection = null;
ISelectionService selectionService =
- (ISelectionService)serviceLocator.getService(ISelectionService.class);
+ serviceLocator.getService(ISelectionService.class);
if (selectionService != null) {
selection = selectionService.getSelection();
}
}
else {
IWorkbenchPart part = null;
- IPartService partService = (IPartService)serviceLocator.getService(IPartService.class);
+ IPartService partService = serviceLocator.getService(IPartService.class);
if (partService != null) {
part = partService.getActivePart();
return getVMProviderForPart(part);
*/
static public ISelection getSelection(IServiceLocator serviceLocator) {
ISelectionService selectionService =
- (ISelectionService)serviceLocator.getService(ISelectionService.class);
+ serviceLocator.getService(ISelectionService.class);
if (selectionService != null) {
return selectionService.getSelection();
}
Viewer viewer = ((IDebugView)part).getViewer();
if (input instanceof IAdaptable && viewer instanceof TreeModelViewer) {
IPresentationContext presContext = ((TreeModelViewer)viewer).getPresentationContext();
- IVMAdapter vmAdapter = (IVMAdapter)((IAdaptable)input).getAdapter(IVMAdapter.class);
+ IVMAdapter vmAdapter = ((IAdaptable)input).getAdapter(IVMAdapter.class);
if (vmAdapter != null) {
return vmAdapter.getVMProvider(presContext);
}
for (final ILabelUpdate update : updates) {
final IBreakpoint bp = ((BreakpointVMContext)update.getElement()).getBreakpoint();
- IElementLabelProvider provider = (IElementLabelProvider)bp.getAdapter(IElementLabelProvider.class);
+ IElementLabelProvider provider = bp.getAdapter(IElementLabelProvider.class);
if (provider == null) {
update.done();
continue;
for (final IElementMementoRequest update : updates) {
final IBreakpoint bp = ((BreakpointVMContext)update.getElement()).getBreakpoint();
- IElementMementoProvider provider = (IElementMementoProvider)bp.getAdapter(IElementMementoProvider.class);
+ IElementMementoProvider provider = bp.getAdapter(IElementMementoProvider.class);
if (provider == null) {
update.done();
continue;
for (final IElementCompareRequest update : updates) {
final IBreakpoint bp = ((BreakpointVMContext)update.getElement()).getBreakpoint();
- IElementMementoProvider provider = (IElementMementoProvider)bp.getAdapter(IElementMementoProvider.class);
+ IElementMementoProvider provider = bp.getAdapter(IElementMementoProvider.class);
if (provider == null) {
update.done();
continue;
private boolean eventContainsElement(Object element) {
if (element instanceof IAdaptable) {
- IExpression expression = (IExpression)((IAdaptable)element).getAdapter(IExpression.class);
+ IExpression expression = ((IAdaptable)element).getAdapter(IExpression.class);
if (expression != null) {
for (int i = 0; i < fEvent.getExpressions().length; i++) {
if (expression.equals(fEvent.getExpressions()[i])) {
private IWatchExpression getWatchExpression(Object element) {
if (element instanceof IAdaptable) {
- return (IWatchExpression)((IAdaptable)element).getAdapter(IWatchExpression.class);
+ return ((IAdaptable)element).getAdapter(IWatchExpression.class);
}
return null;
}
return;
}
IRunControl runControlService = getServicesTracker().getService(IRunControl.class);
- SteppingController stepQueueMgr = (SteppingController) execDmc.getAdapter(SteppingController.class);
+ SteppingController stepQueueMgr = execDmc.getAdapter(SteppingController.class);
if (runControlService == null || stepQueueMgr == null) return;
String imageKey = null;
public IExpressionDMContext getVariableDMC(Object element) {
if (element instanceof IAdaptable) {
- return (IExpressionDMContext) ((IAdaptable) element).getAdapter(IExpressionDMContext.class);
+ return ((IAdaptable) element).getAdapter(IExpressionDMContext.class);
}
return null;
}
public IExpressionDMContext getExpressionDMC(Object element) {
if (element instanceof IAdaptable) {
- return (IExpressionDMContext) ((IAdaptable) element).getAdapter(IExpressionDMContext.class);
+ return ((IAdaptable) element).getAdapter(IExpressionDMContext.class);
}
return null;
}
public IFormattedDataDMContext getFormattedDMC(Object element) {
if (element instanceof IAdaptable) {
- return (IFormattedDataDMContext) ((IAdaptable) element).getAdapter(IFormattedDataDMContext.class);
+ return ((IAdaptable) element).getAdapter(IFormattedDataDMContext.class);
}
return null;
}
*/
private IExpressionDMContext getVariableDMC(Object element) {
if (element instanceof IAdaptable) {
- return (IExpressionDMContext)((IAdaptable)element).getAdapter(IExpressionDMContext.class);
+ return ((IAdaptable)element).getAdapter(IExpressionDMContext.class);
}
return null;
}
private IElementPropertiesProvider getElementPropertiesProvider(Object element) {
if (element instanceof IAdaptable) {
- return (IElementPropertiesProvider)((IAdaptable)element).getAdapter(IElementPropertiesProvider.class);
+ return ((IAdaptable)element).getAdapter(IElementPropertiesProvider.class);
}
return null;
}
if (adapterType.equals(IMemoryBlockRetrieval.class)) {
IAdaptable adaptable = (IAdaptable) adaptableObject;
//Retrieve the session's Memory Block Retrieval Manager
- IMemoryBlockRetrievalManager retrievalManager = ((IMemoryBlockRetrievalManager) adaptable
+ IMemoryBlockRetrievalManager retrievalManager = (adaptable
.getAdapter(IMemoryBlockRetrievalManager.class));
if (retrievalManager != null) {
//resolve the specific Memory Block Retrieval associated to the memory context of adaptableObject
IMemoryDMContext memoryDmc = null;
IDMContext dmc = null;
if (context instanceof IAdaptable) {
- dmc = (IDMContext)((IAdaptable)context).getAdapter(IDMContext.class);
+ dmc = ((IAdaptable)context).getAdapter(IDMContext.class);
if (dmc != null) {
memoryDmc = DMContexts.getAncestorOfType(dmc, IMemoryDMContext.class);
}
public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
ITextEditor textEditor = getEditor(part);
if (textEditor != null) {
- IResource resource = (IResource) textEditor.getEditorInput().getAdapter(IResource.class);
+ IResource resource = textEditor.getEditorInput().getAdapter(IResource.class);
ITextSelection textSelection = (ITextSelection) selection;
int lineNumber = textSelection.getStartLine();
IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(PDAPlugin.ID_PDA_DEBUG_MODEL);
private ITextEditor getEditor(IWorkbenchPart part) {
if (part instanceof ITextEditor) {
ITextEditor editorPart = (ITextEditor) part;
- IResource resource = (IResource) editorPart.getEditorInput().getAdapter(IResource.class);
+ IResource resource = editorPart.getEditorInput().getAdapter(IResource.class);
if (resource != null) {
String extension = resource.getFileExtension();
if (extension != null && extension.equals("pda")) {
if (variableAndFunctionName != null && part instanceof ITextEditor && selection instanceof ITextSelection) {
ITextEditor editorPart = (ITextEditor)part;
int lineNumber = ((ITextSelection)selection).getStartLine();
- IResource resource = (IResource) editorPart.getEditorInput().getAdapter(IResource.class);
+ IResource resource = editorPart.getEditorInput().getAdapter(IResource.class);
String var = variableAndFunctionName[0];
String fcn = variableAndFunctionName[1];
// look for existing watchpoint to delete
public Object getAdapter(Object adaptableObject, Class adapterType) {
if (adaptableObject instanceof PDAEditor) {
ITextEditor editorPart = (ITextEditor) adaptableObject;
- IResource resource = (IResource) editorPart.getEditorInput().getAdapter(IResource.class);
+ IResource resource = editorPart.getEditorInput().getAdapter(IResource.class);
if (resource != null) {
String extension = resource.getFileExtension();
if (extension != null && extension.equals("pda")) {
// register and bit field context are covered here.
// When these show up in expression view, the register/bit field vm node's associateExpression has called
// RegisterVMC/BitFieldVMC's setExpression
- IExpression y = (IExpression) ((IVMContext) x).getAdapter(IExpression.class);
+ IExpression y = ((IVMContext) x).getAdapter(IExpression.class);
if (y == null) {
rm.setData(null);
} else {
persistable.setValue(ctx.getExpression(), format);
changed.add((IDMVMContext) x);
} else if (x instanceof IDMVMContext) {
- IExpression y = (IExpression) ((IVMContext) x).getAdapter(IExpression.class);
+ IExpression y = ((IVMContext) x).getAdapter(IExpression.class);
if (y == null)
continue;
persistable.setValue(y.getExpressionText(), format);
private TriggerDMContext getAlarmDMC(Object element) {
if (element instanceof IAdaptable) {
- return (TriggerDMContext)((IAdaptable)element).getAdapter(TriggerDMContext.class);
+ return ((IAdaptable)element).getAdapter(TriggerDMContext.class);
}
return null;
}
final IDMVMContext containerVMC = _containerVMC;
final TreePath containerPath = launchPath.createChildPath(containerVMC);
final IElementPropertiesProvider containerPropProvider =
- (IElementPropertiesProvider)containerVMC.getAdapter(IElementPropertiesProvider.class);
+ containerVMC.getAdapter(IElementPropertiesProvider.class);
Assert.assertNotNull(containerPropProvider);
// Check if container is suspended.
if (element instanceof IResource) {
resourceBeingRenamed = (IResource) element;
} else if (element instanceof IAdaptable) {
- resourceBeingRenamed = (IResource) ((IAdaptable) element).getAdapter(IResource.class);
+ resourceBeingRenamed = ((IAdaptable) element).getAdapter(IResource.class);
}
return true;
public FixedBacktrackingParser(TokenStream tokStream, ParseTable prs, RuleAction ra) throws BadParseSymFileException,
NotBacktrackParseTableException
{
- this.tokStream = (PrsStream) tokStream;
+ this.tokStream = tokStream;
this.prs = prs;
this.ra = ra;
public String[] orderedTerminalSymbols() { return C99ExpressionParsersym.orderedTerminalSymbols; }
public String getTokenKindName(int kind) { return C99ExpressionParsersym.orderedTerminalSymbols[kind]; }
public int getEOFTokenKind() { return C99ExpressionParserprs.EOFT_SYMBOL; }
- public PrsStream getParseStream() { return (PrsStream) this; }
+ public PrsStream getParseStream() { return this; }
//
// Report error message for given error_token.
{
try
{
- btParser = new FixedBacktrackingParser(monitor, (TokenStream) this, prs, (RuleAction) this);
+ btParser = new FixedBacktrackingParser(monitor, this, prs, this);
}
catch (NotBacktrackParseTableException e)
{
public String[] orderedTerminalSymbols() { return C99NoCastExpressionParsersym.orderedTerminalSymbols; }
public String getTokenKindName(int kind) { return C99NoCastExpressionParsersym.orderedTerminalSymbols[kind]; }
public int getEOFTokenKind() { return C99NoCastExpressionParserprs.EOFT_SYMBOL; }
- public PrsStream getParseStream() { return (PrsStream) this; }
+ public PrsStream getParseStream() { return this; }
//
// Report error message for given error_token.
{
try
{
- btParser = new FixedBacktrackingParser(monitor, (TokenStream) this, prs, (RuleAction) this);
+ btParser = new FixedBacktrackingParser(monitor, this, prs, this);
}
catch (NotBacktrackParseTableException e)
{
public String[] orderedTerminalSymbols() { return C99Parsersym.orderedTerminalSymbols; }
public String getTokenKindName(int kind) { return C99Parsersym.orderedTerminalSymbols[kind]; }
public int getEOFTokenKind() { return C99Parserprs.EOFT_SYMBOL; }
- public PrsStream getParseStream() { return (PrsStream) this; }
+ public PrsStream getParseStream() { return this; }
//
// Report error message for given error_token.
{
try
{
- btParser = new FixedBacktrackingParser(monitor, (TokenStream) this, prs, (RuleAction) this);
+ btParser = new FixedBacktrackingParser(monitor, this, prs, this);
}
catch (NotBacktrackParseTableException e)
{
public String[] orderedTerminalSymbols() { return C99SizeofExpressionParsersym.orderedTerminalSymbols; }
public String getTokenKindName(int kind) { return C99SizeofExpressionParsersym.orderedTerminalSymbols[kind]; }
public int getEOFTokenKind() { return C99SizeofExpressionParserprs.EOFT_SYMBOL; }
- public PrsStream getParseStream() { return (PrsStream) this; }
+ public PrsStream getParseStream() { return this; }
//
// Report error message for given error_token.
{
try
{
- btParser = new FixedBacktrackingParser(monitor, (TokenStream) this, prs, (RuleAction) this);
+ btParser = new FixedBacktrackingParser(monitor, this, prs, this);
}
catch (NotBacktrackParseTableException e)
{
public String[] orderedTerminalSymbols() { return CPPExpressionParsersym.orderedTerminalSymbols; }
public String getTokenKindName(int kind) { return CPPExpressionParsersym.orderedTerminalSymbols[kind]; }
public int getEOFTokenKind() { return CPPExpressionParserprs.EOFT_SYMBOL; }
- public PrsStream getParseStream() { return (PrsStream) this; }
+ public PrsStream getParseStream() { return this; }
//
// Report error message for given error_token.
{
try
{
- btParser = new FixedBacktrackingParser(monitor, (TokenStream) this, prs, (RuleAction) this);
+ btParser = new FixedBacktrackingParser(monitor, this, prs, this);
}
catch (NotBacktrackParseTableException e)
{
public String[] orderedTerminalSymbols() { return CPPNoCastExpressionParsersym.orderedTerminalSymbols; }
public String getTokenKindName(int kind) { return CPPNoCastExpressionParsersym.orderedTerminalSymbols[kind]; }
public int getEOFTokenKind() { return CPPNoCastExpressionParserprs.EOFT_SYMBOL; }
- public PrsStream getParseStream() { return (PrsStream) this; }
+ public PrsStream getParseStream() { return this; }
//
// Report error message for given error_token.
{
try
{
- btParser = new FixedBacktrackingParser(monitor, (TokenStream) this, prs, (RuleAction) this);
+ btParser = new FixedBacktrackingParser(monitor, this, prs, this);
}
catch (NotBacktrackParseTableException e)
{
public String[] orderedTerminalSymbols() { return CPPNoFunctionDeclaratorParsersym.orderedTerminalSymbols; }
public String getTokenKindName(int kind) { return CPPNoFunctionDeclaratorParsersym.orderedTerminalSymbols[kind]; }
public int getEOFTokenKind() { return CPPNoFunctionDeclaratorParserprs.EOFT_SYMBOL; }
- public PrsStream getParseStream() { return (PrsStream) this; }
+ public PrsStream getParseStream() { return this; }
//
// Report error message for given error_token.
{
try
{
- btParser = new FixedBacktrackingParser(monitor, (TokenStream) this, prs, (RuleAction) this);
+ btParser = new FixedBacktrackingParser(monitor, this, prs, this);
}
catch (NotBacktrackParseTableException e)
{
public String[] orderedTerminalSymbols() { return CPPParsersym.orderedTerminalSymbols; }
public String getTokenKindName(int kind) { return CPPParsersym.orderedTerminalSymbols[kind]; }
public int getEOFTokenKind() { return CPPParserprs.EOFT_SYMBOL; }
- public PrsStream getParseStream() { return (PrsStream) this; }
+ public PrsStream getParseStream() { return this; }
//
// Report error message for given error_token.
{
try
{
- btParser = new FixedBacktrackingParser(monitor, (TokenStream) this, prs, (RuleAction) this);
+ btParser = new FixedBacktrackingParser(monitor, this, prs, this);
}
catch (NotBacktrackParseTableException e)
{
public String[] orderedTerminalSymbols() { return CPPSizeofExpressionParsersym.orderedTerminalSymbols; }
public String getTokenKindName(int kind) { return CPPSizeofExpressionParsersym.orderedTerminalSymbols[kind]; }
public int getEOFTokenKind() { return CPPSizeofExpressionParserprs.EOFT_SYMBOL; }
- public PrsStream getParseStream() { return (PrsStream) this; }
+ public PrsStream getParseStream() { return this; }
//
// Report error message for given error_token.
{
try
{
- btParser = new FixedBacktrackingParser(monitor, (TokenStream) this, prs, (RuleAction) this);
+ btParser = new FixedBacktrackingParser(monitor, this, prs, this);
}
catch (NotBacktrackParseTableException e)
{
public String[] orderedTerminalSymbols() { return CPPTemplateTypeParameterParsersym.orderedTerminalSymbols; }
public String getTokenKindName(int kind) { return CPPTemplateTypeParameterParsersym.orderedTerminalSymbols[kind]; }
public int getEOFTokenKind() { return CPPTemplateTypeParameterParserprs.EOFT_SYMBOL; }
- public PrsStream getParseStream() { return (PrsStream) this; }
+ public PrsStream getParseStream() { return this; }
//
// Report error message for given error_token.
{
try
{
- btParser = new FixedBacktrackingParser(monitor, (TokenStream) this, prs, (RuleAction) this);
+ btParser = new FixedBacktrackingParser(monitor, this, prs, this);
}
catch (NotBacktrackParseTableException e)
{
public String[] orderedTerminalSymbols() { return GCCParsersym.orderedTerminalSymbols; }
public String getTokenKindName(int kind) { return GCCParsersym.orderedTerminalSymbols[kind]; }
public int getEOFTokenKind() { return GCCParserprs.EOFT_SYMBOL; }
- public PrsStream getParseStream() { return (PrsStream) this; }
+ public PrsStream getParseStream() { return this; }
//
// Report error message for given error_token.
{
try
{
- btParser = new FixedBacktrackingParser(monitor, (TokenStream) this, prs, (RuleAction) this);
+ btParser = new FixedBacktrackingParser(monitor, this, prs, this);
}
catch (NotBacktrackParseTableException e)
{
public String[] orderedTerminalSymbols() { return GCCSizeofExpressionParsersym.orderedTerminalSymbols; }
public String getTokenKindName(int kind) { return GCCSizeofExpressionParsersym.orderedTerminalSymbols[kind]; }
public int getEOFTokenKind() { return GCCSizeofExpressionParserprs.EOFT_SYMBOL; }
- public PrsStream getParseStream() { return (PrsStream) this; }
+ public PrsStream getParseStream() { return this; }
//
// Report error message for given error_token.
{
try
{
- btParser = new FixedBacktrackingParser(monitor, (TokenStream) this, prs, (RuleAction) this);
+ btParser = new FixedBacktrackingParser(monitor, this, prs, this);
}
catch (NotBacktrackParseTableException e)
{
public String[] orderedTerminalSymbols() { return GPPParsersym.orderedTerminalSymbols; }
public String getTokenKindName(int kind) { return GPPParsersym.orderedTerminalSymbols[kind]; }
public int getEOFTokenKind() { return GPPParserprs.EOFT_SYMBOL; }
- public PrsStream getParseStream() { return (PrsStream) this; }
+ public PrsStream getParseStream() { return this; }
//
// Report error message for given error_token.
{
try
{
- btParser = new FixedBacktrackingParser(monitor, (TokenStream) this, prs, (RuleAction) this);
+ btParser = new FixedBacktrackingParser(monitor, this, prs, this);
}
catch (NotBacktrackParseTableException e)
{
public String[] orderedTerminalSymbols() { return GPPSizeofExpressionParsersym.orderedTerminalSymbols; }
public String getTokenKindName(int kind) { return GPPSizeofExpressionParsersym.orderedTerminalSymbols[kind]; }
public int getEOFTokenKind() { return GPPSizeofExpressionParserprs.EOFT_SYMBOL; }
- public PrsStream getParseStream() { return (PrsStream) this; }
+ public PrsStream getParseStream() { return this; }
//
// Report error message for given error_token.
{
try
{
- btParser = new FixedBacktrackingParser(monitor, (TokenStream) this, prs, (RuleAction) this);
+ btParser = new FixedBacktrackingParser(monitor, this, prs, this);
}
catch (NotBacktrackParseTableException e)
{
super.activated();
IWorkbench workbench = PlatformUI.getWorkbench();
- ICommandService commandSupport = (ICommandService) workbench.getAdapter(ICommandService.class);
+ ICommandService commandSupport = workbench.getAdapter(ICommandService.class);
if (commandSupport != null)
{
public void deactivated()
{
IWorkbench workbench = PlatformUI.getWorkbench();
- ICommandService commandSupport = (ICommandService) workbench.getAdapter(ICommandService.class);
+ ICommandService commandSupport = workbench.getAdapter(ICommandService.class);
if (commandSupport != null)
{
{
IMemoryBlock block = fParent.getMemoryBlock();
if (block != null)
- return (IMemoryBlockExtension) block.getAdapter(IMemoryBlockExtension.class);
+ return block.getAdapter(IMemoryBlockExtension.class);
return null;
}
public IDebugTarget getDebugTarget() { return null; }\r
public ILaunch getLaunch() { return null; }\r
public String getModelIdentifier() { return null; }\r
- public <T> T getAdapter(Class<T> adapter) { return null; }\r
+ @SuppressWarnings({ "rawtypes", "unchecked" })\r
+ public Object getAdapter(Class adapter) { return null; }\r
});\r
}\r
\r