Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'core/org.eclipse.cdt.core/parser')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/TodoTaskParser.java17
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/TodoTaskUpdater.java27
2 files changed, 22 insertions, 22 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/TodoTaskParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/TodoTaskParser.java
index 5fe0e8ba319..923d8d1369b 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/TodoTaskParser.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/TodoTaskParser.java
@@ -53,7 +53,7 @@ public class TodoTaskParser {
}
public Task[] parse(IASTComment[] comments) {
- List/*<Task>*/ tasks = new ArrayList();
+ List<Task> tasks = new ArrayList<Task>();
for (int i = 0; i < comments.length; i++) {
IASTComment comment = comments[i];
IASTFileLocation location = comment.getFileLocation();
@@ -65,11 +65,11 @@ public class TodoTaskParser {
if (tasks.isEmpty()) {
return EMPTY_TASK_ARRAY;
}
- return (Task[]) tasks.toArray(new Task[tasks.size()]);
+ return tasks.toArray(new Task[tasks.size()]);
}
private void parse(char[] comment, String filename, int offset, int lineNumber,
- List/*<Task>*/ tasks) {
+ List<Task> tasks) {
int commentLength = comment.length;
int foundTaskIndex = tasks.size();
@@ -117,11 +117,10 @@ public class TodoTaskParser {
boolean containsEmptyTask = false;
for (int i = foundTaskIndex; i < tasks.size(); i++) {
- Task task = (Task) tasks.get(i);
+ Task task = tasks.get(i);
// Retrieve message start and end positions
int msgStart = task.start + task.tag.length();
- int maxValue = i + 1 < tasks.size() ?
- ((Task) tasks.get(i + 1)).start : commentLength;
+ int maxValue = i + 1 < tasks.size() ? tasks.get(i + 1).start : commentLength;
// At most beginning of next task
if (maxValue < msgStart) {
maxValue = msgStart; // Would only occur if tag is before EOF.
@@ -166,10 +165,10 @@ public class TodoTaskParser {
if (containsEmptyTask) {
for (int i = foundTaskIndex; i < tasks.size(); i++) {
- Task task1 = (Task) tasks.get(i);
+ Task task1 = tasks.get(i);
if (task1.message.length() == 0) {
for (int j = i + 1; j < tasks.size(); j++) {
- Task task2 = (Task) tasks.get(j);
+ Task task2 = tasks.get(j);
if (task2.message.length() != 0) {
task1.message = task2.message;
task1.end = task2.end;
@@ -182,7 +181,7 @@ public class TodoTaskParser {
// Add comment offset.
for (int i = foundTaskIndex; i < tasks.size(); i++) {
- Task task = (Task) tasks.get(i);
+ Task task = tasks.get(i);
task.lineNumber += getLineOffset(comment, task.start);
task.start += offset;
task.end += offset;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/TodoTaskUpdater.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/TodoTaskUpdater.java
index 491774ed921..0a903eff858 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/TodoTaskUpdater.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/TodoTaskUpdater.java
@@ -15,8 +15,9 @@ package org.eclipse.cdt.internal.core.pdom.indexer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
import java.util.StringTokenizer;
import org.eclipse.cdt.core.CCorePlugin;
@@ -34,6 +35,7 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
@@ -96,13 +98,13 @@ public class TodoTaskUpdater implements ITodoTaskUpdater {
public void updateTasks(IASTComment[] comments, IIndexFileLocation[] filesToUpdate) {
class TaskList {
IFile fFile;
- List fTasks;
+ List<Task> fTasks;
public TaskList(IFile file) {
fFile= file;
}
public void add(Task task) {
if (fTasks == null) {
- fTasks= new ArrayList();
+ fTasks= new ArrayList<Task>();
}
fTasks.add(task);
}
@@ -111,8 +113,8 @@ public class TodoTaskUpdater implements ITodoTaskUpdater {
final IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
// first collect all valid file-locations
- final HashMap pathToTaskList= new HashMap();
- final HashSet projects= new HashSet();
+ final Map<IPath, TaskList> pathToTaskList= new HashMap<IPath, TaskList>();
+ final Set<IProject> projects= new HashSet<IProject>();
for (int i = 0; i < filesToUpdate.length; i++) {
final IIndexFileLocation indexFileLocation = filesToUpdate[i];
final String filepath = indexFileLocation.getFullPath();
@@ -129,7 +131,7 @@ public class TodoTaskUpdater implements ITodoTaskUpdater {
final Task[] tasks = taskParser.parse(comments);
for (int i = 0; i < tasks.length; i++) {
final Task task = tasks[i];
- TaskList list= (TaskList) pathToTaskList.get(new Path(task.getFileLocation()));
+ TaskList list= pathToTaskList.get(new Path(task.getFileLocation()));
if (list != null) {
list.add(task);
}
@@ -140,18 +142,17 @@ public class TodoTaskUpdater implements ITodoTaskUpdater {
if (!pathToTaskList.isEmpty()) {
Job job= new Job(Messages.TodoTaskUpdater_UpdateJob) {
protected IStatus run(IProgressMonitor monitor) {
- MultiStatus status= new MultiStatus(CCorePlugin.PLUGIN_ID, 0, Messages.TodoTaskUpdater_UpdateJob, null);
+ MultiStatus status= new MultiStatus(CCorePlugin.PLUGIN_ID, 0,
+ Messages.TodoTaskUpdater_UpdateJob, null);
- for (Iterator it = pathToTaskList.values().iterator(); it.hasNext();) {
- final TaskList tasklist = (TaskList) it.next();
+ for (TaskList tasklist : pathToTaskList.values()) {
final IFile file= tasklist.fFile;
try {
if (file.exists()) {
file.deleteMarkers(ICModelMarker.TASK_MARKER, false, IResource.DEPTH_INFINITE);
- final List tasks= tasklist.fTasks;
+ final List<Task> tasks= tasklist.fTasks;
if (tasks != null) {
- for (Iterator itTasks = tasks.iterator(); itTasks.hasNext();) {
- Task task = (Task) itTasks.next();
+ for (Task task : tasks) {
applyTask(task, file);
}
}
@@ -165,7 +166,7 @@ public class TodoTaskUpdater implements ITodoTaskUpdater {
return status;
}
};
- job.setRule(new MultiRule((IProject[]) projects.toArray(new IProject[projects.size()])));
+ job.setRule(new MultiRule(projects.toArray(new IProject[projects.size()])));
job.setSystem(true);
job.schedule();
}

Back to the top