diff options
author | Markus Schorn | 2008-04-08 11:05:59 +0000 |
---|---|---|
committer | Markus Schorn | 2008-04-08 11:05:59 +0000 |
commit | b7b91190f550f3b87a54984c0c216f5928d52712 (patch) | |
tree | 70106710db032945a02d921e8d064183c368ae38 /core/org.eclipse.cdt.ui | |
parent | 0c89fe67334ffe72a9ed7324c08e9fd7b68b8506 (diff) | |
download | org.eclipse.cdt-b7b91190f550f3b87a54984c0c216f5928d52712.tar.gz org.eclipse.cdt-b7b91190f550f3b87a54984c0c216f5928d52712.tar.xz org.eclipse.cdt-b7b91190f550f3b87a54984c0c216f5928d52712.zip |
Use generics.
Diffstat (limited to 'core/org.eclipse.cdt.ui')
26 files changed, 253 insertions, 213 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/codemanipulation/AddIncludesOperation.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/codemanipulation/AddIncludesOperation.java index 8d95d79c868..3049ce6e0fb 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/codemanipulation/AddIncludesOperation.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/codemanipulation/AddIncludesOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -15,21 +15,22 @@ package org.eclipse.cdt.internal.corext.codemanipulation; import java.util.ArrayList; import java.util.List; +import org.eclipse.core.resources.IWorkspaceRunnable; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.jobs.ISchedulingRule; + import org.eclipse.cdt.core.model.IBuffer; import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.IInclude; import org.eclipse.cdt.core.model.ISourceRange; import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.core.model.IUsing; -import org.eclipse.cdt.internal.ui.editor.CEditorMessages; import org.eclipse.cdt.ui.IRequiredInclude; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.jobs.ISchedulingRule; +import org.eclipse.cdt.internal.ui.editor.CEditorMessages; /** @@ -70,7 +71,7 @@ public class AddIncludesOperation implements IWorkspaceRunnable { } if (fTranslationUnit != null) { - ArrayList toAdd = new ArrayList(); + ArrayList<IRequiredInclude> toAdd = new ArrayList<IRequiredInclude>(); monitor.beginTask(CEditorMessages.getString("AddIncludesOperation.description"), 2); //$NON-NLS-1$ @@ -94,7 +95,7 @@ public class AddIncludesOperation implements IWorkspaceRunnable { // So we have our list. Now insert. StringBuffer insert = new StringBuffer(""); //$NON-NLS-1$ for(int j = 0; j < toAdd.size(); j++) { - IRequiredInclude req = (IRequiredInclude)toAdd.get(j); + IRequiredInclude req = toAdd.get(j); if (req.isStandard()) { insert.append("#include <" + req.getIncludeName() + ">").append(newLine); //$NON-NLS-1$ //$NON-NLS-2$ } else { @@ -124,7 +125,7 @@ public class AddIncludesOperation implements IWorkspaceRunnable { } if (fTranslationUnit != null) { - ArrayList toAdd = new ArrayList(); + ArrayList<String> toAdd = new ArrayList<String>(); monitor.beginTask(CEditorMessages.getString("AddIncludesOperation.description"), 2); //$NON-NLS-1$ @@ -148,7 +149,7 @@ public class AddIncludesOperation implements IWorkspaceRunnable { // So we have our list. Now insert. StringBuffer insert = new StringBuffer(""); //$NON-NLS-1$ for(int j = 0; j < toAdd.size(); j++) { - String using = (String)toAdd.get(j); + String using = toAdd.get(j); insert.append("using namespace " + using + ";").append(newLine); //$NON-NLS-1$ //$NON-NLS-2$ } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/codemanipulation/StubUtility.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/codemanipulation/StubUtility.java index eb26684e722..2ccc8375f35 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/codemanipulation/StubUtility.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/codemanipulation/StubUtility.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. + * Copyright (c) 2001, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -293,7 +293,7 @@ public class StubUtility { IDocument doc= new Document(buffer.getString()); int nLines= doc.getNumberOfLines(); MultiTextEdit edit= new MultiTextEdit(); - HashSet removedLines= new HashSet(); + HashSet<Integer> removedLines= new HashSet<Integer>(); for (int i= 0; i < variables.length; i++) { TemplateVariable position= findVariable(buffer, variables[i]); if (position == null) { @@ -561,7 +561,7 @@ public class StubUtility { } templateDatas= projectStore.getTemplateData(); } - List result= new ArrayList(); + List<Template> result= new ArrayList<Template>(); for (int j = 0; j < contentTypes.length; j++) { for (int i = 0; i < templateDatas.length; i++) { Template template = templateDatas[i].getTemplate(); @@ -571,7 +571,7 @@ public class StubUtility { } } } - return (Template[]) result.toArray(new Template[result.size()]); + return result.toArray(new Template[result.size()]); } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/FileTemplateContextType.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/FileTemplateContextType.java index 86001872e17..2c51c7b21f7 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/FileTemplateContextType.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/FileTemplateContextType.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 Wind River Systems, Inc. and others. + * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -60,6 +60,7 @@ public class FileTemplateContextType extends TemplateContextType { super(type, description); } + @Override protected String resolve(TemplateContext context) { String value= context.getVariable(getType()); return value != null ? value : ""; //$NON-NLS-1$ @@ -79,6 +80,7 @@ public class FileTemplateContextType extends TemplateContextType { /* * @see org.eclipse.jface.text.templates.TemplateVariableResolver#resolve(org.eclipse.jface.text.templates.TemplateVariable, org.eclipse.jface.text.templates.TemplateContext) */ + @Override public void resolve(TemplateVariable variable, TemplateContext context) { fFormat= null; TemplateVariableType type= variable.getVariableType(); @@ -92,6 +94,7 @@ public class FileTemplateContextType extends TemplateContextType { /* * @see org.eclipse.jface.text.templates.SimpleTemplateVariableResolver#resolve(org.eclipse.jface.text.templates.TemplateContext) */ + @Override protected String resolve(TemplateContext context) { DateFormat f; if (fFormat == null) { @@ -117,17 +120,19 @@ public class FileTemplateContextType extends TemplateContextType { /* * @see org.eclipse.jface.text.templates.TemplateVariableResolver#resolve(org.eclipse.jface.text.templates.TemplateVariable, org.eclipse.jface.text.templates.TemplateContext) */ + @Override public void resolve(TemplateVariable variable, TemplateContext context) { fVariableName= variable.getName(); TemplateVariableType type= variable.getVariableType(); - List params= type.getParams(); - fArguments= (String[]) params.toArray(new String[params.size()]); + List<?> params= type.getParams(); + fArguments= params.toArray(new String[params.size()]); super.resolve(variable, context); } /* * @see org.eclipse.jface.text.templates.SimpleTemplateVariableResolver#resolve(org.eclipse.jface.text.templates.TemplateContext) */ + @Override protected String resolve(TemplateContext context) { StringBuffer expr= new StringBuffer("${"); //$NON-NLS-1$ expr.append(fVariableName); @@ -172,6 +177,7 @@ public class FileTemplateContextType extends TemplateContextType { addResolver(new FileTemplateVariableResolver(PROJECTNAME, TemplateMessages.FileTemplateContextType_variable_description_projectname)); } + @Override protected void validateVariables(TemplateVariable[] variables) throws TemplateException { ArrayList required= new ArrayList(5); for (int i= 0; i < variables.length; i++) { @@ -191,6 +197,7 @@ public class FileTemplateContextType extends TemplateContextType { /* * @see org.eclipse.jface.text.templates.TemplateContextType#resolve(org.eclipse.jface.text.templates.TemplateVariable, org.eclipse.jface.text.templates.TemplateContext) */ + @Override public void resolve(TemplateVariable variable, TemplateContext context) { String type= variable.getType(); TemplateVariableResolver resolver= getResolver(type); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CElementSet.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CElementSet.java index 3cae39f690c..d058116b99b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CElementSet.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CElementSet.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. + * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,6 @@ * Contributors: * Markus Schorn - initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.internal.ui.callhierarchy; import java.util.ArrayList; @@ -22,7 +21,7 @@ import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.internal.ui.viewsupport.WorkingSetFilterUI; public class CElementSet { - private Set fSet= new LinkedHashSet(); + private Set<ICElement> fSet= new LinkedHashSet<ICElement>(); private int fHashCode; CElementSet( ICElement[] elements) { @@ -33,10 +32,12 @@ public class CElementSet { } } + @Override public int hashCode() { return fHashCode; } + @Override public boolean equals(Object obj) { if (this == obj) { return true; @@ -60,7 +61,7 @@ public class CElementSet { if (fSet.size() != other.fSet.size()) { return false; } - for (Iterator iter = fSet.iterator(); iter.hasNext(); ) { + for (Iterator<ICElement> iter = fSet.iterator(); iter.hasNext(); ) { if (!other.fSet.contains(iter.next())) { return false; } @@ -74,13 +75,13 @@ public class CElementSet { } public ICElement[] getElements(WorkingSetFilterUI filter) { - ArrayList result= new ArrayList(fSet.size()); - for (Iterator iter = fSet.iterator(); iter.hasNext(); ) { - ICElement element = (ICElement) iter.next(); + ArrayList<ICElement> result= new ArrayList<ICElement>(fSet.size()); + for (Iterator<ICElement> iter = fSet.iterator(); iter.hasNext(); ) { + ICElement element = iter.next(); if (filter == null || filter.isPartOfWorkingSet(element)) { result.add(element); } } - return (ICElement[]) result.toArray(new ICElement[result.size()]); + return result.toArray(new ICElement[result.size()]); } }
\ No newline at end of file diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHContentProvider.java index 8bd2996592d..2fded570869 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHContentProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHContentProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. + * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,6 @@ * Contributors: * Markus Schorn - initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.internal.ui.callhierarchy; import java.util.ArrayList; @@ -53,6 +52,7 @@ public class CHContentProvider extends AsyncTreeContentProvider { fView= view; } + @Override public Object getParent(Object element) { if (element instanceof CHNode) { CHNode node = (CHNode) element; @@ -61,6 +61,7 @@ public class CHContentProvider extends AsyncTreeContentProvider { return super.getParent(element); } + @Override protected Object[] syncronouslyComputeChildren(Object parentElement) { if (parentElement instanceof CHMultiDefNode) { return ((CHMultiDefNode) parentElement).getChildNodes(); @@ -84,6 +85,7 @@ public class CHContentProvider extends AsyncTreeContentProvider { return null; } + @Override protected Object[] asyncronouslyComputeChildren(Object parentElement, IProgressMonitor monitor) { try { if (parentElement instanceof ICElement) { @@ -174,7 +176,7 @@ public class CHContentProvider extends AsyncTreeContentProvider { } CHNode[] createNodes(CHNode node, CalledByResult result) throws CoreException { - ArrayList nodes= new ArrayList(); + ArrayList<CHNode> nodes= new ArrayList<CHNode>(); ICElement[] elements= result.getElements(); for (int i = 0; i < elements.length; i++) { ICElement element = elements[i]; @@ -188,7 +190,7 @@ public class CHContentProvider extends AsyncTreeContentProvider { } } } - return (CHNode[]) nodes.toArray(new CHNode[nodes.size()]); + return nodes.toArray(new CHNode[nodes.size()]); } private CHNode createRefbyNode(CHNode parent, ICElement element, IIndexName[] refs) throws CoreException { @@ -212,7 +214,7 @@ public class CHContentProvider extends AsyncTreeContentProvider { CHNode[] createNodes(CHNode node, CallsToResult callsTo) throws CoreException { ITranslationUnit tu= CModelUtil.getTranslationUnit(node.getRepresentedDeclaration()); - ArrayList result= new ArrayList(); + ArrayList<CHNode> result= new ArrayList<CHNode>(); CElementSet[] elementSets= callsTo.getElementSets(); for (int i = 0; i < elementSets.length; i++) { CElementSet set = elementSets[i]; @@ -225,7 +227,7 @@ public class CHContentProvider extends AsyncTreeContentProvider { } } } - return (CHNode[]) result.toArray(new CHNode[result.size()]); + return result.toArray(new CHNode[result.size()]); } private CHNode createReftoNode(CHNode parent, ITranslationUnit tu, ICElement[] elements, IIndexName[] references) throws CoreException { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHHistoryListAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHHistoryListAction.java index 5c9c46769f3..0ac4f52af4a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHHistoryListAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHHistoryListAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -86,6 +86,7 @@ public class CHHistoryListAction extends Action { /* * @see Dialog#createDialogArea(Composite) */ + @Override protected Control createDialogArea(Composite parent) { initializeDialogUnits(parent); @@ -137,13 +138,14 @@ public class CHHistoryListAction extends Action { } public ICElement[] getRemaining() { - List elems= fHistoryList.getElements(); - return (ICElement[]) elems.toArray(new ICElement[elems.size()]); + List<?> elems= fHistoryList.getElements(); + return elems.toArray(new ICElement[elems.size()]); } /* * @see org.eclipse.jface.window.Window#configureShell(Shell) */ + @Override protected void configureShell(Shell newShell) { super.configureShell(newShell); // PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, ...); @@ -152,6 +154,7 @@ public class CHHistoryListAction extends Action { /* (non-Javadoc) * @see org.eclipse.jface.window.Window#create() */ + @Override public void create() { setShellStyle(getShellStyle() | SWT.RESIZE); super.create(); @@ -169,6 +172,7 @@ public class CHHistoryListAction extends Action { /* * @see IAction#run() */ + @Override public void run() { ICElement[] historyEntries= fView.getHistoryEntries(); HistoryListDialog dialog= new HistoryListDialog(fView.getSite().getShell(), historyEntries); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHLabelProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHLabelProvider.java index 95975db6c97..7a892d1a788 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHLabelProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHLabelProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. + * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,6 @@ * Contributors: * Markus Schorn - initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.internal.ui.callhierarchy; import java.util.HashMap; @@ -39,7 +38,7 @@ public class CHLabelProvider extends LabelProvider implements IColorProvider { private CUILabelProvider fCLabelProvider= new CUILabelProvider(LABEL_OPTIONS_SIMPLE, 0); private CHContentProvider fContentProvider; - private HashMap fCachedImages= new HashMap(); + private HashMap<String, Image> fCachedImages= new HashMap<String, Image>(); private Color fColorInactive; public CHLabelProvider(Display display, CHContentProvider cp) { @@ -47,7 +46,8 @@ public class CHLabelProvider extends LabelProvider implements IColorProvider { fContentProvider= cp; } - public Image getImage(Object element) { + @Override + public Image getImage(Object element) { if (element instanceof CHNode) { CHNode node= (CHNode) element; Image image= null; @@ -68,7 +68,8 @@ public class CHLabelProvider extends LabelProvider implements IColorProvider { return super.getImage(element); } - public String getText(Object element) { + @Override + public String getText(Object element) { if (element instanceof CHNode) { CHNode node= (CHNode) element; ICElement decl= node.getOneRepresentedDeclaration(); @@ -114,10 +115,11 @@ public class CHLabelProvider extends LabelProvider implements IColorProvider { return buf.toString(); } + @Override public void dispose() { fCLabelProvider.dispose(); - for (Iterator iter = fCachedImages.values().iterator(); iter.hasNext();) { - Image image = (Image) iter.next(); + for (Iterator<Image> iter = fCachedImages.values().iterator(); iter.hasNext();) { + Image image = iter.next(); image.dispose(); } fCachedImages.clear(); @@ -150,7 +152,7 @@ public class CHLabelProvider extends LabelProvider implements IColorProvider { } String key= image.toString()+String.valueOf(flags); - Image result= (Image) fCachedImages.get(key); + Image result= fCachedImages.get(key); if (result == null) { ImageDescriptor desc= new CElementImageDescriptor( new ImageImageDescriptor(image), flags, new Point(20,16)); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHNode.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHNode.java index c85532172fa..cc708fb72a6 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHNode.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHNode.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. + * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,6 @@ * Contributors: * Markus Schorn - initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.internal.ui.callhierarchy; import java.util.ArrayList; @@ -32,7 +31,7 @@ public class CHNode implements IAdaptable { private CHNode fParent; private ICElement fRepresentedDecl; private ITranslationUnit fFileOfReferences; - private List fReferences; + private List<CHReferenceInfo> fReferences; private int fHashCode; private long fTimestamp; @@ -47,7 +46,7 @@ public class CHNode implements IAdaptable { public CHNode(CHNode parent, ITranslationUnit fileOfReferences, long timestamp, ICElement decl) { fParent= parent; fFileOfReferences= fileOfReferences; - fReferences= Collections.EMPTY_LIST; + fReferences= Collections.emptyList(); fRepresentedDecl= decl; fIsRecursive= computeIsRecursive(fParent, decl); fHashCode= computeHashCode(); @@ -65,11 +64,13 @@ public class CHNode implements IAdaptable { return hashCode; } - public int hashCode() { + @Override + public int hashCode() { return fHashCode; } - public boolean equals(Object o) { + @Override + public boolean equals(Object o) { if (!(o instanceof CHNode)) { return false; } @@ -109,7 +110,7 @@ public class CHNode implements IAdaptable { } public CHReferenceInfo getReference(int idx) { - return (CHReferenceInfo) fReferences.get(idx); + return fReferences.get(idx); } public ICElement getRepresentedDeclaration() { @@ -139,7 +140,7 @@ public class CHNode implements IAdaptable { fReferences= Collections.singletonList(info); return; case 1: - fReferences= new ArrayList(fReferences); + fReferences= new ArrayList<CHReferenceInfo>(fReferences); break; } fReferences.add(info); @@ -149,6 +150,7 @@ public class CHNode implements IAdaptable { return fFileOfReferences; } + @SuppressWarnings("unchecked") public Object getAdapter(Class adapter) { if (adapter.isAssignableFrom(ICElement.class)) { return getRepresentedDeclaration(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHQueries.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHQueries.java index ce26aa4ce2a..cf622ef99f3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHQueries.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHQueries.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. + * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,6 @@ * Contributors: * Markus Schorn - initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.internal.ui.callhierarchy; import java.util.ArrayList; @@ -36,6 +35,7 @@ import org.eclipse.cdt.core.model.ISourceReference; import org.eclipse.cdt.core.parser.util.CharArrayUtils; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; +import org.eclipse.cdt.internal.core.model.ext.ICElementHandle; import org.eclipse.cdt.internal.ui.viewsupport.IndexUI; @@ -74,7 +74,7 @@ public class CHQueries { private static IBinding[] getOverriddenBindings(IIndex index, IIndexBinding binding) { if (binding instanceof ICPPMethod && !(binding instanceof ICPPConstructor)) { try { - final ArrayList result= new ArrayList(); + final ArrayList<ICPPMethod> result= new ArrayList<ICPPMethod>(); final ICPPMethod m= (ICPPMethod) binding; final char[] mname= m.getNameCharArray(); final ICPPClassType mcl= m.getClassOwner(); @@ -91,7 +91,7 @@ public class CHQueries { } } if (isVirtual) { - return (IBinding[]) result.toArray(new IBinding[result.size()]); + return result.toArray(new IBinding[result.size()]); } } catch (DOMException e) { // index bindings don't throw DOMExceptions @@ -105,7 +105,7 @@ public class CHQueries { try { final ICPPMethod m= (ICPPMethod) binding; if (isVirtual(m)) { - final ArrayList result= new ArrayList(); + final ArrayList<ICPPMethod> result= new ArrayList<ICPPMethod>(); final char[] mname= m.getNameCharArray(); final ICPPClassType mcl= m.getClassOwner(); final IFunctionType mft= m.getType(); @@ -121,7 +121,7 @@ public class CHQueries { } } } - return (IBinding[]) result.toArray(new IBinding[result.size()]); + return result.toArray(new IBinding[result.size()]); } } catch (DOMException e) { // index bindings don't throw DOMExceptions @@ -131,14 +131,14 @@ public class CHQueries { } private static ICPPClassType[] getSubClasses(IIndex index, ICPPClassType mcl) throws CoreException { - List result= new LinkedList(); - HashSet handled= new HashSet(); + List<ICPPBinding> result= new LinkedList<ICPPBinding>(); + HashSet<String> handled= new HashSet<String>(); getSubClasses(index, mcl, result, handled); result.remove(0); - return (ICPPClassType[]) result.toArray(new ICPPClassType[result.size()]); + return result.toArray(new ICPPClassType[result.size()]); } - private static void getSubClasses(IIndex index, ICPPBinding classOrTypedef, List result, HashSet handled) throws CoreException { + private static void getSubClasses(IIndex index, ICPPBinding classOrTypedef, List<ICPPBinding> result, HashSet<String> handled) throws CoreException { try { final String key = CPPVisitor.renderQualifiedName(classOrTypedef.getQualifiedName()); if (!handled.add(key)) { @@ -227,13 +227,13 @@ public class CHQueries { defs = IndexUI.findRepresentative(index, binding); } else { - ArrayList list= new ArrayList(); + ArrayList<ICElementHandle> list= new ArrayList<ICElementHandle>(); list.addAll(Arrays.asList(IndexUI.findRepresentative(index, binding))); for (int j = 0; j < virtualOverriders.length; j++) { IBinding overrider = virtualOverriders[j]; list.addAll(Arrays.asList(IndexUI.findRepresentative(index, overrider))); } - defs= (ICElement[]) list.toArray(new ICElement[list.size()]); + defs= list.toArray(new ICElement[list.size()]); } if (defs != null && defs.length > 0) { result.add(defs, name); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHReferenceInfo.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHReferenceInfo.java index f57518272d2..bd8af5e6a1d 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHReferenceInfo.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHReferenceInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 Wind River Systems, Inc. and others. + * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,16 +8,13 @@ * Contributors: * Markus Schorn - initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.internal.ui.callhierarchy; import java.util.Comparator; public class CHReferenceInfo { - public static final Comparator COMPARE_OFFSET = new Comparator() { - public int compare(Object o1, Object o2) { - CHReferenceInfo r1= (CHReferenceInfo) o1; - CHReferenceInfo r2= (CHReferenceInfo) o2; + public static final Comparator<CHReferenceInfo> COMPARE_OFFSET = new Comparator<CHReferenceInfo>() { + public int compare(CHReferenceInfo r1, CHReferenceInfo r2) { return r1.fOffset - r2.fOffset; } }; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CalledByResult.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CalledByResult.java index ef9d9d0552a..d649f3432a1 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CalledByResult.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CalledByResult.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 Wind River Systems, Inc. and others. + * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,6 @@ * Contributors: * Markus Schorn - initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.internal.ui.callhierarchy; import java.util.ArrayList; @@ -21,22 +20,22 @@ import org.eclipse.cdt.core.index.IIndexName; import org.eclipse.cdt.core.model.ICElement; public class CalledByResult { - private Map fElementToReferences= new HashMap(); + private Map<ICElement, List<IIndexName>> fElementToReferences= new HashMap<ICElement, List<IIndexName>>(); public ICElement[] getElements() { - Set elements = fElementToReferences.keySet(); - return (ICElement[]) elements.toArray(new ICElement[elements.size()]); + Set<ICElement> elements = fElementToReferences.keySet(); + return elements.toArray(new ICElement[elements.size()]); } public IIndexName[] getReferences(ICElement calledElement) { - List references= (List) fElementToReferences.get(calledElement); - return (IIndexName[]) references.toArray(new IIndexName[references.size()]); + List<IIndexName> references= fElementToReferences.get(calledElement); + return references.toArray(new IIndexName[references.size()]); } public void add(ICElement elem, IIndexName ref) { - List list= (List) fElementToReferences.get(elem); + List<IIndexName> list= fElementToReferences.get(elem); if (list == null) { - list= new ArrayList(); + list= new ArrayList<IIndexName>(); fElementToReferences.put(elem, list); } list.add(ref); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CallsToResult.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CallsToResult.java index e345f88b83c..c61ee028a7c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CallsToResult.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CallsToResult.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 Wind River Systems, Inc. and others. + * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,6 @@ * Contributors: * Markus Schorn - initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.internal.ui.callhierarchy; import java.util.ArrayList; @@ -21,23 +20,23 @@ import org.eclipse.cdt.core.index.IIndexName; import org.eclipse.cdt.core.model.ICElement; public class CallsToResult { - private Map fElementSetsToReferences= new HashMap(); + private Map<CElementSet, List<IIndexName>> fElementSetsToReferences= new HashMap<CElementSet, List<IIndexName>>(); public CElementSet[] getElementSets() { - Set elementSets = fElementSetsToReferences.keySet(); - return (CElementSet[]) elementSets.toArray(new CElementSet[elementSets.size()]); + Set<CElementSet> elementSets = fElementSetsToReferences.keySet(); + return elementSets.toArray(new CElementSet[elementSets.size()]); } public IIndexName[] getReferences(CElementSet elementSet) { - List references= (List) fElementSetsToReferences.get(elementSet); - return (IIndexName[]) references.toArray(new IIndexName[references.size()]); + List<IIndexName> references= fElementSetsToReferences.get(elementSet); + return references.toArray(new IIndexName[references.size()]); } public void add(ICElement[] elems, IIndexName ref) { CElementSet key= new CElementSet(elems); - List list= (List) fElementSetsToReferences.get(key); + List<IIndexName> list= fElementSetsToReferences.get(key); if (list == null) { - list= new ArrayList(); + list= new ArrayList<IIndexName>(); fElementSetsToReferences.put(key, list); } list.add(ref); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/ReferenceVisitor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/ReferenceVisitor.java index 87805ab1d14..3b1dcc323fc 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/ReferenceVisitor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/ReferenceVisitor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 Wind River Systems, Inc. and others. + * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -23,7 +23,7 @@ import org.eclipse.cdt.core.dom.ast.IASTName; * @since 4.0 */ class ReferenceVisitor extends ASTVisitor { - private ArrayList fReferences= new ArrayList(); + private ArrayList<IASTName> fReferences= new ArrayList<IASTName>(); private int fOffset; private int fEndOffset; private String fFileName; @@ -38,9 +38,10 @@ class ReferenceVisitor extends ASTVisitor { } public IASTName[] getReferences() { - return (IASTName[]) fReferences.toArray(new IASTName[fReferences.size()]); + return fReferences.toArray(new IASTName[fReferences.size()]); } + @Override public int visit(IASTName name) { if (name.isReference()) { IASTFileLocation loc= name.getFileLocation(); @@ -55,6 +56,7 @@ class ReferenceVisitor extends ASTVisitor { return super.visit(name); } + @Override public int visit(IASTDeclaration declaration) { IASTFileLocation loc= declaration.getFileLocation(); if (loc != null) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBContentProvider.java index caf64340428..4ecb120dbe2 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBContentProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBContentProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. + * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,6 @@ * Contributors: * Markus Schorn - initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.internal.ui.includebrowser; import java.util.ArrayList; @@ -46,6 +45,7 @@ public class IBContentProvider extends AsyncTreeContentProvider { super(disp); } + @Override public Object getParent(Object element) { if (element instanceof IBNode) { IBNode node = (IBNode) element; @@ -54,6 +54,7 @@ public class IBContentProvider extends AsyncTreeContentProvider { return super.getParent(element); } + @Override protected Object[] syncronouslyComputeChildren(Object parentElement) { if (parentElement instanceof ITranslationUnit) { ITranslationUnit tu = (ITranslationUnit) parentElement; @@ -69,6 +70,7 @@ public class IBContentProvider extends AsyncTreeContentProvider { return null; } + @Override protected Object[] asyncronouslyComputeChildren(Object parentElement, IProgressMonitor monitor) { if (parentElement instanceof IBNode) { IBNode node = (IBNode) parentElement; @@ -102,7 +104,7 @@ public class IBContentProvider extends AsyncTreeContentProvider { directiveFile= node.getRepresentedFile(); } if (includes.length > 0) { - ArrayList result= new ArrayList(includes.length); + ArrayList<IBNode> result= new ArrayList<IBNode>(includes.length); for (int i = 0; i < includes.length; i++) { IIndexInclude include = includes[i]; try { @@ -160,8 +162,8 @@ public class IBContentProvider extends AsyncTreeContentProvider { return index.findIncludedBy(files[0]); } if (files.length > 0) { - ArrayList list= new ArrayList(); - HashSet handled= new HashSet(); + ArrayList<IIndexInclude> list= new ArrayList<IIndexInclude>(); + HashSet<IIndexFileLocation> handled= new HashSet<IIndexFileLocation>(); for (int i = 0; i < files.length; i++) { final IIndexInclude[] includes = index.findIncludedBy(files[i]); for (int j = 0; j < includes.length; j++) { @@ -171,7 +173,7 @@ public class IBContentProvider extends AsyncTreeContentProvider { } } } - return (IIndexInclude[]) list.toArray(new IIndexInclude[list.size()]); + return list.toArray(new IIndexInclude[list.size()]); } } } @@ -189,8 +191,8 @@ public class IBContentProvider extends AsyncTreeContentProvider { return index.findIncludes(files[0]); } if (files.length > 0) { - ArrayList list= new ArrayList(); - HashSet handled= new HashSet(); + ArrayList<IIndexInclude> list= new ArrayList<IIndexInclude>(); + HashSet<IIndexFileLocation> handled= new HashSet<IIndexFileLocation>(); for (int i = 0; i < files.length; i++) { final IIndexInclude[] includes = index.findIncludes(files[i]); for (int j = 0; j < includes.length; j++) { @@ -200,7 +202,7 @@ public class IBContentProvider extends AsyncTreeContentProvider { } } } - return (IIndexInclude[]) list.toArray(new IIndexInclude[list.size()]); + return list.toArray(new IIndexInclude[list.size()]); } } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBConversions.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBConversions.java index 3d69bad8226..a9a5af7ba8c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBConversions.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBConversions.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. + * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,6 @@ * Contributors: * Markus Schorn - initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.internal.ui.includebrowser; import java.util.ArrayList; @@ -59,7 +58,7 @@ public class IBConversions { public static ISelection nodeSelectionToRepresentedTUSelection(ISelection sel) { if (sel instanceof IStructuredSelection) { IStructuredSelection ssel= (IStructuredSelection) sel; - ArrayList tus= new ArrayList(); + ArrayList<ITranslationUnit> tus= new ArrayList<ITranslationUnit>(); for (Iterator iter = ssel.iterator(); iter.hasNext();) { Object obj= iter.next(); if (obj instanceof IBNode) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBDragSourceListener.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBDragSourceListener.java index c06a9838078..ea98a518a9f 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBDragSourceListener.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBDragSourceListener.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 Wind River Systems, Inc. and others. + * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,6 @@ * Contributors: * Markus Schorn - initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.internal.ui.includebrowser; import java.util.ArrayList; @@ -18,7 +17,9 @@ import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.IPath; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.dnd.*; +import org.eclipse.swt.dnd.DragSourceEvent; +import org.eclipse.swt.dnd.DragSourceListener; +import org.eclipse.swt.dnd.FileTransfer; import org.eclipse.ui.part.ResourceTransfer; import org.eclipse.cdt.core.index.IIndexFileLocation; @@ -27,7 +28,7 @@ import org.eclipse.cdt.core.index.IndexLocationFactory; public class IBDragSourceListener implements DragSourceListener { private TreeViewer fTreeViewer; - private ArrayList fSelectedNodes= new ArrayList(); + private ArrayList<IBNode> fSelectedNodes= new ArrayList<IBNode>(); private IBDropTargetListener fDropTargetListener; public IBDragSourceListener(TreeViewer viewer) { @@ -44,7 +45,7 @@ public class IBDragSourceListener implements DragSourceListener { for (Iterator iter = sel.iterator(); iter.hasNext();) { Object element = iter.next(); if (element instanceof IBNode) { - fSelectedNodes.add(element); + fSelectedNodes.add((IBNode) element); } } event.doit= !fSelectedNodes.isEmpty(); @@ -65,9 +66,9 @@ public class IBDragSourceListener implements DragSourceListener { } private String[] getFiles() { - ArrayList files= new ArrayList(fSelectedNodes.size()); - for (Iterator iter = fSelectedNodes.iterator(); iter.hasNext();) { - IBNode node = (IBNode) iter.next(); + ArrayList<String> files= new ArrayList<String>(fSelectedNodes.size()); + for (Iterator<IBNode> iter = fSelectedNodes.iterator(); iter.hasNext();) { + IBNode node = iter.next(); IIndexFileLocation ifl= (IIndexFileLocation) node.getAdapter(IIndexFileLocation.class); if (ifl != null) { IPath location= IndexLocationFactory.getAbsolutePath(ifl); @@ -76,19 +77,19 @@ public class IBDragSourceListener implements DragSourceListener { } } } - return (String[]) files.toArray(new String[files.size()]); + return files.toArray(new String[files.size()]); } private IFile[] getResources() { - ArrayList files= new ArrayList(fSelectedNodes.size()); - for (Iterator iter = fSelectedNodes.iterator(); iter.hasNext();) { - IBNode node = (IBNode) iter.next(); + ArrayList<IFile> files= new ArrayList<IFile>(fSelectedNodes.size()); + for (Iterator<IBNode> iter = fSelectedNodes.iterator(); iter.hasNext();) { + IBNode node = iter.next(); IFile file= (IFile) node.getAdapter(IFile.class); if (file != null) { files.add(file); } } - return (IFile[]) files.toArray(new IFile[files.size()]); + return files.toArray(new IFile[files.size()]); } public void dragFinished(DragSourceEvent event) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBHistoryListAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBHistoryListAction.java index c799376ba7e..940ff8c65e0 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBHistoryListAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBHistoryListAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -86,6 +86,7 @@ public class IBHistoryListAction extends Action { /* * @see Dialog#createDialogArea(Composite) */ + @Override protected Control createDialogArea(Composite parent) { initializeDialogUnits(parent); @@ -137,13 +138,14 @@ public class IBHistoryListAction extends Action { } public ITranslationUnit[] getRemaining() { - List elems= fHistoryList.getElements(); - return (ITranslationUnit[]) elems.toArray(new ITranslationUnit[elems.size()]); + List<?> elems= fHistoryList.getElements(); + return elems.toArray(new ITranslationUnit[elems.size()]); } /* * @see org.eclipse.jface.window.Window#configureShell(Shell) */ + @Override protected void configureShell(Shell newShell) { super.configureShell(newShell); // PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, ...); @@ -152,6 +154,7 @@ public class IBHistoryListAction extends Action { /* (non-Javadoc) * @see org.eclipse.jface.window.Window#create() */ + @Override public void create() { setShellStyle(getShellStyle() | SWT.RESIZE); super.create(); @@ -169,6 +172,7 @@ public class IBHistoryListAction extends Action { /* * @see IAction#run() */ + @Override public void run() { ITranslationUnit[] historyEntries= fView.getHistoryEntries(); HistoryListDialog dialog= new HistoryListDialog(fView.getSite().getShell(), historyEntries); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBLabelProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBLabelProvider.java index 91416b78998..a7cdcb266ca 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBLabelProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBLabelProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. + * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,6 @@ * Contributors: * Markus Schorn - initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.internal.ui.includebrowser; import java.util.HashMap; @@ -35,7 +34,7 @@ public class IBLabelProvider extends LabelProvider implements IColorProvider { private CElementLabelProvider fCLabelProvider= new CElementLabelProvider(); private Color fColorInactive; private IBContentProvider fContentProvider; - private HashMap fCachedImages= new HashMap(); + private HashMap<String, Image> fCachedImages= new HashMap<String, Image>(); private boolean fShowFolders; public IBLabelProvider(Display display, IBContentProvider cp) { @@ -43,7 +42,8 @@ public class IBLabelProvider extends LabelProvider implements IColorProvider { fContentProvider= cp; } - public Image getImage(Object element) { + @Override + public Image getImage(Object element) { if (element instanceof IBNode) { IBNode node= (IBNode) element; ITranslationUnit tu= node.getRepresentedTranslationUnit(); @@ -53,7 +53,8 @@ public class IBLabelProvider extends LabelProvider implements IColorProvider { return super.getImage(element); } - public String getText(Object element) { + @Override + public String getText(Object element) { if (element instanceof IBNode) { IBNode node= (IBNode) element; IPath path= node.getRepresentedPath(); @@ -68,10 +69,11 @@ public class IBLabelProvider extends LabelProvider implements IColorProvider { return super.getText(element); } - public void dispose() { + @Override + public void dispose() { fCLabelProvider.dispose(); - for (Iterator iter = fCachedImages.values().iterator(); iter.hasNext();) { - Image image = (Image) iter.next(); + for (Iterator<Image> iter = fCachedImages.values().iterator(); iter.hasNext();) { + Image image = iter.next(); image.dispose(); } fCachedImages.clear(); @@ -107,7 +109,7 @@ public class IBLabelProvider extends LabelProvider implements IColorProvider { return image; } String key= image.toString()+String.valueOf(flags); - Image result= (Image) fCachedImages.get(key); + Image result= fCachedImages.get(key); if (result == null) { ImageDescriptor desc= new CElementImageDescriptor( new ImageImageDescriptor(image), flags, new Point(20,16)); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBNode.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBNode.java index 4402696459e..504f67b0c15 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBNode.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBNode.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. + * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,6 @@ * Contributors: * Markus Schorn - initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.internal.ui.includebrowser; import org.eclipse.core.resources.IFile; @@ -65,11 +64,13 @@ public class IBNode implements IAdaptable { return hashCode; } - public int hashCode() { + @Override + public int hashCode() { return fHashCode; } - public boolean equals(Object o) { + @Override + public boolean equals(Object o) { if (!(o instanceof IBNode)) { return false; } @@ -156,7 +157,8 @@ public class IBNode implements IAdaptable { return fRepresentedFile.getName(); } - public Object getAdapter(Class adapter) { + @SuppressWarnings("unchecked") + public Object getAdapter(Class adapter) { if (fRepresentedFile != null) { if (adapter.isAssignableFrom(ITranslationUnit.class)) { return fRepresentedFile.getTranslationUnit(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THGraph.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THGraph.java index d9398e023ba..54f04031050 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THGraph.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THGraph.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 Wind River Systems, Inc. and others. + * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,6 @@ * Contributors: * Markus Schorn - initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.internal.ui.typehierarchy; import java.util.ArrayList; @@ -43,9 +42,9 @@ import org.eclipse.cdt.internal.ui.viewsupport.IndexUI; class THGraph { private static final ICElement[] NO_MEMBERS = new ICElement[0]; private THGraphNode fInputNode= null; - private HashSet fRootNodes= new HashSet(); - private HashSet fLeaveNodes= new HashSet(); - private HashMap fNodes= new HashMap(); + private HashSet<THGraphNode> fRootNodes= new HashSet<THGraphNode>(); + private HashSet<THGraphNode> fLeaveNodes= new HashSet<THGraphNode>(); + private HashMap<ICElement, THGraphNode> fNodes= new HashMap<ICElement, THGraphNode>(); private boolean fFileIsIndexed; public THGraph() { @@ -56,11 +55,11 @@ class THGraph { } public THGraphNode getNode(ICElement elem) { - return (THGraphNode) fNodes.get(elem); + return fNodes.get(elem); } private THGraphNode addNode(ICElement input) { - THGraphNode node= (THGraphNode) fNodes.get(input); + THGraphNode node= fNodes.get(input); if (node == null) { node= new THGraphNode(input); @@ -91,12 +90,12 @@ class THGraph { return false; } - HashSet checked= new HashSet(); - ArrayList stack= new ArrayList(); + HashSet<THGraphNode> checked= new HashSet<THGraphNode>(); + ArrayList<THGraphNode> stack= new ArrayList<THGraphNode>(); stack.add(to); while (!stack.isEmpty()) { - THGraphNode node= (THGraphNode) stack.remove(stack.size()-1); + THGraphNode node= stack.remove(stack.size()-1); List out= node.getOutgoing(); for (Iterator iterator = out.iterator(); iterator.hasNext();) { THGraphEdge edge= (THGraphEdge) iterator.next(); @@ -120,11 +119,11 @@ class THGraph { return false; } - public Collection getRootNodes() { + public Collection<THGraphNode> getRootNodes() { return fRootNodes; } - public Collection getLeaveNodes() { + public Collection<THGraphNode> getLeaveNodes() { return fLeaveNodes; } @@ -146,15 +145,15 @@ class THGraph { if (fInputNode == null) { return; } - HashSet handled= new HashSet(); - ArrayList stack= new ArrayList(); + HashSet<ICElement> handled= new HashSet<ICElement>(); + ArrayList<ICElement> stack= new ArrayList<ICElement>(); stack.add(fInputNode.getElement()); handled.add(fInputNode.getElement()); while (!stack.isEmpty()) { if (monitor.isCanceled()) { return; } - ICElement elem= (ICElement) stack.remove(stack.size()-1); + ICElement elem= stack.remove(stack.size()-1); THGraphNode graphNode= addNode(elem); try { IIndexBinding binding = IndexUI.elementToBinding(index, elem); @@ -213,8 +212,8 @@ class THGraph { if (fInputNode == null) { return; } - HashSet handled= new HashSet(); - ArrayList stack= new ArrayList(); + HashSet<ICElement> handled= new HashSet<ICElement>(); + ArrayList<ICElement> stack= new ArrayList<ICElement>(); ICElement element = fInputNode.getElement(); stack.add(element); handled.add(element); @@ -222,7 +221,7 @@ class THGraph { if (monitor.isCanceled()) { return; } - ICElement elem= (ICElement) stack.remove(stack.size()-1); + ICElement elem= stack.remove(stack.size()-1); THGraphNode graphNode= addNode(elem); try { IBinding binding = IndexUI.elementToBinding(index, elem); @@ -259,7 +258,7 @@ class THGraph { private void addMembers(IIndex index, THGraphNode graphNode, IBinding binding) throws CoreException { if (graphNode.getMembers(false) == null) { - ArrayList memberList= new ArrayList(); + ArrayList<ICElement> memberList= new ArrayList<ICElement>(); try { if (binding instanceof ICPPClassType) { ICPPClassType ct= (ICPPClassType) binding; @@ -285,12 +284,12 @@ class THGraph { graphNode.setMembers(NO_MEMBERS); } else { - graphNode.setMembers((ICElement[]) memberList.toArray(new ICElement[memberList.size()])); + graphNode.setMembers(memberList.toArray(new ICElement[memberList.size()])); } } } - private void addMemberElements(IIndex index, IBinding[] members, ArrayList memberList) + private void addMemberElements(IIndex index, IBinding[] members, List<ICElement> memberList) throws CoreException { for (int i = 0; i < members.length; i++) { IBinding binding = members[i]; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THGraphNode.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THGraphNode.java index 21d2dab9823..825e8cfc458 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THGraphNode.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THGraphNode.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 Wind River Systems, Inc. and others. + * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,8 +21,8 @@ import java.util.List; import org.eclipse.cdt.core.model.ICElement; class THGraphNode { - private List fOutgoing= Collections.EMPTY_LIST; - private List fIncoming= Collections.EMPTY_LIST; + private List<THGraphEdge> fOutgoing= Collections.emptyList(); + private List<THGraphEdge> fIncoming= Collections.emptyList(); private ICElement fElement; private ICElement[] fMembers= null; @@ -42,12 +42,12 @@ class THGraphNode { return fElement; } - private List addElement(List list, Object elem) { + private List<THGraphEdge> addElement(List<THGraphEdge> list, THGraphEdge elem) { switch (list.size()) { case 0: return Collections.singletonList(elem); case 1: - list= new ArrayList(list); + list= new ArrayList<THGraphEdge>(list); list.add(elem); return list; } @@ -55,11 +55,11 @@ class THGraphNode { return list; } - List getOutgoing() { + List<THGraphEdge> getOutgoing() { return fOutgoing; } - List getIncoming() { + List<THGraphEdge> getIncoming() { return fIncoming; } @@ -71,19 +71,19 @@ class THGraphNode { if (!addInherited) { return fMembers; } - ArrayList list= new ArrayList(); - collectMembers(new HashSet(), list); - return (ICElement[]) list.toArray(new ICElement[list.size()]); + ArrayList<ICElement> list= new ArrayList<ICElement>(); + collectMembers(new HashSet<THGraphNode>(), list); + return list.toArray(new ICElement[list.size()]); } - private void collectMembers(HashSet visited, List list) { + private void collectMembers(HashSet<THGraphNode> visited, List<ICElement> list) { if (visited.add(this)) { if (fMembers != null) { list.addAll(Arrays.asList(fMembers)); } - List bases= getOutgoing(); - for (Iterator iterator = bases.iterator(); iterator.hasNext();) { - THGraphEdge edge = (THGraphEdge) iterator.next(); + List<THGraphEdge> bases= getOutgoing(); + for (Iterator<THGraphEdge> iterator = bases.iterator(); iterator.hasNext();) { + THGraphEdge edge = iterator.next(); edge.getEndNode().collectMembers(visited, list); } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THHierarchyModel.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THHierarchyModel.java index d80bb0843f4..308c367cfdc 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THHierarchyModel.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THHierarchyModel.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 Wind River Systems, Inc. and others. + * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,6 @@ * Contributors: * Markus Schorn - initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.internal.ui.typehierarchy; import java.util.ArrayList; @@ -42,6 +41,7 @@ class THHierarchyModel { super(Messages.THHierarchyModel_Job_title); } + @Override protected IStatus run(IProgressMonitor monitor) { return onComputeGraph(this, monitor); } @@ -181,12 +181,12 @@ class THHierarchyModel { return; } boolean fwd= fHierarchyKind == SUPER_TYPE_HIERARCHY; - ArrayList stack= new ArrayList(); - ArrayList roots= new ArrayList(); - ArrayList leafs= new ArrayList(); + ArrayList<THNode> stack= new ArrayList<THNode>(); + ArrayList<THNode> roots= new ArrayList<THNode>(); + ArrayList<THNode> leafs= new ArrayList<THNode>(); THGraphNode inputNode= fGraph.getInputNode(); - Collection groots; + Collection<THGraphNode> groots; if (fHierarchyKind == TYPE_HIERARCHY) { groots= fGraph.getLeaveNodes(); @@ -197,27 +197,27 @@ class THHierarchyModel { groots= Collections.singleton(node); } else { - groots= Collections.EMPTY_SET; + groots= Collections.emptySet(); } } - for (Iterator iterator = groots.iterator(); iterator.hasNext();) { - THGraphNode gnode = (THGraphNode) iterator.next(); + for (Iterator<THGraphNode> iterator = groots.iterator(); iterator.hasNext();) { + THGraphNode gnode = iterator.next(); THNode node = createNode(null, gnode, inputNode); roots.add(node); stack.add(node); } while(!stack.isEmpty()) { - THNode node= (THNode) stack.remove(stack.size()-1); + THNode node= stack.remove(stack.size()-1); THGraphNode gnode= fGraph.getNode(node.getElement()); - List edges= fwd ? gnode.getOutgoing() : gnode.getIncoming(); + List<THGraphEdge> edges= fwd ? gnode.getOutgoing() : gnode.getIncoming(); if (edges.isEmpty()) { leafs.add(node); } else { - for (Iterator iterator = edges.iterator(); iterator.hasNext();) { - THGraphEdge edge = (THGraphEdge) iterator.next(); + for (Iterator<THGraphEdge> iterator = edges.iterator(); iterator.hasNext();) { + THGraphEdge edge = iterator.next(); THGraphNode gchildNode= fwd ? edge.getEndNode() : edge.getStartNode(); THNode childNode= createNode(node, gchildNode, inputNode); node.addChild(childNode); @@ -225,7 +225,7 @@ class THHierarchyModel { } } } - fRootNodes= (THNode[]) roots.toArray(new THNode[roots.size()]); + fRootNodes= roots.toArray(new THNode[roots.size()]); removeFilteredLeafs(fRootNodes); fSelectedTypeNode= findSelection(fRootNodes); if (fSelectedTypeNode != null) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THHistoryListAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THHistoryListAction.java index 13c803a8d08..969993652b8 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THHistoryListAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THHistoryListAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -86,6 +86,7 @@ public class THHistoryListAction extends Action { /* * @see Dialog#createDialogArea(Composite) */ + @Override protected Control createDialogArea(Composite parent) { initializeDialogUnits(parent); @@ -137,13 +138,14 @@ public class THHistoryListAction extends Action { } public ICElement[] getRemaining() { - List elems= fHistoryList.getElements(); - return (ICElement[]) elems.toArray(new ICElement[elems.size()]); + List<?> elems= fHistoryList.getElements(); + return elems.toArray(new ICElement[elems.size()]); } /* * @see org.eclipse.jface.window.Window#configureShell(Shell) */ + @Override protected void configureShell(Shell newShell) { super.configureShell(newShell); // PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, ...); @@ -152,6 +154,7 @@ public class THHistoryListAction extends Action { /* (non-Javadoc) * @see org.eclipse.jface.window.Window#create() */ + @Override public void create() { setShellStyle(getShellStyle() | SWT.RESIZE); super.create(); @@ -169,6 +172,7 @@ public class THHistoryListAction extends Action { /* * @see IAction#run() */ + @Override public void run() { ICElement[] historyEntries= fView.getHistoryEntries(); HistoryListDialog dialog= new HistoryListDialog(fView.getSite().getShell(), historyEntries); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THLabelProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THLabelProvider.java index ab4adbe0abe..845ee7ae879 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THLabelProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THLabelProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 Wind River Systems, Inc. and others. + * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,6 @@ * Contributors: * Markus Schorn - initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.internal.ui.typehierarchy; import java.util.HashMap; @@ -37,7 +36,7 @@ public class THLabelProvider extends LabelProvider implements IColorProvider { private CUILabelProvider fCLabelProvider= new CUILabelProvider(LABEL_OPTIONS_SIMPLE, 0); private THHierarchyModel fModel; - private HashMap fCachedImages= new HashMap(); + private HashMap<String, Image> fCachedImages= new HashMap<String, Image>(); private Color fColorInactive; private boolean fMarkImplementers= true; private boolean fHideNonImplementers= false; @@ -47,7 +46,8 @@ public class THLabelProvider extends LabelProvider implements IColorProvider { fModel= model; } - public Image getImage(Object element) { + @Override + public Image getImage(Object element) { if (element instanceof THNode) { THNode node= (THNode) element; ICElement decl= node.getElement(); @@ -69,7 +69,8 @@ public class THLabelProvider extends LabelProvider implements IColorProvider { return super.getImage(element); } - public String getText(Object element) { + @Override + public String getText(Object element) { if (element instanceof THNode) { THNode node= (THNode) element; ICElement decl= node.getElement(); @@ -81,10 +82,11 @@ public class THLabelProvider extends LabelProvider implements IColorProvider { return super.getText(element); } + @Override public void dispose() { fCLabelProvider.dispose(); - for (Iterator iter = fCachedImages.values().iterator(); iter.hasNext();) { - Image image = (Image) iter.next(); + for (Iterator<Image> iter = fCachedImages.values().iterator(); iter.hasNext();) { + Image image = iter.next(); image.dispose(); } fCachedImages.clear(); @@ -106,7 +108,7 @@ public class THLabelProvider extends LabelProvider implements IColorProvider { } String key= image.toString()+String.valueOf(flags); - Image result= (Image) fCachedImages.get(key); + Image result= fCachedImages.get(key); if (result == null) { ImageDescriptor desc= new CElementImageDescriptor( new ImageImageDescriptor(image), flags, new Point(20,16)); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THNode.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THNode.java index 475b76a2117..1471f00120e 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THNode.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THNode.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 Wind River Systems, Inc. and others. + * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,6 @@ * Contributors: * Markus Schorn - initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.internal.ui.typehierarchy; import java.util.ArrayList; @@ -25,7 +24,7 @@ import org.eclipse.cdt.internal.ui.util.CoreUtility; public class THNode implements IAdaptable { private THNode fParent; private ICElement fElement; - private List fChildren= Collections.EMPTY_LIST; + private List<THNode> fChildren= Collections.emptyList(); private int fHashCode; private boolean fIsFiltered; @@ -51,11 +50,13 @@ public class THNode implements IAdaptable { return hashCode; } - public int hashCode() { + @Override + public int hashCode() { return fHashCode; } - public boolean equals(Object o) { + @Override + public boolean equals(Object o) { if (!(o instanceof THNode)) { return false; } @@ -80,6 +81,7 @@ public class THNode implements IAdaptable { return fElement; } + @SuppressWarnings("unchecked") public Object getAdapter(Class adapter) { if (adapter.isAssignableFrom(ICElement.class)) { return getElement(); @@ -97,7 +99,7 @@ public class THNode implements IAdaptable { public void addChild(THNode childNode) { if (fChildren.isEmpty()) { - fChildren= new ArrayList(); + fChildren= new ArrayList<THNode>(); } fChildren.add(childNode); } @@ -107,7 +109,7 @@ public class THNode implements IAdaptable { } public THNode[] getChildren() { - return (THNode[]) fChildren.toArray(new THNode[fChildren.size()]); + return fChildren.toArray(new THNode[fChildren.size()]); } public void setIsImplementor(boolean val) { @@ -119,8 +121,8 @@ public class THNode implements IAdaptable { } public void removeFilteredLeafs() { - for (Iterator iterator = fChildren.iterator(); iterator.hasNext();) { - THNode child = (THNode) iterator.next(); + for (Iterator<THNode> iterator = fChildren.iterator(); iterator.hasNext();) { + THNode child = iterator.next(); child.removeFilteredLeafs(); if (child.isFiltered() && !child.hasChildren()) { iterator.remove(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/indexwizards/TeamProjectIndexExportWizardPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/indexwizards/TeamProjectIndexExportWizardPage.java index 59d2918a602..ef9e39b41da 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/indexwizards/TeamProjectIndexExportWizardPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/indexwizards/TeamProjectIndexExportWizardPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 Wind River Systems, Inc. and others. + * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,6 @@ * Contributors: * Markus Schorn - initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.internal.ui.wizards.indexwizards; import java.lang.reflect.InvocationTargetException; @@ -149,7 +148,8 @@ public class TeamProjectIndexExportWizardPage extends WizardDataTransferPage im IDialogConstants.SELECT_ALL_ID, Messages.TeamProjectIndexExportWizardPage_selectAll, false); SelectionAdapter listener = new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { + @Override + public void widgetSelected(SelectionEvent e) { fProjectViewer.setAllChecked(true); updateWidgetEnablements(); } @@ -160,7 +160,8 @@ public class TeamProjectIndexExportWizardPage extends WizardDataTransferPage im IDialogConstants.DESELECT_ALL_ID, Messages.TeamProjectIndexExportWizardPage_deselectAll, false); listener = new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { + @Override + public void widgetSelected(SelectionEvent e) { fProjectViewer.setAllChecked(false); updateWidgetEnablements(); } @@ -194,7 +195,7 @@ public class TeamProjectIndexExportWizardPage extends WizardDataTransferPage im } private void initProjects() { - ArrayList input = new ArrayList(); + ArrayList<ICProject> input = new ArrayList<ICProject>(); ICProject[] projects; try { projects = CoreModel.getDefault().getCModel().getCProjects(); @@ -210,7 +211,7 @@ public class TeamProjectIndexExportWizardPage extends WizardDataTransferPage im } private void setupBasedOnInitialSelections() { - HashSet names= new HashSet(); + HashSet<String> names= new HashSet<String>(); Iterator it = fInitialSelection.iterator(); while (it.hasNext()) { IProject project = (IProject) it.next(); @@ -266,7 +267,8 @@ public class TeamProjectIndexExportWizardPage extends WizardDataTransferPage im Button button= createButton(destinationSelectionGroup, IDialogConstants.CLIENT_ID, Messages.TeamProjectIndexExportWizardPage_variableButton, false); SelectionAdapter listener = new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { + @Override + public void widgetSelected(SelectionEvent e) { onInsertVariable(); } }; @@ -353,7 +355,8 @@ public class TeamProjectIndexExportWizardPage extends WizardDataTransferPage im * Answer a boolean indicating whether the receivers destination specification * widgets currently all contain valid values. */ - protected boolean validateDestinationGroup() { + @Override + protected boolean validateDestinationGroup() { String destinationValue = getDestinationValue(); if (destinationValue.length() == 0) { setMessage(Messages.TeamProjectIndexExportWizardPage_destinationMessage); @@ -364,7 +367,8 @@ public class TeamProjectIndexExportWizardPage extends WizardDataTransferPage im return true; } - protected boolean validateSourceGroup() { + @Override + protected boolean validateSourceGroup() { // there must be some resources selected for Export boolean isValid = true; Object[] projectsToExport = getCheckedElements(); @@ -377,7 +381,8 @@ public class TeamProjectIndexExportWizardPage extends WizardDataTransferPage im return super.validateSourceGroup() && isValid; } - protected void updateWidgetEnablements() { + @Override + protected void updateWidgetEnablements() { boolean pageComplete = determinePageCompletion(); setPageComplete(pageComplete); if (pageComplete) { @@ -391,10 +396,12 @@ public class TeamProjectIndexExportWizardPage extends WizardDataTransferPage im updateWidgetEnablements(); } - protected String getErrorDialogTitle() { + @Override + protected String getErrorDialogTitle() { return Messages.TeamProjectIndexExportWizardPage_errorDlgTitle; } + @Override protected boolean allowNewContainerName() { return false; } |