1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-18 22:45:23 +02:00

[330398] RSE leaks SWT resources

This commit is contained in:
David McKnight 2011-03-16 16:46:11 +00:00
parent 753a698c0f
commit 437b0f5d14
12 changed files with 111 additions and 118 deletions

View file

@ -71,6 +71,7 @@
* David McKnight (IBM) - [324192] Cannot open a renamed file * David McKnight (IBM) - [324192] Cannot open a renamed file
* David McKnight (IBM) - [228743] [usability][dnd] Paste into read-only folder fails silently * David McKnight (IBM) - [228743] [usability][dnd] Paste into read-only folder fails silently
* David McKnight (IBM) - [284157] [performance] too many jobs kicked off for getting file permissions for table * David McKnight (IBM) - [284157] [performance] too many jobs kicked off for getting file permissions for table
* David McKnight (IBM) - [330398] RSE leaks SWT resources
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.files.ui.view; package org.eclipse.rse.internal.files.ui.view;
@ -485,18 +486,13 @@ public class SystemViewRemoteFileAdapter
if (moveAction == null) if (moveAction == null)
moveAction = new SystemMoveRemoteFileAction(shell); moveAction = new SystemMoveRemoteFileAction(shell);
//ISubSystem subsys = firstFile.getParentRemoteFileSubSystem();
// DKM - clipboard based copy actions
Clipboard clipboard = RSEUIPlugin.getTheSystemRegistryUI().getSystemClipboard();
if (pasteClipboardAction == null) if (pasteClipboardAction == null)
{ {
pasteClipboardAction = new SystemPasteFromClipboardAction(shell, clipboard); pasteClipboardAction = new SystemPasteFromClipboardAction(shell, null);
} }
if (copyClipboardAction == null) if (copyClipboardAction == null)
{ {
copyClipboardAction = new SystemCopyToClipboardAction(shell, clipboard); copyClipboardAction = new SystemCopyToClipboardAction(shell, null);
} }
if (searchAction == null) if (searchAction == null)
{ {

View file

@ -42,6 +42,7 @@
* Kevin Doyle (IBM) - [242431] Register a new unique context menu id, so contributions can be made to all our views * Kevin Doyle (IBM) - [242431] Register a new unique context menu id, so contributions can be made to all our views
* David McKnight (IBM) - [260346] RSE view for jobs does not remember resized columns * David McKnight (IBM) - [260346] RSE view for jobs does not remember resized columns
* David McKnight (IBM) - [333702] Remote Systems details view does not maintain column width settings across sessions * David McKnight (IBM) - [333702] Remote Systems details view does not maintain column width settings across sessions
* David McKnight (IBM) - [330398] RSE leaks SWT resources
*******************************************************/ *******************************************************/
package org.eclipse.rse.internal.ui.view; package org.eclipse.rse.internal.ui.view;
@ -1274,12 +1275,10 @@ public class SystemTableViewPart extends ViewPart
_browsePosition = 0; _browsePosition = 0;
// register global edit actions // register global edit actions
Clipboard clipboard = RSEUIPlugin.getTheSystemRegistryUI().getSystemClipboard();
CellEditorActionHandler editorActionHandler = new CellEditorActionHandler(getViewSite().getActionBars()); CellEditorActionHandler editorActionHandler = new CellEditorActionHandler(getViewSite().getActionBars());
_copyAction = new SystemCopyToClipboardAction(_viewer.getShell(), clipboard); _copyAction = new SystemCopyToClipboardAction(_viewer.getShell(), null);
_pasteAction = new SystemPasteFromClipboardAction(_viewer.getShell(), clipboard); _pasteAction = new SystemPasteFromClipboardAction(_viewer.getShell(), null);
_deleteAction = new SystemCommonDeleteAction(_viewer.getShell(), _viewer); _deleteAction = new SystemCommonDeleteAction(_viewer.getShell(), _viewer);
_renameAction = new SystemCommonRenameAction(_viewer.getShell(), _viewer); _renameAction = new SystemCommonRenameAction(_viewer.getShell(), _viewer);

View file

@ -43,6 +43,7 @@
* Martin Oberhuber (Wind River) - [326910] RSE looses selection when creating a project * Martin Oberhuber (Wind River) - [326910] RSE looses selection when creating a project
* David McKnight (IBM) - [330386] RSE SystemView has Focus Problems with Eclipse SDK 4.1M3 * David McKnight (IBM) - [330386] RSE SystemView has Focus Problems with Eclipse SDK 4.1M3
* David McKnight (IBM) - [238365] Collapsing tree in new window collapses tree in Original window * David McKnight (IBM) - [238365] Collapsing tree in new window collapses tree in Original window
* David McKnight (IBM) - [330398] RSE leaks SWT resources
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.ui.view; package org.eclipse.rse.internal.ui.view;
@ -386,12 +387,10 @@ public class SystemViewPart
} }
// register global edit actions // register global edit actions
Clipboard clipboard = RSEUIPlugin.getTheSystemRegistryUI().getSystemClipboard();
CellEditorActionHandler editorActionHandler = new CellEditorActionHandler(getViewSite().getActionBars()); CellEditorActionHandler editorActionHandler = new CellEditorActionHandler(getViewSite().getActionBars());
_copyAction = new SystemCopyToClipboardAction(systemView.getShell(), clipboard); _copyAction = new SystemCopyToClipboardAction(systemView.getShell(), null);
_pasteAction = new SystemPasteFromClipboardAction(systemView.getShell(), clipboard); _pasteAction = new SystemPasteFromClipboardAction(systemView.getShell(), null);
editorActionHandler.setCopyAction(_copyAction); editorActionHandler.setCopyAction(_copyAction);
editorActionHandler.setPasteAction(_pasteAction); editorActionHandler.setPasteAction(_pasteAction);

View file

@ -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
@ -17,6 +17,7 @@
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* Xuan Chen (IBM) - [223126] [api][breaking] Remove API related to User Actions in RSE Core/UI * Xuan Chen (IBM) - [223126] [api][breaking] Remove API related to User Actions in RSE Core/UI
* David McKnight (IBM) - [330398] RSE leaks SWT resources
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.ui.view; package org.eclipse.rse.internal.ui.view;
@ -63,7 +64,7 @@ public class SystemViewScratchpadAdapter extends AbstractSystemViewAdapter imple
{ {
if (_pasteToScratchpadAction == null) if (_pasteToScratchpadAction == null)
{ {
_pasteToScratchpadAction = new SystemPasteFromClipboardAction(shell, RSEUIPlugin.getTheSystemRegistryUI().getSystemClipboard()); _pasteToScratchpadAction = new SystemPasteFromClipboardAction(shell, null);
} }
menu.add(menuGroup, _pasteToScratchpadAction); menu.add(menuGroup, _pasteToScratchpadAction);
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved. * Copyright (c) 2002, 2011 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
@ -18,6 +18,7 @@
* Kevin Doyle (IBM) - [177587] changed wrapped selection provider in setFocus() * Kevin Doyle (IBM) - [177587] changed wrapped selection provider in setFocus()
* Kevin Doyle (IBM) - [212940] Duplicate Help Context Identifiers * Kevin Doyle (IBM) - [212940] Duplicate Help Context Identifiers
* 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) - [330398] RSE leaks SWT resources
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.ui.view.monitor; package org.eclipse.rse.internal.ui.view.monitor;
@ -257,11 +258,10 @@ FocusListener
createControl(_tabFolderPage); createControl(_tabFolderPage);
// global actions // global actions
Clipboard clipboard = RSEUIPlugin.getTheSystemRegistryUI().getSystemClipboard(); _copyAction = new SystemCopyToClipboardAction(_viewer.getShell(), null);
_copyAction = new SystemCopyToClipboardAction(_viewer.getShell(), clipboard);
_copyAction.setEnabled(false); _copyAction.setEnabled(false);
_pasteAction = new SystemPasteFromClipboardAction(_viewer.getShell(), clipboard); _pasteAction = new SystemPasteFromClipboardAction(_viewer.getShell(), null);
_pasteAction.setEnabled(false); _pasteAction.setEnabled(false);
editorActionHandler.setCopyAction(_copyAction); editorActionHandler.setCopyAction(_copyAction);

View file

@ -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
@ -19,6 +19,7 @@
* Kevin Doyle (IBM) - [193155] Double Clicking on a String in Scratchpad Errors * Kevin Doyle (IBM) - [193155] Double Clicking on a String in Scratchpad Errors
* Kevin Doyle (IBM) - [194867] Remote Scratchpad should have Refresh Action on toolbar * Kevin Doyle (IBM) - [194867] Remote Scratchpad should have Refresh Action on toolbar
* Kevin Doyle (IBM) - [242431] Register a new unique context menu id, so contributions can be made to all our views * Kevin Doyle (IBM) - [242431] Register a new unique context menu id, so contributions can be made to all our views
* David McKnight (IBM) - [330398] RSE leaks SWT resources
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.ui.view.scratchpad; package org.eclipse.rse.internal.ui.view.scratchpad;
@ -137,12 +138,11 @@ public class SystemScratchpadViewPart extends ViewPart
// register global edit actions // register global edit actions
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
Clipboard clipboard = RSEUIPlugin.getTheSystemRegistryUI().getSystemClipboard();
CellEditorActionHandler editorActionHandler = new CellEditorActionHandler(getViewSite().getActionBars()); CellEditorActionHandler editorActionHandler = new CellEditorActionHandler(getViewSite().getActionBars());
_copyAction = new SystemCopyToClipboardAction(_viewer.getShell(), clipboard); _copyAction = new SystemCopyToClipboardAction(_viewer.getShell(), null);
_pasteAction = new SystemPasteFromClipboardAction(_viewer.getShell(), clipboard); _pasteAction = new SystemPasteFromClipboardAction(_viewer.getShell(), null);
_deleteAction = new SystemCommonDeleteAction(_viewer.getShell(), _viewer); _deleteAction = new SystemCommonDeleteAction(_viewer.getShell(), _viewer);
_renameAction = new SystemCommonRenameAction(_viewer.getShell(), _viewer); _renameAction = new SystemCommonRenameAction(_viewer.getShell(), _viewer);

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2003, 2010 IBM Corporation and others. * Copyright (c) 2003, 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
@ -19,6 +19,7 @@
* David McKnight (IBM) - [214395] Properties View not updated when clicking on Search Results * David McKnight (IBM) - [214395] Properties View not updated when clicking on Search Results
* David McKnight (IBM) - [190015] [performance] Remove All Match's from Search Results Takes a while * David McKnight (IBM) - [190015] [performance] Remove All Match's from Search Results Takes a while
* David McKnight (IBM) - [296877] Allow user to choose the attributes for remote search result * David McKnight (IBM) - [296877] Allow user to choose the attributes for remote search result
* David McKnight (IBM) - [330398] RSE leaks SWT resources
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.ui.view.search; package org.eclipse.rse.internal.ui.view.search;
@ -713,11 +714,10 @@ public class SystemSearchViewPart extends ViewPart
tbMgr.add(_selectColumnsAction); tbMgr.add(_selectColumnsAction);
// clipboard // clipboard
Clipboard clipboard = RSEUIPlugin.getTheSystemRegistryUI().getSystemClipboard();
Shell shell = RSEUIPlugin.getTheSystemRegistryUI().getShell(); Shell shell = RSEUIPlugin.getTheSystemRegistryUI().getShell();
copyAction = new SystemSearchCopyToClipboardAction(shell, clipboard); copyAction = new SystemSearchCopyToClipboardAction(shell, null);
pasteAction = new SystemPasteFromClipboardAction(shell, clipboard); pasteAction = new SystemPasteFromClipboardAction(shell, null);
CellEditorActionHandler editorActionHandler = new CellEditorActionHandler(getViewSite().getActionBars()); CellEditorActionHandler editorActionHandler = new CellEditorActionHandler(getViewSite().getActionBars());

View file

@ -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
@ -17,6 +17,7 @@
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings * David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
* David McKnight (IBM) - [248339] [dnd][encodings] Cannot drag&drop / copy&paste files or folders with turkish or arabic names * David McKnight (IBM) - [248339] [dnd][encodings] Cannot drag&drop / copy&paste files or folders with turkish or arabic names
* David McKnight (IBM) - [330398] RSE leaks SWT resources
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.ui.actions; package org.eclipse.rse.ui.actions;
@ -40,6 +41,7 @@ import org.eclipse.rse.internal.ui.view.SystemViewDataDropAdapter;
import org.eclipse.rse.services.clientserver.messages.SystemMessage; import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemContextMenuConstants; import org.eclipse.rse.ui.ISystemContextMenuConstants;
import org.eclipse.rse.ui.RSEUIPlugin; import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.internal.model.SystemRegistryUI;
import org.eclipse.rse.ui.validators.IValidatorRemoteSelection; import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
import org.eclipse.rse.ui.view.ISystemEditableRemoteObject; import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
@ -62,19 +64,24 @@ import org.eclipse.ui.part.ResourceTransfer;
public class SystemCopyToClipboardAction extends SystemBaseAction implements IValidatorRemoteSelection public class SystemCopyToClipboardAction extends SystemBaseAction implements IValidatorRemoteSelection
{ {
private IStructuredSelection _selection; private IStructuredSelection _selection;
private Clipboard _clipboard;
private boolean _doResourceTransfer = false; // determines whether or not to download on copy private boolean _doResourceTransfer = false; // determines whether or not to download on copy
/** /**
* Constructor * Constructor
* -will deprecate this later since we don't use this clipboard now
*/ */
public SystemCopyToClipboardAction(Shell shell, Clipboard clipboard) public SystemCopyToClipboardAction(Shell shell, Clipboard clipboard){
this(shell);
}
/**
* Constructor
*/
private SystemCopyToClipboardAction(Shell shell)
{ {
super(SystemResources.ACTION_COPY_LABEL, super(SystemResources.ACTION_COPY_LABEL,
PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_COPY), PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_COPY),
shell); shell);
_clipboard = clipboard;
setToolTipText(SystemResources.ACTION_COPY_TOOLTIP); setToolTipText(SystemResources.ACTION_COPY_TOOLTIP);
allowOnMultipleSelection(true); allowOnMultipleSelection(true);
setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE); setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
@ -247,9 +254,10 @@ public class SystemCopyToClipboardAction extends SystemBaseAction implements IV
{ {
fn[j] = (String)fileNames.get(j); fn[j] = (String)fileNames.get(j);
} }
_clipboard.setContents(new Object[] { data, ft, fn, textStream.toString() }, new Transfer[] { PluginTransfer.getInstance(), ResourceTransfer.getInstance(), FileTransfer.getInstance(), TextTransfer.getInstance()}); Clipboard clipboard = SystemRegistryUI.getInstance().getSystemClipboard();
clipboard.setContents(new Object[] { data, ft, fn, textStream.toString() }, new Transfer[] { PluginTransfer.getInstance(), ResourceTransfer.getInstance(), FileTransfer.getInstance(), TextTransfer.getInstance()});
clipboard.dispose();
} }
else else
{ {
@ -259,14 +267,17 @@ public class SystemCopyToClipboardAction extends SystemBaseAction implements IV
ft[i] = (String) fileNames.get(i); ft[i] = (String) fileNames.get(i);
} }
Clipboard clipboard = SystemRegistryUI.getInstance().getSystemClipboard();
if (ft.length > 0) if (ft.length > 0)
{ {
_clipboard.setContents(new Object[] { data, ft, textStream.toString() }, new Transfer[] { PluginTransfer.getInstance(), FileTransfer.getInstance(), TextTransfer.getInstance()}); clipboard.setContents(new Object[] { data, ft, textStream.toString() }, new Transfer[] { PluginTransfer.getInstance(), FileTransfer.getInstance(), TextTransfer.getInstance()});
} }
else else
{ {
_clipboard.setContents(new Object[] { data, textStream.toString() }, new Transfer[] { PluginTransfer.getInstance(), TextTransfer.getInstance()}); clipboard.setContents(new Object[] { data, textStream.toString() }, new Transfer[] { PluginTransfer.getInstance(), TextTransfer.getInstance()});
} }
clipboard.dispose();
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2002, 2009 IBM Corporation and others. All rights reserved. * Copyright (c) 2002, 2011 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
@ -15,6 +15,7 @@
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* Kenya Ishimoto (IBM) - [241197] Paste action causes IllegalArgumentException at Resource.copy * Kenya Ishimoto (IBM) - [241197] Paste action causes IllegalArgumentException at Resource.copy
* Zhou Renjian (Kortide) - [282241] "Paste" is enabled on file system when text is in clipboard * Zhou Renjian (Kortide) - [282241] "Paste" is enabled on file system when text is in clipboard
* David McKnight (IBM) - [330398] RSE leaks SWT resources
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui.actions; package org.eclipse.rse.ui.actions;
@ -36,6 +37,7 @@ import org.eclipse.rse.internal.ui.view.SystemDNDTransferRunnable;
import org.eclipse.rse.services.clientserver.messages.SystemMessage; import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemContextMenuConstants; import org.eclipse.rse.ui.ISystemContextMenuConstants;
import org.eclipse.rse.ui.RSEUIPlugin; import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.internal.model.SystemRegistryUI;
import org.eclipse.rse.ui.validators.IValidatorRemoteSelection; import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
import org.eclipse.swt.dnd.Clipboard; import org.eclipse.swt.dnd.Clipboard;
@ -54,21 +56,27 @@ import org.eclipse.ui.part.ResourceTransfer;
*/ */
public class SystemPasteFromClipboardAction extends SystemBaseAction implements IValidatorRemoteSelection public class SystemPasteFromClipboardAction extends SystemBaseAction implements IValidatorRemoteSelection
{ {
private int _srcType; private int _srcType;
private Object _selection; private Object _selection;
private Clipboard _clipboard;
/**
* Constructor
* -will deprecate this later since we don't use this clipboard now
*/
public SystemPasteFromClipboardAction(Shell shell, Clipboard clipboard)
{
this(shell);
}
/** /**
* Constructor * Constructor
*/ */
public SystemPasteFromClipboardAction(Shell shell, Clipboard clipboard) private SystemPasteFromClipboardAction(Shell shell)
{ {
super(SystemResources.ACTION_PASTE_LABEL, super(SystemResources.ACTION_PASTE_LABEL,
PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_PASTE), PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_PASTE),
//RSEUIPlugin.getDefault().getImageDescriptor(ISystemConstants.ICON_SYSTEM_PASTE_ID), //RSEUIPlugin.getDefault().getImageDescriptor(ISystemConstants.ICON_SYSTEM_PASTE_ID),
shell); shell);
_clipboard = clipboard;
_srcType = SystemDNDTransferRunnable.SRC_TYPE_RSE_RESOURCE; _srcType = SystemDNDTransferRunnable.SRC_TYPE_RSE_RESOURCE;
setEnabled(false); setEnabled(false);
@ -113,32 +121,7 @@ public class SystemPasteFromClipboardAction extends SystemBaseAction implements
rulesList.add(srcObjects.get(i)); rulesList.add(srcObjects.get(i));
j++; j++;
} }
/** FIXME - IREmoteFile is systems.core independent now
else if (srcObjects.get(i) instanceof IRemoteFile)
{
rulesList.add(new RemoteFileSchedulingRule((IRemoteFile)srcObjects.get(i)));
j++;
}
**/
} }
/*
if (target instanceof ISchedulingRule)
{
rulesList.add(target);
}
*/
/** FIXME - IREmoteFile is systems.core independent now
else if (target instanceof IRemoteFile)
{
rulesList.add(new RemoteFileSchedulingRule((IRemoteFile)target));
}
*/
/*
else
{
rulesList.add(targetSubSystem);
}
*/
if (rulesList.size() > 0) if (rulesList.size() > 0)
{ {
ISchedulingRule[] rules = (ISchedulingRule[])rulesList.toArray(new ISchedulingRule[rulesList.size()]); ISchedulingRule[] rules = (ISchedulingRule[])rulesList.toArray(new ISchedulingRule[rulesList.size()]);
@ -150,9 +133,6 @@ public class SystemPasteFromClipboardAction extends SystemBaseAction implements
runnable.schedule(); runnable.schedule();
RSEUIPlugin.getTheSystemRegistryUI().clearRunnableContext(); RSEUIPlugin.getTheSystemRegistryUI().clearRunnableContext();
} }
// clear clipboard
// _clipboard.setContents(new Object[] { null }, new Transfer[] { PluginTransfer.getInstance()});
// setEnabled(false);
} }
@ -168,12 +148,13 @@ public class SystemPasteFromClipboardAction extends SystemBaseAction implements
} }
public boolean hasSource() public boolean hasSource()
{ {
synchronized (_clipboard) Clipboard clipboard = SystemRegistryUI.getInstance().getSystemClipboard();
try
{ {
try synchronized (clipboard)
{ {
Object object = _clipboard.getContents(PluginTransfer.getInstance()); Object object = clipboard.getContents(PluginTransfer.getInstance());
if (object != null) if (object != null)
{ {
if (object instanceof PluginTransferData) if (object instanceof PluginTransferData)
@ -191,7 +172,7 @@ public class SystemPasteFromClipboardAction extends SystemBaseAction implements
{ {
// clipboard must have resources or files // clipboard must have resources or files
ResourceTransfer resTransfer = ResourceTransfer.getInstance(); ResourceTransfer resTransfer = ResourceTransfer.getInstance();
object = _clipboard.getContents(resTransfer); object = clipboard.getContents(resTransfer);
if (object != null) if (object != null)
{ {
IResource[] resourceData = (IResource[]) object; IResource[] resourceData = (IResource[]) object;
@ -204,7 +185,7 @@ public class SystemPasteFromClipboardAction extends SystemBaseAction implements
else else
{ {
FileTransfer fileTransfer = FileTransfer.getInstance(); FileTransfer fileTransfer = FileTransfer.getInstance();
object = _clipboard.getContents(fileTransfer); object = clipboard.getContents(fileTransfer);
if (object != null) if (object != null)
{ {
@ -218,7 +199,7 @@ public class SystemPasteFromClipboardAction extends SystemBaseAction implements
else else
{ {
TextTransfer textTransfer = TextTransfer.getInstance(); TextTransfer textTransfer = TextTransfer.getInstance();
object = _clipboard.getContents(textTransfer); object = clipboard.getContents(textTransfer);
if (object != null) if (object != null)
{ {
@ -230,9 +211,12 @@ public class SystemPasteFromClipboardAction extends SystemBaseAction implements
} }
} }
} }
catch (Exception e) }
{ catch (Exception e)
} {
}
finally {
clipboard.dispose();
} }
return false; return false;
} }

View file

@ -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
@ -16,6 +16,7 @@
* David McKnight(IBM) - [239257] Tooltip for Filter Pool label is incorrect * David McKnight(IBM) - [239257] Tooltip for Filter Pool label is incorrect
* Kevin Doyle (IBM) - [235223] Duplicate Filter Strings * Kevin Doyle (IBM) - [235223] Duplicate Filter Strings
* David McKnight (IBM) - [252708] Saving Profile Job happens when not changing Property Values on Connections * David McKnight (IBM) - [252708] Saving Profile Job happens when not changing Property Values on Connections
* David McKnight (IBM) - [330398] RSE leaks SWT resources
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.ui.filters; package org.eclipse.rse.ui.filters;
@ -48,6 +49,7 @@ import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemBaseForm; import org.eclipse.rse.ui.SystemBaseForm;
import org.eclipse.rse.ui.SystemWidgetHelpers; import org.eclipse.rse.ui.SystemWidgetHelpers;
import org.eclipse.rse.ui.actions.ISystemAction; import org.eclipse.rse.ui.actions.ISystemAction;
import org.eclipse.rse.ui.internal.model.SystemRegistryUI;
import org.eclipse.rse.ui.messages.ISystemMessageLine; import org.eclipse.rse.ui.messages.ISystemMessageLine;
import org.eclipse.rse.ui.messages.SystemMessageDialog; import org.eclipse.rse.ui.messages.SystemMessageDialog;
import org.eclipse.rse.ui.validators.ISystemValidator; import org.eclipse.rse.ui.validators.ISystemValidator;
@ -98,7 +100,6 @@ public class SystemChangeFilterPane extends SystemBaseForm
private SystemChangeFilterActionMoveStringUp moveUpAction; private SystemChangeFilterActionMoveStringUp moveUpAction;
private SystemChangeFilterActionMoveStringDown moveDownAction; private SystemChangeFilterActionMoveStringDown moveDownAction;
private MenuManager menuMgr; private MenuManager menuMgr;
private Clipboard clipboard;
private boolean menuListenerAdded; private boolean menuListenerAdded;
// inputs // inputs
@ -1364,12 +1365,12 @@ public class SystemChangeFilterPane extends SystemBaseForm
*/ */
public void doCopy() public void doCopy()
{ {
if (clipboard == null) Clipboard clipboard = new Clipboard(getShell().getDisplay());
clipboard = new Clipboard(getShell().getDisplay());
String selection = getCurrentSelection(); String selection = getCurrentSelection();
TextTransfer transfer = TextTransfer.getInstance(); TextTransfer transfer = TextTransfer.getInstance();
clipboard.setContents(new Object[] {selection}, new Transfer[] {transfer}); clipboard.setContents(new Object[] {selection}, new Transfer[] {transfer});
clipboard.dispose();
} }
/** /**
* Decide if we can do the paste or not. * Decide if we can do the paste or not.
@ -1377,11 +1378,11 @@ public class SystemChangeFilterPane extends SystemBaseForm
*/ */
public boolean canPaste() public boolean canPaste()
{ {
if (clipboard == null) Clipboard clipboard = new Clipboard(getShell().getDisplay());
return false; TextTransfer textTransfer = TextTransfer.getInstance();
TextTransfer textTransfer = TextTransfer.getInstance(); String textData = (String)clipboard.getContents(textTransfer);
String textData = (String)clipboard.getContents(textTransfer); clipboard.dispose();
return ((textData != null) && (textData.length() > 0)); return ((textData != null) && (textData.length() > 0));
} }
/** /**
* Actually do the copy of the current filter string to the clipboard. * Actually do the copy of the current filter string to the clipboard.
@ -1389,8 +1390,7 @@ public class SystemChangeFilterPane extends SystemBaseForm
*/ */
public void doPaste() public void doPaste()
{ {
if (clipboard == null) Clipboard clipboard = SystemRegistryUI.getInstance().getSystemClipboard();
return;
TextTransfer textTransfer = TextTransfer.getInstance(); TextTransfer textTransfer = TextTransfer.getInstance();
String textData = (String)clipboard.getContents(textTransfer); String textData = (String)clipboard.getContents(textTransfer);
@ -1409,6 +1409,7 @@ public class SystemChangeFilterPane extends SystemBaseForm
} }
processListSelect(); // defect 45790... processListSelect(); // defect 45790...
setPageComplete(verify(false)); setPageComplete(verify(false));
clipboard.dispose();
} }
// -------------- // --------------

View file

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved. * Copyright (c) 2006, 2011 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
@ -12,6 +12,7 @@
* *
* Contributors: * Contributors:
* {Name} (company) - description of contribution. * {Name} (company) - description of contribution.
* David McKnight (IBM) - [330398] RSE leaks SWT resources
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui.widgets; package org.eclipse.rse.ui.widgets;
@ -139,11 +140,6 @@ public class SystemCollapsableSection extends Composite implements MouseListener
super(compositeParent, SWT.NULL); super(compositeParent, SWT.NULL);
if (_colorCollapsable == null)
{
Display display = Display.getCurrent();
_colorCollapsable = new Color(display, 0, 140, 140);
}
setLayout(new RTwisteeLayout()); setLayout(new RTwisteeLayout());
@ -157,6 +153,14 @@ public class SystemCollapsableSection extends Composite implements MouseListener
addPaintListener(this); addPaintListener(this);
addMouseListener(this); addMouseListener(this);
} }
private static Color getCollapsableColour(){
if (_colorCollapsable == null || _colorCollapsable.isDisposed()){
Display display = Display.getCurrent();
_colorCollapsable = new Color(display, 0, 140, 140);
}
return _colorCollapsable;
}
/** /**
* Get the actual composite inside the collapsible section to * Get the actual composite inside the collapsible section to
@ -298,13 +302,14 @@ public class SystemCollapsableSection extends Composite implements MouseListener
int iY, int iY,
boolean bCollapsed) boolean bCollapsed)
{ {
Color ccolour = getCollapsableColour();
// Not collapsed: v // Not collapsed: v
//----------------- //-----------------
if (bCollapsed == false) if (bCollapsed == false)
{ {
gc.setForeground(_colorCollapsable); gc.setForeground(ccolour);
int iA = iX; int iA = iX;
int iB = iY + 3; int iB = iY + 3;
@ -333,7 +338,7 @@ public class SystemCollapsableSection extends Composite implements MouseListener
//------------- //-------------
else else
{ {
gc.setForeground(_colorCollapsable); gc.setForeground(ccolour);
int iA = iX + 2; int iA = iX + 2;
int iB = iY; int iB = iY;
@ -355,6 +360,7 @@ public class SystemCollapsableSection extends Composite implements MouseListener
iB++; iB++;
gc.drawLine(iA, iB, iA, iB); gc.drawLine(iA, iB, iA, iB);
} }
ccolour.dispose();
} }
/** /**

View file

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved. * Copyright (c) 2006, 2011 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
@ -19,6 +19,7 @@
* Martin Oberhuber (Wind River) - [] Move SystemRegistry impl into Core * Martin Oberhuber (Wind River) - [] Move SystemRegistry impl into Core
* Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core * Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
* David McKnight (IBM) - [248339] [dnd][encodings] Cannot drag&drop / copy&paste files or folders with turkish or arabic names * David McKnight (IBM) - [248339] [dnd][encodings] Cannot drag&drop / copy&paste files or folders with turkish or arabic names
* David McKnight (IBM) - [330398] RSE leaks SWT resources
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui.internal.model; package org.eclipse.rse.ui.internal.model;
@ -80,7 +81,6 @@ public class SystemRegistryUI implements ISystemRegistryUI {
private Vector previousRunnableContexts = new Vector(); private Vector previousRunnableContexts = new Vector();
private Vector previousRunnableContextShells = new Vector(); private Vector previousRunnableContextShells = new Vector();
private Clipboard clipboard = null;
private SystemScratchpad scratchpad = null; private SystemScratchpad scratchpad = null;
/** /**
@ -277,22 +277,17 @@ public class SystemRegistryUI implements ISystemRegistryUI {
*/ */
public Clipboard getSystemClipboard() public Clipboard getSystemClipboard()
{ {
if (clipboard == null) Display display = null;
Shell shell = getShell();
if (shell == null)
{ {
Display display = null; display = Display.getDefault();
Shell shell = getShell();
if (shell == null)
{
display = Display.getDefault();
}
else
{
display = shell.getDisplay();
}
clipboard = new Clipboard(display);
} }
else
return clipboard; {
display = shell.getDisplay();
}
return new Clipboard(display);
} }
/** /**
@ -442,6 +437,7 @@ public class SystemRegistryUI implements ISystemRegistryUI {
srcObjects.add(textData); srcObjects.add(textData);
} }
} }
clipboard.dispose();
return srcObjects; return srcObjects;
} }