MCPcopy Create free account
hub / github.com/MITK/MITK / Drop

Method Drop

Plugins/org.blueberry.ui.qt/src/internal/berryPartStack.cpp:49–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49void PartStack::PartStackDropResult::Drop()
50{
51 // If we're dragging a pane over itself do nothing
52 //if (dropResult.getInsertionPoint() == pane.getPresentablePart()) { return; };
53
54 Object::Pointer cookie;
55 if (dropResult != 0)
56 {
57 cookie = dropResult->GetCookie();
58 }
59
60 PartPane::Pointer pane(this->pane);
61 PartStack::Pointer stack(this->stack);
62 // Handle cross window drops by opening a new editor
63 if (pane->GetPartReference().Cast<IEditorReference> () != 0)
64 {
65 IEditorReference::Pointer editorRef = pane->GetPartReference().Cast<
66 IEditorReference> ();
67 if (pane->GetWorkbenchWindow() != stack->GetWorkbenchWindow())
68 {
69 try
70 {
71 IEditorInput::Pointer input = editorRef->GetEditorInput();
72
73 // Close the old editor and capture the actual closed state incase of a 'cancel'
74 bool editorClosed = pane->GetPage()->CloseEditor(editorRef, true);
75
76 // Only open open the new editor if the old one closed
77 if (editorClosed)
78 stack->GetPage()->OpenEditor(input, editorRef->GetId());
79 return;
80 }
81 catch (const PartInitException& e)
82 {
83 //e.printStackTrace();
84 BERRY_ERROR << e.what();
85 }
86
87 }
88 }
89
90 if (pane->GetContainer() != stack)
91 {
92 // Moving from another stack
93 stack->DerefPart(pane);
94 pane->Reparent(stack->GetParent());
95 stack->Add(pane, cookie);
96 stack->SetSelection(pane);
97 pane->SetFocus();
98 }
99 else if (cookie != 0)
100 {
101 // Rearranging within this stack
102 stack->GetPresentation()->MovePart(stack->GetPresentablePart(pane), cookie);
103 }
104}
105
106CursorType PartStack::PartStackDropResult::GetCursor()

Callers 1

PerformDragMethod · 0.45

Calls 15

GetCookieMethod · 0.80
whatMethod · 0.80
GetPresentablePartMethod · 0.80
GetPartReferenceMethod · 0.45
GetWorkbenchWindowMethod · 0.45
GetEditorInputMethod · 0.45
CloseEditorMethod · 0.45
GetPageMethod · 0.45
OpenEditorMethod · 0.45
GetIdMethod · 0.45
GetContainerMethod · 0.45
DerefPartMethod · 0.45

Tested by

no test coverage detected