mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-14 20:45:22 +02:00
[239702] Copy/Paste doesn't work with User Defined Actions and Named Types
This commit is contained in:
parent
6f357c8863
commit
167535165b
2 changed files with 22 additions and 21 deletions
|
@ -15,6 +15,7 @@
|
||||||
* Kevin Doyle (IBM) - [222825] NPE when changing profile on Work with User Actions Dialog
|
* Kevin Doyle (IBM) - [222825] NPE when changing profile on Work with User Actions Dialog
|
||||||
* Kevin Doyle (IBM) - [222828] Icons for some Actions Missing
|
* Kevin Doyle (IBM) - [222828] Icons for some Actions Missing
|
||||||
* Kevin Doyle (IBM) - [240725] Add Null Pointer checking when there are no default user actions
|
* Kevin Doyle (IBM) - [240725] Add Null Pointer checking when there are no default user actions
|
||||||
|
* Kevin Doyle (IBM) - [239702] Copy/Paste doesn't work with User Defined Actions and Named Types
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.useractions.ui.uda;
|
package org.eclipse.rse.internal.useractions.ui.uda;
|
||||||
|
@ -36,6 +37,7 @@ import org.eclipse.rse.core.SystemResourceManager;
|
||||||
import org.eclipse.rse.core.model.IPropertySet;
|
import org.eclipse.rse.core.model.IPropertySet;
|
||||||
import org.eclipse.rse.core.model.IPropertySetContainer;
|
import org.eclipse.rse.core.model.IPropertySetContainer;
|
||||||
import org.eclipse.rse.core.model.ISystemProfile;
|
import org.eclipse.rse.core.model.ISystemProfile;
|
||||||
|
import org.eclipse.rse.core.model.PropertySet;
|
||||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||||
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
||||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||||
|
@ -710,26 +712,18 @@ public abstract class SystemUDBaseManager implements IResourceChangeListener, IS
|
||||||
* if the reference in the clipboard corresponds to a node clone in this object.
|
* if the reference in the clipboard corresponds to a node clone in this object.
|
||||||
* @return an id that uniquely identifies the cloned node, or null if it failed.
|
* @return an id that uniquely identifies the cloned node, or null if it failed.
|
||||||
*/
|
*/
|
||||||
//TODO - XUAN
|
|
||||||
/*
|
|
||||||
public String prepareClipboardCopy(SystemXMLElementWrapper elementWrapper) {
|
public String prepareClipboardCopy(SystemXMLElementWrapper elementWrapper) {
|
||||||
getDocument(elementWrapper.getProfile());
|
getDocument(elementWrapper.getProfile());
|
||||||
Element element = elementWrapper.getElement();
|
IPropertySet element = elementWrapper.getElement();
|
||||||
currentNodeClone = null;
|
currentNodeClone = new PropertySet(element);
|
||||||
try {
|
|
||||||
currentNodeClone = (Element) element.cloneNode(true); // true=>deep clone, including text vs just attributes
|
|
||||||
} catch (Exception exc) {
|
|
||||||
SystemBasePlugin.logError("Error cloning user action/type element for clipboard", exc); //$NON-NLS-1$
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
currentNodeCloneID = getActionSubSystem().getClass().getName() + "." + //$NON-NLS-1$
|
currentNodeCloneID = getActionSubSystem().getClass().getName() + "." + //$NON-NLS-1$
|
||||||
getFileName() + "." + //$NON-NLS-1$
|
getActionSubSystem().getOSType() + "." + //$NON-NLS-1$
|
||||||
elementWrapper.getName();
|
elementWrapper.getName();
|
||||||
currentNodeCloneDomain = elementWrapper.getDomain();
|
currentNodeCloneDomain = elementWrapper.getDomain();
|
||||||
// currentNodeCloneName = elementWrapper.getName();
|
// currentNodeCloneName = elementWrapper.getName();
|
||||||
return currentNodeCloneID;
|
return currentNodeCloneID;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if the given ID, read from the clipboard, matches a node we prepared for
|
* Test if the given ID, read from the clipboard, matches a node we prepared for
|
||||||
|
@ -749,12 +743,21 @@ public abstract class SystemUDBaseManager implements IResourceChangeListener, IS
|
||||||
* @return SystemXMLElementWrapper wrapper object of pasted element, or null if it failed
|
* @return SystemXMLElementWrapper wrapper object of pasted element, or null if it failed
|
||||||
*/
|
*/
|
||||||
public SystemXMLElementWrapper pasteClipboardCopy(SystemXMLElementWrapper selectedElementWrapper, String id) {
|
public SystemXMLElementWrapper pasteClipboardCopy(SystemXMLElementWrapper selectedElementWrapper, String id) {
|
||||||
getDocument(selectedElementWrapper.getProfile());
|
ISystemProfile profile = selectedElementWrapper.getProfile();
|
||||||
|
if (profile == null)
|
||||||
|
profile = getActionSubSystem().getSubsystem().getSystemProfile();
|
||||||
|
getDocument(profile);
|
||||||
IPropertySet selectedElement = selectedElementWrapper.getElement();
|
IPropertySet selectedElement = selectedElementWrapper.getElement();
|
||||||
SystemXMLElementWrapper pastedElementWrapper = null;
|
SystemXMLElementWrapper pastedElementWrapper = null;
|
||||||
try {
|
try {
|
||||||
IPropertySetContainer parentElement = null;
|
IPropertySetContainer parentElement = null;
|
||||||
IPropertySet pastedElement = null;
|
IPropertySet pastedElement = null;
|
||||||
|
|
||||||
|
pastedElementWrapper = createElementWrapper(currentNodeClone, selectedElementWrapper.getProfile(), selectedElementWrapper.getDomain());
|
||||||
|
pastedElementWrapper.setName(getUniqueCloneName(pastedElementWrapper));
|
||||||
|
currentNodeClone.setName(getUniqueCloneName(pastedElementWrapper));
|
||||||
|
pastedElementWrapper.setIBM(false); // not an IBM action, even if source was
|
||||||
|
|
||||||
if (selectedElementWrapper.isDomain()) {
|
if (selectedElementWrapper.isDomain()) {
|
||||||
parentElement = selectedElement;
|
parentElement = selectedElement;
|
||||||
parentElement.addPropertySet(currentNodeClone);
|
parentElement.addPropertySet(currentNodeClone);
|
||||||
|
@ -765,14 +768,12 @@ public abstract class SystemUDBaseManager implements IResourceChangeListener, IS
|
||||||
parentElement.addPropertySet(currentNodeClone);
|
parentElement.addPropertySet(currentNodeClone);
|
||||||
pastedElement = currentNodeClone;
|
pastedElement = currentNodeClone;
|
||||||
}
|
}
|
||||||
pastedElementWrapper = createElementWrapper(pastedElement, selectedElementWrapper.getProfile(), selectedElementWrapper.getDomain());
|
|
||||||
pastedElementWrapper.setName(getUniqueCloneName(pastedElementWrapper));
|
|
||||||
pastedElementWrapper.setIBM(false); // not an IBM action, even if source was
|
|
||||||
} catch (Exception exc) {
|
} catch (Exception exc) {
|
||||||
SystemBasePlugin.logError("Error pasting user action/type", exc); //$NON-NLS-1$
|
SystemBasePlugin.logError("Error pasting user action/type", exc); //$NON-NLS-1$
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
saveUserData(selectedElementWrapper.getProfile());
|
saveUserData(profile);
|
||||||
return pastedElementWrapper;
|
return pastedElementWrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
|
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
|
||||||
* Kevin Doyle (IBM) - [222831] Can't Delete User Actions/Named Types
|
* Kevin Doyle (IBM) - [222831] Can't Delete User Actions/Named Types
|
||||||
* Kevin Doyle (IBM) - [222827] Treeview is collapsed after creating new user action
|
* Kevin Doyle (IBM) - [222827] Treeview is collapsed after creating new user action
|
||||||
|
* Kevin Doyle (IBM) - [239702] Copy/Paste doesn't work with User Defined Actions and Named Types
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.useractions.ui.uda;
|
package org.eclipse.rse.internal.useractions.ui.uda;
|
||||||
|
@ -48,6 +49,7 @@ import org.eclipse.rse.ui.messages.SystemMessageDialog;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.dnd.Clipboard;
|
import org.eclipse.swt.dnd.Clipboard;
|
||||||
import org.eclipse.swt.dnd.TextTransfer;
|
import org.eclipse.swt.dnd.TextTransfer;
|
||||||
|
import org.eclipse.swt.dnd.Transfer;
|
||||||
import org.eclipse.swt.events.DisposeEvent;
|
import org.eclipse.swt.events.DisposeEvent;
|
||||||
import org.eclipse.swt.events.DisposeListener;
|
import org.eclipse.swt.events.DisposeListener;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
@ -456,7 +458,6 @@ public class SystemUDBaseTreeView extends TreeViewer implements IMenuListener, I
|
||||||
* Called by the SystemChangeFilterActionCopyString action class.
|
* Called by the SystemChangeFilterActionCopyString action class.
|
||||||
*/
|
*/
|
||||||
public boolean doCopy() {
|
public boolean doCopy() {
|
||||||
/*
|
|
||||||
IStructuredSelection selection = (IStructuredSelection) getSelection();
|
IStructuredSelection selection = (IStructuredSelection) getSelection();
|
||||||
SystemXMLElementWrapper firstSelect = (SystemXMLElementWrapper) selection.getFirstElement();
|
SystemXMLElementWrapper firstSelect = (SystemXMLElementWrapper) selection.getFirstElement();
|
||||||
if (clipboard == null) clipboard = new Clipboard(getShell().getDisplay());
|
if (clipboard == null) clipboard = new Clipboard(getShell().getDisplay());
|
||||||
|
@ -464,7 +465,6 @@ public class SystemUDBaseTreeView extends TreeViewer implements IMenuListener, I
|
||||||
if (id == null) return false;
|
if (id == null) return false;
|
||||||
TextTransfer transfer = TextTransfer.getInstance();
|
TextTransfer transfer = TextTransfer.getInstance();
|
||||||
clipboard.setContents(new Object[] { id }, new Transfer[] { transfer });
|
clipboard.setContents(new Object[] { id }, new Transfer[] { transfer });
|
||||||
*/
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue