Example usage for org.eclipse.jface.viewers TableViewer reveal

List of usage examples for org.eclipse.jface.viewers TableViewer reveal

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers TableViewer reveal.

Prototype

@Override
    public void reveal(Object element) 

Source Link

Usage

From source file:org.fusesource.ide.fabric8.ui.navigator.properties.ContainerTableSheetPage.java

License:Open Source License

protected void setSelectedContainerIds(Set<String> selectedIds) {
    TableViewer viewer = getTableView().getViewer();
    if (viewer != null) {
        List<?> propertySources = getPropertySources();
        List selected = new ArrayList();
        for (Object object : propertySources) {
            if (object instanceof IPropertySource) {
                IPropertySource source = (IPropertySource) object;
                Object value = source.getPropertyValue("id");
                if (value instanceof String && selectedIds.contains(value.toString())) {
                    selected.add(object);
                }//from  ww  w  .  ja  v  a  2 s.c o  m
            }
        }
        viewer.setSelection(new StructuredSelection(selected));
        if (selected.size() == 1) {
            Object first = selected.get(0);
            viewer.reveal(first);
        }
    }

}

From source file:org.fusesource.ide.jmx.fabric8.navigator.properties.AbstractContainersTabSection.java

License:Open Source License

protected void setSelectedContainerIds(Set<String> selectedIds) {
    TableViewer viewer = getViewer();
    if (viewer != null) {
        List<?> propertySources = getPropertySources();
        List selected = new ArrayList();
        for (Object object : propertySources) {
            if (object instanceof IPropertySource) {
                IPropertySource source = (IPropertySource) object;
                Object value = source.getPropertyValue("id");
                if (value instanceof String && selectedIds.contains(value.toString())) {
                    selected.add(object);
                }//from   ww  w  . j a va2  s  .  c  o m
            }
        }
        viewer.setSelection(new StructuredSelection(selected));
        if (selected.size() == 1) {
            Object first = selected.get(0);
            viewer.reveal(first);
        }
    }
}

From source file:org.fusesource.ide.jmx.fabric8.navigator.properties.ContainerTableSheetPage.java

License:Open Source License

protected void setSelectedContainerIds(Set<String> selectedIds) {
    TableViewer viewer = getTableView().getViewer();
    if (viewer != null) {
        List<?> propertySources = getPropertySources();
        List selected = new ArrayList();
        for (Object object : propertySources) {
            if (object instanceof IPropertySource) {
                IPropertySource source = (IPropertySource) object;
                Object value = source.getPropertyValue("id");
                if (value instanceof String && selectedIds.contains(value.toString())) {
                    selected.add(object);
                }/*from ww  w . j  ava2  s  .  c  o m*/
            }
        }
        viewer.setSelection(new StructuredSelection(selected));
        if (selected.size() == 1) {
            Object first = selected.get(0);
            viewer.reveal(first);
        }
    }
}

From source file:org.fusesource.ide.jmx.karaf.navigator.osgi.BundlesTableSheetPage.java

License:Open Source License

protected void setSelectedBundleIds(Set<Long> selectedBundleIds) {
    TableViewer viewer = getTableView().getViewer();
    if (viewer != null) {
        List<?> propertySources = getPropertySources();
        List<Object> selected = new ArrayList<>();
        for (Object object : propertySources) {
            if (object instanceof IPropertySource) {
                BundleStateFacade bundleState = new BundleStateFacade((IPropertySource) object);
                final Long id = bundleState.getId();
                if (id != null && selectedBundleIds.contains(id)) {
                    selected.add(object);
                }//from   w w w. j  ava2  s. c o  m
            }
        }
        viewer.setSelection(new StructuredSelection(selected));
        if (selected.size() == 1) {
            Object first = selected.get(0);
            viewer.reveal(first);
        }
    }
}

From source file:org.fusesource.ide.jmx.karaf.navigator.osgi.BundlesTabSection.java

License:Open Source License

protected void setSelectedBundleIds(Set<Long> selectedBundleIds) {
    TableViewer viewer = getViewer();
    if (viewer != null) {
        List<?> propertySources = getPropertySources();
        List<Object> selected = new ArrayList<>();
        for (Object object : propertySources) {
            if (object instanceof IPropertySource) {
                BundleStateFacade bundleState = new BundleStateFacade((IPropertySource) object);
                final Long id = bundleState.getId();
                if (id != null && selectedBundleIds.contains(id)) {
                    selected.add(object);
                }/*from   w w w. j a va 2 s . co  m*/
            }
        }
        viewer.setSelection(new StructuredSelection(selected));
        if (selected.size() == 1) {
            Object first = selected.get(0);
            viewer.reveal(first);
        }
    }
}

From source file:org.kalypso.model.wspm.ui.view.table.UpdateSelectionJob.java

License:Open Source License

@Override
public IStatus runInUIThread(final IProgressMonitor monitor) {
    if (monitor.isCanceled())
        return Status.CANCEL_STATUS;

    final TableViewer viewer = m_tableControl.getTupleResultViewer();
    if (Objects.isNull(viewer) || viewer.getTable().isDisposed())
        return Status.CANCEL_STATUS;

    final IProfile profile = m_tableControl.getProfil();

    final IProfileRecord[] records = toSelection(profile);

    m_tableControl.disableFireSelectionChanged();

    viewer.setSelection(new StructuredSelection(records));
    viewer.reveal(records);

    return Status.OK_STATUS;
}