Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2021-04-26 09:19:20 +0000
committerAlexander Kurtakov2021-04-26 09:52:09 +0000
commit875f97c0cffb147e110374a6c51f9150a326da2f (patch)
tree9b6e8c588c3ad43b0048488e9c76bd3750a6048f
parent0157397c26188d4f1db6f8ae9aed27808d4bd16f (diff)
downloadeclipse.platform.team-I20210501-1800.tar.gz
eclipse.platform.team-I20210501-1800.tar.xz
eclipse.platform.team-I20210501-1800.zip
Change-Id: I23b9caa4df8d3f8b90cadaca92ec992d032908d9 Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.team/+/179827 Tested-by: Platform Bot <platform-bot@eclipse.org> Reviewed-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemTableProvider.java54
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/PessimisticFilesystemProvider.java8
2 files changed, 31 insertions, 31 deletions
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemTableProvider.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemTableProvider.java
index 595d61d95..b263f35cd 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemTableProvider.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemTableProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2017 IBM Corporation and others.
+ * Copyright (c) 2006, 2021 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -25,7 +25,7 @@ import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TableLayout;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -63,9 +63,9 @@ public class FileSystemTableProvider {
viewer.setLabelProvider(new HistoryLabelProvider());
// By default, reverse sort by revision.
- HistorySorter sorter = new HistorySorter(COL_DATE);
+ HistoryComparator sorter = new HistoryComparator(COL_DATE);
sorter.setReversed(true);
- viewer.setSorter(sorter);
+ viewer.setComparator(sorter);
return viewer;
}
@@ -104,15 +104,15 @@ public class FileSystemTableProvider {
if (entry == null)
return ""; //$NON-NLS-1$
switch (columnIndex) {
- case COL_TYPE :
- if (entry instanceof FileSystemFileRevision)
- return "FileSystem revision"; //$NON-NLS-1$
-
- return "Local history revision"; //$NON-NLS-1$
- case COL_DATE :
- long date = entry.getTimestamp();
- Date dateFromLong = new Date(date);
- return DateFormat.getInstance().format(dateFromLong);
+ case COL_TYPE :
+ if (entry instanceof FileSystemFileRevision)
+ return "FileSystem revision"; //$NON-NLS-1$
+
+ return "Local history revision"; //$NON-NLS-1$
+ case COL_DATE :
+ long date = entry.getTimestamp();
+ Date dateFromLong = new Date(date);
+ return DateFormat.getInstance().format(dateFromLong);
}
return ""; //$NON-NLS-1$
}
@@ -137,7 +137,7 @@ public class FileSystemTableProvider {
/**
* The history sorter
*/
- class HistorySorter extends ViewerSorter {
+ class HistoryComparator extends ViewerComparator {
private boolean reversed = false;
private int columnNumber;
@@ -149,7 +149,7 @@ public class FileSystemTableProvider {
* The constructor.
* @param columnNumber
*/
- public HistorySorter(int columnNumber) {
+ public HistoryComparator(int columnNumber) {
this.columnNumber = columnNumber;
}
@@ -169,8 +169,8 @@ public class FileSystemTableProvider {
result = super.compare(compareViewer, o1, o2);
} else {
int[] columnSortOrder = SORT_ORDERS_BY_COLUMN[columnNumber];
- for (int i = 0; i < columnSortOrder.length; ++i) {
- result = compareColumnValue(columnSortOrder[i], e1, e2);
+ for (int element : columnSortOrder) {
+ result = compareColumnValue(element, e1, e2);
if (result != 0)
break;
}
@@ -185,16 +185,16 @@ public class FileSystemTableProvider {
*/
int compareColumnValue(int columnNumber, IFileRevision e1, IFileRevision e2) {
switch (columnNumber) {
- case 0 : /* date */
- long date1 = e1.getTimestamp();
- long date2 = e2.getTimestamp();
- if (date1 == date2)
- return 0;
+ case 0 : /* date */
+ long date1 = e1.getTimestamp();
+ long date2 = e2.getTimestamp();
+ if (date1 == date2)
+ return 0;
- return date1 > date2 ? -1 : 1;
+ return date1 > date2 ? -1 : 1;
- default :
- return 0;
+ default :
+ return 0;
}
}
@@ -260,12 +260,12 @@ public class FileSystemTableProvider {
public void widgetSelected(SelectionEvent e) {
// column selected - need to sort
int column = tableViewer.getTable().indexOf((TableColumn) e.widget);
- HistorySorter oldSorter = (HistorySorter) tableViewer.getSorter();
+ HistoryComparator oldSorter = (HistoryComparator) tableViewer.getComparator();
if (oldSorter != null && column == oldSorter.getColumnNumber()) {
oldSorter.setReversed(!oldSorter.isReversed());
tableViewer.refresh();
} else {
- tableViewer.setSorter(new HistorySorter(column));
+ tableViewer.setComparator(new HistoryComparator(column));
}
}
};
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/PessimisticFilesystemProvider.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/PessimisticFilesystemProvider.java
index 6c296c7bb..26179976c 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/PessimisticFilesystemProvider.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/PessimisticFilesystemProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2021 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -311,8 +311,8 @@ public class PessimisticFilesystemProvider extends RepositoryProvider {
DataOutputStream out= new DataOutputStream(byteOut);
try {
out.writeInt(controlledResources.size());
- for (Iterator i= controlledResources.iterator(); i.hasNext();) {
- IResource resource= (IResource) i.next();
+ for (Object element : controlledResources) {
+ IResource resource= (IResource) element;
out.writeUTF(resource.getProjectRelativePath().toString());
}
out.flush();
@@ -672,7 +672,7 @@ public class PessimisticFilesystemProvider extends RepositoryProvider {
* Answers a collection of all of the resources contained below
* the given resource and the resource itself.
*/
- private Collection getSubtreeMembers(IResource resource) {
+ private Collection<IResource> getSubtreeMembers(IResource resource) {
final Set<IResource> resources = new HashSet<>(1);
IResourceVisitor visitor= resource1 -> {
switch (resource1.getType()) {

Back to the top