aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWojciech Sudol2014-03-23 16:40:12 (EDT)
committerWojciech Sudol2014-03-24 03:55:50 (EDT)
commit14fcb3d905696a2ca28bc5dfb589c66e5749f20f (patch)
treed5dc5c1fb6cc9e1dfad822cb000878523483061f
parent5b07d9b68ef8e333824d364aef18b1f787403155 (diff)
downloadeclipse.platform.ui-14fcb3d905696a2ca28bc5dfb589c66e5749f20f.zip
eclipse.platform.ui-14fcb3d905696a2ca28bc5dfb589c66e5749f20f.tar.gz
eclipse.platform.ui-14fcb3d905696a2ca28bc5dfb589c66e5749f20f.tar.bz2
Bug 429505 - [Progress] Refine Eclipse4 based progress viewrefs/changes/58/23758/2
- removed raw type warnings - removed unused methods Change-Id: I89d93ebfb5c2565dc6430a348e708653b88ec693 Signed-off-by: Wojciech Sudol <wojciech.sudol@pl.ibm.com>
-rw-r--r--bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/BlockedJobsDialog.java7
-rw-r--r--bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/DetailedProgressViewer.java10
-rw-r--r--bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/FinishedJobs.java26
-rw-r--r--bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/GroupInfo.java8
-rw-r--r--bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/JobInfo.java7
-rw-r--r--bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/JobTreeElement.java4
-rw-r--r--bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressAnimationProcessor.java4
-rw-r--r--bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressCanvasViewer.java8
-rw-r--r--bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressInfoItem.java22
-rw-r--r--bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressManager.java60
-rw-r--r--bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressMessages.java4
-rw-r--r--bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressMonitorJobsDialog.java5
-rw-r--r--bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressServiceImpl.java4
-rw-r--r--bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressViewUpdater.java18
-rw-r--r--bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressViewerContentProvider.java12
-rw-r--r--bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/StatusAdapterHelper.java76
-rw-r--r--bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/legacy/StatusAdapter.java137
-rw-r--r--bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/legacy/StatusUtil.java80
-rw-r--r--bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/messages.properties2
19 files changed, 106 insertions, 388 deletions
diff --git a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/BlockedJobsDialog.java b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/BlockedJobsDialog.java
index 1c9bf63..a0b754d 100644
--- a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/BlockedJobsDialog.java
+++ b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/BlockedJobsDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2010 IBM Corporation and others.
+ * Copyright (c) 2004, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -311,8 +311,9 @@ public class BlockedJobsDialog extends IconAndMessageDialog {
* @see org.eclipse.jface.viewers.ViewerComparator#compare(org.eclipse.jface.viewers.Viewer,
* java.lang.Object, java.lang.Object)
*/
- public int compare(Viewer testViewer, Object e1, Object e2) {
- return ((Comparable) e1).compareTo(e2);
+ @SuppressWarnings("unchecked")
+ public int compare(Viewer testViewer, Object e1, Object e2) {
+ return ((Comparable<Object>) e1).compareTo(e2);
}
});
ProgressViewerContentProvider provider = getContentProvider();
diff --git a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/DetailedProgressViewer.java b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/DetailedProgressViewer.java
index b01901c..a751684 100644
--- a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/DetailedProgressViewer.java
+++ b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/DetailedProgressViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2010 IBM Corporation and others.
+ * Copyright (c) 2005, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -158,7 +158,7 @@ public class DetailedProgressViewer extends AbstractProgressViewer {
ViewerComparator sorter = getComparator();
// Use a Set in case we are getting something added that exists
- Set newItems = new HashSet(elements.length);
+ Set<Object> newItems = new HashSet<Object>(elements.length);
Control[] existingChildren = control.getChildren();
for (int i = 0; i < existingChildren.length; i++) {
@@ -365,8 +365,8 @@ public class DetailedProgressViewer extends AbstractProgressViewer {
*
* @see org.eclipse.jface.viewers.StructuredViewer#getSelectionFromWidget()
*/
- protected List getSelectionFromWidget() {
- return new ArrayList(0);
+ protected List<Object> getSelectionFromWidget() {
+ return new ArrayList<Object>(0);
}
/*
@@ -465,7 +465,7 @@ public class DetailedProgressViewer extends AbstractProgressViewer {
* @see org.eclipse.jface.viewers.StructuredViewer#setSelectionToWidget(java.util.List,
* boolean)
*/
- protected void setSelectionToWidget(List l, boolean reveal) {
+ protected void setSelectionToWidget(@SuppressWarnings("rawtypes") List l, boolean reveal) {
}
diff --git a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/FinishedJobs.java b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/FinishedJobs.java
index 69ef66d..ae40c21 100644
--- a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/FinishedJobs.java
+++ b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/FinishedJobs.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * Copyright (c) 2003, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -58,9 +58,9 @@ public class FinishedJobs extends EventManager {
private IJobProgressManagerListener listener;
- private HashSet keptjobinfos = new HashSet();
+ private HashSet<JobTreeElement> keptjobinfos = new HashSet<JobTreeElement>();
- private HashMap finishedTime = new HashMap();
+ private HashMap<Object, Long> finishedTime = new HashMap<Object, Long>();
private static JobTreeElement[] EMPTY_INFOS;
@@ -184,7 +184,7 @@ public class FinishedJobs extends EventManager {
long now = System.currentTimeMillis();
finishedTime.put(info, new Long(now));
- Object parent = info.getParent();
+ GroupInfo parent = info.getParent();
if (!(parent == null || keptjobinfos.contains(parent))) {
keptjobinfos.add(parent);
finishedTime.put(parent, new Long(now));
@@ -227,10 +227,10 @@ public class FinishedJobs extends EventManager {
Object prop = myJob
.getProperty(ProgressManagerUtil.KEEPONE_PROPERTY);
if (prop instanceof Boolean && ((Boolean) prop).booleanValue()) {
- ArrayList found = null;
+ ArrayList<JobTreeElement> found = null;
JobTreeElement[] all;
synchronized (keptjobinfos) {
- all = (JobTreeElement[]) keptjobinfos
+ all = keptjobinfos
.toArray(new JobTreeElement[keptjobinfos.size()]);
}
for (int i = 0; i < all.length; i++) {
@@ -240,14 +240,14 @@ public class FinishedJobs extends EventManager {
if (job != null && job != myJob
&& job.belongsTo(myJob)) {
if (found == null) {
- found = new ArrayList();
+ found = new ArrayList<JobTreeElement>();
}
found.add(jte);
}
}
}
if (found != null) {
- return (JobTreeElement[]) found
+ return found
.toArray(new JobTreeElement[found.size()]);
}
}
@@ -322,8 +322,8 @@ public class FinishedJobs extends EventManager {
// delete all elements that have jte as their direct or indirect
// parent
- JobTreeElement jtes[] = (JobTreeElement[]) keptjobinfos
- .toArray(new JobTreeElement[keptjobinfos.size()]);
+ JobTreeElement jtes[] = keptjobinfos
+ .toArray(new JobTreeElement[keptjobinfos.size()]);
for (int i = 0; i < jtes.length; i++) {
JobTreeElement parent = (JobTreeElement) jtes[i]
.getParent();
@@ -361,7 +361,7 @@ public class FinishedJobs extends EventManager {
}
synchronized (keptjobinfos) {
- all = (JobTreeElement[]) keptjobinfos
+ all = keptjobinfos
.toArray(new JobTreeElement[keptjobinfos.size()]);
}
@@ -397,7 +397,7 @@ public class FinishedJobs extends EventManager {
*/
public void clearAll() {
synchronized (keptjobinfos) {
- JobTreeElement[] all = (JobTreeElement[]) keptjobinfos
+ JobTreeElement[] all = keptjobinfos
.toArray(new JobTreeElement[keptjobinfos.size()]);
for (int i = 0; i < all.length; i++) {
disposeAction(all[i]);
@@ -418,7 +418,7 @@ public class FinishedJobs extends EventManager {
* Return the set of kept jobs.
* @return Set
*/
- Set getKeptAsSet() {
+ Set<JobTreeElement> getKeptAsSet() {
return keptjobinfos;
}
}
diff --git a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/GroupInfo.java b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/GroupInfo.java
index d94b658..19786af 100644
--- a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/GroupInfo.java
+++ b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/GroupInfo.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2012 IBM Corporation and others.
+ * Copyright (c) 2003, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,7 +25,7 @@ import org.eclipse.osgi.util.NLS;
class GroupInfo extends JobTreeElement implements IProgressMonitor {
- private List infos = new ArrayList();
+ private List<JobInfo> infos = new ArrayList<JobInfo>();
private Object lock = new Object();
@@ -142,9 +142,9 @@ class GroupInfo extends JobTreeElement implements IProgressMonitor {
* finished and the receiver is not being kept then remove it.
*/
private void updateInProgressManager() {
- Iterator infoIterator = infos.iterator();
+ Iterator<JobInfo> infoIterator = infos.iterator();
while (infoIterator.hasNext()) {
- JobInfo next = (JobInfo) infoIterator.next();
+ JobInfo next = infoIterator.next();
if (!(next.getJob().getState() == Job.NONE)) {
progressManager.refreshGroup(this);
return;
diff --git a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/JobInfo.java b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/JobInfo.java
index 00845c3..65189e8 100644
--- a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/JobInfo.java
+++ b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/JobInfo.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2012 IBM Corporation and others.
+ * Copyright (c) 2003, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,6 +15,7 @@ package org.eclipse.e4.ui.progress.internal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.jobs.Job;
@@ -31,7 +32,7 @@ public class JobInfo extends JobTreeElement {
private IStatus blockedStatus;
private volatile boolean canceled = false;
- private List children = Collections.synchronizedList(new ArrayList());
+ private List<SubTaskInfo> children = Collections.synchronizedList(new ArrayList<SubTaskInfo>());
private Job job;
@@ -341,7 +342,7 @@ public class JobInfo extends JobTreeElement {
*
* @see org.eclipse.ui.internal.progress.JobTreeElement#getParent()
*/
- public Object getParent() {
+ public GroupInfo getParent() {
return parent;
}
diff --git a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/JobTreeElement.java b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/JobTreeElement.java
index 155a00d..bf6dbc9 100644
--- a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/JobTreeElement.java
+++ b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/JobTreeElement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * Copyright (c) 2003, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,7 +16,7 @@ import org.eclipse.swt.graphics.Image;
/**
* The JobTreeElement is the abstract superclass of items displayed in the tree.
*/
-public abstract class JobTreeElement implements Comparable {
+public abstract class JobTreeElement implements Comparable<Object> {
/**
* Return the parent of this object.
diff --git a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressAnimationProcessor.java b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressAnimationProcessor.java
index 1c2c1d8..08fc5fb 100644
--- a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressAnimationProcessor.java
+++ b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressAnimationProcessor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * Copyright (c) 2004, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -37,7 +37,7 @@ class ProgressAnimationProcessor implements IAnimationProcessor {
manager = animationManager;
}
- List items = Collections.synchronizedList(new ArrayList());
+ List<AnimationItem> items = Collections.synchronizedList(new ArrayList<AnimationItem>());
/*
* (non-Javadoc)
diff --git a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressCanvasViewer.java b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressCanvasViewer.java
index 94a368a..b4183c2 100644
--- a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressCanvasViewer.java
+++ b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressCanvasViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * Copyright (c) 2004, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -43,7 +43,7 @@ public class ProgressCanvasViewer extends AbstractProgressViewer {
Object[] displayedItems = new Object[0];
- private final static List EMPTY_LIST = new ArrayList();
+ private final static List<Object> EMPTY_LIST = new ArrayList<Object>();
/**
* Font metrics to use for determining pixel sizes.
@@ -128,7 +128,7 @@ public class ProgressCanvasViewer extends AbstractProgressViewer {
*
* @see org.eclipse.jface.viewers.StructuredViewer#getSelectionFromWidget()
*/
- protected List getSelectionFromWidget() {
+ protected List<Object> getSelectionFromWidget() {
//No selection on a Canvas
return EMPTY_LIST;
}
@@ -158,7 +158,7 @@ public class ProgressCanvasViewer extends AbstractProgressViewer {
* @see org.eclipse.jface.viewers.StructuredViewer#setSelectionToWidget(java.util.List,
* boolean)
*/
- protected void setSelectionToWidget(List l, boolean reveal) {
+ protected void setSelectionToWidget(@SuppressWarnings("rawtypes") List l, boolean reveal) {
//Do nothing as there is no selection
}
diff --git a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressInfoItem.java b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressInfoItem.java
index c4fc84b..b653f53 100644
--- a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressInfoItem.java
+++ b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressInfoItem.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2013 IBM Corporation and others.
+ * Copyright (c) 2005, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -87,7 +87,7 @@ public class ProgressInfoItem extends Composite {
ToolItem actionButton;
- List taskEntries = new ArrayList(0);
+ List<Link> taskEntries = new ArrayList<Link>(0);
private ProgressBar progressBar;
@@ -304,7 +304,7 @@ public class ProgressInfoItem extends Composite {
IDialogConstants.VERTICAL_SPACING);
linkData.left = new FormAttachment(progressLabel, 0, SWT.LEFT);
linkData.right = new FormAttachment(actionBar, 0, SWT.LEFT);
- ((Link) taskEntries.get(0)).setLayoutData(linkData);
+ taskEntries.get(0).setLayoutData(linkData);
}
}
@@ -562,7 +562,7 @@ public class ProgressInfoItem extends Composite {
// Remove completed tasks
if (infos.length < taskEntries.size()) {
for (int i = infos.length; i < taskEntries.size(); i++) {
- ((Link) taskEntries.get(i)).dispose();
+ taskEntries.get(i).dispose();
}
if (infos.length > 1)
@@ -716,7 +716,7 @@ public class ProgressInfoItem extends Composite {
// Give an initial value so as to constrain the link shortening
linkData.width = 20;
- ((Link) taskEntries.get(0)).setLayoutData(linkData);
+ taskEntries.get(0).setLayoutData(linkData);
}
}
@@ -743,7 +743,7 @@ public class ProgressInfoItem extends Composite {
// Give an initial value so as to constrain the link shortening
linkData.width = 20;
} else {
- Link previous = (Link) taskEntries.get(index - 1);
+ Link previous = taskEntries.get(index - 1);
linkData.top = new FormAttachment(previous,
IDialogConstants.VERTICAL_SPACING);
linkData.left = new FormAttachment(previous, 0, SWT.LEFT);
@@ -783,7 +783,7 @@ public class ProgressInfoItem extends Composite {
});
taskEntries.add(link);
} else {
- link = (Link) taskEntries.get(index);
+ link = taskEntries.get(index);
}
// check for action property
@@ -910,9 +910,9 @@ public class ProgressInfoItem extends Composite {
setForeground(color);
progressLabel.setForeground(color);
- Iterator taskEntryIterator = taskEntries.iterator();
+ Iterator<Link> taskEntryIterator = taskEntries.iterator();
while (taskEntryIterator.hasNext()) {
- ((Link) taskEntryIterator.next()).setForeground(color);
+ taskEntryIterator.next().setForeground(color);
}
}
@@ -928,9 +928,9 @@ public class ProgressInfoItem extends Composite {
actionBar.setBackground(color);
jobImageLabel.setBackground(color);
- Iterator taskEntryIterator = taskEntries.iterator();
+ Iterator<Link> taskEntryIterator = taskEntries.iterator();
while (taskEntryIterator.hasNext()) {
- ((Link) taskEntryIterator.next()).setBackground(color);
+ taskEntryIterator.next().setBackground(color);
}
}
diff --git a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressManager.java b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressManager.java
index 70d606a..597a932 100644
--- a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressManager.java
+++ b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2013 IBM Corporation and others.
+ * Copyright (c) 2003, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -73,12 +73,14 @@ public class ProgressManager extends ProgressProvider {
private static ProgressManager singleton;
- final private Map jobs = Collections.synchronizedMap(new HashMap());
+ final private Map<Job, JobInfo> jobs = Collections
+ .synchronizedMap(new HashMap<Job, JobInfo>());
- final Map runnableMonitors = Collections.synchronizedMap(new HashMap());
+ final Map<Job, JobMonitor> runnableMonitors = Collections
+ .synchronizedMap(new HashMap<Job, JobMonitor>());
- final private Map familyListeners = Collections
- .synchronizedMap(new HashMap());
+ final private Map<Object, Collection<IJobBusyListener>> familyListeners = Collections
+ .synchronizedMap(new HashMap<Object, Collection<IJobBusyListener>>());
// list of IJobProgressManagerListener
private ListenerList listeners = new ListenerList();
@@ -110,10 +112,7 @@ public class ProgressManager extends ProgressProvider {
*/
public static final String BLOCKED_JOB_KEY = "LOCKED_JOB"; //$NON-NLS-1$
-
-// private static final String IMAGE_KEY = "org.eclipse.ui.progress.images"; //$NON-NLS-1$
-
@Inject
@Optional
IProgressService progressService;
@@ -184,7 +183,7 @@ public class ProgressManager extends ProgressProvider {
public JobMonitor progressFor(Job job) {
synchronized (runnableMonitors) {
- JobMonitor monitor = (JobMonitor) runnableMonitors.get(job);
+ JobMonitor monitor = runnableMonitors.get(job);
if (monitor == null) {
monitor = new JobMonitor(job);
runnableMonitors.put(job, monitor);
@@ -200,9 +199,7 @@ public class ProgressManager extends ProgressProvider {
*
* @see org.eclipse.core.runtime.jobs.ProgressProvider#createProgressGroup()
*/
-
public IProgressMonitor createProgressGroup() {
- //TODO E4 circular dependency
return new GroupInfo(this, finishedJobs);
}
@@ -248,7 +245,7 @@ public class ProgressManager extends ProgressProvider {
* @return JobInfo
*/
JobInfo internalGetJobInfo(Job job) {
- return (JobInfo) jobs.get(job);
+ return jobs.get(job);
}
@@ -460,7 +457,7 @@ public class ProgressManager extends ProgressProvider {
public void aboutToRun(IJobChangeEvent event) {
JobInfo info = getJobInfo(event.getJob());
refreshJobInfo(info);
- Iterator startListeners = busyListenersForJob(event.getJob())
+ Iterator<IJobBusyListener> startListeners = busyListenersForJob(event.getJob())
.iterator();
while (startListeners.hasNext()) {
IJobBusyListener next = (IJobBusyListener) startListeners
@@ -478,10 +475,10 @@ public class ProgressManager extends ProgressProvider {
if (!PlatformUI.isWorkbenchRunning()) {
return;
}
- Iterator startListeners = busyListenersForJob(event.getJob())
+ Iterator<IJobBusyListener> startListeners = busyListenersForJob(event.getJob())
.iterator();
while (startListeners.hasNext()) {
- IJobBusyListener next = (IJobBusyListener) startListeners
+ IJobBusyListener next = startListeners
.next();
next.decrementBusy(event.getJob());
}
@@ -809,10 +806,10 @@ public class ProgressManager extends ProgressProvider {
*/
public JobInfo[] getJobInfos(boolean debug) {
synchronized (jobs) {
- Iterator iterator = jobs.keySet().iterator();
- Collection result = new ArrayList();
+ Iterator<Job> iterator = jobs.keySet().iterator();
+ Collection<JobInfo> result = new ArrayList<JobInfo>();
while (iterator.hasNext()) {
- Job next = (Job) iterator.next();
+ Job next = iterator.next();
if (!isCurrentDisplaying(next, debug)) {
result.add(jobs.get(next));
}
@@ -831,12 +828,12 @@ public class ProgressManager extends ProgressProvider {
*/
public JobTreeElement[] getRootElements(boolean debug) {
synchronized (jobs) {
- Iterator iterator = jobs.keySet().iterator();
- Collection result = new HashSet();
+ Iterator<Job> iterator = jobs.keySet().iterator();
+ Collection<JobTreeElement> result = new HashSet<JobTreeElement>();
while (iterator.hasNext()) {
- Job next = (Job) iterator.next();
+ Job next = iterator.next();
if (!isCurrentDisplaying(next, debug)) {
- JobInfo jobInfo = (JobInfo) jobs.get(next);
+ JobInfo jobInfo = jobs.get(next);
GroupInfo group = jobInfo.getGroupInfo();
if (group == null) {
result.add(jobInfo);
@@ -858,7 +855,7 @@ public class ProgressManager extends ProgressProvider {
*/
public boolean hasJobInfos() {
synchronized (jobs) {
- Iterator iterator = jobs.keySet().iterator();
+ Iterator<Job> iterator = jobs.keySet().iterator();
while (iterator.hasNext()) {
return true;
}
@@ -918,9 +915,9 @@ public class ProgressManager extends ProgressProvider {
*/
void addListenerToFamily(Object family, IJobBusyListener listener) {
synchronized (familyListeners) {
- Collection currentListeners = (Collection) familyListeners.get(family);
+ Collection<IJobBusyListener> currentListeners = familyListeners.get(family);
if (currentListeners == null) {
- currentListeners = new HashSet();
+ currentListeners = new HashSet<IJobBusyListener>();
familyListeners.put(family, currentListeners);
}
currentListeners.add(listener);
@@ -934,10 +931,10 @@ public class ProgressManager extends ProgressProvider {
*/
void removeListener(IJobBusyListener listener) {
synchronized (familyListeners) {
- Iterator families = familyListeners.keySet().iterator();
+ Iterator<Object> families = familyListeners.keySet().iterator();
while (families.hasNext()) {
Object next = families.next();
- Collection currentListeners = (Collection) familyListeners
+ Collection<IJobBusyListener> currentListeners = familyListeners
.get(next);
currentListeners.remove(listener);
@@ -955,7 +952,8 @@ public class ProgressManager extends ProgressProvider {
* @param job
* @return Collection of IJobBusyListener
*/
- private Collection busyListenersForJob(Job job) {
+ @SuppressWarnings("unchecked")
+ private Collection<IJobBusyListener> busyListenersForJob(Job job) {
if (job.isSystem()) {
return Collections.EMPTY_LIST;
}
@@ -965,12 +963,12 @@ public class ProgressManager extends ProgressProvider {
return Collections.EMPTY_LIST;
}
- Iterator families = familyListeners.keySet().iterator();
- Collection returnValue = new HashSet();
+ Iterator<Object> families = familyListeners.keySet().iterator();
+ Collection<IJobBusyListener> returnValue = new HashSet<IJobBusyListener>();
while (families.hasNext()) {
Object next = families.next();
if (job.belongsTo(next)) {
- Collection currentListeners = (Collection) familyListeners
+ Collection<IJobBusyListener> currentListeners = familyListeners
.get(next);
returnValue.addAll(currentListeners);
}
diff --git a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressMessages.java b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressMessages.java
index cd109e5..8bc2bbe 100644
--- a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressMessages.java
+++ b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -79,6 +79,8 @@ public class ProgressMessages extends NLS {
public static String TrimCommon_Progress_TrimName;
+ public static String StatusUtil_errorOccurred;
+
// public static String ProgressView_ClearAll; //TODO E4
static {
diff --git a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressMonitorJobsDialog.java b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressMonitorJobsDialog.java
index 7bd511e..8f7c90e 100644
--- a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressMonitorJobsDialog.java
+++ b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressMonitorJobsDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
+ * Copyright (c) 2004, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -144,8 +144,9 @@ public class ProgressMonitorJobsDialog extends ProgressMonitorDialog {
* @see org.eclipse.jface.viewers.ViewerComparator#compare(org.eclipse.jface.viewers.Viewer,
* java.lang.Object, java.lang.Object)
*/
+ @SuppressWarnings("unchecked")
public int compare(Viewer testViewer, Object e1, Object e2) {
- return ((Comparable) e1).compareTo(e2);
+ return ((Comparable<Object>) e1).compareTo(e2);
}
});
diff --git a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressServiceImpl.java b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressServiceImpl.java
index 4894280..e153f6f 100644
--- a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressServiceImpl.java
+++ b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressServiceImpl.java
@@ -47,7 +47,7 @@ public class ProgressServiceImpl implements IProgressService {
private static final String IMAGE_KEY = "org.eclipse.ui.progress.images"; //$NON-NLS-1$
- private Hashtable imageKeyTable = new Hashtable();
+ private Hashtable<Object, String> imageKeyTable = new Hashtable<Object, String>();
@Inject
@Optional
@@ -110,7 +110,7 @@ public class ProgressServiceImpl implements IProgressService {
@Override
public Image getIconFor(Job job) {
- Enumeration families = imageKeyTable.keys();
+ Enumeration<Object> families = imageKeyTable.keys();
while (families.hasMoreElements()) {
Object next = families.nextElement();
if (job.belongsTo(next)) {
diff --git a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressViewUpdater.java b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressViewUpdater.java
index f06d377..7457e24 100644
--- a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressViewUpdater.java
+++ b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressViewUpdater.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2013 IBM Corporation and others.
+ * Copyright (c) 2003, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -63,11 +63,11 @@ public class ProgressViewUpdater implements IJobProgressManagerListener {
*/
class UpdatesInfo {
- Collection additions = new HashSet();
+ Collection<JobTreeElement> additions = new HashSet<JobTreeElement>();
- Collection deletions = new HashSet();
+ Collection<JobTreeElement> deletions = new HashSet<JobTreeElement>();
- Collection refreshes = new HashSet();
+ Collection<JobTreeElement> refreshes = new HashSet<JobTreeElement>();
boolean updateAll = false;
@@ -113,9 +113,9 @@ public class ProgressViewUpdater implements IJobProgressManagerListener {
}
void processForUpdate() {
- HashSet staleAdditions = new HashSet();
+ HashSet<JobTreeElement> staleAdditions = new HashSet<JobTreeElement>();
- Iterator additionsIterator = additions.iterator();
+ Iterator<JobTreeElement> additionsIterator = additions.iterator();
while (additionsIterator.hasNext()) {
JobTreeElement treeElement = (JobTreeElement) additionsIterator
.next();
@@ -128,8 +128,8 @@ public class ProgressViewUpdater implements IJobProgressManagerListener {
additions.removeAll(staleAdditions);
- HashSet obsoleteRefresh = new HashSet();
- Iterator refreshIterator = refreshes.iterator();
+ HashSet<JobTreeElement> obsoleteRefresh = new HashSet<JobTreeElement>();
+ Iterator<JobTreeElement> refreshIterator = refreshes.iterator();
while (refreshIterator.hasNext()) {
JobTreeElement treeElement = (JobTreeElement) refreshIterator
.next();
@@ -189,7 +189,7 @@ public class ProgressViewUpdater implements IJobProgressManagerListener {
* @param provider
*/
void removeCollector(IProgressUpdateCollector provider) {
- HashSet newCollectors = new HashSet();
+ HashSet<IProgressUpdateCollector> newCollectors = new HashSet<IProgressUpdateCollector>();
for (int i = 0; i < collectors.length; i++) {
if (!collectors[i].equals(provider)) {
newCollectors.add(collectors[i]);
diff --git a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressViewerContentProvider.java b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressViewerContentProvider.java
index 60bdef7..d96641e 100644
--- a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressViewerContentProvider.java
+++ b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/ProgressViewerContentProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
+ * Copyright (c) 2004, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -167,21 +167,21 @@ public class ProgressViewerContentProvider extends ProgressContentProvider {
if (!showFinished)
return elements;
- Set kept = finishedJobs.getKeptAsSet();
+ Set<JobTreeElement> kept = finishedJobs.getKeptAsSet();
if (kept.size() == 0)
return elements;
- Set all = new HashSet();
+ Set<Object> all = new HashSet<Object>();
for (int i = 0; i < elements.length; i++) {
Object element = elements[i];
all.add(element);
}
- Iterator keptIterator = kept.iterator();
+ Iterator<JobTreeElement> keptIterator = kept.iterator();
while (keptIterator.hasNext()) {
- JobTreeElement next = (JobTreeElement) keptIterator.next();
+ JobTreeElement next = keptIterator.next();
if (next.getParent() != null && all.contains(next.getParent()))
continue;
all.add(next);
@@ -205,7 +205,7 @@ public class ProgressViewerContentProvider extends ProgressContentProvider {
if (elements.length == 0) {
return elements;
}
- HashSet roots = new HashSet();
+ HashSet<Object> roots = new HashSet<Object>();
for (int i = 0; i < elements.length; i++) {
JobTreeElement element = (JobTreeElement) elements[i];
if (element.isJobInfo()) {
diff --git a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/StatusAdapterHelper.java b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/StatusAdapterHelper.java
deleted file mode 100644
index a7fe954..0000000
--- a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/StatusAdapterHelper.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.e4.ui.progress.internal;
-
-import java.util.HashMap;
-
-import org.eclipse.e4.ui.progress.IProgressConstants;
-import org.eclipse.e4.ui.progress.internal.legacy.StatusAdapter;
-
-/**
- * StatusAdapterHelper is a class for caching {@link StatusAdapter} instances to make sure
- * they are not created twice within the progress service.
- * @since 3.3
- */
-public class StatusAdapterHelper {
- private static StatusAdapterHelper instance;
-
- private HashMap map;
-
- private StatusAdapterHelper() {
- }
-
- /**
- * Return the singleton.
- * @return StatusAdapterHelper
- */
- public static StatusAdapterHelper getInstance() {
- if (instance == null) {
- instance = new StatusAdapterHelper();
- }
- return instance;
- }
-
- /**
- * Set the {@link StatusAdapter} for the {@link JobInfo}
- * @param info
- * @param statusAdapter
- */
- public void putStatusAdapter(JobInfo info, StatusAdapter statusAdapter) {
- if (map == null) {
- map = new HashMap();
- }
- map.put(info, statusAdapter);
- }
-
- /**
- * Return the adapter for this info.
- * @param info
- * @return
- */
- public StatusAdapter getStatusAdapter(JobInfo info) {
- if (map == null) {
- return null;
- }
- StatusAdapter statusAdapter = (StatusAdapter) map.remove(info);
- statusAdapter.setProperty(
- IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY,
- Boolean.FALSE);
- return statusAdapter;
- }
-
- public void clear() {
- if (map != null) {
- map.clear();
- }
- }
-}
diff --git a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/legacy/StatusAdapter.java b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/legacy/StatusAdapter.java
deleted file mode 100644
index 4194621..0000000
--- a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/legacy/StatusAdapter.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.e4.ui.progress.internal.legacy;
-
-import java.util.HashMap;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.e4.ui.progress.IProgressConstants;
-
-/**
- * <p>
- * The StatusAdapter wraps an instance of IStatus subclass and can hold
- * additional information either by using properties or by adding a new adapter. Used during
- * status handling process.
- * </p>
- *
- * @since 3.3
- */
-public class StatusAdapter implements IAdaptable {
-
- static final String PROPERTY_PREFIX = IProgressConstants.PROPERTY_PREFIX
- + ".workbench.statusHandlers.adapters"; //$NON-NLS-1$
-
- public static final QualifiedName TITLE_PROPERTY = new QualifiedName(
- PROPERTY_PREFIX, "title"); //$NON-NLS-1$
-
- public static final QualifiedName TIMESTAMP_PROPERTY = new QualifiedName(
- PROPERTY_PREFIX, "timestamp"); //$NON-NLS-1$
-
- private IStatus status;
-
- private HashMap properties;
-
- private HashMap adapters;
-
- /**
- * Creates an instance of this class.
- *
- * @param status
- * the status to wrap. May not be <code>null</code>.
- */
- public StatusAdapter(IStatus status) {
- this.status = status;
- }
-
- /**
- * Associates new object which is an instance of the given class with this
- * adapter. object will be returned when {@link IAdaptable#getAdapter(Class)}
- * is called on the receiver with {@link Class} adapter as a parameter.
- *
- * @param adapter
- * the adapter class
- * @param object
- * the adapter instance
- */
- public void addAdapter(Class adapter, Object object) {
- if (adapters == null) {
- adapters = new HashMap();
- }
- adapters.put(adapter, object);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- @Override
- public Object getAdapter(Class adapter) {
- if (adapters == null) {
- return null;
- }
- return adapters.get(adapter);
- }
-
- /**
- * Returns the wrapped status.
- *
- * @return the wrapped status set in the constructor or in
- * <code>setStatus(IStatus)</code>. Will not be <code>null</code>.
- */
- public IStatus getStatus() {
- return status;
- }
-
- /**
- * Sets a new status for this adapter.
- *
- * @param status
- * the status to set. May not be <code>null</code>.
- */
- public void setStatus(IStatus status) {
- this.status = status;
- }
-
- /**
- * Returns the value of the adapter's property identified by the given key,
- * or <code>null</code> if this adapter has no such property.
- *
- * @param key
- * the qualified name of the property
- * @return the value of the property, or <code>null</code> if this adapter
- * has no such property
- */
- public Object getProperty(QualifiedName key) {
- if (properties == null) {
- return null;
- }
- return properties.get(key);
- }
-
- /**
- * Sets the value of the receiver's property identified by the given key.
- *
- * @param key
- * the qualified name of the property
- * @param value
- * the value of the property
- */
- public void setProperty(QualifiedName key, Object value) {
- if (properties == null) {
- properties = new HashMap();
- }
- properties.put(key, value);
- }
-}
diff --git a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/legacy/StatusUtil.java b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/legacy/StatusUtil.java
index a298b55..51cec72 100644
--- a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/legacy/StatusUtil.java
+++ b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/legacy/StatusUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,16 +12,12 @@ package org.eclipse.e4.ui.progress.internal.legacy;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.e4.ui.progress.IProgressConstants;
+import org.eclipse.e4.ui.progress.internal.ProgressMessages;
/**
* Utility class to create status objects.
@@ -31,47 +27,6 @@ import org.eclipse.e4.ui.progress.IProgressConstants;
*/
public class StatusUtil {
- /**
- * Answer a flat collection of the passed status and its recursive children
- */
- protected static List flatten(IStatus aStatus) {
- List result = new ArrayList();
-
- if (aStatus.isMultiStatus()) {
- IStatus[] children = aStatus.getChildren();
- for (int i = 0; i < children.length; i++) {
- IStatus currentChild = children[i];
- if (currentChild.isMultiStatus()) {
- Iterator childStatiiEnum = flatten(currentChild).iterator();
- while (childStatiiEnum.hasNext()) {
- result.add(childStatiiEnum.next());
- }
- } else {
- result.add(currentChild);
- }
- }
- } else {
- result.add(aStatus);
- }
-
- return result;
- }
-
- /**
- * This method must not be called outside the workbench.
- *
- * Utility method for creating status.
- */
- protected static IStatus newStatus(IStatus[] stati, String message,
- Throwable exception) {
-
- Assert.isTrue(message != null);
- Assert.isTrue(message.trim().length() != 0);
-
- return new MultiStatus(IProgressConstants.PLUGIN_ID, IStatus.ERROR,
- stati, message, exception);
- }
-
public static Throwable getCause(Throwable exception) {
// Figure out which exception should actually be logged -- if the given exception is
// a wrapper, unwrap it
@@ -137,33 +92,6 @@ public class StatusUtil {
statusMessage, getCause(exception));
}
- /**
- * This method must not be called outside the workbench.
- *
- * Utility method for creating status.
- * @param children
- * @param message
- * @param exception
- * @return {@link IStatus}
- */
- public static IStatus newStatus(List children, String message,
- Throwable exception) {
-
- List flatStatusCollection = new ArrayList();
- Iterator iter = children.iterator();
- while (iter.hasNext()) {
- IStatus currentStatus = (IStatus) iter.next();
- Iterator childrenIter = flatten(currentStatus).iterator();
- while (childrenIter.hasNext()) {
- flatStatusCollection.add(childrenIter.next());
- }
- }
-
- IStatus[] stati = new IStatus[flatStatusCollection.size()];
- flatStatusCollection.toArray(stati);
- return newStatus(stati, message, exception);
- }
-
/**
* Returns a localized message describing the given exception. If the given exception does not
* have a localized message, this returns the string "An error occurred".
@@ -185,9 +113,7 @@ public class StatusUtil {
return ce.getStatus().getMessage();
}
- //TODO localize
-// return WorkbenchMessages.StatusUtil_errorOccurred;
- return "ERROR OCCURRED"; //$NON-NLS-1$
+ return ProgressMessages.StatusUtil_errorOccurred;
}
diff --git a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/messages.properties b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/messages.properties
index 7964b41..af65c31 100644
--- a/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/messages.properties
+++ b/bundles/org.eclipse.e4.ui.progress/src/org/eclipse/e4/ui/progress/internal/messages.properties
@@ -74,3 +74,5 @@ WorkbenchPreference_RunInBackgroundButton=Always r&un in background
WorkbenchPreference_RunInBackgroundToolTip=Run long operations in the background where possible
TrimCommon_Progress_TrimName=&Progress
+
+StatusUtil_errorOccurred = An unexpected exception was thrown.