[
https://issues.jboss.org/browse/JBIDE-21755?page=com.atlassian.jira.plugi...
]
Viacheslav Kabanovich edited comment on JBIDE-21755 at 2/25/16 9:43 PM:
------------------------------------------------------------------------
I have a simple solution for 'autoloading' which may have side effects, so that I
put it here as snippet, not a PR:
Replace method inputChanged() in
org.jboss.tools.openshift.internal.common.ui.explorer.BaseExplorerContentProvider with
this code:
{code}
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
if(this.viewer != null) {
this.viewer.removeSelectionChangedListener(selectionListener);
}
this.viewer = (TreeViewer) viewer;
if(this.viewer != null) {
this.viewer.addSelectionChangedListener(selectionListener);
}
if(input != null && connectionListener != null) {
input.removeListener(connectionListener);
}
if(newInput instanceof ConnectionsRegistry) {
input = (ConnectionsRegistry) newInput;
if(connectionListener != null) {
input.addListener(connectionListener);
}
}
}
SelectionListener selectionListener = new SelectionListener();
class SelectionListener implements ISelectionChangedListener {
@Override
public void selectionChanged(SelectionChangedEvent event) {
ISelection s = event.getSelection();
if(!s.isEmpty() && s instanceof IStructuredSelection) {
IStructuredSelection st = (IStructuredSelection)s;
final Object o = st.getFirstElement();
if(o instanceof IConnection) {
return;
}
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
TreeViewer v = BaseExplorerContentProvider.this.viewer;
if(v != null && v.getControl() != null &&
!v.getControl().isDisposed()) {
boolean b = v.getExpandedState(o);
if(!b) {
v.setExpandedState(o, true);
v.setExpandedState(o, false);
}
}
}
});
}
}
}
{code}
The idea is to flip expansion to true and back to false for a selected node, which causes
loading. SWT Tree is nice to make it unnoticed for user, but of course loading resources
job appears in progress.
The code takes care not to flip expansion on IConnection node, because if it is not
connected yet that triggers Sign In dialog, and then there are two of them. But when user
clicks on children of connection it means that it is connected (is it always true?) and
just normal resource loading happens. Flip is called only if node is not expanded.
Probably we can also analyse if tree has children loaded before, then flip is also not
needed.
was (Author: scabanovich):
I have a simple solution for 'autoloading' which may have side effects, so that I
put it here as snippet, not a PR:
Replace method inputChanged() in
org.jboss.tools.openshift.internal.common.ui.explorer.BaseExplorerContentProvider with
this code:
{code}
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
if(this.viewer != null) {
this.viewer.removeSelectionChangedListener(selectionListener);
}
this.viewer = (TreeViewer) viewer;
if(this.viewer != null) {
this.viewer.addSelectionChangedListener(selectionListener);
}
if(input != null && connectionListener != null) {
input.removeListener(connectionListener);
}
if(newInput instanceof ConnectionsRegistry) {
input = (ConnectionsRegistry) newInput;
if(connectionListener != null) {
input.addListener(connectionListener);
}
}
}
SelectionListener selectionListener = new SelectionListener();
class SelectionListener implements ISelectionChangedListener {
@Override
public void selectionChanged(SelectionChangedEvent event) {
ISelection s = event.getSelection();
if(!s.isEmpty() && s instanceof IStructuredSelection) {
IStructuredSelection st = (IStructuredSelection)s;
final Object o = st.getFirstElement();
if(o instanceof IConnection) {
return;
}
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
TreeViewer v = BaseExplorerContentProvider.this.viewer;
if(v != null && v.getControl() != null &&
!v.getControl().isDisposed()) {
boolean b = v.getExpandedState(o);
if(!b) {
v.setExpandedState(o, true);
v.setExpandedState(o, false);
}
}
}
});
}
}
}
{code}
"Eager-er" loading of the project properties
--------------------------------------------
Key: JBIDE-21755
URL:
https://issues.jboss.org/browse/JBIDE-21755
Project: Tools (JBoss Tools)
Issue Type: Enhancement
Components: openshift
Affects Versions: 4.3.1.Beta2
Reporter: Xavier Coulon
Once I logged in the OpenShift Explorer, if I expand the connection and select my
project, all tables on the tabbed properties view are empty. I need to expand the project
in the OpenShift Explorer view to trigger a loading which then allows for displaying the
data in the properties view. This is somehow confusing because the user may think that the
OpenShift project is empty.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)