Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2019-05-22 15:25:01 -0400
committerAlexander Kurtakov2019-05-23 02:42:59 -0400
commit5d716493f5246ed829c9d556f87bb702843a0e17 (patch)
tree1e24f219ead86846fa68e229337212f3ef553b1e
parent2873061a63a0265393f1d094eaefcc16ced1b251 (diff)
downloadorg.eclipse.linuxtools-5d716493f5246ed829c9d556f87bb702843a0e17.tar.gz
org.eclipse.linuxtools-5d716493f5246ed829c9d556f87bb702843a0e17.tar.xz
org.eclipse.linuxtools-5d716493f5246ed829c9d556f87bb702843a0e17.zip
Use getStructuredSelection method instead of casting.
Change-Id: I1b0498453496a7fb0120af2cfe897f07f9e562cd Signed-off-by: Alexander Kurtakov <akurtako@redhat.com> Reviewed-on: https://git.eclipse.org/r/142621 Tested-by: Linux Tools Bot <linuxtools-bot@eclipse.org>
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/testutils/swt/DockerImageHierarchyViewAssertions.java4
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/EnableConnectionCommandHandler.java2
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/RemoveConnectionCommandHandler.java2
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/CopyValueAction.java2
-rwxr-xr-xoprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileView.java4
-rwxr-xr-xoprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewDeleteSessionAction.java4
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewDoubleClickListener.java4
-rwxr-xr-xprofiling/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/internal/dataviewers/charts/dialogs/ChartDialog.java2
-rw-r--r--profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STCollapseSelectionAction.java3
-rw-r--r--profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STCopyAction.java2
-rw-r--r--profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STExpandSelectionAction.java3
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/MetadataPage.java4
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/SpecfileQuickOutlineDialog.java3
-rw-r--r--valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/internal/valgrind/cachegrind/CachegrindViewPart.java2
-rw-r--r--valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/internal/valgrind/massif/MassifTreeViewer.java2
-rw-r--r--valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/internal/valgrind/ui/CoreMessagesViewer.java2
-rw-r--r--valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/CollapseAction.java2
-rw-r--r--valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/ExpandAction.java2
18 files changed, 25 insertions, 24 deletions
diff --git a/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/testutils/swt/DockerImageHierarchyViewAssertions.java b/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/testutils/swt/DockerImageHierarchyViewAssertions.java
index 8e1291bf56..9b34847da8 100644
--- a/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/testutils/swt/DockerImageHierarchyViewAssertions.java
+++ b/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/testutils/swt/DockerImageHierarchyViewAssertions.java
@@ -60,7 +60,7 @@ public class DockerImageHierarchyViewAssertions
public void hasSelectedElement(final IDockerImage expectedSelection) {
notNullValue();
- final IStructuredSelection selection = (IStructuredSelection) actual.getCommonViewer().getSelection();
+ final IStructuredSelection selection = actual.getCommonViewer().getStructuredSelection();
if (selection.size() != 1) {
failWithMessage("Expected Docker Image Hierarchy view to have <%s> selected elements, but there was <%s>",
1, selection.size());
@@ -84,7 +84,7 @@ public class DockerImageHierarchyViewAssertions
public void hasSelectedElement(final Object expectedSelection) {
notNullValue();
- final IStructuredSelection selection = (IStructuredSelection) actual.getCommonViewer().getSelection();
+ final IStructuredSelection selection = actual.getCommonViewer().getStructuredSelection();
if (selection.size() != 1) {
failWithMessage("Expected Docker Image Hierarchy view to have <%s> selected elements, but there was <%s>",
1, selection.size());
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/EnableConnectionCommandHandler.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/EnableConnectionCommandHandler.java
index 4ab7e1668f..20d8fd1ecf 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/EnableConnectionCommandHandler.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/EnableConnectionCommandHandler.java
@@ -39,7 +39,7 @@ public class EnableConnectionCommandHandler extends AbstractHandler {
final IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
if(activePart instanceof CommonNavigator) {
final CommonViewer viewer = ((CommonNavigator)activePart).getCommonViewer();
- final ITreeSelection selection = (ITreeSelection) viewer.getSelection();
+ final ITreeSelection selection = viewer.getStructuredSelection();
for (TreePath treePath : selection.getPaths()) {
final IDockerConnection conn = (IDockerConnection) treePath
.getLastSegment();
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/RemoveConnectionCommandHandler.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/RemoveConnectionCommandHandler.java
index 815f1a7ad8..9eb2b09a23 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/RemoveConnectionCommandHandler.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/RemoveConnectionCommandHandler.java
@@ -35,7 +35,7 @@ public class RemoveConnectionCommandHandler extends AbstractHandler {
final IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
if(activePart instanceof CommonNavigator) {
final CommonViewer viewer = ((CommonNavigator)activePart).getCommonViewer();
- final ITreeSelection selection = (ITreeSelection) viewer.getSelection();
+ final ITreeSelection selection = viewer.getStructuredSelection();
Stream.of(selection.getPaths()).forEach(
p -> DockerConnectionManager.getInstance().removeConnection(
(IDockerConnection) p.getLastSegment()));
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/CopyValueAction.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/CopyValueAction.java
index fd3d8a9503..402e429d08 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/CopyValueAction.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/CopyValueAction.java
@@ -37,7 +37,7 @@ public class CopyValueAction extends Action {
@Override
public void run() {
- IStructuredSelection selection = (IStructuredSelection)treeViewer.getSelection();
+ IStructuredSelection selection = treeViewer.getStructuredSelection();
if (!selection.isEmpty()) {
StringBuilder sb = new StringBuilder();
boolean needEOL = false;
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileView.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileView.java
index 910e3b5edc..f313a05e40 100755
--- a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileView.java
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileView.java
@@ -20,8 +20,8 @@ import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.linuxtools.internal.oprofile.core.model.OpModelRoot;
import org.eclipse.linuxtools.internal.oprofile.ui.OprofileUiMessages;
@@ -145,7 +145,7 @@ public class OprofileView extends ViewPart implements ISelectionChangedListener
@Override
public void selectionChanged(SelectionChangedEvent event) {
- TreeSelection tsl = (TreeSelection) viewer.getSelection();
+ ITreeSelection tsl = viewer.getStructuredSelection();
if (tsl.getFirstElement() instanceof UiModelSession) {
if (!deleteSessionAction.isEnabled()) {
deleteSessionAction.setEnabled(true);
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewDeleteSessionAction.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewDeleteSessionAction.java
index 10fa928045..36bcbcc3f2 100755
--- a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewDeleteSessionAction.java
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewDeleteSessionAction.java
@@ -15,7 +15,7 @@ package org.eclipse.linuxtools.internal.oprofile.ui.view;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.linuxtools.internal.oprofile.core.Oprofile;
import org.eclipse.linuxtools.internal.oprofile.core.OprofileCorePlugin;
@@ -36,7 +36,7 @@ public class OprofileViewDeleteSessionAction extends Action {
@Override
public void run() {
- TreeSelection tsl = (TreeSelection) treeViewer.getSelection();
+ ITreeSelection tsl = treeViewer.getStructuredSelection();
if (tsl.getFirstElement() instanceof UiModelSession) {
UiModelSession sess = (UiModelSession) tsl.getFirstElement();
deleteSession(sess);
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewDoubleClickListener.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewDoubleClickListener.java
index 43f18a1aa1..96c7d9593e 100644
--- a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewDoubleClickListener.java
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewDoubleClickListener.java
@@ -17,7 +17,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.linuxtools.internal.oprofile.core.Oprofile;
import org.eclipse.linuxtools.oprofile.ui.model.IUiModelElement;
@@ -44,7 +44,7 @@ public class OprofileViewDoubleClickListener implements IDoubleClickListener {
@Override
public void doubleClick(DoubleClickEvent event) {
TreeViewer tv = (TreeViewer) event.getSource();
- TreeSelection tsl = (TreeSelection) tv.getSelection();
+ ITreeSelection tsl = tv.getStructuredSelection();
IUiModelElement element = (IUiModelElement) tsl.getFirstElement();
try {
diff --git a/profiling/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/internal/dataviewers/charts/dialogs/ChartDialog.java b/profiling/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/internal/dataviewers/charts/dialogs/ChartDialog.java
index 9bd931066b..b344d3a97a 100755
--- a/profiling/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/internal/dataviewers/charts/dialogs/ChartDialog.java
+++ b/profiling/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/internal/dataviewers/charts/dialogs/ChartDialog.java
@@ -357,7 +357,7 @@ public class ChartDialog extends Dialog {
* @return a new chart
*/
private Chart produceChart() {
- IStructuredSelection selection = (IStructuredSelection) stViewer.getViewer().getSelection();
+ IStructuredSelection selection = stViewer.getViewer().getStructuredSelection();
if (selection == StructuredSelection.EMPTY)
return null;
Object[] objects = selection.toArray();
diff --git a/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STCollapseSelectionAction.java b/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STCollapseSelectionAction.java
index 8c3644913e..9338259967 100644
--- a/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STCollapseSelectionAction.java
+++ b/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STCollapseSelectionAction.java
@@ -16,6 +16,7 @@ import java.util.Iterator;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.AbstractTreeViewer;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.linuxtools.dataviewers.STDataViewersActivator;
import org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTTreeViewer;
@@ -45,7 +46,7 @@ public class STCollapseSelectionAction extends Action {
@Override
public void run() {
- TreeSelection selection = (TreeSelection) stViewer.getViewer().getSelection();
+ IStructuredSelection selection = stViewer.getViewer().getStructuredSelection();
if (selection != null && selection != TreeSelection.EMPTY) {
for (Iterator<?> itSel = selection.iterator(); itSel.hasNext();) {
stViewer.getViewer().collapseToLevel(itSel.next(), AbstractTreeViewer.ALL_LEVELS);
diff --git a/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STCopyAction.java b/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STCopyAction.java
index 79f2222cf1..c300b7b659 100644
--- a/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STCopyAction.java
+++ b/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STCopyAction.java
@@ -44,7 +44,7 @@ public class STCopyAction extends Action {
@Override
public void run() {
Clipboard cb = new Clipboard(Display.getDefault());
- IStructuredSelection selections = (IStructuredSelection) stViewer.getViewer().getSelection();
+ IStructuredSelection selections = stViewer.getViewer().getStructuredSelection();
Iterator<?> iterator = selections.iterator();
StringBuilder sb = new StringBuilder();
diff --git a/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STExpandSelectionAction.java b/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STExpandSelectionAction.java
index e00b45562d..34a04600bc 100644
--- a/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STExpandSelectionAction.java
+++ b/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STExpandSelectionAction.java
@@ -16,6 +16,7 @@ import java.util.Iterator;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.AbstractTreeViewer;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.linuxtools.dataviewers.STDataViewersActivator;
import org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTTreeViewer;
@@ -45,7 +46,7 @@ public class STExpandSelectionAction extends Action {
@Override
public void run() {
- TreeSelection selection = (TreeSelection) stViewer.getViewer().getSelection();
+ IStructuredSelection selection = stViewer.getViewer().getStructuredSelection();
if (selection != null && selection != TreeSelection.EMPTY) {
for (Iterator<?> itSel = selection.iterator(); itSel.hasNext();) {
stViewer.getViewer().expandToLevel(itSel.next(), AbstractTreeViewer.ALL_LEVELS);
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/MetadataPage.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/MetadataPage.java
index 5fdf33e72f..3e61a350cb 100644
--- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/MetadataPage.java
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/MetadataPage.java
@@ -164,7 +164,7 @@ public class MetadataPage extends FormPage {
});
// expand or shrink a category
tagsTreeViewer.addDoubleClickListener(event -> {
- IStructuredSelection selection = (IStructuredSelection) tagsTreeViewer.getSelection();
+ IStructuredSelection selection = tagsTreeViewer.getStructuredSelection();
if (selection.getFirstElement() instanceof CreaterepoTreeCategory) {
CreaterepoTreeCategory category = (CreaterepoTreeCategory) selection.getFirstElement();
tagsTreeViewer.setExpandedState(category, !tagsTreeViewer.getExpandedState(category));
@@ -322,7 +322,7 @@ public class MetadataPage extends FormPage {
* in the tag text field.
*/
private void addTag() {
- IStructuredSelection selection = (IStructuredSelection) tagsTreeViewer.getSelection();
+ IStructuredSelection selection = tagsTreeViewer.getStructuredSelection();
if (selection.getFirstElement() instanceof CreaterepoTreeCategory) {
CreaterepoTreeCategory category = (CreaterepoTreeCategory) selection.getFirstElement();
String text = tagTxt.getText().trim();
diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/SpecfileQuickOutlineDialog.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/SpecfileQuickOutlineDialog.java
index b4a66ee579..dbf0b8cc59 100644
--- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/SpecfileQuickOutlineDialog.java
+++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/SpecfileQuickOutlineDialog.java
@@ -16,7 +16,6 @@ import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.PopupDialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileElement;
import org.eclipse.swt.SWT;
@@ -143,6 +142,6 @@ public class SpecfileQuickOutlineDialog extends PopupDialog {
if (treeViewer == null) {
return null;
}
- return ((IStructuredSelection) treeViewer.getSelection()).getFirstElement();
+ return treeViewer.getStructuredSelection().getFirstElement();
}
}
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/internal/valgrind/cachegrind/CachegrindViewPart.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/internal/valgrind/cachegrind/CachegrindViewPart.java
index 88c1f1850f..bcd5a18cd5 100644
--- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/internal/valgrind/cachegrind/CachegrindViewPart.java
+++ b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/internal/valgrind/cachegrind/CachegrindViewPart.java
@@ -150,7 +150,7 @@ public class CachegrindViewPart extends ViewPart implements IValgrindToolView {
MenuManager manager = new MenuManager();
manager.addMenuListener(manager1 -> {
- ITreeSelection selection = (ITreeSelection) viewer.getSelection();
+ ITreeSelection selection = viewer.getStructuredSelection();
ICachegrindElement element = (ICachegrindElement) selection.getFirstElement();
if (contentProvider.hasChildren(element)) {
manager1.add(expandAction);
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/internal/valgrind/massif/MassifTreeViewer.java b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/internal/valgrind/massif/MassifTreeViewer.java
index cdbbe14ad2..9664b4e77a 100644
--- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/internal/valgrind/massif/MassifTreeViewer.java
+++ b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/internal/valgrind/massif/MassifTreeViewer.java
@@ -88,7 +88,7 @@ public class MassifTreeViewer {
MenuManager manager = new MenuManager();
manager.addMenuListener(manager1 -> {
- ITreeSelection selection = (ITreeSelection) viewer.getSelection();
+ ITreeSelection selection = viewer.getStructuredSelection();
MassifHeapTreeNode element = (MassifHeapTreeNode) selection.getFirstElement();
if (contentProvider.hasChildren(element)) {
manager1.add(expandAction);
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/internal/valgrind/ui/CoreMessagesViewer.java b/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/internal/valgrind/ui/CoreMessagesViewer.java
index 446064f3f8..cbc3950328 100644
--- a/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/internal/valgrind/ui/CoreMessagesViewer.java
+++ b/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/internal/valgrind/ui/CoreMessagesViewer.java
@@ -171,7 +171,7 @@ public class CoreMessagesViewer {
MenuManager manager = new MenuManager();
manager.addMenuListener(manager1 -> {
- ITreeSelection selection = (ITreeSelection) viewer.getSelection();
+ ITreeSelection selection = viewer.getStructuredSelection();
Object element = selection.getFirstElement();
if (contentProvider.hasChildren(element)) {
manager1.add(expandAction);
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/CollapseAction.java b/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/CollapseAction.java
index c17d04703c..c49a00f65e 100644
--- a/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/CollapseAction.java
+++ b/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/CollapseAction.java
@@ -39,7 +39,7 @@ public class CollapseAction extends Action {
@Override
public void run() {
- IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
+ IStructuredSelection selection = viewer.getStructuredSelection();
Object element = selection.getFirstElement();
viewer.collapseToLevel(element, AbstractTreeViewer.ALL_LEVELS);
}
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/ExpandAction.java b/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/ExpandAction.java
index af8125de22..09d793b5ed 100644
--- a/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/ExpandAction.java
+++ b/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/ExpandAction.java
@@ -38,7 +38,7 @@ public class ExpandAction extends Action {
@Override
public void run() {
- IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
+ IStructuredSelection selection = viewer.getStructuredSelection();
Object element = selection.getFirstElement();
viewer.expandToLevel(element, AbstractTreeViewer.ALL_LEVELS);
}

Back to the top