Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMarkus Schorn2008-04-17 05:11:27 -0400
committerMarkus Schorn2008-04-17 05:11:27 -0400
commit477fe21a1393a7c2751fee3dd81baa6cd872872c (patch)
tree8b09456fb6d6a919add495e10159c630039e4a24 /core
parent52fa978c3c8e8a86278d45aada6efc9b74431c37 (diff)
downloadorg.eclipse.cdt-477fe21a1393a7c2751fee3dd81baa6cd872872c.tar.gz
org.eclipse.cdt-477fe21a1393a7c2751fee3dd81baa6cd872872c.tar.xz
org.eclipse.cdt-477fe21a1393a7c2751fee3dd81baa6cd872872c.zip
Fix warnings.
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core/.settings/org.eclipse.jdt.core.prefs4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodTemplate.java2
-rw-r--r--core/org.eclipse.cdt.ui/.settings/org.eclipse.jdt.core.prefs4
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/AbstractPathOptionBlock.java97
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ArchiveFileFilter.java2
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElement.java47
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementFilter.java2
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementGroup.java56
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementSorter.java27
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathBasePage.java26
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerDefaultPage.java4
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerDescriptor.java4
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerEntryPage.java92
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerWizard.java25
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathFilterPage.java6
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryBasePage.java7
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryPage.java191
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryPerFilePage.java197
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathLibraryEntryPage.java100
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathOrderExportPage.java19
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathOutputEntryPage.java122
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathProjectsEntryPage.java55
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathSourceEntryPage.java120
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathTabBlock.java24
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ExclusionPatternDialog.java44
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ExclusionPatternEntryDialog.java6
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/MultipleFolderSelectionDialog.java14
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/NewIncludesSymbolsTabBlock.java18
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/NewSourceFolderDialog.java17
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/SourceAttachmentBlock.java42
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CodeTemplateBlock.java20
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/DefinitionFinder.java5
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/AbstractCEditorTextHover.java5
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CEditorTextHoverProxy.java4
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/ITreeListAdapter.java16
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/ListDialogField.java4
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/TreeListDialogField.java48
-rw-r--r--core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/Template.java15
-rw-r--r--core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/TemplateDrivenWizard.java28
-rw-r--r--core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/TemplateListSelectionPage.java2
-rw-r--r--core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/TemplatesChoiceWizard.java35
-rw-r--r--core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/WizardNode.java25
-rw-r--r--core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/pages/NewProjectCreationPage.java3
-rw-r--r--core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/pages/TemplatePreferencePage.java10
-rw-r--r--core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/UIElementTreeBuilderHelper.java6
-rw-r--r--core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/uiwidgets/UIBrowseWidget.java3
-rw-r--r--core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/uiwidgets/UIStringListWidget.java8
-rw-r--r--core/org.eclipse.cdt.ui/utils.ui/org/eclipse/cdt/utils/ui/controls/FileListControl.java16
-rw-r--r--core/org.eclipse.cdt.ui/utils.ui/org/eclipse/cdt/utils/ui/controls/RadioButtonsArea.java14
49 files changed, 824 insertions, 817 deletions
diff --git a/core/org.eclipse.cdt.core/.settings/org.eclipse.jdt.core.prefs b/core/org.eclipse.cdt.core/.settings/org.eclipse.jdt.core.prefs
index a8437783b7d..55971625745 100644
--- a/core/org.eclipse.cdt.core/.settings/org.eclipse.jdt.core.prefs
+++ b/core/org.eclipse.cdt.core/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Wed Apr 09 13:24:35 CEST 2008
+#Thu Apr 17 11:04:18 CEST 2008
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -61,7 +61,7 @@ org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodTemplate.java
index 6ec70c41450..6183340e968 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodTemplate.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodTemplate.java
@@ -124,7 +124,7 @@ public class CPPMethodTemplate extends CPPFunctionTemplate implements
public ICPPClassType getClassOwner() throws DOMException {
IScope scope= getScope();
- while (scope instanceof ICPPTemplateScope) {
+ if (scope instanceof ICPPTemplateScope) {
scope= scope.getParent();
}
if( scope instanceof ICPPClassScope ){
diff --git a/core/org.eclipse.cdt.ui/.settings/org.eclipse.jdt.core.prefs b/core/org.eclipse.cdt.ui/.settings/org.eclipse.jdt.core.prefs
index 8824e1831d7..60316262c0b 100644
--- a/core/org.eclipse.cdt.ui/.settings/org.eclipse.jdt.core.prefs
+++ b/core/org.eclipse.cdt.ui/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Wed Apr 09 11:35:31 CEST 2008
+#Thu Apr 17 11:03:55 CEST 2008
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -62,7 +62,7 @@ org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/AbstractPathOptionBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/AbstractPathOptionBlock.java
index 9dab3180264..9c731143cae 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/AbstractPathOptionBlock.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/AbstractPathOptionBlock.java
@@ -13,19 +13,6 @@ package org.eclipse.cdt.internal.ui.dialogs.cpaths;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.cdt.core.model.CModelException;
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.ICModelStatus;
-import org.eclipse.cdt.core.model.ICProject;
-import org.eclipse.cdt.core.model.IPathEntry;
-import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener;
-import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
-import org.eclipse.cdt.internal.ui.dialogs.StatusUtil;
-import org.eclipse.cdt.internal.ui.util.CoreUtility;
-import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
-import org.eclipse.cdt.ui.dialogs.ICOptionPage;
-import org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
@@ -37,6 +24,21 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.cdt.core.model.CModelException;
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ICModelStatus;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.model.IPathEntry;
+import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
+import org.eclipse.cdt.ui.dialogs.ICOptionPage;
+import org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock;
+
+import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener;
+import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
+import org.eclipse.cdt.internal.ui.dialogs.StatusUtil;
+import org.eclipse.cdt.internal.ui.util.CoreUtility;
+
abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock implements ICOptionContainer {
private StatusInfo fCPathStatus;
@@ -71,17 +73,17 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
* returned must not be valid.
*/
public IPathEntry[] getRawCPath() throws CModelException{
- List elements = getCPaths();
+ List<CPElement> elements = getCPaths();
IPathEntry[] entries = getCProject().getRawPathEntries();
- List cpath = new ArrayList(elements.size() + entries.length);
+ List<IPathEntry> cpath = new ArrayList<IPathEntry>(elements.size() + entries.length);
int[] applyTypes = getAppliedFilteredTypes();
// create and set the paths
for (int i = 0; i < elements.size(); i++) {
- CPElement entry = ((CPElement) elements.get(i));
- for(int j = 0; j < applyTypes.length; j++) {
- if (entry.getEntryKind() == applyTypes[j]) {
+ CPElement entry = (elements.get(i));
+ for (int applyType : applyTypes) {
+ if (entry.getEntryKind() == applyType) {
cpath.add(entry.getPathEntry());
break;
}
@@ -89,21 +91,21 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
}
// add entries which do not match type being applyed by the ui block
- for(int i = 0; i < entries.length; i++) {
- int pathType = entries[i].getEntryKind();
+ for (IPathEntry entrie : entries) {
+ int pathType = entrie.getEntryKind();
boolean found = false;
- for(int j = 0; j < applyTypes.length; j++) {
- if (pathType == applyTypes[j]) {
+ for (int applyType : applyTypes) {
+ if (pathType == applyType) {
found = true;
break;
}
}
if (!found) {
- cpath.add(entries[i]);
+ cpath.add(entrie);
}
}
- return (IPathEntry[]) cpath.toArray(new IPathEntry[cpath.size()]);
+ return cpath.toArray(new IPathEntry[cpath.size()]);
}
/**
@@ -120,7 +122,7 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
*/
public void init(ICElement element, IPathEntry[] cpathEntries) {
setCElement(element);
- List newCPath = null;
+ List<CPElement> newCPath = null;
if (cpathEntries == null) {
try {
@@ -132,7 +134,7 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
if (cpathEntries != null) {
newCPath = getFilteredElements(cpathEntries, getFilteredTypes());
} else {
- newCPath = new ArrayList();
+ newCPath = new ArrayList<CPElement>();
}
initialize(element, newCPath);
}
@@ -140,12 +142,11 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
abstract protected int[] getFilteredTypes(); // path type which block would like access to
abstract protected int[] getAppliedFilteredTypes(); // path type which block modifies
- abstract protected void initialize(ICElement element, List cPaths);
+ abstract protected void initialize(ICElement element, List<CPElement> cPaths);
- protected ArrayList getFilteredElements(IPathEntry[] cPathEntries, int[] types) {
- ArrayList newCPath = new ArrayList();
- for (int i = 0; i < cPathEntries.length; i++) {
- IPathEntry curr = cPathEntries[i];
+ protected ArrayList<CPElement> getFilteredElements(IPathEntry[] cPathEntries, int[] types) {
+ ArrayList<CPElement> newCPath = new ArrayList<CPElement>();
+ for (IPathEntry curr : cPathEntries) {
if (contains(types, curr.getEntryKind())) {
newCPath.add(CPElement.createFromExisting(curr, getCElement()));
}
@@ -164,16 +165,16 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
return false;
}
- abstract protected List getCPaths();
+ abstract protected List<CPElement> getCPaths();
private String getEncodedSettings() {
StringBuffer buf = new StringBuffer();
- List elements = getCPaths();
+ List<CPElement> elements = getCPaths();
int nElements = elements.size();
buf.append('[').append(nElements).append(']');
for (int i = 0; i < nElements; i++) {
- CPElement elem = (CPElement) elements.get(i);
+ CPElement elem = elements.get(i);
elem.appendEncodedSettings(buf);
}
return buf.toString();
@@ -234,7 +235,7 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
super.setCurrentPage(page);
CPathBasePage newPage = (CPathBasePage) page;
if (fCurrPage != null) {
- List selection = fCurrPage.getSelection();
+ List<?> selection = fCurrPage.getSelection();
if (!selection.isEmpty()) {
newPage.setSelection(selection);
}
@@ -252,11 +253,11 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
}
protected void updateBuildPathStatus() {
- List elements = getCPaths();
+ List<CPElement> elements = getCPaths();
IPathEntry[] entries = new IPathEntry[elements.size()];
for (int i = elements.size() - 1; i >= 0; i--) {
- CPElement currElement = (CPElement) elements.get(i);
+ CPElement currElement = elements.get(i);
entries[i] = currElement.getPathEntry();
}
@@ -288,7 +289,7 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
return fCurrPage;
}
- protected void internalConfigureCProject(List cPathEntries, IProgressMonitor monitor) throws CoreException,
+ protected void internalConfigureCProject(List<CPElement> cPathEntries, IProgressMonitor monitor) throws CoreException,
InterruptedException {
// 10 monitor steps to go
@@ -296,14 +297,14 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
IPathEntry[] entries = getCProject().getRawPathEntries();
- List cpath = new ArrayList(cPathEntries.size() + entries.length);
+ List<IPathEntry> cpath = new ArrayList<IPathEntry>(cPathEntries.size() + entries.length);
int[] applyTypes = getAppliedFilteredTypes();
// create and set the paths
for (int i = 0; i < cPathEntries.size(); i++) {
- CPElement entry = ((CPElement) cPathEntries.get(i));
- for(int j = 0; j < applyTypes.length; j++) {
- if (entry.getEntryKind() == applyTypes[j]) {
+ CPElement entry = (cPathEntries.get(i));
+ for (int applyType : applyTypes) {
+ if (entry.getEntryKind() == applyType) {
IResource res = entry.getResource();
if ((res instanceof IFolder) && !res.exists()) {
CoreUtility.createFolder((IFolder) res, true, true, null);
@@ -315,22 +316,22 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
}
// add entries which do not match type being applyed by the ui block
- for(int i = 0; i < entries.length; i++) {
- int pathType = entries[i].getEntryKind();
+ for (IPathEntry entrie : entries) {
+ int pathType = entrie.getEntryKind();
boolean found = false;
- for(int j = 0; j < applyTypes.length; j++) {
- if (pathType == applyTypes[j]) {
+ for (int applyType : applyTypes) {
+ if (pathType == applyType) {
found = true;
break;
}
}
if (!found) {
- cpath.add(entries[i]);
+ cpath.add(entrie);
}
}
monitor.worked(1);
- getCProject().setRawPathEntries((IPathEntry[]) cpath.toArray(new IPathEntry[cpath.size()]),
+ getCProject().setRawPathEntries(cpath.toArray(new IPathEntry[cpath.size()]),
new SubProgressMonitor(monitor, 7));
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ArchiveFileFilter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ArchiveFileFilter.java
index 3ad2f842d75..c3a40ba6379 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ArchiveFileFilter.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ArchiveFileFilter.java
@@ -35,7 +35,7 @@ public class ArchiveFileFilter extends ViewerFilter {
private static final String[] fgArchiveExtensions= { "a", "so", "dll" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- private List fExcludes;
+ private List<IFile> fExcludes;
private boolean fRecursive;
/**
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElement.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElement.java
index 44c9bbff739..5eeae3466a6 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElement.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElement.java
@@ -13,6 +13,14 @@ package org.eclipse.cdt.internal.ui.dialogs.cpaths;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICElement;
@@ -28,13 +36,6 @@ import org.eclipse.cdt.core.model.IPathEntryContainer;
import org.eclipse.cdt.core.model.IPathEntryContainerExtension;
import org.eclipse.cdt.core.model.ISourceEntry;
import org.eclipse.cdt.ui.CUIPlugin;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
public class CPElement {
@@ -57,7 +58,7 @@ public class CPElement {
private final IPath fPath;
private final ICProject fCProject;
private final IResource fResource;
- private final ArrayList fChildren = new ArrayList(1);
+ private final ArrayList<Object> fChildren = new ArrayList<Object>(1);
private boolean fIsExported;
@@ -143,8 +144,8 @@ public class CPElement {
else {
entries = container.getPathEntries();
}
- for (int i = 0; i < entries.length; i++) {
- CPElement curr = createFromExisting(entries[i], fCProject);
+ for (IPathEntry entrie : entries) {
+ CPElement curr = createFromExisting(entrie, fCProject);
curr.createAttributeElement(PARENT_CONTAINER, this);
CPElementGroup group = new CPElementGroup(this, curr.getEntryKind());
int indx = fChildren.indexOf(group);
@@ -243,8 +244,8 @@ public class CPElement {
case IPathEntry.CDT_MACRO_FILE :
IPath[] exclusion = (IPath[])getAttribute(EXCLUSION);
buf.append('[').append(exclusion.length).append(']');
- for (int i = 0; i < exclusion.length; i++) {
- appendEncodePath(exclusion[i], buf);
+ for (IPath element : exclusion) {
+ appendEncodePath(element, buf);
}
switch (fEntryKind) {
case IPathEntry.CDT_INCLUDE :
@@ -270,6 +271,7 @@ public class CPElement {
appendEncodePath(base, buf);
String symbol = (String)getAttribute(MACRO_NAME);
buf.append(symbol).append(';');
+ break;
case IPathEntry.CDT_MACRO_FILE :
baseRef = (IPath)getAttribute(BASE_REF);
appendEncodePath(baseRef, buf);
@@ -333,11 +335,14 @@ public class CPElement {
public void setParent(CPElementGroup group) {
CPElementAttribute attribute = findAttributeElement(PARENT);
- if (attribute == null && group != null) {
- createAttributeElement(PARENT, group);
- return;
+ if (attribute == null) {
+ if (group != null) {
+ createAttributeElement(PARENT, group);
+ }
+ }
+ else {
+ attribute.setValue(group);
}
- attribute.setValue(group);
}
public CPElementGroup getParent() {
@@ -399,7 +404,7 @@ public class CPElement {
// return new Object[] { findAttributeElement(SOURCEATTACHMENT) };
case IPathEntry.CDT_CONTAINER : {
- List list = new ArrayList();
+ List<Object> list = new ArrayList<Object>();
for (int i = 0; i < fChildren.size(); i++) {
Object curr = fChildren.get(i);
if (curr instanceof CPElementGroup) {
@@ -559,7 +564,7 @@ public class CPElement {
res = root.getFolder(path);
}
}
- if (res.getType() != IResource.ROOT && res.getType() != IResource.PROJECT && fCProject != null) {
+ if (res != null && res.getType() != IResource.ROOT && res.getType() != IResource.PROJECT && fCProject != null) {
if (!fCProject.isOnSourceRoot(res)) {
fStatus = new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID, -1, CPathEntryMessages.getString("CPElement.status.notOnSourcePath"), null); //$NON-NLS-1$
}
@@ -576,7 +581,7 @@ public class CPElement {
res = root.getFolder(path);
}
}
- if (res.getType() != IResource.ROOT && res.getType() != IResource.PROJECT && fCProject != null) {
+ if (res != null && res.getType() != IResource.ROOT && res.getType() != IResource.PROJECT && fCProject != null) {
if (!fCProject.isOnSourceRoot(res)) {
fStatus = new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID, -1, CPathEntryMessages.getString("CPElement.status.notOnSourcePath"), null); //$NON-NLS-1$
}
@@ -593,7 +598,7 @@ public class CPElement {
res = root.getFolder(path);
}
}
- if (res.getType() != IResource.ROOT && res.getType() != IResource.PROJECT && fCProject != null) {
+ if (res != null && res.getType() != IResource.ROOT && res.getType() != IResource.PROJECT && fCProject != null) {
if (!fCProject.isOnSourceRoot(res)) {
fStatus = new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID, -1, CPathEntryMessages.getString("CPElement.status.notOnSourcePath"), null); //$NON-NLS-1$
}
@@ -607,7 +612,7 @@ public class CPElement {
res = root.getFolder(path);
}
}
- if (res.getType() != IResource.ROOT && res.getType() != IResource.PROJECT && fCProject != null) {
+ if (res != null && res.getType() != IResource.ROOT && res.getType() != IResource.PROJECT && fCProject != null) {
if (!fCProject.isOnSourceRoot(res)) {
fStatus = new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID, -1, CPathEntryMessages.getString("CPElement.status.notOnSourcePath"), null); //$NON-NLS-1$
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementFilter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementFilter.java
index 361ad828831..4ac478ebec8 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementFilter.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementFilter.java
@@ -23,7 +23,7 @@ import org.eclipse.jface.viewers.ViewerFilter;
*/
public class CPElementFilter extends ViewerFilter {
- protected List fExcludes;
+ protected List<Object> fExcludes;
protected int[] fKind;
protected boolean fExportedOnly;
protected boolean fShowInherited;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementGroup.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementGroup.java
index fa8d3db0786..ed28e1149ca 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementGroup.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementGroup.java
@@ -26,19 +26,19 @@ public class CPElementGroup {
private CPElement parent;
private final int kind;
private IResource resource;
- private Map childrenListMap;
- private List childrenList;
+ private Map<Integer, List<CPElement>> childrenListMap;
+ private List<CPElement> childrenList;
public CPElementGroup(IResource resource) {
this.kind = -1;
this.resource = resource;
- this.childrenListMap = new LinkedHashMap(2);
+ this.childrenListMap = new LinkedHashMap<Integer, List<CPElement>>(2);
}
public CPElementGroup(CPElement parent, int kind) {
this.parent = parent;
this.kind = kind;
- this.childrenList = new ArrayList();
+ this.childrenList = new ArrayList<CPElement>();
}
public IResource getResource() {
@@ -77,24 +77,24 @@ public class CPElementGroup {
}
public int indexof(CPElement element) {
- List children = getChildrenList(element.getEntryKind(), false);
+ List<CPElement> children = getChildrenList(element.getEntryKind(), false);
return children != null ? children.indexOf(element) : -1;
}
public void addChild(CPElement element, int insertIndex) {
- List children = getChildrenList(element.getEntryKind(), true);
+ List<CPElement> children = getChildrenList(element.getEntryKind(), true);
children.add(insertIndex, element);
element.setParent(this);
}
public void addChild(CPElement element) {
- List children = getChildrenList(element.getEntryKind(), true);
+ List<CPElement> children = getChildrenList(element.getEntryKind(), true);
int indx = children.indexOf(element);
if (indx == -1) {
indx = children.size();
if (element.getInherited() == null) {
for (int i = 0; i < children.size(); i++) {
- CPElement next = (CPElement)children.get(i);
+ CPElement next = children.get(i);
if (next.getInherited() != null) {
indx = i;
break;
@@ -104,7 +104,7 @@ public class CPElementGroup {
children.add(indx, element);
element.setParent(this);
} else { // add element with closes matching resource path.
- CPElement other = (CPElement)children.get(indx);
+ CPElement other = children.get(indx);
if (other.getInherited() != null && element.getInherited() != null) {
IPath otherPath = other.getInherited().getPath();
IPath elemPath = element.getInherited().getPath();
@@ -121,21 +121,21 @@ public class CPElementGroup {
public void setChildren(CPElement[] elements) {
if (elements.length > 0) {
if (childrenListMap != null) {
- childrenListMap.put(new Integer(elements[0].getEntryKind()), new ArrayList(Arrays.asList(elements)));
+ childrenListMap.put(new Integer(elements[0].getEntryKind()), new ArrayList<CPElement>(Arrays.asList(elements)));
} else {
- childrenList = new ArrayList(Arrays.asList(elements));
+ childrenList = new ArrayList<CPElement>(Arrays.asList(elements));
}
}
}
public void addChildren(CPElement[] elements) {
- for (int i = 0; i < elements.length; i++) {
- addChild(elements[i]);
+ for (CPElement element : elements) {
+ addChild(element);
}
}
public boolean removeChild(CPElement element) {
- List children = getChildrenList(element.getEntryKind(), false);
+ List<CPElement> children = getChildrenList(element.getEntryKind(), false);
if (children == null) {
return false;
}
@@ -147,25 +147,25 @@ public class CPElementGroup {
}
public CPElement[] getChildren(int kind) {
- List children = getChildrenList(kind, true);
- return (CPElement[])children.toArray(new CPElement[children.size()]);
+ List<CPElement> children = getChildrenList(kind, true);
+ return children.toArray(new CPElement[children.size()]);
}
public CPElement[] getChildren() {
if (childrenList != null) {
- return (CPElement[])childrenList.toArray(new CPElement[childrenList.size()]);
+ return childrenList.toArray(new CPElement[childrenList.size()]);
}
- Collection lists = childrenListMap.values();
- Iterator iter = lists.iterator();
- List children = new ArrayList();
+ Collection<List<CPElement>> lists = childrenListMap.values();
+ Iterator<List<CPElement>> iter = lists.iterator();
+ List<CPElement> children = new ArrayList<CPElement>();
while (iter.hasNext()) {
- children.addAll((List)iter.next());
+ children.addAll(iter.next());
}
- return (CPElement[])children.toArray(new CPElement[children.size()]);
+ return children.toArray(new CPElement[children.size()]);
}
public boolean contains(CPElement element) {
- List children = getChildrenList(element.getEntryKind(), false);
+ List<CPElement> children = getChildrenList(element.getEntryKind(), false);
if (children == null) {
return false;
}
@@ -173,7 +173,7 @@ public class CPElementGroup {
}
public void replaceChild(CPElement element, CPElement replaceWith) {
- List children = getChildrenList(element.getEntryKind(), false);
+ List<CPElement> children = getChildrenList(element.getEntryKind(), false);
if (children == null) {
return;
}
@@ -184,14 +184,14 @@ public class CPElementGroup {
}
}
- private List getChildrenList(int kind, boolean create) {
- List children = null;
+ private List<CPElement> getChildrenList(int kind, boolean create) {
+ List<CPElement> children = null;
if (childrenList != null) {
children = childrenList;
} else {
- children = (List)childrenListMap.get(new Integer(kind));
+ children = childrenListMap.get(new Integer(kind));
if (children == null && create) {
- children = new ArrayList();
+ children = new ArrayList<CPElement>();
childrenListMap.put(new Integer(kind), children);
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementSorter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementSorter.java
index d3ad8f7ba5a..a5b398efeb4 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementSorter.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementSorter.java
@@ -13,11 +13,12 @@ package org.eclipse.cdt.internal.ui.dialogs.cpaths;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.cdt.core.model.IPathEntry;
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.cdt.core.model.IPathEntry;
+
public class CPElementSorter extends ViewerSorter {
private static final int SOURCE = 0;
@@ -64,21 +65,21 @@ public class CPElementSorter extends ViewerSorter {
@Override
public void sort(Viewer viewer, Object[] elements) {
// include paths and symbol definitions must not be sorted
- List sort = new ArrayList(elements.length);
- List includes = new ArrayList(elements.length);
- List syms = new ArrayList(elements.length);
- for (int i = 0; i < elements.length; i++) {
- if (elements[i] instanceof CPElement) {
- CPElement element = (CPElement)elements[i];
- if (element.getEntryKind() == IPathEntry.CDT_INCLUDE) {
- includes.add(elements[i]);
- } else if (element.getEntryKind() == IPathEntry.CDT_MACRO) {
- syms.add(elements[i]);
+ List<Object> sort = new ArrayList<Object>(elements.length);
+ List<CPElement> includes = new ArrayList<CPElement>(elements.length);
+ List<CPElement> syms = new ArrayList<CPElement>(elements.length);
+ for (Object element : elements) {
+ if (element instanceof CPElement) {
+ CPElement cpelement = (CPElement)element;
+ if (cpelement.getEntryKind() == IPathEntry.CDT_INCLUDE) {
+ includes.add(cpelement);
+ } else if (cpelement.getEntryKind() == IPathEntry.CDT_MACRO) {
+ syms.add(cpelement);
} else {
- sort.add(elements[i]);
+ sort.add(cpelement);
}
} else {
- sort.add(elements[i]);
+ sort.add(element);
}
}
System.arraycopy(sort.toArray(), 0, elements, 0, sort.size());
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathBasePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathBasePage.java
index 2ab0feebd03..3c167f1374a 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathBasePage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathBasePage.java
@@ -14,11 +14,12 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Set;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.resource.ImageDescriptor;
+
import org.eclipse.cdt.core.model.CoreModelUtil;
import org.eclipse.cdt.core.model.IPathEntry;
import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.resource.ImageDescriptor;
public abstract class CPathBasePage extends AbstractCOptionPage {
@@ -30,20 +31,20 @@ public abstract class CPathBasePage extends AbstractCOptionPage {
super(title, image);
}
- protected void fixNestingConflicts(List newEntries, List existingList, Set modifiedSourceEntries) {
- ArrayList existing = new ArrayList(existingList);
+ protected void fixNestingConflicts(List<CPElement> newEntries, List<CPElement> existingList, Set<CPElement> modifiedSourceEntries) {
+ ArrayList<CPElement> existing = new ArrayList<CPElement>(existingList);
for (int i = 0; i < newEntries.size(); i++) {
- CPElement curr = (CPElement) newEntries.get(i);
+ CPElement curr = newEntries.get(i);
addExclusionPatterns(curr, existing, modifiedSourceEntries);
// add the entry to the existing list so it can be analyse also.
existing.add(curr);
}
}
- private void addExclusionPatterns(CPElement newEntry, List existing, Set modifiedEntries) {
+ private void addExclusionPatterns(CPElement newEntry, List<CPElement> existing, Set<CPElement> modifiedEntries) {
IPath entryPath = newEntry.getPath();
for (int i = 0; i < existing.size(); i++) {
- CPElement curr = (CPElement) existing.get(i);
+ CPElement curr = existing.get(i);
if (curr.getEntryKind() == IPathEntry.CDT_SOURCE) {
IPath currPath = curr.getPath();
if (currPath.isPrefixOf(entryPath) && !currPath.equals(entryPath)) {
@@ -61,18 +62,17 @@ public abstract class CPathBasePage extends AbstractCOptionPage {
}
}
- public abstract List getSelection();
+ public abstract List<?> getSelection();
- public abstract void setSelection(List selection);
+ public abstract void setSelection(List<?> selection);
public abstract boolean isEntryKind(int kind);
- protected List filterList(List input) {
- ArrayList filtered = new ArrayList();
+ protected List<CPElement> filterList(List<CPElement> cpelements) {
+ ArrayList<CPElement> filtered = new ArrayList<CPElement>();
- List cpelements = input;
for (int i = 0; i < cpelements.size(); i++) {
- CPElement cpe = (CPElement) cpelements.get(i);
+ CPElement cpe = cpelements.get(i);
if (isEntryKind(cpe.getEntryKind())) {
filtered.add(cpe);
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerDefaultPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerDefaultPage.java
index c30a9961bf5..4ba952deb67 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerDefaultPage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerDefaultPage.java
@@ -36,7 +36,7 @@ import org.eclipse.swt.widgets.Composite;
public class CPathContainerDefaultPage extends NewElementWizardPage implements IPathEntryContainerPage {
private StringDialogField fEntryField;
- private ArrayList fUsedPaths;
+ private ArrayList<IPath> fUsedPaths;
/**
* Constructor for ClasspathContainerDefaultPage.
@@ -47,7 +47,7 @@ public class CPathContainerDefaultPage extends NewElementWizardPage implements I
setDescription(CPathEntryMessages.getString("CPathContainerDefaultPage.description")); //$NON-NLS-1$
setImageDescriptor(CPluginImages.DESC_WIZBAN_ADD_LIBRARY);
- fUsedPaths= new ArrayList();
+ fUsedPaths= new ArrayList<IPath>();
fEntryField= new StringDialogField();
fEntryField.setLabelText(CPathEntryMessages.getString("CPathContainerDefaultPage.path.label")); //$NON-NLS-1$
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerDescriptor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerDescriptor.java
index f9a44b36d83..fa520d06ab5 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerDescriptor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerDescriptor.java
@@ -333,7 +333,7 @@ public class CPathContainerDescriptor implements IContainerDescriptor {
}
public static IContainerDescriptor[] getDescriptors() {
- ArrayList containers = new ArrayList();
+ ArrayList<IContainerDescriptor> containers = new ArrayList<IContainerDescriptor>();
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CUIPlugin.PLUGIN_ID, ATT_EXTENSION);
if (extensionPoint != null) {
@@ -358,7 +358,7 @@ public class CPathContainerDescriptor implements IContainerDescriptor {
containers.add(defaultPage);
}
}
- return (CPathContainerDescriptor[]) containers.toArray(new CPathContainerDescriptor[containers.size()]);
+ return containers.toArray(new CPathContainerDescriptor[containers.size()]);
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerEntryPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerEntryPage.java
index 6a9e244cd64..cbe1e17712d 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerEntryPage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerEntryPage.java
@@ -14,9 +14,22 @@ package org.eclipse.cdt.internal.ui.dialogs.cpaths;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.widgets.Composite;
+
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.IContainerEntry;
import org.eclipse.cdt.core.model.IPathEntry;
+import org.eclipse.cdt.ui.CUIPlugin;
+
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
import org.eclipse.cdt.internal.ui.util.PixelConverter;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
@@ -25,24 +38,13 @@ import org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.ListDialogField;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.TreeListDialogField;
-import org.eclipse.cdt.ui.CUIPlugin;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.widgets.Composite;
public class CPathContainerEntryPage extends CPathBasePage {
- private ListDialogField fCPathList;
+ private ListDialogField<CPElement> fCPathList;
private ICProject fCurrCProject;
- private TreeListDialogField fContainersList;
+ private TreeListDialogField<CPElement> fContainersList;
private final int IDX_ADD = 0;
@@ -50,7 +52,7 @@ public class CPathContainerEntryPage extends CPathBasePage {
private final int IDX_REMOVE = 3;
private final int IDX_EXPORT = 5;
- public CPathContainerEntryPage(ListDialogField cPathList) {
+ public CPathContainerEntryPage(ListDialogField<CPElement> cPathList) {
super(CPathEntryMessages.getString("ContainerEntryPage.title")); //$NON-NLS-1$
fCPathList = cPathList;
@@ -65,7 +67,7 @@ public class CPathContainerEntryPage extends CPathBasePage {
ContainersAdapter adapter = new ContainersAdapter();
- fContainersList = new TreeListDialogField(adapter, buttonLabels, new CPElementLabelProvider());
+ fContainersList = new TreeListDialogField<CPElement>(adapter, buttonLabels, new CPElementLabelProvider());
fContainersList.setDialogFieldListener(adapter);
fContainersList.setLabelText(CPathEntryMessages.getString("ContainerEntryPage.libraries.label")); //$NON-NLS-1$
@@ -84,12 +86,12 @@ public class CPathContainerEntryPage extends CPathBasePage {
}
private void updateLibrariesList() {
- List cpelements = fCPathList.getElements();
- List libelements = new ArrayList(cpelements.size());
+ List<CPElement> cpelements = fCPathList.getElements();
+ List<CPElement> libelements = new ArrayList<CPElement>(cpelements.size());
int nElements = cpelements.size();
for (int i = 0; i < nElements; i++) {
- CPElement cpe = (CPElement)cpelements.get(i);
+ CPElement cpe = cpelements.get(i);
if (isEntryKind(cpe.getEntryKind())) {
libelements.add(cpe);
}
@@ -127,28 +129,28 @@ public class CPathContainerEntryPage extends CPathBasePage {
CUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(composite, ICHelpContextIds.PROJECT_PATHS_CONTAINERS);
}
- private class ContainersAdapter implements IDialogFieldListener, ITreeListAdapter {
+ private class ContainersAdapter implements IDialogFieldListener, ITreeListAdapter<CPElement> {
private final Object[] EMPTY_ARR = new Object[0];
// -------- IListAdapter --------
- public void customButtonPressed(TreeListDialogField field, int index) {
+ public void customButtonPressed(TreeListDialogField<CPElement> field, int index) {
containerPageCustomButtonPressed(field, index);
}
- public void selectionChanged(TreeListDialogField field) {
+ public void selectionChanged(TreeListDialogField<CPElement> field) {
containerPageSelectionChanged(field);
}
- public void doubleClicked(TreeListDialogField field) {
+ public void doubleClicked(TreeListDialogField<CPElement> field) {
containerPageDoubleClicked(field);
}
- public void keyPressed(TreeListDialogField field, KeyEvent event) {
+ public void keyPressed(TreeListDialogField<CPElement> field, KeyEvent event) {
containerPageKeyPressed(field, event);
}
- public Object[] getChildren(TreeListDialogField field, Object element) {
+ public Object[] getChildren(TreeListDialogField<CPElement> field, Object element) {
if (element instanceof CPElement) {
return ((CPElement)element).getChildren();
} else if (element instanceof CPElementGroup) {
@@ -157,7 +159,7 @@ public class CPathContainerEntryPage extends CPathBasePage {
return EMPTY_ARR;
}
- public Object getParent(TreeListDialogField field, Object element) {
+ public Object getParent(TreeListDialogField<CPElement> field, Object element) {
if (element instanceof CPElementAttribute) {
return ((CPElementAttribute)element).getParent();
} else if (element instanceof CPElementGroup) {
@@ -166,7 +168,7 @@ public class CPathContainerEntryPage extends CPathBasePage {
return null;
}
- public boolean hasChildren(TreeListDialogField field, Object element) {
+ public boolean hasChildren(TreeListDialogField<CPElement> field, Object element) {
if (element instanceof CPElementGroup) {
return true;
} else if (element instanceof CPElement) {
@@ -206,8 +208,8 @@ public class CPathContainerEntryPage extends CPathBasePage {
if (containers != null) {
int nElementsChosen = containers.length;
// remove duplicates
- List cplist = fContainersList.getElements();
- List elementsToAdd = new ArrayList(nElementsChosen);
+ List<CPElement> cplist = fContainersList.getElements();
+ List<CPElement> elementsToAdd = new ArrayList<CPElement>(nElementsChosen);
for (int i = 0; i < nElementsChosen; i++) {
CPElement curr = containers[i];
@@ -225,17 +227,17 @@ public class CPathContainerEntryPage extends CPathBasePage {
}
}
- protected void containerPageDoubleClicked(TreeListDialogField field) {
- List selection = fContainersList.getSelectedElements();
+ protected void containerPageDoubleClicked(TreeListDialogField<?> field) {
+ List<?> selection = fContainersList.getSelectedElements();
if (canEdit(selection)) {
editEntry();
}
}
- protected void containerPageKeyPressed(TreeListDialogField field, KeyEvent event) {
+ protected void containerPageKeyPressed(TreeListDialogField<?> field, KeyEvent event) {
if (field == fContainersList) {
if (event.character == SWT.DEL && event.stateMask == 0) {
- List selection = field.getSelectedElements();
+ List<?> selection = field.getSelectedElements();
if (canRemove(selection)) {
removeEntry();
}
@@ -243,7 +245,7 @@ public class CPathContainerEntryPage extends CPathBasePage {
}
}
- private boolean canRemove(List selElements) {
+ private boolean canRemove(List<?> selElements) {
if (selElements.size() == 0) {
return false;
}
@@ -262,11 +264,11 @@ public class CPathContainerEntryPage extends CPathBasePage {
}
private void removeEntry() {
- List selElements = fContainersList.getSelectedElements();
+ List<?> selElements = fContainersList.getSelectedElements();
fContainersList.removeElements(selElements);
}
- private boolean canExport(List selElements) {
+ private boolean canExport(List<?> selElements) {
if (selElements.size() == 0) {
return false;
}
@@ -285,7 +287,7 @@ public class CPathContainerEntryPage extends CPathBasePage {
}
private void exportEntry() {
- List selElements = fContainersList.getSelectedElements();
+ List<?> selElements = fContainersList.getSelectedElements();
if (selElements.size() == 0) {
return;
}
@@ -302,7 +304,7 @@ public class CPathContainerEntryPage extends CPathBasePage {
* Method editEntry.
*/
private void editEntry() {
- List selElements = fContainersList.getSelectedElements();
+ List<?> selElements = fContainersList.getSelectedElements();
if (selElements.size() != 1) {
return;
}
@@ -349,13 +351,13 @@ public class CPathContainerEntryPage extends CPathBasePage {
}
void containerPageSelectionChanged(DialogField field) {
- List selElements = fContainersList.getSelectedElements();
+ List<?> selElements = fContainersList.getSelectedElements();
fContainersList.enableButton(IDX_EDIT, canEdit(selElements));
fContainersList.enableButton(IDX_REMOVE, canRemove(selElements));
fContainersList.enableButton(IDX_EXPORT, canExport(selElements));
}
- private boolean canEdit(List selElements) {
+ private boolean canEdit(List<?> selElements) {
if (selElements.size() != 1) {
return false;
}
@@ -378,14 +380,14 @@ public class CPathContainerEntryPage extends CPathBasePage {
}
private void updateCPathList() {
- List projelements = fContainersList.getElements();
+ List<CPElement> projelements = fContainersList.getElements();
- List cpelements = fCPathList.getElements();
+ List<CPElement> cpelements = fCPathList.getElements();
int nEntries = cpelements.size();
// backwards, as entries will be deleted
int lastRemovePos = nEntries;
for (int i = nEntries - 1; i >= 0; i--) {
- CPElement cpe = (CPElement)cpelements.get(i);
+ CPElement cpe = cpelements.get(i);
int kind = cpe.getEntryKind();
if (isEntryKind(kind)) {
if (!projelements.remove(cpe)) {
@@ -429,7 +431,7 @@ public class CPathContainerEntryPage extends CPathBasePage {
private IPathEntry[] getRawClasspath() {
IPathEntry[] currEntries = new IPathEntry[fCPathList.getSize()];
for (int i = 0; i < currEntries.length; i++) {
- CPElement curr = (CPElement)fCPathList.getElement(i);
+ CPElement curr = fCPathList.getElement(i);
currEntries[i] = curr.getPathEntry();
}
return currEntries;
@@ -449,7 +451,7 @@ public class CPathContainerEntryPage extends CPathBasePage {
* @see BuildPathBasePage#getSelection
*/
@Override
- public List getSelection() {
+ public List<?> getSelection() {
return fContainersList.getSelectedElements();
}
@@ -457,7 +459,7 @@ public class CPathContainerEntryPage extends CPathBasePage {
* @see BuildPathBasePage#setSelection
*/
@Override
- public void setSelection(List selElements) {
+ public void setSelection(List<?> selElements) {
fContainersList.selectElements(new StructuredSelection(selElements));
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerWizard.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerWizard.java
index a233f12d11d..e55c5eb629a 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerWizard.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerWizard.java
@@ -14,18 +14,20 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.IContainerEntry;
import org.eclipse.cdt.core.model.IPathEntry;
import org.eclipse.cdt.core.model.IProjectEntry;
+import org.eclipse.cdt.ui.wizards.IPathEntryContainerPage;
+
import org.eclipse.cdt.internal.ui.util.ExceptionHandler;
import org.eclipse.cdt.internal.ui.util.PixelConverter;
-import org.eclipse.cdt.ui.wizards.IPathEntryContainerPage;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
/**
*/
@@ -122,12 +124,12 @@ public class CPathContainerWizard extends Wizard {
} else if (fEntryToEdit == null) { // new entry: show selection page as
// first page
IContainerDescriptor[] containers = CPathContainerDescriptor.getDescriptors();
- List allContainers = new ArrayList(Arrays.asList(containers));
+ List<IContainerDescriptor> allContainers = new ArrayList<IContainerDescriptor>(Arrays.asList(containers));
if (fFilterType != null) {
allContainers.add(0, new ProjectContainerDescriptor(fFilterType));
}
fSelectionWizardPage = new CPathContainerSelectionPage(
- (IContainerDescriptor[])allContainers.toArray(new IContainerDescriptor[0]));
+ allContainers.toArray(new IContainerDescriptor[0]));
addPage(fSelectionWizardPage);
// add as dummy, will not be shown
@@ -153,7 +155,6 @@ public class CPathContainerWizard extends Wizard {
containerPage = pageDesc.createPage();
} catch (CoreException e) {
handlePageCreationFailed(e);
- containerPage = null;
}
}
if (containerPage == null) {
@@ -202,9 +203,9 @@ public class CPathContainerWizard extends Wizard {
}
private IContainerDescriptor findDescriptorPage(IContainerDescriptor[] containers, IPathEntry entry) {
- for (int i = 0; i < containers.length; i++) {
- if (containers[i].canEdit(entry)) {
- return containers[i];
+ for (IContainerDescriptor container2 : containers) {
+ if (container2.canEdit(entry)) {
+ return container2;
}
}
return null;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathFilterPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathFilterPage.java
index 7aebf2d8cca..993e2c282f7 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathFilterPage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathFilterPage.java
@@ -42,8 +42,8 @@ public class CPathFilterPage extends WizardPage {
private CheckboxTableViewer viewer;
private IPathEntry fParentEntry;
- private List fPaths;
- private List fExclusions;
+ private List<IPathEntry> fPaths;
+ private List<?> fExclusions;
private ViewerFilter filter;
protected ICElement fCElement;
@@ -118,7 +118,7 @@ public class CPathFilterPage extends WizardPage {
private void createExlusions(boolean showExported) {
- fExclusions = new ArrayList();
+ fExclusions = new ArrayList<Object>();
if (filter != null) {
viewer.removeFilter(filter);
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryBasePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryBasePage.java
index dc36cd1be72..1dbdbd38321 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryBasePage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryBasePage.java
@@ -12,9 +12,10 @@ package org.eclipse.cdt.internal.ui.dialogs.cpaths;
import java.util.List;
-import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.cdt.core.model.ICElement;
+
public abstract class CPathIncludeSymbolEntryBasePage extends CPathBasePage {
public CPathIncludeSymbolEntryBasePage(String title) {
@@ -25,6 +26,6 @@ public abstract class CPathIncludeSymbolEntryBasePage extends CPathBasePage {
super(title, image);
}
- public abstract void init(ICElement cElement, List cPaths);
- public abstract List getCPaths();
+ public abstract void init(ICElement cElement, List<CPElement> cPaths);
+ public abstract List<CPElement> getCPaths();
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryPage.java
index 8744f0a7b6e..f2240d2170e 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryPage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryPage.java
@@ -12,33 +12,8 @@ package org.eclipse.cdt.internal.ui.dialogs.cpaths;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Iterator;
import java.util.List;
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.model.CoreModelUtil;
-import org.eclipse.cdt.core.model.ICContainer;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.ICProject;
-import org.eclipse.cdt.core.model.IContainerEntry;
-import org.eclipse.cdt.core.model.IIncludeEntry;
-import org.eclipse.cdt.core.model.IMacroEntry;
-import org.eclipse.cdt.core.model.IPathEntry;
-import org.eclipse.cdt.core.model.ITranslationUnit;
-import org.eclipse.cdt.internal.ui.CPluginImages;
-import org.eclipse.cdt.internal.ui.ICHelpContextIds;
-import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener;
-import org.eclipse.cdt.internal.ui.dialogs.TypedElementSelectionValidator;
-import org.eclipse.cdt.internal.ui.dialogs.TypedViewerFilter;
-import org.eclipse.cdt.internal.ui.util.PixelConverter;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.SelectionButtonDialogField;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.TreeListDialogField;
-import org.eclipse.cdt.ui.CElementContentProvider;
-import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -66,9 +41,35 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.CoreModelUtil;
+import org.eclipse.cdt.core.model.ICContainer;
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.model.IContainerEntry;
+import org.eclipse.cdt.core.model.IIncludeEntry;
+import org.eclipse.cdt.core.model.IMacroEntry;
+import org.eclipse.cdt.core.model.IPathEntry;
+import org.eclipse.cdt.core.model.ITranslationUnit;
+import org.eclipse.cdt.ui.CElementContentProvider;
+import org.eclipse.cdt.ui.CUIPlugin;
+
+import org.eclipse.cdt.internal.ui.CPluginImages;
+import org.eclipse.cdt.internal.ui.ICHelpContextIds;
+import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener;
+import org.eclipse.cdt.internal.ui.dialogs.TypedElementSelectionValidator;
+import org.eclipse.cdt.internal.ui.dialogs.TypedViewerFilter;
+import org.eclipse.cdt.internal.ui.util.PixelConverter;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.SelectionButtonDialogField;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.TreeListDialogField;
+
public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage {
- private TreeListDialogField fIncludeSymPathsList;
+ private TreeListDialogField<CPElementGroup> fIncludeSymPathsList;
private SelectionButtonDialogField fShowInheritedPaths;
private ICProject fCurrCProject;
private CPElementFilter fFilter;
@@ -105,28 +106,28 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
/* 15 */CPathEntryMessages.getString("IncludeSymbolEntryPage.down")}; //$NON-NLS-1$
private CPElementGroup fTopGroup;
- private class IncludeSymbolAdapter implements IDialogFieldListener, ITreeListAdapter {
+ private class IncludeSymbolAdapter implements IDialogFieldListener, ITreeListAdapter<CPElementGroup> {
private final Object[] EMPTY_ARR = new Object[0];
// -------- IListAdapter --------
- public void customButtonPressed(TreeListDialogField field, int index) {
+ public void customButtonPressed(TreeListDialogField<CPElementGroup> field, int index) {
ListCustomButtonPressed(field, index);
}
- public void selectionChanged(TreeListDialogField field) {
+ public void selectionChanged(TreeListDialogField<CPElementGroup> field) {
listPageSelectionChanged(field);
}
- public void doubleClicked(TreeListDialogField field) {
+ public void doubleClicked(TreeListDialogField<CPElementGroup> field) {
ListPageDoubleClicked(field);
}
- public void keyPressed(TreeListDialogField field, KeyEvent event) {
+ public void keyPressed(TreeListDialogField<CPElementGroup> field, KeyEvent event) {
ListPageKeyPressed(field, event);
}
- public Object[] getChildren(TreeListDialogField field, Object element) {
+ public Object[] getChildren(TreeListDialogField<CPElementGroup> field, Object element) {
if (element instanceof CPElement) {
return ((CPElement)element).getChildren();
} else if (element instanceof CPElementGroup) {
@@ -135,7 +136,7 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
return EMPTY_ARR;
}
- public Object getParent(TreeListDialogField field, Object element) {
+ public Object getParent(TreeListDialogField<CPElementGroup> field, Object element) {
if (element instanceof CPElementGroup) {
return ((CPElementGroup)element).getParent();
} else if (element instanceof CPElement) {
@@ -144,7 +145,7 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
return null;
}
- public boolean hasChildren(TreeListDialogField field, Object element) {
+ public boolean hasChildren(TreeListDialogField<CPElementGroup> field, Object element) {
if (element instanceof CPElementGroup) {
return true;
}
@@ -166,7 +167,7 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
super(CPathEntryMessages.getString("IncludeSymbolEntryPage.title")); //$NON-NLS-1$
fContext = context;
IncludeSymbolAdapter adapter = new IncludeSymbolAdapter();
- fIncludeSymPathsList = new TreeListDialogField(adapter, buttonLabel, new CPElementLabelProvider(true, false)) {
+ fIncludeSymPathsList = new TreeListDialogField<CPElementGroup>(adapter, buttonLabel, new CPElementLabelProvider(true, false)) {
@Override
protected int getTreeStyle() {
@@ -216,9 +217,9 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
}
@Override
- public void init(ICElement cElement, List cPaths) {
+ public void init(ICElement cElement, List<CPElement> cPaths) {
fCurrCProject = cElement.getCProject();
- List elements = createGroups(cElement, cPaths);
+ List<CPElementGroup> elements = createGroups(cElement, cPaths);
fIncludeSymPathsList.setElements(elements);
updateStatus();
}
@@ -227,9 +228,9 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
CPElement entryError = null;
int nErrorEntries = 0;
IStatus status = Status.OK_STATUS;
- List elements = getCPaths();
+ List<CPElement> elements = getCPaths();
for (int i = elements.size() - 1; i >= 0; i--) {
- CPElement currElement = (CPElement)elements.get(i);
+ CPElement currElement = elements.get(i);
if (currElement.getStatus().getSeverity() != IStatus.OK) {
nErrorEntries++;
if (entryError == null) {
@@ -239,7 +240,7 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
}
if (nErrorEntries > 0) {
- if (nErrorEntries == 1) {
+ if (nErrorEntries == 1 && entryError != null) {
status = entryError.getStatus();
} else {
status = new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID, -1, CPathEntryMessages.getFormattedString(
@@ -250,7 +251,7 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
fContext.statusChanged(status);
}
- private void updateStatus(List selected) {
+ private void updateStatus(List<?> selected) {
if (selected.size() != 1) {
updateStatus();
return;
@@ -269,9 +270,9 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
}
}
- private List createGroups(ICElement element, List cPaths) {
+ private List<CPElementGroup> createGroups(ICElement element, List<?> cPaths) {
// create resource groups
- List resourceGroups = new ArrayList(5);
+ List<CPElementGroup> resourceGroups = new ArrayList<CPElementGroup>(5);
fTopGroup = new CPElementGroup(element.getResource());
resourceGroups.add(fTopGroup);
// add containers first so that they appear at top of list
@@ -293,7 +294,7 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
if (ndx == -1) {
resourceGroups.add(resGroup);
} else {
- resGroup = (CPElementGroup)resourceGroups.get(ndx);
+ resGroup = resourceGroups.get(ndx);
}
resGroup.addChild(cpelement);
}
@@ -341,33 +342,33 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
}
}
- private void addPathToResourceGroups(CPElement element, CPElementGroup parent, List groups) {
+ private void addPathToResourceGroups(CPElement element, CPElementGroup parent, List<CPElementGroup> groups) {
if (parent != null) {
parent.addChild(element);
}
for (int i = 0; i < groups.size(); i++) {
- CPElementGroup group = (CPElementGroup)groups.get(i);
+ CPElementGroup group = groups.get(i);
addPathToResourceGroup(element, parent, group);
}
}
- private void updatePathOnResourceGroups(CPElement element, List groups) {
+ private void updatePathOnResourceGroups(CPElement element, List<CPElementGroup> groups) {
CPElementGroup parent = element.getParent();
IPath resPath = element.getPath();
IPath[] exclusions = (IPath[])element.getAttribute(CPElement.EXCLUSION);
for (int i = 0; i < groups.size(); i++) {
- CPElementGroup group = (CPElementGroup)groups.get(i);
+ CPElementGroup group = groups.get(i);
if (group != parent) {
boolean found = false;
CPElement[] elements = group.getChildren(element.getEntryKind());
- for (int j = 0; j < elements.length; j++) {
- if (elements[j].getInherited() == element) {
+ for (CPElement element2 : elements) {
+ if (element2.getInherited() == element) {
found = true;
if (!CoreModelUtil.isExcludedPath(group.getResource().getFullPath().removeFirstSegments(
resPath.segmentCount()), exclusions)) {
- group.replaceChild(elements[j], new CPElement(element, group.getPath(), group.getResource()));
+ group.replaceChild(element2, new CPElement(element, group.getPath(), group.getResource()));
} else {
- group.removeChild(elements[j]);
+ group.removeChild(element2);
}
break;
}
@@ -379,7 +380,7 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
}
}
- private CPElement removePathFromResourceGroups(CPElement element, List groups) {
+ private CPElement removePathFromResourceGroups(CPElement element, List<CPElementGroup> groups) {
CPElement Inherited = element.getInherited();
CPElementGroup resGroup = element.getParent();
resGroup.removeChild(element);
@@ -394,11 +395,11 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
}
// remove all inherited
for (int i = 0; i < groups.size(); i++) {
- CPElementGroup group = (CPElementGroup)groups.get(i);
+ CPElementGroup group = groups.get(i);
CPElement elements[] = group.getChildren(element.getEntryKind());
- for (int j = 0; j < elements.length; j++) {
- if (elements[j].getInherited() == element) {
- group.removeChild(elements[j]);
+ for (CPElement element2 : elements) {
+ if (element2.getInherited() == element) {
+ group.removeChild(element2);
break;
}
}
@@ -406,7 +407,7 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
return element;
}
- private boolean canAddPath(List selected) {
+ private boolean canAddPath(List<?> selected) {
CPElementGroup group = getSelectedGroup();
if (group != null) {
return group.getEntryKind() == -1; // resource group
@@ -414,7 +415,7 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
return false;
}
- private boolean canRemove(List selected) {
+ private boolean canRemove(List<?> selected) {
if (selected.size() != 1) {
return false;
}
@@ -436,7 +437,7 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
}
private void removeEntry() {
- List selected = getSelection();
+ List<?> selected = getSelection();
Object elem = selected.get(0);
if (elem instanceof CPElement) {
CPElement element = (CPElement)elem;
@@ -457,7 +458,7 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
updateStatus();
}
- private boolean canEdit(List selected) {
+ private boolean canEdit(List<?> selected) {
if (selected.size() != 1) {
return false;
}
@@ -480,7 +481,7 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
}
private void editEntry() {
- List selElements = fIncludeSymPathsList.getSelectedElements();
+ List<?> selElements = fIncludeSymPathsList.getSelectedElements();
if (selElements.size() != 1) {
return;
}
@@ -543,7 +544,7 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
fIncludeSymPathsList.refresh(element);
}
- private boolean canExport(List selected) {
+ private boolean canExport(List<?> selected) {
if (selected.size() != 1) {
return false;
}
@@ -560,7 +561,7 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
return false;
}
- private boolean canMove(List selected) {
+ private boolean canMove(List<?> selected) {
if (selected.size() == 0) {
return false;
}
@@ -579,7 +580,7 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
return true;
}
- private boolean canMoveUp(List selected) {
+ private boolean canMoveUp(List<?> selected) {
if (!canMove(selected)) {
return false;
}
@@ -593,7 +594,7 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
return true;
}
- private boolean canMoveDown(List selected) {
+ private boolean canMoveDown(List<?> selected) {
if (!canMove(selected)) {
return false;
}
@@ -610,8 +611,7 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
private boolean moveUp(CPElement element) {
boolean rc = false;
int kind = element.getEntryKind();
- for (Iterator j = fIncludeSymPathsList.getElements().iterator(); j.hasNext();) {
- CPElementGroup group = (CPElementGroup)j.next();
+ for (CPElementGroup group : fIncludeSymPathsList.getElements()) {
CPElement[] children = group.getChildren(kind);
for (int k = 0; k < children.length; ++k) {
CPElement child = children[k];
@@ -643,8 +643,7 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
private boolean moveDown(CPElement element) {
boolean rc = false;
int kind = element.getEntryKind();
- for (Iterator j = fIncludeSymPathsList.getElements().iterator(); j.hasNext();) {
- CPElementGroup group = (CPElementGroup)j.next();
+ for (CPElementGroup group : fIncludeSymPathsList.getElements()) {
CPElement[] children = group.getChildren(kind);
for (int k = children.length - 1; k >= 0; --k) {
CPElement child = children[k];
@@ -668,7 +667,7 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
}
private CPElementGroup getSelectedGroup() {
- List selected = fIncludeSymPathsList.getSelectedElements();
+ List<?> selected = fIncludeSymPathsList.getSelectedElements();
if (!selected.isEmpty()) {
Object item = selected.get(0);
if (item instanceof CPElement) {
@@ -695,8 +694,8 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
updateStatus();
}
- protected void listPageSelectionChanged(TreeListDialogField field) {
- List selected = field.getSelectedElements();
+ protected void listPageSelectionChanged(TreeListDialogField<?> field) {
+ List<?> selected = field.getSelectedElements();
field.enableButton(IDX_REMOVE, canRemove(selected));
field.enableButton(IDX_EDIT, canEdit(selected));
field.enableButton(IDX_ADD_CONTRIBUTED, canAddPath(selected));
@@ -709,7 +708,7 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
updateStatus(selected);
}
- protected void ListCustomButtonPressed(TreeListDialogField field, int index) {
+ protected void ListCustomButtonPressed(TreeListDialogField<?> field, int index) {
switch (index) {
case IDX_ADD_FOLDER_FILE :
addNewPathResource();
@@ -754,16 +753,16 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
}
}
- protected void ListPageDoubleClicked(TreeListDialogField field) {
+ protected void ListPageDoubleClicked(TreeListDialogField<?> field) {
if (canEdit(fIncludeSymPathsList.getSelectedElements())) {
editEntry();
}
}
- protected void ListPageKeyPressed(TreeListDialogField field, KeyEvent event) {
+ protected void ListPageKeyPressed(TreeListDialogField<?> field, KeyEvent event) {
if (field == fIncludeSymPathsList) {
if (event.character == SWT.DEL && event.stateMask == 0) {
- List selection = field.getSelectedElements();
+ List<?> selection = field.getSelectedElements();
if (canEdit(selection)) {
removeEntry();
}
@@ -772,17 +771,17 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
}
protected IPathEntry[] getRawPathEntries() {
- List paths = getCPaths();
+ List<CPElement> paths = getCPaths();
IPathEntry[] currEntries = new IPathEntry[paths.size()];
for (int i = 0; i < currEntries.length; i++) {
- CPElement curr = (CPElement)paths.get(i);
+ CPElement curr = paths.get(i);
currEntries[i] = curr.getPathEntry();
}
return currEntries;
}
protected void addNewPathResource() {
- Class[] acceptedClasses = new Class[]{ICProject.class, ICContainer.class, ITranslationUnit.class};
+ Class<?>[] acceptedClasses = new Class[]{ICProject.class, ICContainer.class, ITranslationUnit.class};
TypedElementSelectionValidator validator = new TypedElementSelectionValidator(acceptedClasses, false);
ViewerFilter filter = new TypedViewerFilter(acceptedClasses);
@@ -808,17 +807,17 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
}
CPElementGroup newGroup = new CPElementGroup(resource);
if (!fIncludeSymPathsList.getElements().contains(newGroup)) {
- List groups = fIncludeSymPathsList.getElements();
+ List<CPElementGroup> groups = fIncludeSymPathsList.getElements();
for (int i = 0; i < groups.size(); i++) {
- CPElementGroup group = (CPElementGroup)groups.get(i);
+ CPElementGroup group = groups.get(i);
if (group.getPath().isPrefixOf(newGroup.getPath())) {
CPElement[] cpelements = group.getChildren();
- for (int j = 0; j < cpelements.length; j++) {
- if (cpelements[j].getInherited() == null) {
- switch (cpelements[j].getEntryKind()) {
+ for (CPElement cpelement : cpelements) {
+ if (cpelement.getInherited() == null) {
+ switch (cpelement.getEntryKind()) {
case IPathEntry.CDT_INCLUDE :
case IPathEntry.CDT_MACRO :
- addPathToResourceGroup(cpelements[j], null, newGroup);
+ addPathToResourceGroup(cpelement, null, newGroup);
}
}
}
@@ -955,7 +954,7 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
}
protected CPElement[] openWorkspacePathEntryDialog(CPElement existing) {
- Class[] acceptedClasses = new Class[]{ICProject.class, IProject.class, IContainer.class, ICContainer.class};
+ Class<?>[] acceptedClasses = new Class[]{ICProject.class, IProject.class, IContainer.class, ICContainer.class};
TypedElementSelectionValidator validator = new TypedElementSelectionValidator(acceptedClasses, existing == null);
ViewerFilter filter = new TypedViewerFilter(acceptedClasses);
@@ -1080,7 +1079,7 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
* @see org.eclipse.cdt.internal.ui.dialogs.cpaths.CPathBasePage#getSelection()
*/
@Override
- public List getSelection() {
+ public List<?> getSelection() {
return fIncludeSymPathsList.getSelectedElements();
}
@@ -1090,7 +1089,7 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
* @see org.eclipse.cdt.internal.ui.dialogs.cpaths.CPathBasePage#setSelection(java.util.List)
*/
@Override
- public void setSelection(List selElements) {
+ public void setSelection(List<?> selElements) {
fIncludeSymPathsList.selectElements(new StructuredSelection(selElements));
}
@@ -1108,15 +1107,15 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage
}
@Override
- public List getCPaths() {
- List cPaths = new ArrayList();
- List groups = fIncludeSymPathsList.getElements();
+ public List<CPElement> getCPaths() {
+ List<CPElement> cPaths = new ArrayList<CPElement>();
+ List<CPElementGroup> groups = fIncludeSymPathsList.getElements();
for (int i = 0; i < groups.size(); i++) {
- CPElementGroup group = (CPElementGroup)groups.get(i);
+ CPElementGroup group = groups.get(i);
CPElement[] elements = group.getChildren();
- for (int j = 0; j < elements.length; j++) {
- if (elements[j].getInherited() == null) {
- cPaths.add(elements[j]);
+ for (CPElement element : elements) {
+ if (element.getInherited() == null) {
+ cPaths.add(element);
}
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryPerFilePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryPerFilePage.java
index 1e18a3b9a7e..52522249326 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryPerFilePage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryPerFilePage.java
@@ -12,33 +12,8 @@ package org.eclipse.cdt.internal.ui.dialogs.cpaths;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Iterator;
import java.util.List;
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.model.CoreModelUtil;
-import org.eclipse.cdt.core.model.ICContainer;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.ICProject;
-import org.eclipse.cdt.core.model.IContainerEntry;
-import org.eclipse.cdt.core.model.IIncludeEntry;
-import org.eclipse.cdt.core.model.IMacroEntry;
-import org.eclipse.cdt.core.model.IPathEntry;
-import org.eclipse.cdt.core.model.ITranslationUnit;
-import org.eclipse.cdt.internal.ui.CPluginImages;
-import org.eclipse.cdt.internal.ui.ICHelpContextIds;
-import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener;
-import org.eclipse.cdt.internal.ui.dialogs.TypedElementSelectionValidator;
-import org.eclipse.cdt.internal.ui.dialogs.TypedViewerFilter;
-import org.eclipse.cdt.internal.ui.util.PixelConverter;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.SelectionButtonDialogField;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.TreeListDialogField;
-import org.eclipse.cdt.ui.CElementContentProvider;
-import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -67,9 +42,35 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.CoreModelUtil;
+import org.eclipse.cdt.core.model.ICContainer;
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.model.IContainerEntry;
+import org.eclipse.cdt.core.model.IIncludeEntry;
+import org.eclipse.cdt.core.model.IMacroEntry;
+import org.eclipse.cdt.core.model.IPathEntry;
+import org.eclipse.cdt.core.model.ITranslationUnit;
+import org.eclipse.cdt.ui.CElementContentProvider;
+import org.eclipse.cdt.ui.CUIPlugin;
+
+import org.eclipse.cdt.internal.ui.CPluginImages;
+import org.eclipse.cdt.internal.ui.ICHelpContextIds;
+import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener;
+import org.eclipse.cdt.internal.ui.dialogs.TypedElementSelectionValidator;
+import org.eclipse.cdt.internal.ui.dialogs.TypedViewerFilter;
+import org.eclipse.cdt.internal.ui.util.PixelConverter;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.SelectionButtonDialogField;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.TreeListDialogField;
+
public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryBasePage {
- private TreeListDialogField fIncludeSymPathsList;
+ private TreeListDialogField<CPElementGroup> fIncludeSymPathsList;
private SelectionButtonDialogField fShowInheritedPaths;
private ICElement fCurrCElement;
private ICProject fCurrCProject;
@@ -150,28 +151,28 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
}
- private class IncludeSymbolAdapter implements IDialogFieldListener, ITreeListAdapter {
+ private class IncludeSymbolAdapter implements IDialogFieldListener, ITreeListAdapter<CPElementGroup> {
private final Object[] EMPTY_ARR = new Object[0];
// -------- IListAdapter --------
- public void customButtonPressed(TreeListDialogField field, int index) {
+ public void customButtonPressed(TreeListDialogField<CPElementGroup> field, int index) {
listCustomButtonPressed(field, index);
}
- public void selectionChanged(TreeListDialogField field) {
+ public void selectionChanged(TreeListDialogField<CPElementGroup> field) {
listPageSelectionChanged(field);
}
- public void doubleClicked(TreeListDialogField field) {
+ public void doubleClicked(TreeListDialogField<CPElementGroup> field) {
listPageDoubleClicked(field);
}
- public void keyPressed(TreeListDialogField field, KeyEvent event) {
+ public void keyPressed(TreeListDialogField<CPElementGroup> field, KeyEvent event) {
listPageKeyPressed(field, event);
}
- public Object[] getChildren(TreeListDialogField field, Object element) {
+ public Object[] getChildren(TreeListDialogField<CPElementGroup> field, Object element) {
if (element instanceof CPElement) {
return ((CPElement)element).getChildren();
} else if (element instanceof CPElementGroup) {
@@ -180,7 +181,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
return EMPTY_ARR;
}
- public Object getParent(TreeListDialogField field, Object element) {
+ public Object getParent(TreeListDialogField<CPElementGroup> field, Object element) {
if (element instanceof CPElementGroup) {
return ((CPElementGroup)element).getParent();
} else if (element instanceof CPElement) {
@@ -189,7 +190,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
return null;
}
- public boolean hasChildren(TreeListDialogField field, Object element) {
+ public boolean hasChildren(TreeListDialogField<CPElementGroup> field, Object element) {
if (element instanceof CPElementGroup) {
return true;
}
@@ -211,7 +212,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
super(CPathEntryMessages.getString("IncludeSymbolEntryPage.title")); //$NON-NLS-1$
fContext = context;
IncludeSymbolAdapter adapter = new IncludeSymbolAdapter();
- fIncludeSymPathsList = new TreeListDialogField(adapter, buttonLabel, new CPElementLabelProvider(true, false)) {
+ fIncludeSymPathsList = new TreeListDialogField<CPElementGroup>(adapter, buttonLabel, new CPElementLabelProvider(true, false)) {
@Override
protected int getTreeStyle() {
@@ -263,10 +264,10 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
}
@Override
- public void init(ICElement cElement, List cPaths) {
+ public void init(ICElement cElement, List<CPElement> cPaths) {
fCurrCElement = cElement;
fCurrCProject = cElement.getCProject();
- List elements = createGroups(cElement, cPaths);
+ List<CPElementGroup> elements = createGroups(cElement, cPaths);
fIncludeSymPathsList.setElements(elements);
updateStatus();
}
@@ -275,9 +276,9 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
CPElement entryError = null;
int nErrorEntries = 0;
IStatus status = Status.OK_STATUS;
- List elements = getCPaths();
+ List<CPElement> elements = getCPaths();
for (int i = elements.size() - 1; i >= 0; i--) {
- CPElement currElement = (CPElement)elements.get(i);
+ CPElement currElement = elements.get(i);
if (currElement.getStatus().getSeverity() != IStatus.OK) {
nErrorEntries++;
if (entryError == null) {
@@ -287,7 +288,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
}
if (nErrorEntries > 0) {
- if (nErrorEntries == 1) {
+ if (nErrorEntries == 1 && entryError != null) {
status = entryError.getStatus();
} else {
status = new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID, -1, CPathEntryMessages.getFormattedString(
@@ -298,7 +299,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
fContext.statusChanged(status);
}
- private void updateStatus(List selected) {
+ private void updateStatus(List<?> selected) {
if (selected.size() != 1) {
updateStatus();
return;
@@ -317,14 +318,14 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
}
}
- private List createGroups(ICElement element, List cPaths) {
+ private List<CPElementGroup> createGroups(ICElement element, List<CPElement> cPaths) {
// create resource groups
- List resourceGroups = new ArrayList(5);
+ List<CPElementGroup> resourceGroups = new ArrayList<CPElementGroup>(5);
fTopGroup = new CPElementGroup(element.getResource());
resourceGroups.add(fTopGroup);
// add containers first so that they appear at top of list
for (int i = 0; i < cPaths.size(); i++) {
- CPElement cpelement = (CPElement)cPaths.get(i);
+ CPElement cpelement = cPaths.get(i);
switch (cpelement.getEntryKind()) {
case IPathEntry.CDT_CONTAINER :
fTopGroup.addChild(cpelement);
@@ -332,7 +333,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
}
}
for (int i = 0; i < cPaths.size(); i++) {
- CPElement cpelement = (CPElement)cPaths.get(i);
+ CPElement cpelement = cPaths.get(i);
switch (cpelement.getEntryKind()) {
case IPathEntry.CDT_INCLUDE :
case IPathEntry.CDT_INCLUDE_FILE :
@@ -343,7 +344,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
if (ndx == -1) {
resourceGroups.add(resGroup);
} else {
- resGroup = (CPElementGroup)resourceGroups.get(ndx);
+ resGroup = resourceGroups.get(ndx);
}
resGroup.addChild(cpelement);
}
@@ -352,7 +353,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
// place each path in its appropriate inherited group (or not if
// excluded)
for (int i = 0; i < cPaths.size(); i++) {
- CPElement cpelement = (CPElement)cPaths.get(i);
+ CPElement cpelement = cPaths.get(i);
switch (cpelement.getEntryKind()) {
case IPathEntry.CDT_INCLUDE :
case IPathEntry.CDT_INCLUDE_FILE :
@@ -393,33 +394,33 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
}
}
- private void addPathToResourceGroups(CPElement element, CPElementGroup parent, List groups) {
+ private void addPathToResourceGroups(CPElement element, CPElementGroup parent, List<CPElementGroup> groups) {
if (parent != null) {
parent.addChild(element);
}
for (int i = 0; i < groups.size(); i++) {
- CPElementGroup group = (CPElementGroup)groups.get(i);
+ CPElementGroup group = groups.get(i);
addPathToResourceGroup(element, parent, group);
}
}
- private void updatePathOnResourceGroups(CPElement element, List groups) {
+ private void updatePathOnResourceGroups(CPElement element, List<CPElementGroup> groups) {
CPElementGroup parent = element.getParent();
IPath resPath = element.getPath();
IPath[] exclusions = (IPath[])element.getAttribute(CPElement.EXCLUSION);
for (int i = 0; i < groups.size(); i++) {
- CPElementGroup group = (CPElementGroup)groups.get(i);
+ CPElementGroup group = groups.get(i);
if (group != parent) {
boolean found = false;
CPElement[] elements = group.getChildren(element.getEntryKind());
- for (int j = 0; j < elements.length; j++) {
- if (elements[j].getInherited() == element) {
+ for (CPElement element2 : elements) {
+ if (element2.getInherited() == element) {
found = true;
if (!CoreModelUtil.isExcludedPath(group.getResource().getFullPath().removeFirstSegments(
resPath.segmentCount()), exclusions)) {
- group.replaceChild(elements[j], new CPElement(element, group.getPath(), group.getResource()));
+ group.replaceChild(element2, new CPElement(element, group.getPath(), group.getResource()));
} else {
- group.removeChild(elements[j]);
+ group.removeChild(element2);
}
break;
}
@@ -431,7 +432,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
}
}
- private CPElement removePathFromResourceGroups(CPElement element, List groups) {
+ private CPElement removePathFromResourceGroups(CPElement element, List<CPElementGroup> groups) {
CPElement Inherited = element.getInherited();
CPElementGroup resGroup = element.getParent();
resGroup.removeChild(element);
@@ -446,11 +447,11 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
}
// remove all inherited
for (int i = 0; i < groups.size(); i++) {
- CPElementGroup group = (CPElementGroup)groups.get(i);
+ CPElementGroup group = groups.get(i);
CPElement elements[] = group.getChildren(element.getEntryKind());
- for (int j = 0; j < elements.length; j++) {
- if (elements[j].getInherited() == element) {
- group.removeChild(elements[j]);
+ for (CPElement element2 : elements) {
+ if (element2.getInherited() == element) {
+ group.removeChild(element2);
break;
}
}
@@ -458,7 +459,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
return element;
}
- private boolean canAddPath(List selected) {
+ private boolean canAddPath(List<?> selected) {
CPElementGroup group = getSelectedGroup();
if (group != null) {
return group.getEntryKind() == -1; // resource group
@@ -466,7 +467,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
return false;
}
- private boolean canRemove(List selected) {
+ private boolean canRemove(List<?> selected) {
if (selected.size() != 1) {
return false;
}
@@ -488,7 +489,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
}
private void removeEntry() {
- List selected = getSelection();
+ List<?> selected = getSelection();
Object elem = selected.get(0);
if (elem instanceof CPElement) {
CPElement element = (CPElement)elem;
@@ -509,7 +510,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
updateStatus();
}
- private boolean canEdit(List selected) {
+ private boolean canEdit(List<?> selected) {
if (selected.size() != 1) {
return false;
}
@@ -532,7 +533,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
}
private void editEntry() {
- List selElements = fIncludeSymPathsList.getSelectedElements();
+ List<?> selElements = fIncludeSymPathsList.getSelectedElements();
if (selElements.size() != 1) {
return;
}
@@ -595,7 +596,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
fIncludeSymPathsList.refresh(element);
}
- private boolean canExport(List selected) {
+ private boolean canExport(List<?> selected) {
if (selected.size() != 1) {
return false;
}
@@ -612,7 +613,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
return false;
}
- private boolean canMove(List selected) {
+ private boolean canMove(List<?> selected) {
if (selected.size() == 0) {
return false;
}
@@ -631,7 +632,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
return true;
}
- private boolean canMoveUp(List selected) {
+ private boolean canMoveUp(List<?> selected) {
if (!canMove(selected)) {
return false;
}
@@ -645,7 +646,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
return true;
}
- private boolean canMoveDown(List selected) {
+ private boolean canMoveDown(List<?> selected) {
if (!canMove(selected)) {
return false;
}
@@ -662,8 +663,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
private boolean moveUp(CPElement element) {
boolean rc = false;
int kind = element.getEntryKind();
- for (Iterator j = fIncludeSymPathsList.getElements().iterator(); j.hasNext();) {
- CPElementGroup group = (CPElementGroup)j.next();
+ for (CPElementGroup group : fIncludeSymPathsList.getElements()) {
CPElement[] children = group.getChildren(kind);
for (int k = 0; k < children.length; ++k) {
CPElement child = children[k];
@@ -695,8 +695,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
private boolean moveDown(CPElement element) {
boolean rc = false;
int kind = element.getEntryKind();
- for (Iterator j = fIncludeSymPathsList.getElements().iterator(); j.hasNext();) {
- CPElementGroup group = (CPElementGroup)j.next();
+ for (CPElementGroup group : fIncludeSymPathsList.getElements()) {
CPElement[] children = group.getChildren(kind);
for (int k = children.length - 1; k >= 0; --k) {
CPElement child = children[k];
@@ -720,7 +719,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
}
private CPElementGroup getSelectedGroup() {
- List selected = fIncludeSymPathsList.getSelectedElements();
+ List<?> selected = fIncludeSymPathsList.getSelectedElements();
if (!selected.isEmpty()) {
Object item = selected.get(0);
if (item instanceof CPElement) {
@@ -749,8 +748,8 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
updateStatus();
}
- protected void listPageSelectionChanged(TreeListDialogField field) {
- List selected = field.getSelectedElements();
+ protected void listPageSelectionChanged(TreeListDialogField<CPElementGroup> field) {
+ List<?> selected = field.getSelectedElements();
field.enableButton(IDX_REMOVE, canRemove(selected));
field.enableButton(IDX_EDIT, canEdit(selected));
field.enableButton(IDX_ADD_CONTRIBUTED, canAddPath(selected));
@@ -763,7 +762,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
updateStatus(selected);
}
- protected void listCustomButtonPressed(TreeListDialogField field, int index) {
+ protected void listCustomButtonPressed(TreeListDialogField<CPElementGroup> field, int index) {
switch (index) {
case IDX_ADD_FOLDER_FILE :
addNewPathResource();
@@ -808,16 +807,16 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
}
}
- protected void listPageDoubleClicked(TreeListDialogField field) {
+ protected void listPageDoubleClicked(TreeListDialogField<CPElementGroup> field) {
if (canEdit(fIncludeSymPathsList.getSelectedElements())) {
editEntry();
}
}
- protected void listPageKeyPressed(TreeListDialogField field, KeyEvent event) {
+ protected void listPageKeyPressed(TreeListDialogField<CPElementGroup> field, KeyEvent event) {
if (field == fIncludeSymPathsList) {
if (event.character == SWT.DEL && event.stateMask == 0) {
- List selection = field.getSelectedElements();
+ List<?> selection = field.getSelectedElements();
if (canEdit(selection)) {
removeEntry();
}
@@ -826,17 +825,17 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
}
protected IPathEntry[] getRawPathEntries() {
- List paths = getCPaths();
+ List<CPElement> paths = getCPaths();
IPathEntry[] currEntries = new IPathEntry[paths.size()];
for (int i = 0; i < currEntries.length; i++) {
- CPElement curr = (CPElement)paths.get(i);
+ CPElement curr = paths.get(i);
currEntries[i] = curr.getPathEntry();
}
return currEntries;
}
protected void addNewPathResource() {
- Class[] acceptedClasses = new Class[]{ICProject.class, ICContainer.class, ITranslationUnit.class};
+ Class<?>[] acceptedClasses = new Class[]{ICProject.class, ICContainer.class, ITranslationUnit.class};
TypedElementSelectionValidator validator = new TypedElementSelectionValidator(acceptedClasses, false);
ViewerFilter filter = new TypedViewerFilter(acceptedClasses);
@@ -862,19 +861,19 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
}
CPElementGroup newGroup = new CPElementGroup(resource);
if (!fIncludeSymPathsList.getElements().contains(newGroup)) {
- List groups = fIncludeSymPathsList.getElements();
+ List<CPElementGroup> groups = fIncludeSymPathsList.getElements();
for (int i = 0; i < groups.size(); i++) {
- CPElementGroup group = (CPElementGroup)groups.get(i);
+ CPElementGroup group = groups.get(i);
if (group.getPath().isPrefixOf(newGroup.getPath())) {
CPElement[] cpelements = group.getChildren();
- for (int j = 0; j < cpelements.length; j++) {
- if (cpelements[j].getInherited() == null) {
- switch (cpelements[j].getEntryKind()) {
+ for (CPElement cpelement : cpelements) {
+ if (cpelement.getInherited() == null) {
+ switch (cpelement.getEntryKind()) {
case IPathEntry.CDT_INCLUDE :
case IPathEntry.CDT_INCLUDE_FILE :
case IPathEntry.CDT_MACRO :
case IPathEntry.CDT_MACRO_FILE :
- addPathToResourceGroup(cpelements[j], null, newGroup);
+ addPathToResourceGroup(cpelement, null, newGroup);
}
}
}
@@ -1011,7 +1010,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
}
protected CPElement[] openWorkspacePathEntryDialog(CPElement existing) {
- Class[] acceptedClasses = new Class[]{ICProject.class, IProject.class, IContainer.class, ICContainer.class};
+ Class<?>[] acceptedClasses = new Class[]{ICProject.class, IProject.class, IContainer.class, ICContainer.class};
TypedElementSelectionValidator validator = new TypedElementSelectionValidator(acceptedClasses, existing == null);
ViewerFilter filter = new TypedViewerFilter(acceptedClasses);
@@ -1136,7 +1135,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
* @see org.eclipse.cdt.internal.ui.dialogs.cpaths.CPathBasePage#getSelection()
*/
@Override
- public List getSelection() {
+ public List<?> getSelection() {
return fIncludeSymPathsList.getSelectedElements();
}
@@ -1146,7 +1145,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
* @see org.eclipse.cdt.internal.ui.dialogs.cpaths.CPathBasePage#setSelection(java.util.List)
*/
@Override
- public void setSelection(List selElements) {
+ public void setSelection(List<?> selElements) {
fIncludeSymPathsList.selectElements(new StructuredSelection(selElements));
}
@@ -1164,15 +1163,15 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB
}
@Override
- public List getCPaths() {
- List cPaths = new ArrayList();
- List groups = fIncludeSymPathsList.getElements();
+ public List<CPElement> getCPaths() {
+ List<CPElement> cPaths = new ArrayList<CPElement>();
+ List<CPElementGroup> groups = fIncludeSymPathsList.getElements();
for (int i = 0; i < groups.size(); i++) {
- CPElementGroup group = (CPElementGroup)groups.get(i);
+ CPElementGroup group = groups.get(i);
CPElement[] elements = group.getChildren();
- for (int j = 0; j < elements.length; j++) {
- if (elements[j].getInherited() == null) {
- cPaths.add(elements[j]);
+ for (CPElement element : elements) {
+ if (element.getInherited() == null) {
+ cPaths.add(element);
}
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathLibraryEntryPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathLibraryEntryPage.java
index e172f9e95f0..04775c2316a 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathLibraryEntryPage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathLibraryEntryPage.java
@@ -15,21 +15,6 @@ package org.eclipse.cdt.internal.ui.dialogs.cpaths;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.cdt.core.model.ICProject;
-import org.eclipse.cdt.core.model.IContainerEntry;
-import org.eclipse.cdt.core.model.ILibraryEntry;
-import org.eclipse.cdt.core.model.IPathEntry;
-import org.eclipse.cdt.internal.ui.CPluginImages;
-import org.eclipse.cdt.internal.ui.ICHelpContextIds;
-import org.eclipse.cdt.internal.ui.dialogs.TypedElementSelectionValidator;
-import org.eclipse.cdt.internal.ui.util.PixelConverter;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.ListDialogField;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.TreeListDialogField;
-import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IResource;
@@ -53,15 +38,32 @@ import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.ui.views.navigator.ResourceComparator;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.model.IContainerEntry;
+import org.eclipse.cdt.core.model.ILibraryEntry;
+import org.eclipse.cdt.core.model.IPathEntry;
+import org.eclipse.cdt.ui.CUIPlugin;
+
+import org.eclipse.cdt.internal.ui.CPluginImages;
+import org.eclipse.cdt.internal.ui.ICHelpContextIds;
+import org.eclipse.cdt.internal.ui.dialogs.TypedElementSelectionValidator;
+import org.eclipse.cdt.internal.ui.util.PixelConverter;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.ListDialogField;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.TreeListDialogField;
+
/**
* CPathLibraryEntryPage
*/
public class CPathLibraryEntryPage extends CPathBasePage {
- private ListDialogField fCPathList;
+ private ListDialogField<CPElement> fCPathList;
private ICProject fCurrCProject;
private IPath fProjPath;
- private TreeListDialogField fLibrariesList;
+ private TreeListDialogField<CPElement> fLibrariesList;
private IWorkspaceRoot fWorkspaceRoot;
@@ -72,7 +74,7 @@ public class CPathLibraryEntryPage extends CPathBasePage {
private final int IDX_REMOVE = 5;
private final int IDX_EXPORT = 7;
- public CPathLibraryEntryPage(ListDialogField cPathList) {
+ public CPathLibraryEntryPage(ListDialogField<CPElement> cPathList) {
super(CPathEntryMessages.getString("LibrariesEntryPage.title")); //$NON-NLS-1$
setDescription(CPathEntryMessages.getString("LibrariesEntryPage.description")); //$NON-NLS-1$
@@ -92,7 +94,7 @@ public class CPathLibraryEntryPage extends CPathBasePage {
/* IDX_EXPORT */ CPathEntryMessages.getString("LibrariesEntryPage.libraries.export.button") //$NON-NLS-1$
};
- fLibrariesList = new TreeListDialogField(adapter, buttonLabels, new CPElementLabelProvider());
+ fLibrariesList = new TreeListDialogField<CPElement>(adapter, buttonLabels, new CPElementLabelProvider());
fLibrariesList.setDialogFieldListener(adapter);
fLibrariesList.setLabelText(CPathEntryMessages.getString("LibrariesEntryPage.libraries.label")); //$NON-NLS-1$
@@ -115,7 +117,7 @@ public class CPathLibraryEntryPage extends CPathBasePage {
}
private void updateLibrariesList() {
- List cpelements = filterList(fCPathList.getElements());
+ List<CPElement> cpelements = filterList(fCPathList.getElements());
fLibrariesList.setElements(cpelements);
}
@@ -123,7 +125,7 @@ public class CPathLibraryEntryPage extends CPathBasePage {
* @see org.eclipse.cdt.internal.ui.dialogs.cpaths.CPathBasePage#getSelection()
*/
@Override
- public List getSelection() {
+ public List<?> getSelection() {
return fLibrariesList.getSelectedElements();
}
@@ -131,7 +133,7 @@ public class CPathLibraryEntryPage extends CPathBasePage {
* @see org.eclipse.cdt.internal.ui.dialogs.cpaths.CPathBasePage#setSelection(java.util.List)
*/
@Override
- public void setSelection(List selElements) {
+ public void setSelection(List<?> selElements) {
fLibrariesList.selectElements(new StructuredSelection(selElements));
}
@@ -178,42 +180,42 @@ public class CPathLibraryEntryPage extends CPathBasePage {
CUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(composite, ICHelpContextIds.PROJECT_PATHS_LIBRARIES);
}
- private class LibrariesAdapter implements IDialogFieldListener, ITreeListAdapter {
+ private class LibrariesAdapter implements IDialogFieldListener, ITreeListAdapter<CPElement> {
private final Object[] EMPTY_ARR= new Object[0];
// -------- IListAdapter --------
- public void customButtonPressed(TreeListDialogField field, int index) {
+ public void customButtonPressed(TreeListDialogField<CPElement> field, int index) {
libraryPageCustomButtonPressed(field, index);
}
- public void selectionChanged(TreeListDialogField field) {
+ public void selectionChanged(TreeListDialogField<CPElement> field) {
libraryPageSelectionChanged(field);
}
- public void doubleClicked(TreeListDialogField field) {
+ public void doubleClicked(TreeListDialogField<CPElement> field) {
libraryPageDoubleClicked(field);
}
- public void keyPressed(TreeListDialogField field, KeyEvent event) {
+ public void keyPressed(TreeListDialogField<CPElement> field, KeyEvent event) {
libraryPageKeyPressed(field, event);
}
- public Object[] getChildren(TreeListDialogField field, Object element) {
+ public Object[] getChildren(TreeListDialogField<CPElement> field, Object element) {
if (element instanceof CPElement) {
return ((CPElement) element).getChildren();
}
return EMPTY_ARR;
}
- public Object getParent(TreeListDialogField field, Object element) {
+ public Object getParent(TreeListDialogField<CPElement> field, Object element) {
if (element instanceof CPElementAttribute) {
return ((CPElementAttribute) element).getParent();
}
return null;
}
- public boolean hasChildren(TreeListDialogField field, Object element) {
+ public boolean hasChildren(TreeListDialogField<CPElement> field, Object element) {
// return (element instanceof CPElement);
return false;
}
@@ -251,8 +253,8 @@ public class CPathLibraryEntryPage extends CPathBasePage {
if (libentries != null) {
int nElementsChosen= libentries.length;
// remove duplicates
- List cplist= fLibrariesList.getElements();
- List elementsToAdd= new ArrayList(nElementsChosen);
+ List<CPElement> cplist= fLibrariesList.getElements();
+ List<CPElement> elementsToAdd= new ArrayList<CPElement>(nElementsChosen);
for (int i= 0; i < nElementsChosen; i++) {
CPElement curr= libentries[i];
@@ -270,7 +272,7 @@ public class CPathLibraryEntryPage extends CPathBasePage {
}
}
- private boolean canExport(List selElements) {
+ private boolean canExport(List<?> selElements) {
if (selElements.size() == 0) {
return false;
}
@@ -291,7 +293,7 @@ public class CPathLibraryEntryPage extends CPathBasePage {
}
private void exportEntry() {
- List selElements = fLibrariesList.getSelectedElements();
+ List<?> selElements = fLibrariesList.getSelectedElements();
if (selElements.size() != 1) {
return;
}
@@ -302,17 +304,17 @@ public class CPathLibraryEntryPage extends CPathBasePage {
}
}
- protected void libraryPageDoubleClicked(TreeListDialogField field) {
- List selection= fLibrariesList.getSelectedElements();
+ protected void libraryPageDoubleClicked(TreeListDialogField<CPElement> field) {
+ List<?> selection= fLibrariesList.getSelectedElements();
if (canEdit(selection)) {
editEntry();
}
}
- protected void libraryPageKeyPressed(TreeListDialogField field, KeyEvent event) {
+ protected void libraryPageKeyPressed(TreeListDialogField<CPElement> field, KeyEvent event) {
if (field == fLibrariesList) {
if (event.character == SWT.DEL && event.stateMask == 0) {
- List selection= field.getSelectedElements();
+ List<?> selection= field.getSelectedElements();
if (canRemove(selection)) {
removeEntry();
}
@@ -321,7 +323,7 @@ public class CPathLibraryEntryPage extends CPathBasePage {
}
private void removeEntry() {
- List selElements= fLibrariesList.getSelectedElements();
+ List<?> selElements= fLibrariesList.getSelectedElements();
for (int i= selElements.size() - 1; i >= 0 ; i--) {
Object elem= selElements.get(i);
if (elem instanceof CPElementAttribute) {
@@ -339,7 +341,7 @@ public class CPathLibraryEntryPage extends CPathBasePage {
}
}
- private boolean canRemove(List selElements) {
+ private boolean canRemove(List<?> selElements) {
if (selElements.size() == 0) {
return false;
}
@@ -363,7 +365,7 @@ public class CPathLibraryEntryPage extends CPathBasePage {
* Method editEntry.
*/
private void editEntry() {
- List selElements= fLibrariesList.getSelectedElements();
+ List<?> selElements= fLibrariesList.getSelectedElements();
if (selElements.size() != 1) {
return;
}
@@ -409,17 +411,17 @@ public class CPathLibraryEntryPage extends CPathBasePage {
}
protected void libraryPageSelectionChanged(DialogField field) {
- List selElements= fLibrariesList.getSelectedElements();
+ List<?> selElements= fLibrariesList.getSelectedElements();
fLibrariesList.enableButton(IDX_EDIT, canEdit(selElements));
fLibrariesList.enableButton(IDX_REMOVE, canRemove(selElements));
fLibrariesList.enableButton(IDX_EXPORT, canExport(selElements));
}
private IFile[] getUsedLibFiles(CPElement existing) {
- List res= new ArrayList();
- List cplist= fLibrariesList.getElements();
+ List<IResource> res= new ArrayList<IResource>();
+ List<CPElement> cplist= fLibrariesList.getElements();
for (int i= 0; i < cplist.size(); i++) {
- CPElement elem= (CPElement)cplist.get(i);
+ CPElement elem= cplist.get(i);
if (elem.getEntryKind() == IPathEntry.CDT_LIBRARY && (elem != existing)) {
IResource resource= elem.getResource();
if (resource instanceof IFile) {
@@ -427,7 +429,7 @@ public class CPathLibraryEntryPage extends CPathBasePage {
}
}
}
- return (IFile[]) res.toArray(new IFile[res.size()]);
+ return res.toArray(new IFile[res.size()]);
}
private CPElement newCPLibraryElement(IPath libraryPath) {
@@ -466,7 +468,7 @@ public class CPathLibraryEntryPage extends CPathBasePage {
}
private CPElement[] openLibFileDialog(CPElement existing) {
- Class[] acceptedClasses= new Class[] { IFile.class };
+ Class<?>[] acceptedClasses= new Class[] { IFile.class };
TypedElementSelectionValidator validator= new TypedElementSelectionValidator(acceptedClasses, existing == null);
ViewerFilter filter= new ArchiveFileFilter(getUsedLibFiles(existing), true);
@@ -504,7 +506,7 @@ public class CPathLibraryEntryPage extends CPathBasePage {
protected IPathEntry[] getRawPathEntries() {
IPathEntry[] currEntries = new IPathEntry[fCPathList.getSize()];
for (int i = 0; i < currEntries.length; i++) {
- CPElement curr = (CPElement) fCPathList.getElement(i);
+ CPElement curr = fCPathList.getElement(i);
currEntries[i] = curr.getPathEntry();
}
return currEntries;
@@ -539,7 +541,7 @@ public class CPathLibraryEntryPage extends CPathBasePage {
return null;
}
- private boolean canEdit(List selElements) {
+ private boolean canEdit(List<?> selElements) {
if (selElements.size() != 1) {
return false;
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathOrderExportPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathOrderExportPage.java
index c763d0ec921..a60e8538c0e 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathOrderExportPage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathOrderExportPage.java
@@ -12,11 +12,6 @@ package org.eclipse.cdt.internal.ui.dialogs.cpaths;
import java.util.List;
-import org.eclipse.cdt.internal.ui.CPluginImages;
-import org.eclipse.cdt.internal.ui.util.PixelConverter;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.ListDialogField;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -24,11 +19,17 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.cdt.internal.ui.CPluginImages;
+import org.eclipse.cdt.internal.ui.util.PixelConverter;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.ListDialogField;
+
public class CPathOrderExportPage extends CPathBasePage {
- private ListDialogField fCPathList;
+ private ListDialogField<?> fCPathList;
- public CPathOrderExportPage(ListDialogField cPathList) {
+ public CPathOrderExportPage(ListDialogField<?> cPathList) {
super(CPathEntryMessages.getString("OrderExportsPage.title")); //$NON-NLS-1$
setDescription(CPathEntryMessages.getString("OrderExportsPage.description")); //$NON-NLS-1$
fCPathList = cPathList;
@@ -61,7 +62,7 @@ public class CPathOrderExportPage extends CPathBasePage {
* @see BuildPathBasePage#getSelection
*/
@Override
- public List getSelection() {
+ public List<?> getSelection() {
return fCPathList.getSelectedElements();
}
@@ -69,7 +70,7 @@ public class CPathOrderExportPage extends CPathBasePage {
* @see BuildPathBasePage#setSelection
*/
@Override
- public void setSelection(List selElements) {
+ public void setSelection(List<?> selElements) {
fCPathList.selectElements(new StructuredSelection(selElements));
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathOutputEntryPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathOutputEntryPage.java
index 52c620d44be..6871ecb03b0 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathOutputEntryPage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathOutputEntryPage.java
@@ -17,30 +17,17 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
-import org.eclipse.cdt.core.model.ICProject;
-import org.eclipse.cdt.core.model.IPathEntry;
-import org.eclipse.cdt.internal.ui.CPluginImages;
-import org.eclipse.cdt.internal.ui.ICHelpContextIds;
-import org.eclipse.cdt.internal.ui.dialogs.TypedViewerFilter;
-import org.eclipse.cdt.internal.ui.util.PixelConverter;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.ListDialogField;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.TreeListDialogField;
-import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -54,21 +41,36 @@ import org.eclipse.ui.dialogs.NewFolderDialog;
import org.eclipse.ui.model.BaseWorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.model.IPathEntry;
+import org.eclipse.cdt.ui.CUIPlugin;
+
+import org.eclipse.cdt.internal.ui.CPluginImages;
+import org.eclipse.cdt.internal.ui.ICHelpContextIds;
+import org.eclipse.cdt.internal.ui.dialogs.TypedViewerFilter;
+import org.eclipse.cdt.internal.ui.util.PixelConverter;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.ListDialogField;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.TreeListDialogField;
+
public class CPathOutputEntryPage extends CPathBasePage {
- private ListDialogField fCPathList;
+ private ListDialogField<CPElement> fCPathList;
private ICProject fCurrCProject;
private IPath fProjPath;
private IWorkspaceRoot fWorkspaceRoot;
- private TreeListDialogField fOutputList;
+ private TreeListDialogField<CPElement> fOutputList;
private final int IDX_ADD = 0;
private final int IDX_EDIT = 2;
private final int IDX_REMOVE = 3;
- public CPathOutputEntryPage(ListDialogField cPathList) {
+ public CPathOutputEntryPage(ListDialogField<CPElement> cPathList) {
super(CPathEntryMessages.getString("OutputPathEntryPage.title")); //$NON-NLS-1$
setDescription(CPathEntryMessages.getString("OutputPathEntryPage.description")); //$NON-NLS-1$
@@ -85,7 +87,7 @@ public class CPathOutputEntryPage extends CPathBasePage {
/* 3 = IDX_REMOVE */CPathEntryMessages.getString("OutputPathEntryPage.folders.remove.button") //$NON-NLS-1$
};
- fOutputList = new TreeListDialogField(adapter, buttonLabels, new CPElementLabelProvider());
+ fOutputList = new TreeListDialogField<CPElement>(adapter, buttonLabels, new CPElementLabelProvider());
fOutputList.setDialogFieldListener(adapter);
fOutputList.setLabelText(CPathEntryMessages.getString("OutputPathEntryPage.folders.label")); //$NON-NLS-1$
@@ -108,11 +110,11 @@ public class CPathOutputEntryPage extends CPathBasePage {
private void updateFoldersList() {
- List folders = filterList(fCPathList.getElements());
+ List<CPElement> folders = filterList(fCPathList.getElements());
fOutputList.setElements(folders);
for (int i = 0; i < folders.size(); i++) {
- CPElement cpe = (CPElement)folders.get(i);
+ CPElement cpe = folders.get(i);
IPath[] patterns = (IPath[])cpe.getAttribute(CPElement.EXCLUSION);
if (patterns.length > 0) {
fOutputList.expandElement(cpe, 3);
@@ -132,9 +134,9 @@ public class CPathOutputEntryPage extends CPathBasePage {
fOutputList.setButtonsMinWidth(buttonBarWidth);
// expand
- List elements = fOutputList.getElements();
+ List<CPElement> elements = fOutputList.getElements();
for (int i = 0; i < elements.size(); i++) {
- CPElement elem = (CPElement)elements.get(i);
+ CPElement elem = elements.get(i);
IPath[] patterns = (IPath[])elem.getAttribute(CPElement.EXCLUSION);
if (patterns.length > 0) {
fOutputList.expandElement(elem, 3);
@@ -145,42 +147,42 @@ public class CPathOutputEntryPage extends CPathBasePage {
CUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(composite, ICHelpContextIds.PROJECT_PATHS_OUTPUT);
}
- private class OutputContainerAdapter implements ITreeListAdapter, IDialogFieldListener {
+ private class OutputContainerAdapter implements ITreeListAdapter<CPElement>, IDialogFieldListener {
private final Object[] EMPTY_ARR = new Object[0];
// -------- IListAdapter --------
- public void customButtonPressed(TreeListDialogField field, int index) {
+ public void customButtonPressed(TreeListDialogField<CPElement> field, int index) {
outputPageCustomButtonPressed(field, index);
}
- public void selectionChanged(TreeListDialogField field) {
+ public void selectionChanged(TreeListDialogField<CPElement> field) {
outputPageSelectionChanged(field);
}
- public void doubleClicked(TreeListDialogField field) {
+ public void doubleClicked(TreeListDialogField<CPElement> field) {
outputPageDoubleClicked(field);
}
- public void keyPressed(TreeListDialogField field, KeyEvent event) {
+ public void keyPressed(TreeListDialogField<CPElement> field, KeyEvent event) {
outputPageKeyPressed(field, event);
}
- public Object[] getChildren(TreeListDialogField field, Object element) {
+ public Object[] getChildren(TreeListDialogField<CPElement> field, Object element) {
if (element instanceof CPElement) {
return ((CPElement)element).getChildren();
}
return EMPTY_ARR;
}
- public Object getParent(TreeListDialogField field, Object element) {
+ public Object getParent(TreeListDialogField<CPElement> field, Object element) {
if (element instanceof CPElementAttribute) {
return ((CPElementAttribute)element).getParent();
}
return null;
}
- public boolean hasChildren(TreeListDialogField field, Object element) {
+ public boolean hasChildren(TreeListDialogField<CPElement> field, Object element) {
return (element instanceof CPElement);
}
@@ -191,10 +193,10 @@ public class CPathOutputEntryPage extends CPathBasePage {
}
- protected void outputPageKeyPressed(TreeListDialogField field, KeyEvent event) {
+ protected void outputPageKeyPressed(TreeListDialogField<CPElement> field, KeyEvent event) {
if (field == fOutputList) {
if (event.character == SWT.DEL && event.stateMask == 0) {
- List selection = field.getSelectedElements();
+ List<?> selection = field.getSelectedElements();
if (canRemove(selection)) {
removeEntry();
}
@@ -202,9 +204,9 @@ public class CPathOutputEntryPage extends CPathBasePage {
}
}
- protected void outputPageDoubleClicked(TreeListDialogField field) {
+ protected void outputPageDoubleClicked(TreeListDialogField<CPElement> field) {
if (field == fOutputList) {
- List selection = field.getSelectedElements();
+ List<?> selection = field.getSelectedElements();
if (canEdit(selection)) {
editEntry();
}
@@ -214,8 +216,8 @@ public class CPathOutputEntryPage extends CPathBasePage {
private boolean hasFolders(IContainer container) {
try {
IResource[] members = container.members();
- for (int i = 0; i < members.length; i++) {
- if (members[i] instanceof IContainer) {
+ for (IResource member : members) {
+ if (member instanceof IContainer) {
return true;
}
}
@@ -228,14 +230,14 @@ public class CPathOutputEntryPage extends CPathBasePage {
protected void outputPageCustomButtonPressed(DialogField field, int index) {
if (field == fOutputList) {
if (index == IDX_ADD) {
- List elementsToAdd = new ArrayList(10);
+ List<CPElement> elementsToAdd = new ArrayList<CPElement>(10);
IProject project = fCurrCProject.getProject();
if (project.exists()) {
if (hasFolders(project)) {
CPElement[] srcentries = openOutputContainerDialog(null);
if (srcentries != null) {
- for (int i = 0; i < srcentries.length; i++) {
- elementsToAdd.add(srcentries[i]);
+ for (CPElement srcentrie : srcentries) {
+ elementsToAdd.add(srcentrie);
}
}
} else {
@@ -251,14 +253,14 @@ public class CPathOutputEntryPage extends CPathBasePage {
}
}
if (!elementsToAdd.isEmpty()) {
- HashSet modifiedElements = new HashSet();
+ HashSet<CPElement> modifiedElements = new HashSet<CPElement>();
askForAddingExclusionPatternsDialog(elementsToAdd, modifiedElements);
fOutputList.addElements(elementsToAdd);
fOutputList.postSetSelection(new StructuredSelection(elementsToAdd));
if (!modifiedElements.isEmpty()) {
- for (Iterator iter = modifiedElements.iterator(); iter.hasNext();) {
+ for (Iterator<CPElement> iter = modifiedElements.iterator(); iter.hasNext();) {
Object elem = iter.next();
fOutputList.refresh(elem);
fOutputList.expandElement(elem, 3);
@@ -275,7 +277,7 @@ public class CPathOutputEntryPage extends CPathBasePage {
}
private void editEntry() {
- List selElements = fOutputList.getSelectedElements();
+ List<?> selElements = fOutputList.getSelectedElements();
if (selElements.size() != 1) {
return;
}
@@ -311,13 +313,13 @@ public class CPathOutputEntryPage extends CPathBasePage {
}
protected void outputPageSelectionChanged(DialogField field) {
- List selected = fOutputList.getSelectedElements();
+ List<?> selected = fOutputList.getSelectedElements();
fOutputList.enableButton(IDX_EDIT, canEdit(selected));
fOutputList.enableButton(IDX_REMOVE, canRemove(selected));
}
private void removeEntry() {
- List selElements = fOutputList.getSelectedElements();
+ List<Object> selElements = fOutputList.getSelectedElements();
for (int i = selElements.size() - 1; i >= 0; i--) {
Object elem = selElements.get(i);
if (elem instanceof CPElementAttribute) {
@@ -336,7 +338,7 @@ public class CPathOutputEntryPage extends CPathBasePage {
}
}
- private boolean canRemove(List selElements) {
+ private boolean canRemove(List<?> selElements) {
if (selElements.size() == 0) {
return false;
}
@@ -361,7 +363,7 @@ public class CPathOutputEntryPage extends CPathBasePage {
return true;
}
- private boolean canEdit(List selElements) {
+ private boolean canEdit(List<?> selElements) {
if (selElements.size() != 1) {
return false;
}
@@ -387,15 +389,15 @@ public class CPathOutputEntryPage extends CPathBasePage {
}
private void updateCPathList() {
- List srcelements = fOutputList.getElements();
+ List<CPElement> srcelements = fOutputList.getElements();
- List cpelements = fCPathList.getElements();
+ List<CPElement> cpelements = fCPathList.getElements();
int nEntries = cpelements.size();
// backwards, as entries will be deleted
int lastRemovePos = nEntries;
int afterLastSourcePos = 0;
for (int i = nEntries - 1; i >= 0; i--) {
- CPElement cpe = (CPElement)cpelements.get(i);
+ CPElement cpe = cpelements.get(i);
int kind = cpe.getEntryKind();
if (isEntryKind(kind)) {
if (!srcelements.remove(cpe)) {
@@ -439,7 +441,7 @@ public class CPathOutputEntryPage extends CPathBasePage {
return null;
}
- private void askForAddingExclusionPatternsDialog(List newEntries, Set modifiedEntries) {
+ private void askForAddingExclusionPatternsDialog(List<CPElement> newEntries, Set<CPElement> modifiedEntries) {
fixNestingConflicts(newEntries, fOutputList.getElements(), modifiedEntries);
if (!modifiedEntries.isEmpty()) {
String title = CPathEntryMessages.getString("OutputPathEntryPage.exclusion_added.title"); //$NON-NLS-1$
@@ -450,11 +452,11 @@ public class CPathOutputEntryPage extends CPathBasePage {
private CPElement[] openOutputContainerDialog(CPElement existing) {
- Class[] acceptedClasses = new Class[]{IProject.class, IFolder.class};
- List existingContainers = getExistingContainers(null);
+ Class<?>[] acceptedClasses = new Class[]{IProject.class, IFolder.class};
+ List<IContainer> existingContainers = getExistingContainers(null);
IProject[] allProjects = fWorkspaceRoot.getProjects();
- ArrayList rejectedElements = new ArrayList(allProjects.length);
+ ArrayList<IProject> rejectedElements = new ArrayList<IProject>(allProjects.length);
IProject currProject = fCurrCProject.getProject();
for (int i = 0; i < allProjects.length; i++) {
if (!allProjects[i].equals(currProject)) {
@@ -497,15 +499,15 @@ public class CPathOutputEntryPage extends CPathBasePage {
return null;
}
- private List getExistingContainers(CPElement existing) {
- List res = new ArrayList();
- List cplist = fOutputList.getElements();
+ private List<IContainer> getExistingContainers(CPElement existing) {
+ List<IContainer> res = new ArrayList<IContainer>();
+ List<CPElement> cplist = fOutputList.getElements();
for (int i = 0; i < cplist.size(); i++) {
- CPElement elem = (CPElement)cplist.get(i);
+ CPElement elem = cplist.get(i);
if (elem != existing) {
IResource resource = elem.getResource();
if (resource instanceof IContainer) { // defensive code
- res.add(resource);
+ res.add((IContainer) resource);
}
}
}
@@ -521,7 +523,7 @@ public class CPathOutputEntryPage extends CPathBasePage {
* @see BuildPathBasePage#getSelection
*/
@Override
- public List getSelection() {
+ public List<Object> getSelection() {
return fOutputList.getSelectedElements();
}
@@ -529,7 +531,7 @@ public class CPathOutputEntryPage extends CPathBasePage {
* @see BuildPathBasePage#setSelection
*/
@Override
- public void setSelection(List selElements) {
+ public void setSelection(List<?> selElements) {
fOutputList.selectElements(new StructuredSelection(selElements));
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathProjectsEntryPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathProjectsEntryPage.java
index 3ff353ac5b6..a589fdb444a 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathProjectsEntryPage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathProjectsEntryPage.java
@@ -13,10 +13,23 @@ package org.eclipse.cdt.internal.ui.dialogs.cpaths;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICModel;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.IPathEntry;
+import org.eclipse.cdt.ui.CUIPlugin;
+
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
import org.eclipse.cdt.internal.ui.util.PixelConverter;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.CheckedListDialogField;
@@ -24,24 +37,14 @@ import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.ListDialogField;
-import org.eclipse.cdt.ui.CUIPlugin;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
public class CPathProjectsEntryPage extends CPathBasePage {
- private CheckedListDialogField fProjectsList;
+ private CheckedListDialogField<CPElement> fProjectsList;
ICProject fCurrCProject;
- private ListDialogField fCPathList;
+ private ListDialogField<CPElement> fCPathList;
- public CPathProjectsEntryPage(ListDialogField cPathList) {
+ public CPathProjectsEntryPage(ListDialogField<CPElement> cPathList) {
super(CPathEntryMessages.getString("ProjectsEntryPage.title")); //$NON-NLS-1$
setDescription(CPathEntryMessages.getString("ProjectsEntryPage.description")); //$NON-NLS-1$
ProjectsListListener listener = new ProjectsListListener();
@@ -49,7 +52,7 @@ public class CPathProjectsEntryPage extends CPathBasePage {
String[] buttonLabels = new String[] { /* 0 */CPathEntryMessages.getString("ProjectsEntryPage.projects.checkall.button"), //$NON-NLS-1$
/* 1 */CPathEntryMessages.getString("ProjectsEntryWorkbookPage.projects.uncheckall.button")}; //$NON-NLS-1$
- fProjectsList = new CheckedListDialogField(null, buttonLabels, new CPElementLabelProvider());
+ fProjectsList = new CheckedListDialogField<CPElement>(null, buttonLabels, new CPElementLabelProvider());
fProjectsList.setDialogFieldListener(listener);
fProjectsList.setLabelText(CPathEntryMessages.getString("ProjectsEntryPage.projects.label")); //$NON-NLS-1$
fProjectsList.setCheckAllButtonIndex(0);
@@ -123,19 +126,19 @@ public class CPathProjectsEntryPage extends CPathBasePage {
void updateProjectsList(ICProject currCProject) {
ICModel cmodel = currCProject.getCModel();
- List projects = new ArrayList();
- final List checkedProjects = new ArrayList();
+ List<CPElement> projects = new ArrayList<CPElement>();
+ final List<CPElement> checkedProjects = new ArrayList<CPElement>();
try {
ICProject[] cprojects = cmodel.getCProjects();
// a vector remembering all projects that dont have to be added anymore
- List existingProjects = new ArrayList(cprojects.length);
+ List<IResource> existingProjects = new ArrayList<IResource>(cprojects.length);
existingProjects.add(currCProject.getProject());
// add the projects-cpentries that are already on the C Path
- List cpelements = fCPathList.getElements();
+ List<CPElement> cpelements = fCPathList.getElements();
for (int i = cpelements.size() - 1; i >= 0; i--) {
- CPElement cpelem = (CPElement) cpelements.get(i);
+ CPElement cpelem = cpelements.get(i);
if (isEntryKind(cpelem.getEntryKind())) {
existingProjects.add(cpelem.getResource());
projects.add(cpelem);
@@ -143,8 +146,8 @@ public class CPathProjectsEntryPage extends CPathBasePage {
}
}
- for (int i = 0; i < cprojects.length; i++) {
- IProject proj = cprojects[i].getProject();
+ for (ICProject cproject : cprojects) {
+ IProject proj = cproject.getProject();
if (!existingProjects.contains(proj)) {
projects.add(new CPElement(fCurrCProject, IPathEntry.CDT_PROJECT, proj.getFullPath(), proj));
}
@@ -158,13 +161,13 @@ public class CPathProjectsEntryPage extends CPathBasePage {
}
void updateCPathList() {
- List projelements = fProjectsList.getCheckedElements();
+ List<CPElement> projelements = fProjectsList.getCheckedElements();
boolean remove = false;
- List pelements = fCPathList.getElements();
+ List<CPElement> pelements = fCPathList.getElements();
// backwards, as entries will be deleted
for (int i = pelements.size() - 1; i >= 0; i--) {
- CPElement pe = (CPElement) pelements.get(i);
+ CPElement pe = pelements.get(i);
if (isEntryKind(pe.getEntryKind())) {
if (!projelements.remove(pe)) {
pelements.remove(i);
@@ -184,7 +187,7 @@ public class CPathProjectsEntryPage extends CPathBasePage {
* @see BuildPathBasePage#getSelection
*/
@Override
- public List getSelection() {
+ public List<CPElement> getSelection() {
return fProjectsList.getSelectedElements();
}
@@ -192,7 +195,7 @@ public class CPathProjectsEntryPage extends CPathBasePage {
* @see BuildPathBasePage#setSelection
*/
@Override
- public void setSelection(List selElements) {
+ public void setSelection(List<?> selElements) {
fProjectsList.selectElements(new StructuredSelection(selElements));
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathSourceEntryPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathSourceEntryPage.java
index b2bff5aa571..b3c184e563f 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathSourceEntryPage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathSourceEntryPage.java
@@ -13,34 +13,20 @@ package org.eclipse.cdt.internal.ui.dialogs.cpaths;
import java.util.ArrayList;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
-import org.eclipse.cdt.core.model.ICProject;
-import org.eclipse.cdt.core.model.IPathEntry;
-import org.eclipse.cdt.internal.ui.CPluginImages;
-import org.eclipse.cdt.internal.ui.ICHelpContextIds;
-import org.eclipse.cdt.internal.ui.dialogs.TypedViewerFilter;
-import org.eclipse.cdt.internal.ui.util.PixelConverter;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.ListDialogField;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.TreeListDialogField;
-import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -54,21 +40,36 @@ import org.eclipse.ui.dialogs.NewFolderDialog;
import org.eclipse.ui.model.BaseWorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.model.IPathEntry;
+import org.eclipse.cdt.ui.CUIPlugin;
+
+import org.eclipse.cdt.internal.ui.CPluginImages;
+import org.eclipse.cdt.internal.ui.ICHelpContextIds;
+import org.eclipse.cdt.internal.ui.dialogs.TypedViewerFilter;
+import org.eclipse.cdt.internal.ui.util.PixelConverter;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.ListDialogField;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.TreeListDialogField;
+
public class CPathSourceEntryPage extends CPathBasePage {
- private ListDialogField fCPathList;
+ private ListDialogField<CPElement> fCPathList;
private ICProject fCurrCProject;
private IPath fProjPath;
private IWorkspaceRoot fWorkspaceRoot;
- private TreeListDialogField fFoldersList;
+ private TreeListDialogField<CPElement> fFoldersList;
private final int IDX_ADD = 0;
private final int IDX_EDIT = 2;
private final int IDX_REMOVE = 3;
- public CPathSourceEntryPage(ListDialogField classPathList) {
+ public CPathSourceEntryPage(ListDialogField<CPElement> classPathList) {
super(CPathEntryMessages.getString("SourcePathEntryPage.title")); //$NON-NLS-1$
setDescription(CPathEntryMessages.getString("SourcePathEntryPage.description")); //$NON-NLS-1$
@@ -85,7 +86,7 @@ public class CPathSourceEntryPage extends CPathBasePage {
/* 3 = IDX_REMOVE */CPathEntryMessages.getString("SourcePathEntryPage.folders.remove.button") //$NON-NLS-1$
};
- fFoldersList = new TreeListDialogField(adapter, buttonLabels, new CPElementLabelProvider());
+ fFoldersList = new TreeListDialogField<CPElement>(adapter, buttonLabels, new CPElementLabelProvider());
fFoldersList.setDialogFieldListener(adapter);
fFoldersList.setLabelText(CPathEntryMessages.getString("SourcePathEntryPage.folders.label")); //$NON-NLS-1$
@@ -107,11 +108,11 @@ public class CPathSourceEntryPage extends CPathBasePage {
}
private void updateFoldersList() {
- List folders = filterList(fCPathList.getElements());
+ List<CPElement> folders = filterList(fCPathList.getElements());
fFoldersList.setElements(folders);
for (int i = 0; i < folders.size(); i++) {
- CPElement cpe = (CPElement)folders.get(i);
+ CPElement cpe = folders.get(i);
IPath[] patterns = (IPath[])cpe.getAttribute(CPElement.EXCLUSION);
if (patterns.length > 0) {
fFoldersList.expandElement(cpe, 3);
@@ -131,9 +132,9 @@ public class CPathSourceEntryPage extends CPathBasePage {
fFoldersList.setButtonsMinWidth(buttonBarWidth);
// expand
- List elements = fFoldersList.getElements();
+ List<CPElement> elements = fFoldersList.getElements();
for (int i = 0; i < elements.size(); i++) {
- CPElement elem = (CPElement)elements.get(i);
+ CPElement elem = elements.get(i);
IPath[] patterns = (IPath[])elem.getAttribute(CPElement.EXCLUSION);
if (patterns.length > 0) {
fFoldersList.expandElement(elem, 3);
@@ -144,42 +145,42 @@ public class CPathSourceEntryPage extends CPathBasePage {
CUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(composite, ICHelpContextIds.PROJECT_PATHS_SOURCE);
}
- private class SourceContainerAdapter implements ITreeListAdapter, IDialogFieldListener {
+ private class SourceContainerAdapter implements ITreeListAdapter<CPElement>, IDialogFieldListener {
private final Object[] EMPTY_ARR = new Object[0];
// -------- IListAdapter --------
- public void customButtonPressed(TreeListDialogField field, int index) {
+ public void customButtonPressed(TreeListDialogField<CPElement> field, int index) {
sourcePageCustomButtonPressed(field, index);
}
- public void selectionChanged(TreeListDialogField field) {
+ public void selectionChanged(TreeListDialogField<CPElement> field) {
sourcePageSelectionChanged(field);
}
- public void doubleClicked(TreeListDialogField field) {
+ public void doubleClicked(TreeListDialogField<CPElement> field) {
sourcePageDoubleClicked(field);
}
- public void keyPressed(TreeListDialogField field, KeyEvent event) {
+ public void keyPressed(TreeListDialogField<CPElement> field, KeyEvent event) {
sourcePageKeyPressed(field, event);
}
- public Object[] getChildren(TreeListDialogField field, Object element) {
+ public Object[] getChildren(TreeListDialogField<CPElement> field, Object element) {
if (element instanceof CPElement) {
return ((CPElement)element).getChildren();
}
return EMPTY_ARR;
}
- public Object getParent(TreeListDialogField field, Object element) {
+ public Object getParent(TreeListDialogField<CPElement> field, Object element) {
if (element instanceof CPElementAttribute) {
return ((CPElementAttribute)element).getParent();
}
return null;
}
- public boolean hasChildren(TreeListDialogField field, Object element) {
+ public boolean hasChildren(TreeListDialogField<CPElement> field, Object element) {
return (element instanceof CPElement);
}
@@ -190,10 +191,10 @@ public class CPathSourceEntryPage extends CPathBasePage {
}
- protected void sourcePageKeyPressed(TreeListDialogField field, KeyEvent event) {
+ protected void sourcePageKeyPressed(TreeListDialogField<CPElement> field, KeyEvent event) {
if (field == fFoldersList) {
if (event.character == SWT.DEL && event.stateMask == 0) {
- List selection = field.getSelectedElements();
+ List<Object> selection = field.getSelectedElements();
if (canRemove(selection)) {
removeEntry();
}
@@ -201,9 +202,9 @@ public class CPathSourceEntryPage extends CPathBasePage {
}
}
- protected void sourcePageDoubleClicked(TreeListDialogField field) {
+ protected void sourcePageDoubleClicked(TreeListDialogField<CPElement> field) {
if (field == fFoldersList) {
- List selection = field.getSelectedElements();
+ List<Object> selection = field.getSelectedElements();
if (canEdit(selection)) {
editEntry();
}
@@ -213,13 +214,13 @@ public class CPathSourceEntryPage extends CPathBasePage {
protected void sourcePageCustomButtonPressed(DialogField field, int index) {
if (field == fFoldersList) {
if (index == IDX_ADD) {
- List elementsToAdd = new ArrayList(10);
+ List<CPElement> elementsToAdd = new ArrayList<CPElement>(10);
IProject project = fCurrCProject.getProject();
if (project.exists()) {
CPElement[] srcentries = openSourceContainerDialog(null);
if (srcentries != null) {
- for (int i = 0; i < srcentries.length; i++) {
- elementsToAdd.add(srcentries[i]);
+ for (CPElement srcentrie : srcentries) {
+ elementsToAdd.add(srcentrie);
}
}
} else {
@@ -229,15 +230,14 @@ public class CPathSourceEntryPage extends CPathBasePage {
}
}
if (!elementsToAdd.isEmpty()) {
- HashSet modifiedElements = new HashSet();
+ HashSet<CPElement> modifiedElements = new HashSet<CPElement>();
askForAddingExclusionPatternsDialog(elementsToAdd, modifiedElements);
fFoldersList.addElements(elementsToAdd);
fFoldersList.postSetSelection(new StructuredSelection(elementsToAdd));
if (!modifiedElements.isEmpty()) {
- for (Iterator iter = modifiedElements.iterator(); iter.hasNext();) {
- Object elem = iter.next();
+ for (Object elem : modifiedElements) {
fFoldersList.refresh(elem);
fFoldersList.expandElement(elem, 3);
}
@@ -253,7 +253,7 @@ public class CPathSourceEntryPage extends CPathBasePage {
}
private void editEntry() {
- List selElements = fFoldersList.getSelectedElements();
+ List<Object> selElements = fFoldersList.getSelectedElements();
if (selElements.size() != 1) {
return;
}
@@ -289,13 +289,13 @@ public class CPathSourceEntryPage extends CPathBasePage {
}
protected void sourcePageSelectionChanged(DialogField field) {
- List selected = fFoldersList.getSelectedElements();
+ List<Object> selected = fFoldersList.getSelectedElements();
fFoldersList.enableButton(IDX_EDIT, canEdit(selected));
fFoldersList.enableButton(IDX_REMOVE, canRemove(selected));
}
private void removeEntry() {
- List selElements = fFoldersList.getSelectedElements();
+ List<Object> selElements = fFoldersList.getSelectedElements();
for (int i = selElements.size() - 1; i >= 0; i--) {
Object elem = selElements.get(i);
if (elem instanceof CPElementAttribute) {
@@ -314,7 +314,7 @@ public class CPathSourceEntryPage extends CPathBasePage {
}
}
- private boolean canRemove(List selElements) {
+ private boolean canRemove(List<?> selElements) {
if (selElements.size() == 0) {
return false;
}
@@ -339,7 +339,7 @@ public class CPathSourceEntryPage extends CPathBasePage {
return true;
}
- private boolean canEdit(List selElements) {
+ private boolean canEdit(List<?> selElements) {
if (selElements.size() != 1) {
return false;
}
@@ -365,15 +365,15 @@ public class CPathSourceEntryPage extends CPathBasePage {
}
private void updateClasspathList() {
- List srcelements = fFoldersList.getElements();
+ List<CPElement> srcelements = fFoldersList.getElements();
- List cpelements = fCPathList.getElements();
+ List<CPElement> cpelements = fCPathList.getElements();
int nEntries = cpelements.size();
// backwards, as entries will be deleted
int lastRemovePos = nEntries;
int afterLastSourcePos = 0;
for (int i = nEntries - 1; i >= 0; i--) {
- CPElement cpe = (CPElement)cpelements.get(i);
+ CPElement cpe = cpelements.get(i);
int kind = cpe.getEntryKind();
if (isEntryKind(kind)) {
if (!srcelements.remove(cpe)) {
@@ -418,7 +418,7 @@ public class CPathSourceEntryPage extends CPathBasePage {
return null;
}
- private void askForAddingExclusionPatternsDialog(List newEntries, Set modifiedEntries) {
+ private void askForAddingExclusionPatternsDialog(List<CPElement> newEntries, Set<CPElement> modifiedEntries) {
fixNestingConflicts(newEntries, fFoldersList.getElements(), modifiedEntries);
if (!modifiedEntries.isEmpty()) {
String title = CPathEntryMessages.getString("SourcePathEntryPage.exclusion_added.title"); //$NON-NLS-1$
@@ -429,11 +429,11 @@ public class CPathSourceEntryPage extends CPathBasePage {
private CPElement[] openSourceContainerDialog(CPElement existing) {
- Class[] acceptedClasses = new Class[]{IProject.class, IFolder.class};
- List existingContainers = getExistingContainers(null);
+ Class<?>[] acceptedClasses = new Class[]{IProject.class, IFolder.class};
+ List<IContainer> existingContainers = getExistingContainers(null);
IProject[] allProjects = fWorkspaceRoot.getProjects();
- ArrayList rejectedElements = new ArrayList(allProjects.length);
+ ArrayList<IProject> rejectedElements = new ArrayList<IProject>(allProjects.length);
IProject currProject = fCurrCProject.getProject();
for (int i = 0; i < allProjects.length; i++) {
if (!allProjects[i].equals(currProject)) {
@@ -476,15 +476,15 @@ public class CPathSourceEntryPage extends CPathBasePage {
return null;
}
- private List getExistingContainers(CPElement existing) {
- List res = new ArrayList();
- List cplist = fFoldersList.getElements();
+ private List<IContainer> getExistingContainers(CPElement existing) {
+ List<IContainer> res = new ArrayList<IContainer>();
+ List<CPElement> cplist = fFoldersList.getElements();
for (int i = 0; i < cplist.size(); i++) {
- CPElement elem = (CPElement)cplist.get(i);
+ CPElement elem = cplist.get(i);
if (elem != existing) {
IResource resource = elem.getResource();
if (resource instanceof IContainer) { // defensive code
- res.add(resource);
+ res.add((IContainer) resource);
}
}
}
@@ -500,7 +500,7 @@ public class CPathSourceEntryPage extends CPathBasePage {
* @see BuildPathBasePage#getSelection
*/
@Override
- public List getSelection() {
+ public List<Object> getSelection() {
return fFoldersList.getSelectedElements();
}
@@ -508,7 +508,7 @@ public class CPathSourceEntryPage extends CPathBasePage {
* @see BuildPathBasePage#setSelection
*/
@Override
- public void setSelection(List selElements) {
+ public void setSelection(List<?> selElements) {
fFoldersList.selectElements(new StructuredSelection(selElements));
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathTabBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathTabBlock.java
index b266f4761b0..c35a8691b00 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathTabBlock.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathTabBlock.java
@@ -12,22 +12,24 @@ package org.eclipse.cdt.internal.ui.dialogs.cpaths;
import java.util.List;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.IPathEntry;
+
import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.ListDialogField;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
public class CPathTabBlock extends AbstractPathOptionBlock {
private final int[] pathTypes = {IPathEntry.CDT_SOURCE, IPathEntry.CDT_PROJECT, IPathEntry.CDT_OUTPUT, IPathEntry.CDT_LIBRARY,IPathEntry.CDT_CONTAINER};
- private ListDialogField fCPathList;
+ private ListDialogField<CPElement> fCPathList;
private CPathSourceEntryPage fSourcePage;
private CPathProjectsEntryPage fProjectsPage;
@@ -61,12 +63,12 @@ public class CPathTabBlock extends AbstractPathOptionBlock {
};
BuildPathAdapter adapter = new BuildPathAdapter();
- fCPathList = new ListDialogField(null, buttonLabels, null);
+ fCPathList = new ListDialogField<CPElement>(null, buttonLabels, null);
fCPathList.setDialogFieldListener(adapter);
}
@Override
- protected List getCPaths() {
+ protected List<CPElement> getCPaths() {
return fCPathList.getElements();
}
@@ -104,7 +106,7 @@ public class CPathTabBlock extends AbstractPathOptionBlock {
}
@Override
- protected void initialize(ICElement element, List cPaths) {
+ protected void initialize(ICElement element, List<CPElement> cPaths) {
fCPathList.setElements(cPaths);
@@ -135,14 +137,14 @@ public class CPathTabBlock extends AbstractPathOptionBlock {
public void updateCPathStatus() {
getPathStatus().setOK();
- List elements = fCPathList.getElements();
+ List<CPElement> elements = fCPathList.getElements();
CPElement entryError = null;
int nErrorEntries = 0;
IPathEntry[] entries = new IPathEntry[elements.size()];
for (int i = elements.size() - 1; i >= 0; i--) {
- CPElement currElement = (CPElement)elements.get(i);
+ CPElement currElement = elements.get(i);
entries[i] = currElement.getPathEntry();
if (currElement.getStatus().getSeverity() != IStatus.OK) {
@@ -154,7 +156,7 @@ public class CPathTabBlock extends AbstractPathOptionBlock {
}
if (nErrorEntries > 0) {
- if (nErrorEntries == 1) {
+ if (nErrorEntries == 1 && entryError != null) {
getPathStatus().setWarning(entryError.getStatus().getMessage());
} else {
getPathStatus().setWarning(CPathEntryMessages.getFormattedString("CPElement.status.multiplePathErrors", //$NON-NLS-1$
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ExclusionPatternDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ExclusionPatternDialog.java
index c05d49b166b..17276664ebc 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ExclusionPatternDialog.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ExclusionPatternDialog.java
@@ -69,7 +69,7 @@ public class ExclusionPatternDialog extends StatusDialog {
}
- private ListDialogField fExclusionPatternList;
+ private ListDialogField<String> fExclusionPatternList;
private CPElement fCurrElement;
private IProject fCurrProject;
@@ -98,7 +98,7 @@ public class ExclusionPatternDialog extends StatusDialog {
ExclusionPatternAdapter adapter= new ExclusionPatternAdapter();
- fExclusionPatternList= new ListDialogField(adapter, buttonLabels, new ExclusionPatternLabelProvider());
+ fExclusionPatternList= new ListDialogField<String>(adapter, buttonLabels, new ExclusionPatternLabelProvider());
fExclusionPatternList.setDialogFieldListener(adapter);
fExclusionPatternList.setLabelText(label);
fExclusionPatternList.setRemoveButtonIndex(IDX_REMOVE);
@@ -113,9 +113,9 @@ public class ExclusionPatternDialog extends StatusDialog {
IPath[] pattern= (IPath[]) entryToEdit.getAttribute(CPElement.EXCLUSION);
- ArrayList elements= new ArrayList(pattern.length);
- for (int i= 0; i < pattern.length; i++) {
- elements.add(pattern[i].toString());
+ ArrayList<String> elements= new ArrayList<String>(pattern.length);
+ for (IPath element : pattern) {
+ elements.add(element.toString());
}
fExclusionPatternList.setElements(elements);
fExclusionPatternList.selectFirstElement();
@@ -141,7 +141,7 @@ public class ExclusionPatternDialog extends StatusDialog {
return composite;
}
- protected void doCustomButtonPressed(ListDialogField field, int index) {
+ protected void doCustomButtonPressed(ListDialogField<String> field, int index) {
if (index == IDX_ADD) {
addEntry();
} else if (index == IDX_EDIT) {
@@ -151,27 +151,27 @@ public class ExclusionPatternDialog extends StatusDialog {
}
}
- protected void doDoubleClicked(ListDialogField field) {
+ protected void doDoubleClicked(ListDialogField<String> field) {
editEntry();
}
- protected void doSelectionChanged(ListDialogField field) {
- List selected= field.getSelectedElements();
+ protected void doSelectionChanged(ListDialogField<String> field) {
+ List<String> selected= field.getSelectedElements();
fExclusionPatternList.enableButton(IDX_EDIT, canEdit(selected));
}
- private boolean canEdit(List selected) {
+ private boolean canEdit(List<String> selected) {
return selected.size() == 1;
}
private void editEntry() {
- List selElements= fExclusionPatternList.getSelectedElements();
+ List<String> selElements= fExclusionPatternList.getSelectedElements();
if (selElements.size() != 1) {
return;
}
- List existing= fExclusionPatternList.getElements();
- String entry= (String) selElements.get(0);
+ List<String> existing= fExclusionPatternList.getElements();
+ String entry= selElements.get(0);
ExclusionPatternEntryDialog dialog= new ExclusionPatternEntryDialog(getShell(), entry, existing, fCurrElement);
if (dialog.open() == Window.OK) {
fExclusionPatternList.replaceElement(entry, dialog.getExclusionPattern());
@@ -179,7 +179,7 @@ public class ExclusionPatternDialog extends StatusDialog {
}
private void addEntry() {
- List existing= fExclusionPatternList.getElements();
+ List<String> existing= fExclusionPatternList.getElements();
ExclusionPatternEntryDialog dialog= new ExclusionPatternEntryDialog(getShell(), null, existing, fCurrElement);
if (dialog.open() == Window.OK) {
fExclusionPatternList.addElement(dialog.getExclusionPattern());
@@ -190,16 +190,16 @@ public class ExclusionPatternDialog extends StatusDialog {
// -------- ExclusionPatternAdapter --------
- private class ExclusionPatternAdapter implements IListAdapter, IDialogFieldListener {
- public void customButtonPressed(ListDialogField field, int index) {
+ private class ExclusionPatternAdapter implements IListAdapter<String>, IDialogFieldListener {
+ public void customButtonPressed(ListDialogField<String> field, int index) {
doCustomButtonPressed(field, index);
}
- public void selectionChanged(ListDialogField field) {
+ public void selectionChanged(ListDialogField<String> field) {
doSelectionChanged(field);
}
- public void doubleClicked(ListDialogField field) {
+ public void doubleClicked(ListDialogField<String> field) {
doDoubleClicked(field);
}
@@ -218,7 +218,7 @@ public class ExclusionPatternDialog extends StatusDialog {
public IPath[] getExclusionPattern() {
IPath[] res= new IPath[fExclusionPatternList.getSize()];
for (int i= 0; i < res.length; i++) {
- String entry= (String) fExclusionPatternList.getElement(i);
+ String entry= fExclusionPatternList.getElement(i);
res[i]= new Path(entry);
}
return res;
@@ -234,7 +234,7 @@ public class ExclusionPatternDialog extends StatusDialog {
}
private void addMultipleEntries() {
- Class[] acceptedClasses= new Class[] { IFolder.class, IFile.class };
+ Class<?>[] acceptedClasses= new Class<?>[] { IFolder.class, IFile.class };
ISelectionStatusValidator validator= new TypedElementSelectionValidator(acceptedClasses, true);
ViewerFilter filter= new TypedViewerFilter(acceptedClasses);
@@ -256,8 +256,8 @@ public class ExclusionPatternDialog extends StatusDialog {
Object[] objects= dialog.getResult();
int existingSegments= fCurrSourceFolder.getFullPath().segmentCount();
- for (int i= 0; i < objects.length; i++) {
- IResource curr= (IResource) objects[i];
+ for (Object object : objects) {
+ IResource curr= (IResource) object;
IPath path= curr.getFullPath().removeFirstSegments(existingSegments).makeRelative();
String res;
if (curr instanceof IContainer) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ExclusionPatternEntryDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ExclusionPatternEntryDialog.java
index 15f49844638..350dff36b17 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ExclusionPatternEntryDialog.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ExclusionPatternEntryDialog.java
@@ -53,9 +53,9 @@ public class ExclusionPatternEntryDialog extends StatusDialog {
private IContainer fCurrSourceFolder;
private String fExclusionPattern;
- private List fExistingPatterns;
+ private List<String> fExistingPatterns;
- public ExclusionPatternEntryDialog(Shell parent, String patternToEdit, List existingPatterns, CPElement entryToEdit) {
+ public ExclusionPatternEntryDialog(Shell parent, String patternToEdit, List<String> existingPatterns, CPElement entryToEdit) {
super(parent);
fExistingPatterns = existingPatterns;
if (patternToEdit == null) {
@@ -187,7 +187,7 @@ public class ExclusionPatternEntryDialog extends StatusDialog {
// ---------- util method ------------
private IPath chooseExclusionPattern() {
- Class[] acceptedClasses = new Class[] { IFolder.class, IFile.class};
+ Class<?>[] acceptedClasses = new Class<?>[] { IFolder.class, IFile.class};
ISelectionStatusValidator validator = new TypedElementSelectionValidator(acceptedClasses, false);
ViewerFilter filter = new TypedViewerFilter(acceptedClasses);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/MultipleFolderSelectionDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/MultipleFolderSelectionDialog.java
index 56868ce7704..6a9941608e4 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/MultipleFolderSelectionDialog.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/MultipleFolderSelectionDialog.java
@@ -54,12 +54,12 @@ public class MultipleFolderSelectionDialog extends SelectionStatusDialog impleme
private ILabelProvider fLabelProvider;
private ITreeContentProvider fContentProvider;
- private List fFilters;
+ private List<ViewerFilter> fFilters;
private Object fInput;
private Button fNewFolderButton;
private IContainer fSelectedContainer;
- Set fExisting;
+ Set<Object> fExisting;
private Object fFocusElement;
public MultipleFolderSelectionDialog(Shell parent, ILabelProvider labelProvider, ITreeContentProvider contentProvider) {
@@ -79,7 +79,7 @@ public class MultipleFolderSelectionDialog extends SelectionStatusDialog impleme
}
public void setExisting(Object[] existing) {
- fExisting = new HashSet();
+ fExisting = new HashSet<Object>();
for (int i = 0; i < existing.length; i++) {
fExisting.add(existing[i]);
}
@@ -103,7 +103,7 @@ public class MultipleFolderSelectionDialog extends SelectionStatusDialog impleme
*/
public void addFilter(ViewerFilter filter) {
if (fFilters == null)
- fFilters = new ArrayList(4);
+ fFilters = new ArrayList<ViewerFilter>(4);
fFilters.add(filter);
}
@@ -128,7 +128,7 @@ public class MultipleFolderSelectionDialog extends SelectionStatusDialog impleme
checked = null;
}
} else {
- ArrayList res = new ArrayList();
+ ArrayList<Object> res = new ArrayList<Object>();
for (int i = 0; i < checked.length; i++) {
Object elem = checked[i];
if (!fExisting.contains(elem)) {
@@ -163,7 +163,7 @@ public class MultipleFolderSelectionDialog extends SelectionStatusDialog impleme
fViewer.expandToLevel(2);
if (fExisting != null) {
- for (Iterator iter = fExisting.iterator(); iter.hasNext();) {
+ for (Iterator<Object> iter = fExisting.iterator(); iter.hasNext();) {
fViewer.reveal(iter.next());
}
}
@@ -196,7 +196,7 @@ public class MultipleFolderSelectionDialog extends SelectionStatusDialog impleme
fViewer.setComparator(new ResourceComparator(ResourceComparator.NAME));
if (fFilters != null) {
for (int i = 0; i != fFilters.size(); i++)
- fViewer.addFilter((ViewerFilter) fFilters.get(i));
+ fViewer.addFilter(fFilters.get(i));
}
fViewer.setInput(fInput);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/NewIncludesSymbolsTabBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/NewIncludesSymbolsTabBlock.java
index 183131b67eb..79e5b183a30 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/NewIncludesSymbolsTabBlock.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/NewIncludesSymbolsTabBlock.java
@@ -12,11 +12,6 @@ package org.eclipse.cdt.internal.ui.dialogs.cpaths;
import java.util.List;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.ICProject;
-import org.eclipse.cdt.core.model.IPathEntry;
-import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener;
-import org.eclipse.cdt.ui.dialogs.ICOptionPage;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
@@ -24,11 +19,18 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.model.IPathEntry;
+import org.eclipse.cdt.ui.dialogs.ICOptionPage;
+
+import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener;
+
public class NewIncludesSymbolsTabBlock extends AbstractPathOptionBlock implements IStatusChangeListener {
private CPathIncludeSymbolEntryBasePage fIncludeSymbols;
- private List fCPaths;
+ private List<CPElement> fCPaths;
private Composite fComposite;
@@ -64,7 +66,7 @@ public class NewIncludesSymbolsTabBlock extends AbstractPathOptionBlock implemen
}
@Override
- protected List getCPaths() {
+ protected List<CPElement> getCPaths() {
if (fIncludeSymbols != null) {
return fIncludeSymbols.getCPaths();
}
@@ -82,7 +84,7 @@ public class NewIncludesSymbolsTabBlock extends AbstractPathOptionBlock implemen
}
@Override
- protected void initialize(ICElement element, List cPaths) {
+ protected void initialize(ICElement element, List<CPElement> cPaths) {
fCPaths = cPaths;
if (element instanceof ICProject) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/NewSourceFolderDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/NewSourceFolderDialog.java
index 88a7f2f5ff5..457abf28ba6 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/NewSourceFolderDialog.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/NewSourceFolderDialog.java
@@ -12,12 +12,6 @@ package org.eclipse.cdt.internal.ui.dialogs.cpaths;
import java.util.List;
-import org.eclipse.cdt.internal.ui.dialogs.StatusDialog;
-import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.SelectionButtonDialogField;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.StringDialogField;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -31,6 +25,13 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.cdt.internal.ui.dialogs.StatusDialog;
+import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.SelectionButtonDialogField;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.StringDialogField;
+
public class NewSourceFolderDialog extends StatusDialog {
private SelectionButtonDialogField fUseProjectButton;
@@ -40,10 +41,10 @@ public class NewSourceFolderDialog extends StatusDialog {
private StatusInfo fContainerFieldStatus;
private IContainer fFolder;
- private List fExistingFolders;
+ private List<IContainer> fExistingFolders;
private IProject fCurrProject;
- public NewSourceFolderDialog(Shell parent, String title, IProject project, List existingFolders, CPElement entryToEdit) {
+ public NewSourceFolderDialog(Shell parent, String title, IProject project, List<IContainer> existingFolders, CPElement entryToEdit) {
super(parent);
setTitle(title);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/SourceAttachmentBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/SourceAttachmentBlock.java
index fa0c5c5db70..6d9e1badb3d 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/SourceAttachmentBlock.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/SourceAttachmentBlock.java
@@ -15,23 +15,6 @@ import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
-import org.eclipse.cdt.core.model.CModelException;
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.model.ICProject;
-import org.eclipse.cdt.core.model.ILibraryEntry;
-import org.eclipse.cdt.core.model.IPathEntry;
-import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener;
-import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
-import org.eclipse.cdt.internal.ui.dialogs.StatusUtil;
-import org.eclipse.cdt.internal.ui.dialogs.TypedElementSelectionValidator;
-import org.eclipse.cdt.internal.ui.util.PixelConverter;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.IStringButtonAdapter;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.SelectionButtonDialogField;
-import org.eclipse.cdt.internal.ui.wizards.dialogfields.StringButtonDialogField;
-import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IResource;
@@ -63,6 +46,25 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.cdt.core.model.CModelException;
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.model.ILibraryEntry;
+import org.eclipse.cdt.core.model.IPathEntry;
+import org.eclipse.cdt.ui.CUIPlugin;
+
+import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener;
+import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
+import org.eclipse.cdt.internal.ui.dialogs.StatusUtil;
+import org.eclipse.cdt.internal.ui.dialogs.TypedElementSelectionValidator;
+import org.eclipse.cdt.internal.ui.util.PixelConverter;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.IStringButtonAdapter;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.SelectionButtonDialogField;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.StringButtonDialogField;
+
/**
* UI to set the source attachment archive and root. Same implementation for both setting attachments for libraries from variable
* entries and for normal (internal or external) jar.
@@ -366,7 +368,7 @@ public class SourceAttachmentBlock {
private IPath chooseInternalJarFile() {
String initSelection = fFileNameField.getText();
- Class[] acceptedClasses = new Class[]{IFolder.class, IFile.class};
+ Class<?>[] acceptedClasses = new Class<?>[]{IFolder.class, IFile.class};
TypedElementSelectionValidator validator = new TypedElementSelectionValidator(acceptedClasses, false);
ViewerFilter filter = new ArchiveFileFilter(null, false);
@@ -440,7 +442,7 @@ public class SourceAttachmentBlock {
throws CModelException {
IPathEntry[] oldClasspath = cproject.getRawPathEntries();
int nEntries = oldClasspath.length;
- ArrayList newEntries = new ArrayList(nEntries + 1);
+ ArrayList<IPathEntry> newEntries = new ArrayList<IPathEntry>(nEntries + 1);
int entryKind = newEntry.getEntryKind();
IPath jarPath = newEntry.getPath();
boolean found = false;
@@ -461,7 +463,7 @@ public class SourceAttachmentBlock {
// add new
newEntries.add(newEntry);
}
- IPathEntry[] newPathEntries = (IPathEntry[])newEntries.toArray(new IPathEntry[newEntries.size()]);
+ IPathEntry[] newPathEntries = newEntries.toArray(new IPathEntry[newEntries.size()]);
cproject.setRawPathEntries(newPathEntries, monitor);
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CodeTemplateBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CodeTemplateBlock.java
index f207c565d27..bc2c0bac414 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CodeTemplateBlock.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CodeTemplateBlock.java
@@ -81,15 +81,15 @@ import org.eclipse.cdt.internal.ui.wizards.dialogfields.TreeListDialogField;
*/
public class CodeTemplateBlock extends OptionsConfigurationBlock {
- private class CodeTemplateAdapter extends ViewerComparator implements ITreeListAdapter, IDialogFieldListener {
+ private class CodeTemplateAdapter extends ViewerComparator implements ITreeListAdapter<Object>, IDialogFieldListener {
private final Object[] NO_CHILDREN= new Object[0];
- public void customButtonPressed(TreeListDialogField field, int index) {
+ public void customButtonPressed(TreeListDialogField<Object> field, int index) {
doButtonPressed(index, field.getSelectedElements());
}
- public void selectionChanged(TreeListDialogField field) {
+ public void selectionChanged(TreeListDialogField<Object> field) {
List<Object> selected= field.getSelectedElements();
field.enableButton(IDX_ADD, canAdd(selected));
field.enableButton(IDX_EDIT, canEdit(selected));
@@ -99,14 +99,14 @@ public class CodeTemplateBlock extends OptionsConfigurationBlock {
updateSourceViewerInput(selected);
}
- public void doubleClicked(TreeListDialogField field) {
+ public void doubleClicked(TreeListDialogField<Object> field) {
List<Object> selected= field.getSelectedElements();
if (canEdit(selected)) {
doButtonPressed(IDX_EDIT, selected);
}
}
- public Object[] getChildren(TreeListDialogField field, Object element) {
+ public Object[] getChildren(TreeListDialogField<Object> field, Object element) {
if (element == COMMENT_NODE || element == CODE_NODE) {
return getCodeTemplatesOfCategory(element == COMMENT_NODE);
} else if (element == FILE_NODE) {
@@ -117,7 +117,7 @@ public class CodeTemplateBlock extends OptionsConfigurationBlock {
return NO_CHILDREN;
}
- public Object getParent(TreeListDialogField field, Object element) {
+ public Object getParent(TreeListDialogField<Object> field, Object element) {
if (element instanceof TemplatePersistenceData) {
TemplatePersistenceData data= (TemplatePersistenceData) element;
if (data.getTemplate().getName().endsWith(CodeTemplateContextType.COMMENT_SUFFIX)) {
@@ -133,7 +133,7 @@ public class CodeTemplateBlock extends OptionsConfigurationBlock {
return null;
}
- public boolean hasChildren(TreeListDialogField field, Object element) {
+ public boolean hasChildren(TreeListDialogField<Object> field, Object element) {
return (element == COMMENT_NODE || element == CODE_NODE || element == FILE_NODE || element instanceof TemplateContextType);
}
@@ -143,7 +143,7 @@ public class CodeTemplateBlock extends OptionsConfigurationBlock {
}
}
- public void keyPressed(TreeListDialogField field, KeyEvent event) {
+ public void keyPressed(TreeListDialogField<Object> field, KeyEvent event) {
}
/*
@@ -301,7 +301,7 @@ public class CodeTemplateBlock extends OptionsConfigurationBlock {
protected final static Object CODE_NODE= PreferencesMessages.CodeTemplateBlock_templates_code_node;
protected final static Object FILE_NODE= PreferencesMessages.CodeTemplateBlock_templates_file_node;
- private TreeListDialogField fCodeTemplateTree;
+ private TreeListDialogField<Object> fCodeTemplateTree;
private SelectionButtonDialogField fGenerateComments;
protected ProjectTemplateStore fTemplateStore;
@@ -335,7 +335,7 @@ public class CodeTemplateBlock extends OptionsConfigurationBlock {
PreferencesMessages.CodeTemplateBlock_templates_exportall_button
};
- fCodeTemplateTree= new TreeListDialogField(adapter, buttonLabels, new CodeTemplateLabelProvider());
+ fCodeTemplateTree= new TreeListDialogField<Object>(adapter, buttonLabels, new CodeTemplateLabelProvider());
fCodeTemplateTree.setDialogFieldListener(adapter);
fCodeTemplateTree.setLabelText(PreferencesMessages.CodeTemplateBlock_templates_label);
fCodeTemplateTree.setViewerComparator(adapter);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/DefinitionFinder.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/DefinitionFinder.java
index 8a0127512fc..9e190f41238 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/DefinitionFinder.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/DefinitionFinder.java
@@ -50,7 +50,6 @@ public class DefinitionFinder {
return DefinitionFinder.getDefinition(declarator.getName(), resolveBinding, file);
}
- @SuppressWarnings("null") // Can't be null
public static IASTName getDefinition(IASTName methodName, IBinding bind, IFile file) throws CoreException {
TreeMap<String, IASTTranslationUnit> parsedFiles = new TreeMap<String, IASTTranslationUnit>();
@@ -60,7 +59,7 @@ public class DefinitionFinder {
try {
index.acquireReadLock();
- pdomref = index.findDefinitions(bind);
+ pdomref= index.findDefinitions(bind);
} catch (InterruptedException e) {
IStatus status = new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID, IStatus.OK, e.getMessage(), e);
CUIPlugin.log(status);
@@ -68,7 +67,7 @@ public class DefinitionFinder {
index.releaseReadLock();
}
- if (pdomref == null || (pdomref != null && pdomref.length < 1)) {
+ if (pdomref==null || pdomref.length < 1) {
return null;
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/AbstractCEditorTextHover.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/AbstractCEditorTextHover.java
index c343853ab92..bd8bdb37158 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/AbstractCEditorTextHover.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/AbstractCEditorTextHover.java
@@ -67,9 +67,8 @@ public abstract class AbstractCEditorTextHover implements ICEditorTextHover, ITe
&& offset >= selectedRange.x
&& offset <= selectedRange.x + selectedRange.y)
return new Region(selectedRange.x, selectedRange.y);
- else {
- return CWordFinder.findWord(textViewer.getDocument(), offset);
- }
+
+ return CWordFinder.findWord(textViewer.getDocument(), offset);
}
return null;
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CEditorTextHoverProxy.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CEditorTextHoverProxy.java
index 01c92501e87..29744c30338 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CEditorTextHoverProxy.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CEditorTextHoverProxy.java
@@ -82,8 +82,8 @@ public class CEditorTextHoverProxy extends AbstractCEditorTextHover {
if (ensureHoverCreated()) {
if (fHover instanceof ITextHoverExtension2)
return ((ITextHoverExtension2) fHover).getHoverInfo2(textViewer, hoverRegion);
- else
- return fHover.getHoverInfo(textViewer, hoverRegion);
+
+ return fHover.getHoverInfo(textViewer, hoverRegion);
}
return null;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/ITreeListAdapter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/ITreeListAdapter.java
index fc01aa5a963..4f1b85f3a4c 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/ITreeListAdapter.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/ITreeListAdapter.java
@@ -15,32 +15,32 @@ import org.eclipse.swt.events.KeyEvent;
/**
* Change listener used by <code>TreeListDialogField</code>
*/
-public interface ITreeListAdapter {
+public interface ITreeListAdapter<T> {
/**
* A button from the button bar has been pressed.
*/
- void customButtonPressed(TreeListDialogField field, int index);
+ void customButtonPressed(TreeListDialogField<T> field, int index);
/**
* The selection of the list has changed.
*/
- void selectionChanged(TreeListDialogField field);
+ void selectionChanged(TreeListDialogField<T> field);
/**
* The list has been double clicked
*/
- void doubleClicked(TreeListDialogField field);
+ void doubleClicked(TreeListDialogField<T> field);
/**
* A key has been pressed
*/
- void keyPressed(TreeListDialogField field, KeyEvent event);
+ void keyPressed(TreeListDialogField<T> field, KeyEvent event);
- Object[] getChildren(TreeListDialogField field, Object element);
+ Object[] getChildren(TreeListDialogField<T> field, Object element);
- Object getParent(TreeListDialogField field, Object element);
+ Object getParent(TreeListDialogField<T> field, Object element);
- boolean hasChildren(TreeListDialogField field, Object element);
+ boolean hasChildren(TreeListDialogField<T> field, Object element);
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/ListDialogField.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/ListDialogField.java
index 0919c3b2c3a..f89bf0df766 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/ListDialogField.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/ListDialogField.java
@@ -52,7 +52,7 @@ import org.eclipse.cdt.internal.ui.util.TableLayoutComposite;
/**
* A list with a button bar.
* Typical buttons are 'Add', 'Remove', 'Up' and 'Down'.
- * List model is independend of widget creation.
+ * List model is independent of widget creation.
* DialogFields controls are: Label, List and Composite containing buttons.
*/
public class ListDialogField<T> extends DialogField {
@@ -676,7 +676,7 @@ public class ListDialogField<T> extends DialogField {
/**
* Removes elements from the list.
*/
- public void removeElements(List<? extends T> elements) {
+ public void removeElements(List<?> elements) {
if (elements.size() > 0) {
fElements.removeAll(elements);
if (fTable != null) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/TreeListDialogField.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/TreeListDialogField.java
index 60b53a82a8f..120887f1dd3 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/TreeListDialogField.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/TreeListDialogField.java
@@ -51,12 +51,12 @@ import org.eclipse.cdt.internal.ui.util.SWTUtil;
* 'Down'. List model is independend of widget creation. DialogFields controls
* are: Label, List and Composite containing buttons.
*/
-public class TreeListDialogField extends DialogField {
+public class TreeListDialogField<T> extends DialogField {
protected TreeViewer fTree;
protected ILabelProvider fLabelProvider;
protected TreeViewerAdapter fTreeViewerAdapter;
- protected List<Object> fElements;
+ protected List<T> fElements;
protected ViewerComparator fViewerComparator;
protected String[] fButtonLabels;
@@ -74,7 +74,7 @@ public class TreeListDialogField extends DialogField {
private Composite fButtonsControl;
private ISelection fSelectionWhenEnabled;
- ITreeListAdapter fTreeAdapter;
+ ITreeListAdapter<T> fTreeAdapter;
Object fParentElement;
private int fTreeExpandLevel;
@@ -83,7 +83,7 @@ public class TreeListDialogField extends DialogField {
* @param adapter
* Can be <code>null</code>.
*/
- public TreeListDialogField(ITreeListAdapter adapter, String[] buttonLabels, ILabelProvider lprovider) {
+ public TreeListDialogField(ITreeListAdapter<T> adapter, String[] buttonLabels, ILabelProvider lprovider) {
super();
fTreeAdapter = adapter;
@@ -91,7 +91,7 @@ public class TreeListDialogField extends DialogField {
fTreeViewerAdapter = new TreeViewerAdapter();
fParentElement = this;
- fElements = new ArrayList<Object>(10);
+ fElements = new ArrayList<T>(10);
fButtonLabels = buttonLabels;
if (fButtonLabels != null) {
@@ -514,8 +514,8 @@ public class TreeListDialogField extends DialogField {
/**
* Sets the elements shown in the list.
*/
- public void setElements(List<Object> elements) {
- fElements = new ArrayList<Object>(elements);
+ public void setElements(List<T> elements) {
+ fElements = new ArrayList<T>(elements);
refresh();
if (fTree != null) {
fTree.expandToLevel(fTreeExpandLevel);
@@ -527,8 +527,8 @@ public class TreeListDialogField extends DialogField {
* Gets the elements shown in the list. The list returned is a copy, so it
* can be modified by the user.
*/
- public List<Object> getElements() {
- return new ArrayList<Object>(fElements);
+ public List<T> getElements() {
+ return new ArrayList<T>(fElements);
}
/**
@@ -548,7 +548,7 @@ public class TreeListDialogField extends DialogField {
/**
* Replace an element.
*/
- public void replaceElement(Object oldElement, Object newElement) throws IllegalArgumentException {
+ public void replaceElement(T oldElement, T newElement) throws IllegalArgumentException {
int idx = fElements.indexOf(oldElement);
if (idx != -1) {
fElements.set(idx, newElement);
@@ -574,7 +574,7 @@ public class TreeListDialogField extends DialogField {
/**
* Adds an element at the end of the tree list.
*/
- public void addElement(Object element) {
+ public void addElement(T element) {
if (fElements.contains(element)) {
return;
}
@@ -589,15 +589,15 @@ public class TreeListDialogField extends DialogField {
/**
* Adds elements at the end of the tree list.
*/
- public void addElements(List<Object> elements) {
+ public void addElements(List<T> elements) {
int nElements = elements.size();
if (nElements > 0) {
// filter duplicated
- ArrayList<Object> elementsToAdd = new ArrayList<Object>(nElements);
+ ArrayList<T> elementsToAdd = new ArrayList<T>(nElements);
for (int i = 0; i < nElements; i++) {
- Object elem = elements.get(i);
+ T elem = elements.get(i);
if (!fElements.contains(elem)) {
elementsToAdd.add(elem);
}
@@ -616,7 +616,7 @@ public class TreeListDialogField extends DialogField {
/**
* Adds an element at a position.
*/
- public void insertElementAt(Object element, int index) {
+ public void insertElementAt(T element, int index) {
if (fElements.contains(element)) {
return;
}
@@ -659,7 +659,7 @@ public class TreeListDialogField extends DialogField {
/**
* Removes elements from the list.
*/
- public void removeElements(List<Object> elements) {
+ public void removeElements(List<?> elements) {
if (elements.size() > 0) {
fElements.removeAll(elements);
if (fTree != null) {
@@ -735,12 +735,12 @@ public class TreeListDialogField extends DialogField {
// ------- list maintenance
- private List<Object> moveUp(List<Object> elements, List<Object> move) {
+ private List<T> moveUp(List<T> elements, List<?> move) {
int nElements = elements.size();
- List<Object> res = new ArrayList<Object>(nElements);
- Object floating = null;
+ List<T> res = new ArrayList<T>(nElements);
+ T floating = null;
for (int i = 0; i < nElements; i++) {
- Object curr = elements.get(i);
+ T curr = elements.get(i);
if (move.contains(curr)) {
res.add(curr);
} else {
@@ -756,22 +756,22 @@ public class TreeListDialogField extends DialogField {
return res;
}
- private void moveUp(List<Object> toMoveUp) {
+ private void moveUp(List<?> toMoveUp) {
if (toMoveUp.size() > 0) {
setElements(moveUp(fElements, toMoveUp));
fTree.reveal(toMoveUp.get(0));
}
}
- private void moveDown(List<Object> toMoveDown) {
+ private void moveDown(List<?> toMoveDown) {
if (toMoveDown.size() > 0) {
setElements(reverse(moveUp(reverse(fElements), toMoveDown)));
fTree.reveal(toMoveDown.get(toMoveDown.size() - 1));
}
}
- private List<Object> reverse(List<Object> p) {
- List<Object> reverse = new ArrayList<Object>(p.size());
+ private List<T> reverse(List<T> p) {
+ List<T> reverse = new ArrayList<T>(p.size());
for (int i = p.size() - 1; i >= 0; i--) {
reverse.add(p.get(i));
}
diff --git a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/Template.java b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/Template.java
index d1f8f9b9a52..055a262241a 100644
--- a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/Template.java
+++ b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/Template.java
@@ -72,7 +72,7 @@ public class Template extends TemplateCore {
public Map<String, UIWizardPage> getUIPages() {
if (pageMap == null) {
pageMap = new HashMap<String, UIWizardPage>();
- List rootPropertyGrouplist = templateDescriptor.getPropertyGroupList();
+ List<Element> rootPropertyGrouplist = templateDescriptor.getPropertyGroupList();
uiPagesProvider.clearOrderVector();
@@ -81,7 +81,7 @@ public class Template extends TemplateCore {
// root is set to null
// before invoking createUIElementTree(...).
uiElementTreeBuilderManager.setUIElementTreeRootNull();
- uiElementTreeBuilderManager.createUIElementTree(null, (Element) rootPropertyGrouplist.get(i));
+ uiElementTreeBuilderManager.createUIElementTree(null, rootPropertyGrouplist.get(i));
pageMap.putAll(uiPagesProvider.getWizardUIPages(uiElementTreeBuilderManager.getUIElementTreeRoot(), getValueStore()));
}
}
@@ -96,17 +96,17 @@ public class Template extends TemplateCore {
// pages.add(predatingPage);
// }
- Map templatePages = getUIPages();
- List templatePagesOrderVector = getPagesOrderVector();
+ Map<String, UIWizardPage> templatePages = getUIPages();
+ List<String> templatePagesOrderVector = getPagesOrderVector();
if (templatePagesOrderVector.size() != 0) {
IWizardPage prevPage = predatingPage;
for (int i=0; i < templatePagesOrderVector.size(); i++) {
- UIWizardPage page = (UIWizardPage) templatePages.get(templatePagesOrderVector.get(i));
+ UIWizardPage page = templatePages.get(templatePagesOrderVector.get(i));
pages.add(page);
page.setPreviousPage(prevPage);
if (i+1 < templatePagesOrderVector.size()) {
- page.setNextPage((UIWizardPage) templatePages.get(templatePagesOrderVector.get(i+1)));
+ page.setNextPage(templatePages.get(templatePagesOrderVector.get(i+1)));
} else {
page.setNextPage(followingPage);
}
@@ -120,8 +120,7 @@ public class Template extends TemplateCore {
try {
IWizardPage prevPage = predatingPage;
IWizardDataPage[] extraPages = getExtraCreatedPages((IWorkbenchWizard)wizard, PlatformUI.getWorkbench(), null);
- for (int i=0; i < extraPages.length; i++) {
- IWizardDataPage page = extraPages[i];
+ for (IWizardDataPage page : extraPages) {
pages.add(page);
page.setPreviousPage(prevPage);
diff --git a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/TemplateDrivenWizard.java b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/TemplateDrivenWizard.java
index 37a874a1222..ed3fb9285e6 100644
--- a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/TemplateDrivenWizard.java
+++ b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/TemplateDrivenWizard.java
@@ -13,7 +13,6 @@ package org.eclipse.cdt.ui.templateengine;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -55,13 +54,13 @@ public abstract class TemplateDrivenWizard extends Wizard {
@Override
public final void addPages() {
IWizardPage[] pages = getPagesBeforeTemplatePages();
- for(int i=0; i<pages.length; i++) {
- addPageBeforeTemplatePages(pages[i]);
+ for (IWizardPage page : pages) {
+ addPageBeforeTemplatePages(page);
}
pages = getPagesAfterTemplatePages();
- for(int i=0; i<pages.length; i++) {
- addPageAfterTemplatePages(pages[i]);
+ for (IWizardPage page : pages) {
+ addPageAfterTemplatePages(page);
}
}
@@ -130,8 +129,8 @@ public abstract class TemplateDrivenWizard extends Wizard {
@Override
public final boolean canFinish() {
- for(Iterator i = pagesBeforeTemplatePages.iterator(); i.hasNext(); ) {
- IWizardPage page = (IWizardPage) i.next();
+ for (IWizardPage wizardPage : pagesBeforeTemplatePages) {
+ IWizardPage page = wizardPage;
if (!page.isPageComplete()) {
return false;
}
@@ -139,14 +138,14 @@ public abstract class TemplateDrivenWizard extends Wizard {
if (templatePages == null) {
return false;
}
- for(Iterator i = templatePages.values().iterator(); i.hasNext(); ) {
- IWizardPage page = (IWizardPage) i.next();
+ for (Object element : templatePages.values()) {
+ IWizardPage page = (IWizardPage) element;
if (!page.isPageComplete()) {
return false;
}
}
- for(Iterator i = pagesAfterTemplatePages.iterator(); i.hasNext(); ) {
- IWizardPage page = (IWizardPage) i.next();
+ for (Object element : pagesAfterTemplatePages) {
+ IWizardPage page = (IWizardPage) element;
if (!page.isPageComplete()) {
return false;
}
@@ -177,11 +176,10 @@ public abstract class TemplateDrivenWizard extends Wizard {
if (statuses.length == 1 && statuses[0].getException() instanceof ProcessFailureException) {
TemplateEngineUIUtil.showError(statuses[0].getMessage(), statuses[0].getException());
return false;
- } else {
- String msg = Messages.getString("TemplateDrivenWizard.0"); //$NON-NLS-1$
- TemplateEngineUIUtil.showStatusDialog(msg, new MultiStatus(CUIPlugin.getPluginId(), IStatus.OK, statuses, msg, null));
- return true;
}
+ String msg = Messages.getString("TemplateDrivenWizard.0"); //$NON-NLS-1$
+ TemplateEngineUIUtil.showStatusDialog(msg, new MultiStatus(CUIPlugin.getPluginId(), IStatus.OK, statuses, msg, null));
+ return true;
}
@Override
diff --git a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/TemplateListSelectionPage.java b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/TemplateListSelectionPage.java
index 3963fd285e9..7eeb09a6881 100644
--- a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/TemplateListSelectionPage.java
+++ b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/TemplateListSelectionPage.java
@@ -152,7 +152,7 @@ class TemplateListSelectionPage extends WizardSelectionPage implements ISelectio
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
Template currentWizardSelection = null;
Object selectedObject = null;
- Iterator iter = selection.iterator();
+ Iterator<?> iter = selection.iterator();
if (iter.hasNext()) {
selectedObject = iter.next();
if (selectedObject instanceof Template)
diff --git a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/TemplatesChoiceWizard.java b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/TemplatesChoiceWizard.java
index 571379f7821..8eb4c62bc18 100644
--- a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/TemplatesChoiceWizard.java
+++ b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/TemplatesChoiceWizard.java
@@ -49,16 +49,16 @@ public abstract class TemplatesChoiceWizard extends Wizard implements ITemplates
@Override
public final void addPages() {
IWizardPage[] pages = getPagesBeforeTemplatePages();
- for(int i=0; i<pages.length; i++) {
- addPage(pages[i]);
+ for (IWizardPage page : pages) {
+ addPage(page);
}
templateListSelectionPage = new TemplateListSelectionPage(this);
addPage(templateListSelectionPage);
pages = getPagesAfterTemplatePages();
- for(int i=0; i<pages.length; i++) {
- addPage(pages[i]);
+ for (IWizardPage page : pages) {
+ addPage(page);
}
}
@@ -132,13 +132,12 @@ public abstract class TemplatesChoiceWizard extends Wizard implements ITemplates
if (statuses.length == 1 && statuses[0].getException() instanceof ProcessFailureException) {
TemplateEngineUIUtil.showError(statuses[0].getMessage(), statuses[0].getException());
return false;
- } else {
- if (DEBUG) {
- String msg = Messages.getString("TemplatesChoiceWizard.3"); //$NON-NLS-1$
- TemplateEngineUIUtil.showStatusDialog(msg, new MultiStatus(CUIPlugin.getPluginId(), IStatus.OK, statuses, msg, null));
- }
- return true;
}
+ if (DEBUG) {
+ String msg = Messages.getString("TemplatesChoiceWizard.3"); //$NON-NLS-1$
+ TemplateEngineUIUtil.showStatusDialog(msg, new MultiStatus(CUIPlugin.getPluginId(), IStatus.OK, statuses, msg, null));
+ }
+ return true;
}
/**
@@ -149,13 +148,13 @@ public abstract class TemplatesChoiceWizard extends Wizard implements ITemplates
Map<String, String> map = new HashMap<String, String>();
IWizardDataPage[] pages = getPagesBeforeTemplatePages();
- for(int i=0; i<pages.length; i++) {
- map.putAll(pages[i].getPageData());
+ for (IWizardDataPage page : pages) {
+ map.putAll(page.getPageData());
}
pages = getPagesAfterTemplateSelection();
- for(int i=0; i<pages.length; i++) {
- map.putAll(pages[i].getPageData());
+ for (IWizardDataPage page : pages) {
+ map.putAll(page.getPageData());
}
try {
@@ -163,13 +162,13 @@ public abstract class TemplatesChoiceWizard extends Wizard implements ITemplates
} catch (Exception e) {
e.printStackTrace();
}
- for(int i=0; i<pages.length; i++) {
- map.putAll(pages[i].getPageData());
+ for (IWizardDataPage page : pages) {
+ map.putAll(page.getPageData());
}
pages = getPagesAfterTemplatePages();
- for(int i=0; i<pages.length; i++) {
- map.putAll(pages[i].getPageData());
+ for (IWizardDataPage page : pages) {
+ map.putAll(page.getPageData());
}
return map;
diff --git a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/WizardNode.java b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/WizardNode.java
index 0b236af9b34..62fa5581801 100644
--- a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/WizardNode.java
+++ b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/WizardNode.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.ui.templateengine;
-import java.util.Iterator;
import java.util.Map;
import org.eclipse.jface.wizard.IWizard;
@@ -79,21 +78,21 @@ class WizardNode implements IWizardNode {
IWizardPage[] wpages = null;
try {
wpages = parentPage.getPagesAfterTemplateSelection();
+ for (IWizardPage wpage : wpages) {
+ addPage(wpage);
+ }
} catch (Exception e) {
}
- for(int i=0; i<wpages.length; i++) {
- addPage(wpages[i]);
- }
- Map/*<String, UIWizardPage>*/ pages = template.getUIPages();
- for(Iterator i = template.getPagesOrderVector().iterator(); i.hasNext(); ){
- String id = (String) i.next();
- addPage((UIWizardPage) pages.get(id));
+ Map<String, UIWizardPage> pages = template.getUIPages();
+ for (Object element : template.getPagesOrderVector()) {
+ String id = (String) element;
+ addPage(pages.get(id));
}
wpages = parentPage.getPagesAfterTemplatePages();
- for(int i=0; i<wpages.length; i++) {
- addPage(wpages[i]);
+ for (IWizardPage wpage : wpages) {
+ addPage(wpage);
}
}
@@ -103,8 +102,7 @@ class WizardNode implements IWizardNode {
finishPressed = true;
getContainer().updateButtons();
IWizardPage[] wpages = getPages();
- for(int i=0; i<wpages.length; i++) {
- IWizardPage page = wpages[i];
+ for (IWizardPage page : wpages) {
if (page instanceof UIWizardPage)
valueStore.putAll(((UIWizardPage) page).getPageData());
}
@@ -122,8 +120,7 @@ class WizardNode implements IWizardNode {
super.createPageControls(pageContainer);
parentPage.adjustTemplateValues(template);
IWizardPage[] wpages = getPages();
- for(int i=0; i<wpages.length; i++) {
- IWizardPage page = wpages[i];
+ for (IWizardPage page : wpages) {
if (page instanceof UIWizardPage)
((UIWizardPage) page).getComposite().getUIElement().setValues(template.getValueStore());
}
diff --git a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/pages/NewProjectCreationPage.java b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/pages/NewProjectCreationPage.java
index 8ba0222c42e..ce011c9e05f 100644
--- a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/pages/NewProjectCreationPage.java
+++ b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/pages/NewProjectCreationPage.java
@@ -71,9 +71,8 @@ public class NewProjectCreationPage extends WizardNewProjectCreationPage impleme
return false;
}
return true;
- } else {
- return false;
}
+ return false;
}
/**
diff --git a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/pages/TemplatePreferencePage.java b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/pages/TemplatePreferencePage.java
index edda6959dd1..8eb397577c9 100644
--- a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/pages/TemplatePreferencePage.java
+++ b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/pages/TemplatePreferencePage.java
@@ -88,7 +88,7 @@ public class TemplatePreferencePage extends PreferencePage implements IWorkbench
private int columnWidth = 100;
private int columnWeight = 50;
private String columnNames[];
- private static List/*<Element>*/ sharedElementList;
+ private static List<Element> sharedElementList;
private int attrListSize;
private ColumnLayoutData columnLayouts[] = { new ColumnWeightData(columnWeight, columnWidth),
@@ -329,7 +329,7 @@ public class TemplatePreferencePage extends PreferencePage implements IWorkbench
private void addXMLDataIntoTable() {
for (int i = 0, l = sharedElementList.size(); i < l; i++) {
- Element xmlElement = (Element) sharedElementList.get(i);
+ Element xmlElement = sharedElementList.get(i);
String name = xmlElement.getAttribute(TemplateEngineHelper.ID);
String value = xmlElement.getAttribute(TemplateEngineHelper.VALUE);
@@ -413,8 +413,8 @@ public class TemplatePreferencePage extends PreferencePage implements IWorkbench
TableItem duplicateItems[] = table.getItems();
TableItem duplicateItem = null;
- for (int nItems = 0; nItems < duplicateItems.length; nItems++) {
- duplicateItem = duplicateItems[nItems];
+ for (TableItem duplicateItem2 : duplicateItems) {
+ duplicateItem = duplicateItem2;
String duplicateString = duplicateItem.getText();
if (duplicateString.equals(name)) {
@@ -453,7 +453,7 @@ public class TemplatePreferencePage extends PreferencePage implements IWorkbench
int listSize = sharedElementList.size();
int i = 0;
while (i < listSize) {
- Element xmlElement = (Element) sharedElementList.get(i++);
+ Element xmlElement = sharedElementList.get(i++);
attrListSize = xmlElement.getAttributes().getLength();
}
} catch (Exception exp) {
diff --git a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/UIElementTreeBuilderHelper.java b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/UIElementTreeBuilderHelper.java
index 6078005f69f..860b09d6a42 100644
--- a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/UIElementTreeBuilderHelper.java
+++ b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/UIElementTreeBuilderHelper.java
@@ -56,7 +56,7 @@ public class UIElementTreeBuilderHelper implements IUIElementTreeBuilderHelper {
*
* @return List of child Elements for the given
*/
- public List getPropertyGroupList() {
+ public List<Element> getPropertyGroupList() {
return templateDescriptor.getPropertyGroupList();
}
@@ -91,8 +91,8 @@ public class UIElementTreeBuilderHelper implements IUIElementTreeBuilderHelper {
*/
private UIElement getUIWidget(Element element, UIAttributes uiAttributes) {
UIElement widgetElement= null;
- String id= uiAttributes.get(InputUIElement.ID);
- String type= uiAttributes.get(InputUIElement.TYPE);
+ String id= uiAttributes.get(UIElement.ID);
+ String type= uiAttributes.get(UIElement.TYPE);
if (type == null || type.length()==0 ) {
return null;
diff --git a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/uiwidgets/UIBrowseWidget.java b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/uiwidgets/UIBrowseWidget.java
index 4bc2e807208..c4daa4567b9 100644
--- a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/uiwidgets/UIBrowseWidget.java
+++ b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/uiwidgets/UIBrowseWidget.java
@@ -11,7 +11,6 @@
package org.eclipse.cdt.ui.templateengine.uitree.uiwidgets;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
@@ -32,7 +31,7 @@ import org.eclipse.cdt.ui.templateengine.uitree.UIElement;
* This gives a Label and Browse widget.
*/
-public class UIBrowseWidget extends UITextWidget implements ModifyListener {
+public class UIBrowseWidget extends UITextWidget {
/**
* Browse Button of this widget.
diff --git a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/uiwidgets/UIStringListWidget.java b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/uiwidgets/UIStringListWidget.java
index 0b2113914d2..590e0f8cb57 100644
--- a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/uiwidgets/UIStringListWidget.java
+++ b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/uiwidgets/UIStringListWidget.java
@@ -73,7 +73,7 @@ public class UIStringListWidget extends InputUIElement {
for (int i = 0; i < itemsList.size(); i++) {
itemString = itemString + itemsList.get(i) + "|"; //$NON-NLS-1$
}
- retMap.put(uiAttributes.get(InputUIElement.ID), itemString);
+ retMap.put(uiAttributes.get(UIElement.ID), itemString);
return retMap;
}
@@ -84,8 +84,8 @@ public class UIStringListWidget extends InputUIElement {
* @param valueMap
*/
@Override
- public void setValues(Map valueMap) {
- String items = (String) valueMap.get(uiAttributes.get(InputUIElement.ID));
+ public void setValues(Map<String, String> valueMap) {
+ String items = valueMap.get(uiAttributes.get(UIElement.ID));
if (items != null) {
items = items.trim();
@@ -115,7 +115,7 @@ public class UIStringListWidget extends InputUIElement {
gd.verticalIndent = 5;
label.setLayoutData(gd);
- if (uiAttributes.get(InputUIElement.DESCRIPTION) != null){
+ if (uiAttributes.get(UIElement.DESCRIPTION) != null){
String tipText = uiAttributes.get(UIElement.DESCRIPTION);
tipText = tipText.replaceAll("\\\\r\\\\n", "\r\n"); //$NON-NLS-1$ //$NON-NLS-2$, $NON-NLS-2$
label.setToolTipText(tipText);
diff --git a/core/org.eclipse.cdt.ui/utils.ui/org/eclipse/cdt/utils/ui/controls/FileListControl.java b/core/org.eclipse.cdt.ui/utils.ui/org/eclipse/cdt/utils/ui/controls/FileListControl.java
index 09e3f28857f..a090bb561ff 100644
--- a/core/org.eclipse.cdt.ui/utils.ui/org/eclipse/cdt/utils/ui/controls/FileListControl.java
+++ b/core/org.eclipse.cdt.ui/utils.ui/org/eclipse/cdt/utils/ui/controls/FileListControl.java
@@ -13,7 +13,6 @@ package org.eclipse.cdt.utils.ui.controls;
import java.util.ArrayList;
-import java.util.Iterator;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
@@ -184,7 +183,7 @@ public class FileListControl {
dialog.setInitialSelection(container);
- Class[] filteredResources = {IContainer.class, IProject.class};
+ Class<?>[] filteredResources = {IContainer.class, IProject.class};
dialog.addFilter(new TypedCDTViewerFilter(filteredResources));
dialog.setTitle(WORKSPACE_DIR_DIALOG_TITLE);
dialog.setMessage(WORKSPACE_DIR_DIALOG_MSG);
@@ -462,8 +461,8 @@ public class FileListControl {
if (list != null) {
list.removeAll();
}
- for (int i = 0; i < listVal.length; i++) {
- list.add(listVal[i]);
+ for (String element : listVal) {
+ list.add(element);
}
checkNotificationNeeded();
}
@@ -497,9 +496,8 @@ public class FileListControl {
}
public void notifyListeners(String oldVal[], String newVal[]){
- Iterator iter = listeners.iterator();
- while(iter.hasNext()){
- ((IFileListChangeListener)iter.next()).fileListChanged(this,oldVal,newVal);
+ for (IFileListChangeListener listener: listeners) {
+ listener.fileListChanged(this,oldVal,newVal);
}
}
@@ -673,7 +671,7 @@ public class FileListControl {
String newItem = null;
- if (dialog.open() == InputDialog.OK) {
+ if (dialog.open() == Window.OK) {
newItem = dialog.getValue();
/* If newItem is a directory or file path we need to
@@ -781,7 +779,7 @@ public class FileListControl {
// Prompt for value
SelectPathInputDialog dialog = new SelectPathInputDialog(getListControl().getShell(), title, message, initVal, null, browseType);
- if (dialog.open() == SelectPathInputDialog.OK) {
+ if (dialog.open() == Window.OK) {
input = dialog.getValue();
}
diff --git a/core/org.eclipse.cdt.ui/utils.ui/org/eclipse/cdt/utils/ui/controls/RadioButtonsArea.java b/core/org.eclipse.cdt.ui/utils.ui/org/eclipse/cdt/utils/ui/controls/RadioButtonsArea.java
index 5f1287eda71..36b90381e5b 100644
--- a/core/org.eclipse.cdt.ui/utils.ui/org/eclipse/cdt/utils/ui/controls/RadioButtonsArea.java
+++ b/core/org.eclipse.cdt.ui/utils.ui/org/eclipse/cdt/utils/ui/controls/RadioButtonsArea.java
@@ -12,7 +12,6 @@
package org.eclipse.cdt.utils.ui.controls;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.core.runtime.Assert;
@@ -75,8 +74,8 @@ public class RadioButtonsArea extends Composite {
@Override
public void setEnabled(boolean enabled) {
- for( int i = 0; i < radioButtons.length; i++ ) {
- radioButtons[i].setEnabled(enabled);
+ for (Button radioButton : radioButtons) {
+ radioButton.setEnabled(enabled);
}
}
@@ -89,8 +88,7 @@ public class RadioButtonsArea extends Composite {
private boolean checkArray(String[][] table) {
if (table == null)
return false;
- for (int i = 0; i < table.length; i++) {
- String[] array = table[i];
+ for (String[] array : table) {
if (array == null || array.length != 2)
return false;
}
@@ -98,8 +96,7 @@ public class RadioButtonsArea extends Composite {
}
protected void fireSelectionEvent(SelectionEvent event) {
- for(Iterator i = externalListeners.iterator(); i.hasNext(); ) {
- SelectionListener s = (SelectionListener)i.next();
+ for (SelectionListener s : externalListeners) {
s.widgetSelected(event);
}
}
@@ -171,8 +168,7 @@ public class RadioButtonsArea extends Composite {
if (this.value != null) {
boolean found = false;
- for (int i = 0; i < radioButtons.length; i++) {
- Button radio = radioButtons[i];
+ for (Button radio : radioButtons) {
boolean selection = false;
if (((String) radio.getData()).equals(this.value)) {
selection = true;

Back to the top