Skip to content
Snippets Groups Projects
Commit 74318862 authored by Florian Hölzl's avatar Florian Hölzl
Browse files

some fixes to drag and drop

parent 3dfd9b8c
No related branches found
No related tags found
No related merge requests found
......@@ -25,13 +25,16 @@ import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.XYLayout;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.Request;
import org.eclipse.gef.RequestConstants;
import org.eclipse.swt.graphics.Color;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
import org.fortiss.tooling.base.ui.editpart.policy.RemoveEditPolicy;
import org.fortiss.tooling.base.ui.layout.constants.RecommendedLayoutConstants;
import org.fortiss.tooling.base.ui.layout.util.LayoutDataUtils;
import org.fortiss.tooling.kernel.model.INamedCommentedElement;
import org.fortiss.tooling.kernel.ui.services.IEditorService;
import org.fortiss.tooling.kernel.ui.services.IModelElementService;
/**
......@@ -128,30 +131,14 @@ public abstract class NodeEditPartBase<T extends ILayoutedModelElement & INamedC
*/
@Override
protected void createEditPolicies() {
// TODO (FH): add remove policy
// installEditPolicy(EditPolicy.COMPONENT_ROLE, new RemoveEditPolicy());
installEditPolicy(EditPolicy.COMPONENT_ROLE, new RemoveEditPolicy());
}
/** {@inheritDoc} */
@Override
public void performRequest(Request req) {
if (req.getType() == RequestConstants.REQ_OPEN) {
// TODO (FH): add double-click open editor support
// ModelContext context = ModelContextManager.getInstance()
// .getContext(modelElement);
// CCTSEditorInput editorInput = new CCTSEditorInput(modelElement,
// context);
// try {
// PlatformUI.getWorkbench().getActiveWorkbenchWindow()
// .getActivePage()
// .openEditor(editorInput, CCTSBindingEditor.ID);
// } catch (PartInitException e) {
// LoggingUtils
// .error(CCTSModelBaseActivator.getDefault(),
// "Could not open editor with ID "
// + CCTSBindingEditor.ID, e);
// }
IEditorService.INSTANCE.openInEditor(modelElement);
}
super.performRequest(req);
}
......
......@@ -30,7 +30,6 @@ import org.eclipse.swt.dnd.DragSourceEvent;
* @version $Rev: 18709 $
* @ConQAT.Rating RED Hash: 249A02E8613055D236661A34D74A461C
*/
// TODO (FH): move to UI
public class EObjectDragSourceListener extends DragSourceAdapter {
/** Library tree viewer */
......
......@@ -29,20 +29,19 @@ import org.fortiss.tooling.kernel.services.IPrototypeService.Prototype;
* @version $Rev$
* @ConQAT.Rating RED Hash: 7ABCFF777BE5B8EA5A7F4F65D264072E
*/
// TODO (FH): move to UI
public final class DragAndDropUtils {
/** Extracts the EObject contained in the given drop object. */
public static EObject extractDroppedEObject(Object data) {
if (data instanceof IStructuredSelection
&& !((IStructuredSelection) data).isEmpty()) {
Object result = ((IStructuredSelection) data).getFirstElement();
if (result instanceof Prototype) {
return ((Prototype) result).getPrototypeCopy();
}
if (result instanceof EObject) {
return (EObject) result;
}
data = ((IStructuredSelection) data).getFirstElement();
}
if (data instanceof Prototype) {
return ((Prototype) data).getPrototypeCopy();
}
if (data instanceof EObject) {
return (EObject) data;
}
return null;
}
......
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