View | Details | Raw Unified | Return to bug 190805
Collapse All | Expand All

(-)src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreFileAdapter.java (-1 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2008 IBM Corporation and others.
2
 * Copyright (c) 2006, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 16-21 Link Here
16
 * Martin Oberhuber (Wind River) - [235363][api][breaking] IHostFileToRemoteFileAdapter methods should return AbstractRemoteFile
16
 * Martin Oberhuber (Wind River) - [235363][api][breaking] IHostFileToRemoteFileAdapter methods should return AbstractRemoteFile
17
 * David McKnight   (IBM)        - [244765] Invalid thread access during workbench termination
17
 * David McKnight   (IBM)        - [244765] Invalid thread access during workbench termination
18
 * David McKnight   (IBM)        - [255699] NPE when filter string doesn't return result in FileServiceSubSystem.list
18
 * David McKnight   (IBM)        - [255699] NPE when filter string doesn't return result in FileServiceSubSystem.list
19
 * David McKnight   (IBM)        - [190805] [performance][dstore] Right-click > Disconnect on a dstore connection is slow and spawns many Jobs
19
 *******************************************************************************/
20
 *******************************************************************************/
20
21
21
package org.eclipse.rse.internal.subsystems.files.dstore;
22
package org.eclipse.rse.internal.subsystems.files.dstore;
Lines 43-48 Link Here
43
44
44
	private void registerFilePropertyChangeListener(FileServiceSubSystem ss)
45
	private void registerFilePropertyChangeListener(FileServiceSubSystem ss)
45
	{
46
	{
47
		if (_listener != null && _listener.isFinished()){
48
			_listener = null;
49
		}
46
		if (_listener == null)
50
		if (_listener == null)
47
		{
51
		{
48
			DStoreConnectorService connectorService = (DStoreConnectorService)ss.getConnectorService();
52
			DStoreConnectorService connectorService = (DStoreConnectorService)ss.getConnectorService();
(-)src/org/eclipse/rse/internal/subsystems/files/dstore/RemoteFilePropertyChangeListener.java (-92 / +38 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2002, 2008 IBM Corporation and others.
2
 * Copyright (c) 2002, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 14-19 Link Here
14
 * Contributors:
14
 * Contributors:
15
 * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
15
 * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
16
 * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
16
 * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
17
 * David McKnight   (IBM)        - [190805] [performance][dstore] Right-click > Disconnect on a dstore connection is slow and spawns many Jobs
17
 *******************************************************************************/
18
 *******************************************************************************/
18
19
19
package org.eclipse.rse.internal.subsystems.files.dstore;
20
package org.eclipse.rse.internal.subsystems.files.dstore;
Lines 40-47 Link Here
40
import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
41
import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
41
import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem;
42
import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem;
42
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
43
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
43
import org.eclipse.rse.ui.SystemBasePlugin;
44
import org.eclipse.swt.widgets.Display;
45
import org.eclipse.swt.widgets.Shell;
44
import org.eclipse.swt.widgets.Shell;
46
import org.eclipse.ui.progress.UIJob;
45
import org.eclipse.ui.progress.UIJob;
47
46
Lines 64-105 Link Here
64
    protected boolean _networkDown = false;
63
    protected boolean _networkDown = false;
65
    
64
    
66
    protected HashMap _decorateJobs;
65
    protected HashMap _decorateJobs;
67
66
    
68
    protected static class FindShell implements Runnable
67
    protected boolean _finished = false;
69
    {
70
71
        private Shell shell;
72
73
        /**
74
         * @see Runnable#run()
75
         */
76
        public void run()
77
        {
78
            try
79
            {
80
                Shell[] shells = Display.getCurrent().getShells();
81
                for (int loop = 0; loop < shells.length && shell == null; loop++)
82
                {
83
                    if (shells[loop].isEnabled())
84
                    {
85
                        shell = shells[loop];
86
                    }
87
                }
88
            }
89
            catch (Exception e)
90
            {
91
                SystemBasePlugin.logError(
92
                        "StatusChangeListener.FindShell exception: ", e); //$NON-NLS-1$
93
            }
94
        }
95
    }
96
    
68
    
97
    public class DecorateJob extends UIJob
69
    public class DecorateJob extends UIJob
98
    {
70
    {
99
    	private DStoreFile[] _files;
71
    	private DataElement[] _files;
100
    	private DStoreFile   _parentFile;
72
    	private DStoreFile   _parentFile;
101
    	private boolean      _isDone = false;
73
    	private boolean      _isDone = false;
102
    	public DecorateJob(DStoreFile[] files, DStoreFile parentFile)
74
    	public DecorateJob(DataElement[] files, DStoreFile parentFile)
103
    	{
75
    	{
104
    		super(SystemFileResources.RESID_JOB_DECORATEFILES_NAME);
76
    		super(SystemFileResources.RESID_JOB_DECORATEFILES_NAME);
105
    		_files= files;
77
    		_files= files;
Lines 114-136 Link Here
114
		public IStatus runInUIThread(IProgressMonitor monitor)
86
		public IStatus runInUIThread(IProgressMonitor monitor)
115
		{
87
		{
116
			_isDone = false;
88
			_isDone = false;
117
			for (int i = 0; i < _files.length; i++)
89
			IRemoteFile[] children = new IRemoteFile[_files.length];
118
			{			
90
			try {
119
			  _registry.fireEvent(new
91
				for (int i = 0; i < _files.length; i++)
120
                      org.eclipse.rse.core.events.SystemResourceChangeEvent(_files[i],
92
				{			
121
                      ISystemResourceChangeEvents.EVENT_ICON_CHANGE,
93
					DataElement file = _files[i];
122
                        _parentFile));
94
			        StringBuffer path = new StringBuffer(file.getAttribute(DE.A_VALUE));
123
            }
95
			        path.append(_fileSubSystem.getSeparatorChar());
124
              
96
			    	path.append(file.getName());
125
			/*
97
			    
126
			_registry.fireEvent(new
98
			    	children[i] = _fileSubSystem.getRemoteFileObject(path.toString(), monitor);
127
                      org.eclipse.rse.ui.model.SystemResourceChangeEvent(_files,
99
	            }
128
                      ISystemResourceChangeEvent.EVENT_REPLACE_CHILDREN,
100
	              
129
                        _parentFile));
101
				_registry.fireEvent(new
130
                        */
102
	    				org.eclipse.rse.core.events.SystemResourceChangeEvent(children,
103
	    						ISystemResourceChangeEvents.EVENT_ICON_CHANGE,
104
	    						_parentFile));				
105
			}
106
			catch (Exception e){}
107
			
131
			_isDone = true;
108
			_isDone = true;
132
			_decorateJobs.remove(_parentFile);
109
			_decorateJobs.remove(_parentFile);
133
			  return Status.OK_STATUS;
110
			 return Status.OK_STATUS;
134
		}
111
		}
135
    	
112
    	
136
    }
113
    }
Lines 140-145 Link Here
140
    {
117
    {
141
        this.shell = shell;
118
        this.shell = shell;
142
        this._fileSubSystem = fileSS;
119
        this._fileSubSystem = fileSS;
120
        
143
        this.dataStore = dataStore;
121
        this.dataStore = dataStore;
144
        this.system = system;
122
        this.system = system;
145
        this._registry = RSECorePlugin.getTheSystemRegistry();
123
        this._registry = RSECorePlugin.getTheSystemRegistry();
Lines 185-192 Link Here
185
    public void finish()
163
    public void finish()
186
    {
164
    {
187
        dataStore.getDomainNotifier().removeDomainListener(this);
165
        dataStore.getDomainNotifier().removeDomainListener(this);
166
        _finished = true;
188
    }
167
    }
189
168
169
    public boolean isFinished()
170
    {
171
    	return _finished;
172
    }
173
    
190
    /**
174
    /**
191
     * @see IDomainListener#domainChanged(DomainEvent)
175
     * @see IDomainListener#domainChanged(DomainEvent)
192
     */
176
     */
Lines 203-209 Link Here
203
	    	parentPath.append(parent.getName());
187
	    	parentPath.append(parent.getName());
204
	    	DStoreFile parentFile = (DStoreFile) _fileSubSystem.getCachedRemoteFile(parentPath.toString());
188
	    	DStoreFile parentFile = (DStoreFile) _fileSubSystem.getCachedRemoteFile(parentPath.toString());
205
	    	
189
	    	
206
	        boolean refreshParent = false;
207
	        List toUpdate = new ArrayList();
190
	        List toUpdate = new ArrayList();
208
	        for (int i = 0; i < children.size(); i++)
191
	        for (int i = 0; i < children.size(); i++)
209
	        {
192
	        {
Lines 215-257 Link Here
215
	                    type.equals(IUniversalDataStoreConstants.UNIVERSAL_FOLDER_DESCRIPTOR)))
198
	                    type.equals(IUniversalDataStoreConstants.UNIVERSAL_FOLDER_DESCRIPTOR)))
216
	                
199
	                
217
	            {
200
	            {
218
	            	StringBuffer path = new StringBuffer(subject.getAttribute(DE.A_VALUE));
201
	            	toUpdate.add(subject);
219
	            	path.append(_fileSubSystem.getSeparatorChar());
220
	            	path.append(subject.getName());
221
	
222
	    
223
	                // find cached copy
224
	                try
225
	                {
226
	                    DStoreFile updated = (DStoreFile) _fileSubSystem.getCachedRemoteFile(path.toString());
227
	               
228
	                    if (updated != null)
229
	                    {
230
	                         String classification = updated.getClassification();
231
	                        if (!classification.equals("file") && !classification.equals("directory")) //$NON-NLS-1$ //$NON-NLS-2$
232
	                        {
233
	                            refreshParent = true;
234
	                            toUpdate.add(updated);
235
	                        }
236
	                      
237
	                    }
238
	                }
239
	                catch (Exception e)
240
	                {
241
	                    e.printStackTrace();
242
	                }
243
	            }
202
	            }
244
	        }
203
	        }
245
	        
204
	        
246
	        if (refreshParent)
205
	        if (!toUpdate.isEmpty())
247
	        {
206
	        {
248
	        	DecorateJob job = getDecorateJob(parentFile);
207
	        	DecorateJob job = getDecorateJob(parentFile);
249
	        	if (job == null)
208
	        	if (job == null)
250
	        	{
209
	        	{
251
	        		job = new DecorateJob((DStoreFile[])toUpdate.toArray(new DStoreFile[toUpdate.size()]), parentFile);
210
	        		job = new DecorateJob((DataElement[])toUpdate.toArray(new DataElement[toUpdate.size()]), parentFile);
252
	        		job.setRule(parentFile);
211
	        		job.setRule(parentFile);
253
	        		putDecorateJob(parentFile, job);
212
	        		putDecorateJob(parentFile, job);
254
	        		job.schedule(5000);
213
	        		job.schedule(1000);
255
	        	}
214
	        	}
256
        		        	
215
        		        	
257
	        }
216
	        }
Lines 269-288 Link Here
269
    	_decorateJobs.put(file, job);
228
    	_decorateJobs.put(file, job);
270
    }
229
    }
271
    
230
    
272
    
231
273
    public Shell getShell()
274
    {
275
        // dy: DomainNotifier (which calls this method) requires the shell not
276
        // be disposed
277
        //if (shell == null) {
278
        if (shell == null || shell.isDisposed())
279
        {
280
            FindShell findShell = new FindShell();
281
            Display.getDefault().syncExec(findShell);
282
            shell = findShell.shell;
283
        }
284
        return shell;
285
    }
286
232
287
    /**
233
    /**
288
     * @see ICommunicationsListener#communicationsStateChange(CommunicationsEvent)
234
     * @see ICommunicationsListener#communicationsStateChange(CommunicationsEvent)
(-)UI/org/eclipse/rse/internal/ui/view/SystemView.java (-9 / +30 lines)
Lines 1-5 Link Here
1
/********************************************************************************
1
/********************************************************************************
2
 * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
2
 * Copyright (c) 2002, 2009 IBM Corporation and others. All rights reserved.
3
 * This program and the accompanying materials are made available under the terms
3
 * This program and the accompanying materials are made available under the terms
4
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
4
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
5
 * available at http://www.eclipse.org/legal/epl-v10.html
5
 * available at http://www.eclipse.org/legal/epl-v10.html
Lines 67-72 Link Here
67
 * David McKnight   (IBM)        - [249245] not showing inappropriate popup actions for: Refresh, Show In Table, Go Into, etc. 
67
 * David McKnight   (IBM)        - [249245] not showing inappropriate popup actions for: Refresh, Show In Table, Go Into, etc. 
68
 * David McKnight   (IBM)        - [251625] Widget disposed exception when renaming/pasting a folder
68
 * David McKnight   (IBM)        - [251625] Widget disposed exception when renaming/pasting a folder
69
 * David McKnight   (IBM)        - [257721] Doubleclick doing special handling and expanding
69
 * David McKnight   (IBM)        - [257721] Doubleclick doing special handling and expanding
70
 * David McKnight   (IBM)        - [190805] [performance][dstore] Right-click > Disconnect on a dstore connection is slow and spawns many Jobs
70
 ********************************************************************************/
71
 ********************************************************************************/
71
72
72
package org.eclipse.rse.internal.ui.view;
73
package org.eclipse.rse.internal.ui.view;
Lines 2176-2193 Link Here
2176
			case ISystemResourceChangeEvents.EVENT_ICON_CHANGE:
2177
			case ISystemResourceChangeEvents.EVENT_ICON_CHANGE:
2177
				if (debug) logDebugMsg("SV event: EVENT_ICON_CHANGE "); //$NON-NLS-1$
2178
				if (debug) logDebugMsg("SV event: EVENT_ICON_CHANGE "); //$NON-NLS-1$
2178
2179
2179
				if (initViewerFilters != null && initViewerFilters.length > 0) {
2180
				if (src instanceof Object[]){
2180
					Widget w = findItem(src);
2181
					Object[] srcs = (Object[])src;
2181
					if (w == null) {
2182
					for (int s = 0; s < srcs.length; s++){
2182
						refresh(parent);
2183
						if (initViewerFilters != null && initViewerFilters.length > 0) {
2184
							Widget w = findItem(srcs[s]);
2185
							if (w == null) {
2186
								refresh(parent);
2187
							} else {
2188
								properties[0] = IBasicPropertyConstants.P_IMAGE;
2189
								update(srcs[s], properties); // for refreshing non-structural properties in viewer when model changes
2190
		
2191
							}
2192
						} else {
2193
							properties[0] = IBasicPropertyConstants.P_IMAGE;
2194
							update(srcs[s], properties); // for refreshing non-structural properties in viewer when model changes
2195
						}						
2196
					}
2197
				}
2198
				else {
2199
					if (initViewerFilters != null && initViewerFilters.length > 0) {
2200
						Widget w = findItem(src);
2201
						if (w == null) {
2202
							refresh(parent);
2203
						} else {
2204
							properties[0] = IBasicPropertyConstants.P_IMAGE;
2205
							update(src, properties); // for refreshing non-structural properties in viewer when model changes
2206
	
2207
						}
2183
					} else {
2208
					} else {
2184
						properties[0] = IBasicPropertyConstants.P_IMAGE;
2209
						properties[0] = IBasicPropertyConstants.P_IMAGE;
2185
						update(src, properties); // for refreshing non-structural properties in viewer when model changes
2210
						update(src, properties); // for refreshing non-structural properties in viewer when model changes
2186
2187
					}
2211
					}
2188
				} else {
2189
					properties[0] = IBasicPropertyConstants.P_IMAGE;
2190
					update(src, properties); // for refreshing non-structural properties in viewer when model changes
2191
				}
2212
				}
2192
2213
2193
				//updatePropertySheet();
2214
				//updatePropertySheet();

Return to bug 190805