mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 23:05:47 +02:00
[334295] SystemViewForm dialogs don't display cancellable progress in the dialog
This commit is contained in:
parent
4a18f780de
commit
d9d7cb5c02
3 changed files with 110 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2002, 2008 IBM Corporation and others.
|
* Copyright (c) 2002, 2011 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -22,6 +22,7 @@
|
||||||
* Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
|
* Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
|
||||||
* David Dykstal (IBM) - [224671] [api] org.eclipse.rse.core API leaks non-API types
|
* David Dykstal (IBM) - [224671] [api] org.eclipse.rse.core API leaks non-API types
|
||||||
* David Dykstal (IBM) - [226761] fix NPE in team view when expanding items
|
* David Dykstal (IBM) - [226761] fix NPE in team view when expanding items
|
||||||
|
* David McKnight (IBM) - [334295] SystemViewForm dialogs don't display cancellable progress in the dialog
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.ui.view;
|
package org.eclipse.rse.internal.ui.view;
|
||||||
|
@ -195,6 +196,17 @@ public class SystemViewFilterAdapter extends AbstractSystemViewAdapter
|
||||||
return filter.getParentFilterContainer();
|
return filter.getParentFilterContainer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overriding because it's possible for a filter to be promptable while not being a ISystemPromptableObject
|
||||||
|
*/
|
||||||
|
public boolean isPromptable(Object element){
|
||||||
|
ISystemFilter filter = getFilter(element);
|
||||||
|
if (filter != null && filter.isPromptable()){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.isPromptable(element);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the children of this filter.
|
* Return the children of this filter.
|
||||||
* This is a combination of nested filters and resolved filter objects.
|
* This is a combination of nested filters and resolved filter objects.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2009 IBM Corporation and others.
|
* Copyright (c) 2000, 2011 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -17,6 +17,7 @@
|
||||||
* David McKnight (IBM) - [187711] select SystemView APIs exposed by the ISystemTree interface
|
* David McKnight (IBM) - [187711] select SystemView APIs exposed by the ISystemTree interface
|
||||||
* David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
|
* David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
|
||||||
* David McKnight (IBM) - [257721] Doubleclick doing special handling and expanding
|
* David McKnight (IBM) - [257721] Doubleclick doing special handling and expanding
|
||||||
|
* David McKnight (IBM) - [334295] SystemViewForm dialogs don't display cancellable progress in the dialog
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.internal.ui.view;
|
package org.eclipse.rse.internal.ui.view;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -441,6 +442,9 @@ public class SystemViewForm extends Composite implements ISystemTree
|
||||||
|
|
||||||
// for bug 257721, when using system view from a dialog, by default, we don't let adapter handle double-click
|
// for bug 257721, when using system view from a dialog, by default, we don't let adapter handle double-click
|
||||||
tree.allowAdapterToHandleDoubleClick(false);
|
tree.allowAdapterToHandleDoubleClick(false);
|
||||||
|
|
||||||
|
// add custom content provider
|
||||||
|
tree.setContentProvider(new SystemViewFormLabelAndContentProvider());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addOurMouseListener()
|
protected void addOurMouseListener()
|
||||||
|
|
|
@ -0,0 +1,92 @@
|
||||||
|
/********************************************************************************
|
||||||
|
* Copyright (c) 2011 IBM Corporation and others. All rights reserved.
|
||||||
|
* This program and the accompanying materials are made available under the terms
|
||||||
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Initial Contributors:
|
||||||
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
|
* component that contains this file: David McKnight.
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* David McKnight (IBM) - [334295] SystemViewForm dialogs don't display cancellable progress in the dialog
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.rse.internal.ui.view;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.jface.operation.IRunnableContext;
|
||||||
|
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||||
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||||
|
import org.eclipse.rse.ui.SystemBasePlugin;
|
||||||
|
import org.eclipse.rse.ui.view.IContextObject;
|
||||||
|
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
|
||||||
|
import org.eclipse.ui.internal.progress.ProgressMessages;
|
||||||
|
|
||||||
|
public class SystemViewFormLabelAndContentProvider extends
|
||||||
|
SystemViewLabelAndContentProvider {
|
||||||
|
|
||||||
|
// override to deal with progress monitor
|
||||||
|
public Object[] getChildren(Object object)
|
||||||
|
{
|
||||||
|
Object element = object;
|
||||||
|
if (object instanceof IContextObject)
|
||||||
|
{
|
||||||
|
element = ((IContextObject)object).getModelObject();
|
||||||
|
}
|
||||||
|
ISystemViewElementAdapter adapter = getViewAdapter(element);
|
||||||
|
if (supportsDeferredQueries() && !adapter.isPromptable(element))
|
||||||
|
{
|
||||||
|
IRunnableContext irc = RSEUIPlugin.getTheSystemRegistryUI().getRunnableContext();
|
||||||
|
if (irc == null){
|
||||||
|
irc = SystemBasePlugin.getActiveWorkbenchWindow();
|
||||||
|
}
|
||||||
|
if (irc == null){ // no window - defer to the base behaviour
|
||||||
|
return super.getChildren(object);
|
||||||
|
}
|
||||||
|
final Object fparent = object;
|
||||||
|
final Object felement = element;
|
||||||
|
final ISystemViewElementAdapter fadapter = adapter;
|
||||||
|
class MyRunnable implements IRunnableWithProgress
|
||||||
|
{
|
||||||
|
private Object[] _children = null;
|
||||||
|
public void run(IProgressMonitor monitor)
|
||||||
|
throws InvocationTargetException, InterruptedException {
|
||||||
|
|
||||||
|
String taskName = NLS.bind(ProgressMessages.DeferredTreeContentManager_FetchingName, fadapter.getAbsoluteName(felement));
|
||||||
|
monitor.beginTask(taskName, IProgressMonitor.UNKNOWN);
|
||||||
|
if (fparent instanceof IContextObject){
|
||||||
|
_children = fadapter.getChildren((IContextObject)fparent, monitor);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_children = fadapter.getChildren((IAdaptable)fparent, monitor);
|
||||||
|
}
|
||||||
|
monitor.done();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object[] getChildren(){
|
||||||
|
return _children;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
MyRunnable runnable = new MyRunnable();
|
||||||
|
try {
|
||||||
|
irc.run(true, true, runnable);
|
||||||
|
} catch (InvocationTargetException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return runnable.getChildren();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return super.getChildren(object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue