1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-03 23:25:26 +02:00

[236505] Remote systems dialog not working

This commit is contained in:
David McKnight 2008-06-13 13:24:31 +00:00
parent c95b5ae3c1
commit 0de66634cd
3 changed files with 62 additions and 40 deletions

View file

@ -0,0 +1,49 @@
/********************************************************************************
* Copyright (c) 2008 IBM Corporation. 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) - [236505] Remote systems dialog not working
********************************************************************************/
package org.eclipse.rse.internal.ui;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import org.eclipse.swt.graphics.Image;
public class RSEImageMap {
private static Map _imageTable = new Hashtable(100);
public static Image get(Object key) {
if (_imageTable != null){
return (Image)_imageTable.get(key);
}
return null;
}
public static void put(Object key, Image image) {
if (_imageTable == null){
_imageTable = new Hashtable(100);
}
_imageTable.put(key, image);
}
public static final void shutdown() {
if (_imageTable != null) {
for (Iterator i = _imageTable.values().iterator(); i.hasNext();) {
((Image) i.next()).dispose();
}
_imageTable = null;
}
}
}

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
* Copyright (c) 2006, 2008 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
@ -15,15 +15,13 @@
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
* Martin Oberhuber (Wind River) - [197550] Fix NPE when refreshing Pending items
* David McKnight (IBM) - [236505] Remote systems dialog not working
********************************************************************************/
package org.eclipse.rse.internal.ui.view;
import java.util.Collection;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IWorkspace;
@ -40,6 +38,7 @@ import org.eclipse.jface.viewers.Viewer;
import org.eclipse.rse.core.model.ISystemViewInputProvider;
import org.eclipse.rse.core.model.SystemMessageObject;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.internal.ui.RSEImageMap;
import org.eclipse.rse.ui.SystemBasePlugin;
import org.eclipse.rse.ui.model.ISystemShellProvider;
import org.eclipse.rse.ui.operations.SystemDeferredTreeContentManager;
@ -74,12 +73,7 @@ public class SystemViewLabelAndContentProvider extends LabelProvider
private Hashtable resolvedChildrenPerFolder = null; // local cache to improve performance
private boolean _enableDeferredQueries = true;
private SystemDeferredTreeContentManager manager;
/**
* The cache of images that have been dispensed by this provider.
* Maps ImageDescriptor->Image.
*/
private Map imageTable = new Hashtable(40);
/**
* Constructor
*/
@ -161,19 +155,6 @@ public class SystemViewLabelAndContentProvider extends LabelProvider
}
}
}
// The following we got from WorkbenchLabelProvider
if (imageTable != null)
{
Collection imageValues = imageTable.values();
if (imageValues!=null)
{
Iterator images = imageValues.iterator();
if (images!=null)
while (images.hasNext())
((Image)images.next()).dispose();
imageTable = null;
}
}
}
@ -450,31 +431,22 @@ public class SystemViewLabelAndContentProvider extends LabelProvider
//System.out.println("Inside getImage. element = " + element + ", adapter = " + adapter);
if (adapter == null)
return null;
/*
boolean isOpen = false;
if (viewer instanceof AbstractTreeViewer)
{
AbstractTreeViewer atv = (AbstractTreeViewer)viewer;
isOpen = true; //atv.getExpandedState(element);
//System.out.println("In getImage for " + adapter.getName(element) + ": isOpen = " + isOpen);
}
ImageDescriptor descriptor = adapter.getImageDescriptor(element, isOpen);
*/
ImageDescriptor descriptor = adapter.getImageDescriptor(element);
//System.out.println("...descriptor = " + descriptor);
if (descriptor == null)
return null;
//add any annotations to the image descriptor
descriptor = decorateImage(descriptor, element);
//obtain the cached image corresponding to the descriptor
Image image = (Image) imageTable.get(descriptor);
Image image = RSEImageMap.get(descriptor);
if (image == null)
{
image = descriptor.createImage();
imageTable.put(descriptor, image);
RSEImageMap.put(descriptor, image);
}
//System.out.println("...image = " + image);
return image;
}
/**

View file

@ -32,6 +32,7 @@
* Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
* David Dykstal (IBM) - [197167] adding notification and waiting for RSE model
* David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
* David McKnight (IBM) - [236505] Remote systems dialog not working
********************************************************************************/
package org.eclipse.rse.ui;
@ -53,6 +54,7 @@ import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
import org.eclipse.rse.internal.core.model.SystemProfileManager;
import org.eclipse.rse.internal.core.model.SystemRegistry;
import org.eclipse.rse.internal.ui.RSEImageMap;
import org.eclipse.rse.internal.ui.RSESystemTypeAdapterFactory;
import org.eclipse.rse.internal.ui.RSEUIInitJob;
import org.eclipse.rse.internal.ui.subsystems.SubSystemConfigurationProxyAdapterFactory;
@ -500,8 +502,7 @@ public class RSEUIPlugin extends SystemBasePlugin
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
RSEImageMap.shutdown();
// disconnect all active connections
disconnectAll(true);