Skip to content
Snippets Groups Projects
Commit 6d05f85f authored by Georgetta Igna's avatar Georgetta Igna
Browse files

canPaste is checked inside canPasteInto to forbid pasting stated inside other...

canPaste is checked inside canPasteInto to forbid pasting stated inside other states selected in the editor.
refs 2337
parent e6c9faac
No related branches found
No related tags found
No related merge requests found
......@@ -31,10 +31,13 @@ import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
import org.fortiss.tooling.kernel.model.ISpeciallyCopyiable;
import org.fortiss.tooling.kernel.service.IElementCompositorService;
import org.fortiss.tooling.kernel.ui.dnd.CompositionServiceLocalCopyPasteTransfer;
import org.fortiss.tooling.kernel.ui.internal.editor.ExtendableMultiPageEditor;
/**
* Methods for copy/paste transfer. EMF serialization and {@link TextTransfer} is used to transfer
......@@ -45,7 +48,7 @@ import org.fortiss.tooling.kernel.ui.dnd.CompositionServiceLocalCopyPasteTransfe
*
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: 69F65ED1A7907B28D027A90EDD5A88AA
* @ConQAT.Rating YELLOW Hash: 0006B2EE182F1E5CB8FE7EF604679259
*/
public class CopyPasteUtils {
......@@ -135,11 +138,26 @@ public class CopyPasteUtils {
* target
*/
public static boolean canPasteInto(EObject target, IElementCompositionContext context) {
EObject[] contents = getClipBoardContent();
if(contents == null) {
return false;
}
for(EObject insertObj : contents) {
if(insertObj instanceof ISpeciallyCopyiable) {
IWorkbenchPart activePart =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.getActivePart();
if(activePart instanceof ExtendableMultiPageEditor) {
if(!((ISpeciallyCopyiable)insertObj).canPaste(
((ExtendableMultiPageEditor)activePart).getEditedObject(), target))
return false;
}
}
if(IElementCompositorService.INSTANCE.canCompose(target, insertObj, context)) {
return true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment