summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Sewe2017-08-11 06:57:48 -0400
committerAndreas Sewe2017-08-11 06:57:48 -0400
commitc40b503cd712380227c76bf720bc14255581b907 (patch)
treecbd0b7af7057711fe26e296e6cef281696ff0893
parent5fa24fc7e0ae6b8c1a0dfdc09c28ee7c903d0e7b (diff)
downloadorg.eclipse.mylyn.tasks-c40b503cd712380227c76bf720bc14255581b907.tar.gz
org.eclipse.mylyn.tasks-c40b503cd712380227c76bf720bc14255581b907.tar.xz
org.eclipse.mylyn.tasks-c40b503cd712380227c76bf720bc14255581b907.zip
Use ArrayContentProvider.getInstance() where possible
As ArrayContentProvider is stateless, re-using the global instance avoids a few allocations. Change-Id: I767fbc630c195208b4955d9a6344e41355060867 Signed-off-by: Andreas Sewe <andreas.sewe@codetrails.com>
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaSeeAlsoAttributeEditor.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskWorkingSetAction.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/RemoteTaskSelectionDialog.java6
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java2
4 files changed, 6 insertions, 6 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaSeeAlsoAttributeEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaSeeAlsoAttributeEditor.java
index e5b390d30..c1887de2a 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaSeeAlsoAttributeEditor.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaSeeAlsoAttributeEditor.java
@@ -104,7 +104,7 @@ public class BugzillaSeeAlsoAttributeEditor extends AbstractAttributeEditor {
seeAlsoViewer.setColumnProperties(seeAlsoColumns);
ColumnViewerToolTipSupport.enableFor(seeAlsoViewer, ToolTip.NO_RECREATE);
- seeAlsoViewer.setContentProvider(new ArrayContentProvider());
+ seeAlsoViewer.setContentProvider(ArrayContentProvider.getInstance());
seeAlsoViewer.addOpenListener(new IOpenListener() {
public void open(OpenEvent event) {
openseeAlso(event);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskWorkingSetAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskWorkingSetAction.java
index 63acc0090..258a02011 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskWorkingSetAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskWorkingSetAction.java
@@ -268,7 +268,7 @@ public class TaskWorkingSetAction extends Action implements IMenuCreator {
viewer = CheckboxTableViewer.newCheckList(viewerComposite, SWT.BORDER);
viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
viewer.setLabelProvider(new WorkingSetLabelProvider());
- viewer.setContentProvider(new ArrayContentProvider());
+ viewer.setContentProvider(ArrayContentProvider.getInstance());
viewer.addFilter(new WorkingSetFilter(taskWorkingSetIds));
viewer.setInput(window.getWorkbench().getWorkingSetManager().getWorkingSets());
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/RemoteTaskSelectionDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/RemoteTaskSelectionDialog.java
index 179dcc81c..23e98356c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/RemoteTaskSelectionDialog.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/RemoteTaskSelectionDialog.java
@@ -124,7 +124,7 @@ public class RemoteTaskSelectionDialog extends SelectionStatusDialog {
tasksViewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(400, 400).create());
tasksViewer.setLabelProvider(new DecoratingLabelProvider(new TaskElementLabelProvider(true),
PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()));
- tasksViewer.setContentProvider(new ArrayContentProvider());
+ tasksViewer.setContentProvider(ArrayContentProvider.getInstance());
tasksViewer.addFilter(new ViewerFilter() {
@Override
@@ -186,7 +186,7 @@ public class RemoteTaskSelectionDialog extends SelectionStatusDialog {
repositoriesViewer = new ComboViewer(repositoriesComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
repositoriesViewer.setLabelProvider(new TaskRepositoryLabelProvider());
- repositoriesViewer.setContentProvider(new ArrayContentProvider());
+ repositoriesViewer.setContentProvider(ArrayContentProvider.getInstance());
List<TaskRepository> taskRepositories = getTaskRepositories();
repositoriesViewer.setInput(taskRepositories);
if (taskRepositories.size() == 1) {
@@ -229,7 +229,7 @@ public class RemoteTaskSelectionDialog extends SelectionStatusDialog {
addToTaskListCheck.setText(Messages.RemoteTaskSelectionDialog_Add_to_Task_List_category);
categoryViewer = new ComboViewer(addToTaskListComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
- categoryViewer.setContentProvider(new ArrayContentProvider());
+ categoryViewer.setContentProvider(ArrayContentProvider.getInstance());
TaskList taskList = TasksUiPlugin.getTaskList();
LinkedList<AbstractTaskContainer> categories = new LinkedList<AbstractTaskContainer>(taskList.getCategories());
categories.addFirst(taskList.getDefaultCategory());
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java
index 88403877c..9a098f074 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java
@@ -237,7 +237,7 @@ public class TaskEditorAttachmentPart extends AbstractTaskEditorPart {
comparator = createComparator();
attachmentsViewer.setComparator(comparator);
- attachmentsViewer.setContentProvider(new ArrayContentProvider());
+ attachmentsViewer.setContentProvider(ArrayContentProvider.getInstance());
attachmentsViewer.setLabelProvider(createTableProvider());
attachmentsViewer.addOpenListener(new IOpenListener() {
public void open(OpenEvent event) {