diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/widgets/SystemFileTreeAndListGroup.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/widgets/SystemFileTreeAndListGroup.java index 7c89030c068..1953f5da741 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/widgets/SystemFileTreeAndListGroup.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/widgets/SystemFileTreeAndListGroup.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2013 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 @@ -12,10 +12,13 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * David McKnight (IBM) - [422844] rse.files.ui fails to compile against Eclipse 4.4 Luna I20131126 *******************************************************************************/ package org.eclipse.rse.internal.files.ui.widgets; +import java.lang.reflect.Field; + +import org.eclipse.jface.viewers.CheckboxTableViewer; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.IStructuredContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; @@ -23,6 +26,7 @@ import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileEmpty; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Table; @@ -36,11 +40,10 @@ import org.eclipse.swt.widgets.Composite; * We subclass this to add some slight additional functionality, including support for * refreshing the contents. */ -public class SystemFileTreeAndListGroup extends org.eclipse.ui.internal.ide.dialogs.ResourceTreeAndListGroup +public class SystemFileTreeAndListGroup extends org.eclipse.ui.ide.dialogs.ResourceTreeAndListGroup { private Object rootObject = null; - private Object lastSelectedElement = null; - //private ISelectionProvider selectionProvider = null; + // CONSTANTS private static final RemoteFileEmpty EMPTYROOT = new RemoteFileEmpty(); @@ -122,29 +125,8 @@ public class SystemFileTreeAndListGroup extends org.eclipse.ui.internal.ide.dial } */ } - } + } - /** - * Refesh the contents of the file-selection checkbox viewer. - */ - public void refreshFiles() - { - if (lastSelectedElement != null) - populateListViewer(lastSelectedElement); - } - - /** - * Handle the selection of an item in the tree viewer. - * Intercept of parent so we can record the last selected tree node. - * @param event the selection changed event - */ - public void selectionChanged(SelectionChangedEvent event) - { - IStructuredSelection selection = (IStructuredSelection) event.getSelection(); - lastSelectedElement = selection.getFirstElement(); - //selectionProvider = event.getSelectionProvider(); - super.selectionChanged(event); - } /** * Set the root of the widget to be new Root. Regenerate all of the tables and lists from this @@ -154,7 +136,6 @@ public class SystemFileTreeAndListGroup extends org.eclipse.ui.internal.ide.dial */ public void setRoot(Object newRoot) { - lastSelectedElement = null; rootObject = newRoot; super.setRoot(newRoot); } @@ -166,4 +147,20 @@ public class SystemFileTreeAndListGroup extends org.eclipse.ui.internal.ide.dial { setRoot(EMPTYROOT); } + + /** + * Added this to preserve original behaviour with Luna + */ + public Table getListTable(){ + try { + Field f = getClass().getDeclaredField("listViewer"); //$NON-NLS-1$ + f.setAccessible(true); + CheckboxTableViewer tableV = (CheckboxTableViewer) f.get(this); //IllegalAccessException + return tableV.getTable(); + } + catch (Exception e){ + } + + return null; + } } diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteImportWizardPage1.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteImportWizardPage1.java index e5c2e326d52..0d0216aa39b 100644 --- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteImportWizardPage1.java +++ b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteImportWizardPage1.java @@ -20,11 +20,13 @@ * David McKnight (IBM) - [191558] [importexport][efs] Import to Project doesn't work with remote EFS projects * David McKnight (IBM) - [368465] Import Files -RSE - Cyclic Symbolic Reference problem * David McKnight (IBM) - [417033] [import/export] RSE import wizard won't let user to select new source + * David McKnight (IBM) - [422844] rse.files.ui fails to compile against Eclipse 4.4 Luna I20131126 *******************************************************************************/ package org.eclipse.rse.internal.importexport.files; import java.io.File; import java.io.IOException; +import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Collection; @@ -56,6 +58,7 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.window.Window; import org.eclipse.osgi.util.NLS; import org.eclipse.rse.core.model.IHost; @@ -148,21 +151,25 @@ class RemoteImportWizardPage1 extends WizardResourceImportPage implements Listen private MinimizedFileSystemElement _element; private List _resultsQueried; private volatile boolean _isActive = false; + private RemoteImportWizardPage1 _page; private Control _control; - public QueryAllJob(Object fileSystemObject, IImportStructureProvider provider, MinimizedFileSystemElement element, Control control){ + //public QueryAllJob(Object fileSystemObject, IImportStructureProvider provider, MinimizedFileSystemElement element, Control control){ + public QueryAllJob(Object fileSystemObject, IImportStructureProvider provider, MinimizedFileSystemElement element, RemoteImportWizardPage1 page){ super("Querying All"); //$NON-NLS-1$ _fileSystemObject = fileSystemObject; _provider = provider; _element = element; - _control = control; + _page = page; _resultsQueried = new ArrayList(); } public IStatus run(IProgressMonitor monitor){ _isActive = true; - + if (_control == null){ + _control = _page.getControl(); + } final Display d = _control.getDisplay(); d.syncExec(new Runnable(){ public void run(){ @@ -234,15 +241,18 @@ class RemoteImportWizardPage1 extends WizardResourceImportPage implements Listen if (element == _element){ Display.getDefault().asyncExec(new Runnable(){ public void run(){ - DummyProvider provider = new DummyProvider(); - - ISelection sel1 = new StructuredSelection(_element.getParent()); - SelectionChangedEvent evt1 = new SelectionChangedEvent(provider, sel1); - selectionGroup.selectionChanged(evt1); - - ISelection sel2 = new StructuredSelection(_element); - SelectionChangedEvent evt2 = new SelectionChangedEvent(provider, sel2); - selectionGroup.selectionChanged(evt2); + try { + Field treeViewerF = selectionGroup.getClass().getDeclaredField("treeViewer"); //$NON-NLS-1$ + treeViewerF.setAccessible(true); + TreeViewer treeV = (TreeViewer) treeViewerF.get(selectionGroup); + + // selection handling to get table populated + treeV.setSelection(new StructuredSelection(_element.getParent())); + treeV.setSelection(new StructuredSelection(_element)); + } catch (NoSuchFieldException e) { + } catch (IllegalAccessException e){ + } catch (SecurityException e) { + } } }); } @@ -576,8 +586,9 @@ class RemoteImportWizardPage1 extends WizardResourceImportPage implements Listen result.setFileSystemObject(fileSystemObject); if (_queryAllJob == null){ - _queryAllJob = new QueryAllJob(fileSystemObject, provider, result, getControl()); - _queryAllJob.schedule(); + //_queryAllJob = new QueryAllJob(fileSystemObject, provider, result, getControl()); + _queryAllJob = new QueryAllJob(fileSystemObject, provider, result, this); + _queryAllJob.schedule(1000); // need time for control to be created } ////Get the files for the element so as to build the first level