mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 08:55:25 +02:00
Fix warnings.
This commit is contained in:
parent
d5ad391d97
commit
b4636c8a3c
11 changed files with 68 additions and 77 deletions
|
@ -19,6 +19,18 @@ import java.util.Set;
|
|||
import java.util.Stack;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.jface.viewers.ArrayContentProvider;
|
||||
import org.eclipse.jface.viewers.CheckStateChangedEvent;
|
||||
import org.eclipse.jface.viewers.CheckboxTableViewer;
|
||||
import org.eclipse.jface.viewers.ICheckStateListener;
|
||||
import org.eclipse.jface.viewers.ILabelProvider;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.LabelProvider;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
|
@ -32,24 +44,11 @@ import org.eclipse.swt.widgets.Control;
|
|||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.dialogs.SelectionDialog;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
||||
import org.eclipse.cdt.internal.ui.util.SWTUtil;
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.jface.viewers.ArrayContentProvider;
|
||||
import org.eclipse.jface.viewers.CheckStateChangedEvent;
|
||||
import org.eclipse.jface.viewers.CheckboxTableViewer;
|
||||
import org.eclipse.jface.viewers.ICheckStateListener;
|
||||
import org.eclipse.jface.viewers.ILabelProvider;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.LabelProvider;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.dialogs.SelectionDialog;
|
||||
|
||||
public class CustomFiltersDialog extends SelectionDialog {
|
||||
|
||||
|
@ -66,7 +65,7 @@ public class CustomFiltersDialog extends SelectionDialog {
|
|||
Button fEnableUserDefinedPatterns;
|
||||
Text fUserDefinedPatterns;
|
||||
|
||||
Stack fFilterDescriptorChangeHistory;
|
||||
Stack<Object> fFilterDescriptorChangeHistory;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -92,7 +91,7 @@ public class CustomFiltersDialog extends SelectionDialog {
|
|||
fEnabledFilterIds= enabledFilterIds;
|
||||
|
||||
fBuiltInFilters= FilterDescriptor.getFilterDescriptors(fViewId);
|
||||
fFilterDescriptorChangeHistory= new Stack();
|
||||
fFilterDescriptorChangeHistory= new Stack<Object>();
|
||||
setShellStyle(getShellStyle() | SWT.RESIZE);
|
||||
}
|
||||
|
||||
|
@ -181,7 +180,7 @@ public class CustomFiltersDialog extends SelectionDialog {
|
|||
fCheckBoxList.setInput(fBuiltInFilters);
|
||||
setInitialSelections(getEnabledFilterDescriptors());
|
||||
|
||||
List initialSelection= getInitialElementSelections();
|
||||
List<?> initialSelection= getInitialElementSelections();
|
||||
if (initialSelection != null && !initialSelection.isEmpty())
|
||||
checkInitialSelections();
|
||||
|
||||
|
@ -262,7 +261,7 @@ public class CustomFiltersDialog extends SelectionDialog {
|
|||
}
|
||||
|
||||
private void checkInitialSelections() {
|
||||
Iterator itemsToCheck= getInitialElementSelections().iterator();
|
||||
Iterator<?> itemsToCheck= getInitialElementSelections().iterator();
|
||||
while (itemsToCheck.hasNext())
|
||||
fCheckBoxList.setChecked(itemsToCheck.next(),true);
|
||||
}
|
||||
|
@ -270,7 +269,7 @@ public class CustomFiltersDialog extends SelectionDialog {
|
|||
@Override
|
||||
protected void okPressed() {
|
||||
if (fBuiltInFilters != null) {
|
||||
ArrayList result= new ArrayList();
|
||||
ArrayList<FilterDescriptor> result= new ArrayList<FilterDescriptor>();
|
||||
for (int i= 0; i < fBuiltInFilters.length; ++i) {
|
||||
if (fCheckBoxList.getChecked(fBuiltInFilters[i]))
|
||||
result.add(fBuiltInFilters[i]);
|
||||
|
@ -291,14 +290,14 @@ public class CustomFiltersDialog extends SelectionDialog {
|
|||
public String getText(Object element) {
|
||||
if (element instanceof FilterDescriptor)
|
||||
return ((FilterDescriptor)element).getName();
|
||||
else
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// ---------- result handling ----------
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected void setResult(List newResult) {
|
||||
super.setResult(newResult);
|
||||
|
@ -324,10 +323,10 @@ public class CustomFiltersDialog extends SelectionDialog {
|
|||
*/
|
||||
public String[] getEnabledFilterIds() {
|
||||
Object[] result= getResult();
|
||||
Set enabledIds= new HashSet(result.length);
|
||||
Set<String> enabledIds= new HashSet<String>(result.length);
|
||||
for (int i= 0; i < result.length; i++)
|
||||
enabledIds.add(((FilterDescriptor)result[i]).getId());
|
||||
return (String[]) enabledIds.toArray(new String[enabledIds.size()]);
|
||||
return enabledIds.toArray(new String[enabledIds.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -341,20 +340,20 @@ public class CustomFiltersDialog extends SelectionDialog {
|
|||
* @return a stack with the filter descriptor check history
|
||||
* @since 3.0
|
||||
*/
|
||||
public Stack getFilterDescriptorChangeHistory() {
|
||||
public Stack<Object> getFilterDescriptorChangeHistory() {
|
||||
return fFilterDescriptorChangeHistory;
|
||||
}
|
||||
|
||||
private FilterDescriptor[] getEnabledFilterDescriptors() {
|
||||
FilterDescriptor[] filterDescs= fBuiltInFilters;
|
||||
List result= new ArrayList(filterDescs.length);
|
||||
List enabledFilterIds= Arrays.asList(fEnabledFilterIds);
|
||||
List<FilterDescriptor> result= new ArrayList<FilterDescriptor>(filterDescs.length);
|
||||
List<String> enabledFilterIds= Arrays.asList(fEnabledFilterIds);
|
||||
for (int i= 0; i < filterDescs.length; i++) {
|
||||
String id= filterDescs[i].getId();
|
||||
if (enabledFilterIds.contains(id))
|
||||
result.add(filterDescs[i]);
|
||||
}
|
||||
return (FilterDescriptor[])result.toArray(new FilterDescriptor[result.size()]);
|
||||
return result.toArray(new FilterDescriptor[result.size()]);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -17,15 +17,16 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.core.runtime.IExtensionRegistry;
|
||||
import org.eclipse.core.runtime.ISafeRunnable;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.jface.util.SafeRunnable;
|
||||
import org.eclipse.jface.viewers.ViewerFilter;
|
||||
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a custom filter which is provided by the
|
||||
|
@ -33,7 +34,7 @@ import org.eclipse.jface.viewers.ViewerFilter;
|
|||
*
|
||||
* since 2.0
|
||||
*/
|
||||
public class FilterDescriptor implements Comparable {
|
||||
public class FilterDescriptor implements Comparable<FilterDescriptor> {
|
||||
|
||||
private static String PATTERN_FILTER_ID_PREFIX= "_patternFilterId_"; //$NON-NLS-1$
|
||||
|
||||
|
@ -82,13 +83,13 @@ public class FilterDescriptor implements Comparable {
|
|||
*/
|
||||
public static FilterDescriptor[] getFilterDescriptors(String targetId) {
|
||||
FilterDescriptor[] filterDescs= FilterDescriptor.getFilterDescriptors();
|
||||
List result= new ArrayList(filterDescs.length);
|
||||
List<FilterDescriptor> result= new ArrayList<FilterDescriptor>(filterDescs.length);
|
||||
for (int i= 0; i < filterDescs.length; i++) {
|
||||
String tid= filterDescs[i].getTargetId();
|
||||
if (tid == null || tid.equals(targetId))
|
||||
result.add(filterDescs[i]);
|
||||
}
|
||||
return (FilterDescriptor[])result.toArray(new FilterDescriptor[result.size()]);
|
||||
return result.toArray(new FilterDescriptor[result.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -140,10 +141,9 @@ public class FilterDescriptor implements Comparable {
|
|||
String targetId= getTargetId();
|
||||
if (targetId == null)
|
||||
return PATTERN_FILTER_ID_PREFIX + getPattern();
|
||||
else
|
||||
return targetId + PATTERN_FILTER_ID_PREFIX + getPattern();
|
||||
} else
|
||||
return fElement.getAttribute(ID_ATTRIBUTE);
|
||||
return targetId + PATTERN_FILTER_ID_PREFIX + getPattern();
|
||||
}
|
||||
return fElement.getAttribute(ID_ATTRIBUTE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -229,11 +229,8 @@ public class FilterDescriptor implements Comparable {
|
|||
/*
|
||||
* Implements a method from IComparable
|
||||
*/
|
||||
public int compareTo(Object o) {
|
||||
if (o instanceof FilterDescriptor)
|
||||
return Collator.getInstance().compare(getName(), ((FilterDescriptor)o).getName());
|
||||
else
|
||||
return Integer.MIN_VALUE;
|
||||
public int compareTo(FilterDescriptor o) {
|
||||
return Collator.getInstance().compare(getName(), (o).getName());
|
||||
}
|
||||
|
||||
//---- initialization ---------------------------------------------------
|
||||
|
@ -242,8 +239,8 @@ public class FilterDescriptor implements Comparable {
|
|||
* Creates the filter descriptors.
|
||||
*/
|
||||
private static FilterDescriptor[] createFilterDescriptors(IConfigurationElement[] elements) {
|
||||
List result= new ArrayList(5);
|
||||
Set descIds= new HashSet(5);
|
||||
List<FilterDescriptor> result= new ArrayList<FilterDescriptor>(5);
|
||||
Set<String> descIds= new HashSet<String>(5);
|
||||
for (int i= 0; i < elements.length; i++) {
|
||||
final IConfigurationElement element= elements[i];
|
||||
if (FILTER_TAG.equals(element.getName())) {
|
||||
|
@ -262,6 +259,6 @@ public class FilterDescriptor implements Comparable {
|
|||
}
|
||||
}
|
||||
Collections.sort(result);
|
||||
return (FilterDescriptor[])result.toArray(new FilterDescriptor[result.size()]);
|
||||
return result.toArray(new FilterDescriptor[result.size()]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,8 +109,7 @@ public class CFunctionSummary implements IFunctionSummary {
|
|||
public String toString() {
|
||||
if (std)
|
||||
return "#include <" + iname + ">"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
else
|
||||
return "#include \"" + iname + "\""; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
return "#include \"" + iname + "\""; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
}
|
||||
@Override
|
||||
|
|
|
@ -118,8 +118,8 @@ public class CHelpBook implements ICHelpBook {
|
|||
if (++b > bs[i]) { // no overflow
|
||||
bs[i] = b;
|
||||
break;
|
||||
} else
|
||||
i--;
|
||||
}
|
||||
i--;
|
||||
}
|
||||
SortedMap<String, CHelpEntry> sm = (i>-1) ?
|
||||
entries.subMap(pr1, new String(bs)) :
|
||||
|
@ -133,8 +133,8 @@ public class CHelpBook implements ICHelpBook {
|
|||
for (IFunctionSummary fs : he.getFunctionSummary())
|
||||
out.add(fs);
|
||||
return out;
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ICHelpResourceDescriptor getHelpResources(
|
||||
|
|
|
@ -87,8 +87,7 @@ public class CHelpProvider implements ICHelpProvider {
|
|||
}
|
||||
if (lst.size() > 0)
|
||||
return lst.toArray(new ICHelpResourceDescriptor[lst.size()]);
|
||||
else
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
|
||||
public IFunctionSummary[] getMatchingFunctions(
|
||||
|
@ -104,8 +103,7 @@ public class CHelpProvider implements ICHelpProvider {
|
|||
}
|
||||
if (lst.size() > 0)
|
||||
return lst.toArray(new IFunctionSummary[lst.size()]);
|
||||
else
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
|
@ -171,22 +169,20 @@ public class CHelpProvider implements ICHelpProvider {
|
|||
InputSource src = new InputSource(reader);
|
||||
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||
doc = builder.parse(src);
|
||||
Element e = doc.getDocumentElement();
|
||||
if(NODE_HEAD.equals(e.getNodeName())){
|
||||
NodeList list = e.getChildNodes();
|
||||
for(int j = 0; j < list.getLength(); j++){
|
||||
Node node = list.item(j);
|
||||
if(node.getNodeType() != Node.ELEMENT_NODE) continue;
|
||||
if(NODE_BOOK.equals(node.getNodeName())){
|
||||
chbl.add(new CHelpBook((Element)node));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (ParserConfigurationException e) {
|
||||
} catch (SAXException e) {
|
||||
} catch (IOException e) {
|
||||
}
|
||||
|
||||
Element e = doc.getDocumentElement();
|
||||
if(NODE_HEAD.equals(e.getNodeName())){
|
||||
NodeList list = e.getChildNodes();
|
||||
for(int j = 0; j < list.getLength(); j++){
|
||||
Node node = list.item(j);
|
||||
if(node.getNodeType() != Node.ELEMENT_NODE) continue;
|
||||
if(NODE_BOOK.equals(node.getNodeName())){
|
||||
chbl.add(new CHelpBook((Element)node));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public class IBConversions {
|
|||
public static IBNode selectionToNode(ISelection sel) {
|
||||
if (sel instanceof IStructuredSelection) {
|
||||
IStructuredSelection ssel= (IStructuredSelection) sel;
|
||||
for (Iterator iter = ssel.iterator(); iter.hasNext();) {
|
||||
for (Iterator<?> iter = ssel.iterator(); iter.hasNext();) {
|
||||
Object o= iter.next();
|
||||
if (o instanceof IBNode) {
|
||||
IBNode node = (IBNode) o;
|
||||
|
@ -45,7 +45,7 @@ public class IBConversions {
|
|||
public static ITranslationUnit selectionToTU(ISelection sel) {
|
||||
if (sel instanceof IStructuredSelection) {
|
||||
IStructuredSelection ssel= (IStructuredSelection) sel;
|
||||
for (Iterator iter = ssel.iterator(); iter.hasNext();) {
|
||||
for (Iterator<?> iter = ssel.iterator(); iter.hasNext();) {
|
||||
ITranslationUnit tu= objectToTU(iter.next());
|
||||
if (tu != null) {
|
||||
return tu;
|
||||
|
@ -59,7 +59,7 @@ public class IBConversions {
|
|||
if (sel instanceof IStructuredSelection) {
|
||||
IStructuredSelection ssel= (IStructuredSelection) sel;
|
||||
ArrayList<ITranslationUnit> tus= new ArrayList<ITranslationUnit>();
|
||||
for (Iterator iter = ssel.iterator(); iter.hasNext();) {
|
||||
for (Iterator<?> iter = ssel.iterator(); iter.hasNext();) {
|
||||
Object obj= iter.next();
|
||||
if (obj instanceof IBNode) {
|
||||
ITranslationUnit tu= ((IBNode) obj).getRepresentedTranslationUnit();
|
||||
|
|
|
@ -42,7 +42,7 @@ public class IBDragSourceListener implements DragSourceListener {
|
|||
fSelectedNodes.clear();
|
||||
if (event.doit) {
|
||||
IStructuredSelection sel= (IStructuredSelection) fTreeViewer.getSelection();
|
||||
for (Iterator iter = sel.iterator(); iter.hasNext();) {
|
||||
for (Iterator<?> iter = sel.iterator(); iter.hasNext();) {
|
||||
Object element = iter.next();
|
||||
if (element instanceof IBNode) {
|
||||
fSelectedNodes.add((IBNode) element);
|
||||
|
|
|
@ -83,7 +83,7 @@ public class IBDropTargetListener implements DropTargetListener {
|
|||
private ITranslationUnit checkLocalSelection() {
|
||||
ISelection sel= LocalSelectionTransfer.getTransfer().getSelection();
|
||||
if (sel instanceof IStructuredSelection) {
|
||||
for (Iterator iter = ((IStructuredSelection)sel).iterator(); iter.hasNext();) {
|
||||
for (Iterator<?> iter = ((IStructuredSelection)sel).iterator(); iter.hasNext();) {
|
||||
Object element = iter.next();
|
||||
if (element instanceof ITranslationUnit) {
|
||||
return (ITranslationUnit) element;
|
||||
|
|
|
@ -121,7 +121,7 @@ public class IBHistoryListAction extends Action {
|
|||
|
||||
private void doSelectionChanged() {
|
||||
StatusInfo status= new StatusInfo();
|
||||
List selected= fHistoryList.getSelectedElements();
|
||||
List<?> selected= fHistoryList.getSelectedElements();
|
||||
if (selected.size() != 1) {
|
||||
status.setError(""); //$NON-NLS-1$
|
||||
fResult= null;
|
||||
|
|
|
@ -83,6 +83,7 @@ public class OpenIncludeBrowserAction extends SelectionDispatchAction {
|
|||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Object getAdapter(Object object, Class desiredClass) {
|
||||
if (desiredClass.isInstance(object)) {
|
||||
return object;
|
||||
|
|
|
@ -118,8 +118,7 @@ public class IndexView extends ViewPart implements PDOM.IListener, IElementChang
|
|||
IndexNode node= (IndexNode)element;
|
||||
return node.fHasDeclarationInProject;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
public static boolean hasDeclarationInProject(IPDOMNode element) {
|
||||
if (element instanceof PDOMBinding) {
|
||||
|
|
Loading…
Add table
Reference in a new issue