SlideShare a Scribd company logo
Customizing GMF DnD Framework

Step 1 : Contributing custom edit policy provider to GMF editor

In our DnD handler plugin, we contribute
com.tibco.xpd.cm.boma.dnd.core.BOMADnDEditPolicyProvider to the
org.eclipse.gmf.runtime.diagram.ui.editpolicyProviders.

This Presentation Edit Policy Provider extension point is used to define editpolicy providers
for the editpolicy service.
The editpolicy service allows plug-ins to modify or enhance the behavior of an editpart via an
editpolicy without modifying the editpart code.



Step 2 : Attach a custom edit policy and a drop target listener to the edit part

public void createEditPolicies(EditPart editPart) {
                             if (isEditPartValid(editPart))         {

/** if the edit part is valid,
    install the dnd edit policy
    editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE,

dndPolicy);
    editPart.getViewer().addDropTargetListener(dndListner);
**/
}
}

public boolean provides(IOperation operation) {
                             if(operation instanceof CreateEditPoliciesOperation){
                                           EditPart editPart =
((CreateEditPoliciesOperation)
             operation).getEditPart();
                                return isEditPartValid(editPart);
                             }
                             return false;

// Custom Edit Policy
public class BOMADragDropEditPolicy extends DragDropEditPolicy {

//------

}
Step 3 : Prepare the list of objects to be dropped and set it on the Drop Request
@Override
                protected List<Object> getObjectsBeingDropped() {

                                ISelection selection =
LocalSelectionTransfer.getInstance().getSelection();
                            if (selection instanceof IStructuredSelection) {
                                          sourceObjectList =
((IStructuredSelection) selection).toList();
                            }

                            return sourceObjectList;
              }

@Override
              protected Request createTargetRequest() {
      DropObjectsRequest req = new DropObjectsRequest();
            req.setObjects(getObjectsBeingDropped());
                            return req;
              }


Step 4: Return an edit part that can produce an executable command for the
target        request

              private EditPart calculateTargetEditPart() {
                            updateTargetRequest();
                            EditPart ep = getViewer()
                                          .findObjectAtExcluding(
                                                        getDropLocation(),
                                                        getExclusionSet(),
                                                        new
EditPartViewer.Conditional() {
                                                                      public
boolean evaluate(EditPart editpart) {

Command command =
      editpart.getCommand(getTargetRequest());


return command != null;
                                                                          }
                                                         });
                            /*if (ep != null) {
                                          Command command =
ep.getCommand(getTargetRequest());
                                          return (command != null &&
command.canExecute())? ep : null;
                            }*/
                            return ep;
              }


Step 5: Return the required DnD command from the corresponding Edit Part

/**
              * @generated NOT
              */
              @Override
              public Command getCommand(Request _request) {
                             if(_request instanceof DropObjectsRequest)
{
return
getDnDEditPolicy().getCommand(_request);
                            }else {
                                            return
super.getCommand(_request);
                              }
              }

              /**
              * @generated NOT
              * @return
              */
              private EditPolicy getDnDEditPolicy() {
                             EditPolicy dndPolicy = null;
                             EditPolicyIterator i =
getEditPolicyIterator();
                             while (i.hasNext()) {
                                           EditPolicy tempPolicy =
i.next();
                                           if (tempPolicy instanceof
DragDropEditPolicy) {
                                                          dndPolicy =
tempPolicy;
                                                          break;

                                            }
                              }
                              return dndPolicy;
              }

// Custom Edit Policy
  public class BOMADragDropEditPolicy extends DragDropEditPolicy {


@Override
              protected Command getDropElementCommand(EObject element,
DropObjectsRequest
            request) {
                            EObject modelObj = getHostObject();


                            TransactionalEditingDomain editDomain =
(TransactionalEdit
      ingDomain)WorkingCopyUtil.getWorkingCopyFor(modelObj).getEditingDomain();
                            return getGMFWrapper(new
            BOMADragDropCommand(editDomain,request,modelObj,element));
                            }

              private Command getGMFWrapper(ICommand gmfCommand){
                            return new ICommandProxy(gmfCommand);
              }
//------
}


Step 6 : Execute the DnD Command to create the Concepts through corresponding
Generator class
public class BOMADragDropCommand extends AbstractTransactionalCommand{

              private EObject modelObj;
              private EObject element;
              private IDataModelGenerator modelGen;

              /**
              *
              * @param editDomain
              * @param request
              * @param modelObj
              * @param element
              */
              public BOMADragDropCommand (TransactionalEditingDomain
editDomain,DropObjectsRequest request,EObject modelObj,EObject element){
                             super(editDomain,"DND",getAffectedFiles(request));
                             this.modelObj = modelObj;
                             this.element = element;

              }

              @Override
              protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
                            Model model = null;
                            //
                            if(modelObj != null){
                                          if(modelObj instanceof Model){
                                                         model = (Model)modelObj;
                                                int elementType =
                        DropElementTypeResolver.getElementType(element);
                                                         switch(elementType){
                                                                       case
DropElementTypeResolver.CONCEPT_TYPE:
      modelGen = new
      ConceptModelGenerator((Model)modelObj);

modelGen.generateUMLModel(element);

modelGen.setRelationships();

break;
                                                                         case
DropElementTypeResolver.DB_TYPE:
      modelGen = new
      DB2UMLModelGenerator((Model)modelObj);

modelGen.generateUMLModel(element);

modelGen.setRelationships();

break;
                                                                         case
DropElementTypeResolver.JAVA_TYPE:

break;
                                                                         case
DropElementTypeResolver.XSD_TYPE:
break;
                                                   }

                                     }
                       }
                       return CommandResult.newOKCommandResult();
         }

         private static List getAffectedFiles(Request request){

                       return null;
         }
}

More Related Content

What's hot

Vaadin 7
Vaadin 7Vaadin 7
Vaadin 7
Joonas Lehtinen
 
Student management system
Student management systemStudent management system
Student management system
geetika goyal
 
Js 单元测试框架介绍
Js 单元测试框架介绍Js 单元测试框架介绍
Js 单元测试框架介绍louieuser
 
Mongoskin - Guilin
Mongoskin - GuilinMongoskin - Guilin
Mongoskin - Guilin
Jackson Tian
 
ESNext for humans - LvivJS 16 August 2014
ESNext for humans - LvivJS 16 August 2014ESNext for humans - LvivJS 16 August 2014
ESNext for humans - LvivJS 16 August 2014
Jan Jongboom
 
Ian 20150116 java script oop
Ian 20150116 java script oopIan 20150116 java script oop
Ian 20150116 java script oop
LearningTech
 
SOLID - Not Just a State of Matter, It's Principles for OO Propriety
SOLID - Not Just a State of Matter, It's Principles for OO ProprietySOLID - Not Just a State of Matter, It's Principles for OO Propriety
SOLID - Not Just a State of Matter, It's Principles for OO ProprietyChris Weldon
 
Removing structural duplication
Removing structural duplicationRemoving structural duplication
Removing structural duplication
Alexandru Bolboaca
 
Andriy Slobodyanyk "How to Use Hibernate: Key Problems and Solutions"
Andriy Slobodyanyk "How to Use Hibernate: Key Problems and Solutions"Andriy Slobodyanyk "How to Use Hibernate: Key Problems and Solutions"
Andriy Slobodyanyk "How to Use Hibernate: Key Problems and Solutions"
LogeekNightUkraine
 
Vaadin7
Vaadin7Vaadin7
運用Closure Compiler 打造高品質的JavaScript
運用Closure Compiler 打造高品質的JavaScript運用Closure Compiler 打造高品質的JavaScript
運用Closure Compiler 打造高品質的JavaScript
taobao.com
 
Exercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera CymbronExercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera Cymbroncymbron
 
«Objective-C Runtime в примерах» — Алексей Сторожев, e-Legion
«Objective-C Runtime в примерах» — Алексей Сторожев, e-Legion«Objective-C Runtime в примерах» — Алексей Сторожев, e-Legion
«Objective-C Runtime в примерах» — Алексей Сторожев, e-Legion
e-Legion
 
Magic methods
Magic methodsMagic methods
Magic methods
Matthew Barlocker
 
The Ring programming language version 1.10 book - Part 17 of 212
The Ring programming language version 1.10 book - Part 17 of 212The Ring programming language version 1.10 book - Part 17 of 212
The Ring programming language version 1.10 book - Part 17 of 212
Mahmoud Samir Fayed
 
Refactoring group 1 - chapter 3,4,6
Refactoring   group 1 - chapter 3,4,6Refactoring   group 1 - chapter 3,4,6
Refactoring group 1 - chapter 3,4,6Duy Lâm
 
PHP 5 Magic Methods
PHP 5 Magic MethodsPHP 5 Magic Methods
PHP 5 Magic Methods
David Stockton
 
Con5623 pdf 5623_001
Con5623 pdf 5623_001Con5623 pdf 5623_001
Con5623 pdf 5623_001
Euegene Fedorenko
 

What's hot (20)

Vaadin 7
Vaadin 7Vaadin 7
Vaadin 7
 
Student management system
Student management systemStudent management system
Student management system
 
Java
JavaJava
Java
 
Js 单元测试框架介绍
Js 单元测试框架介绍Js 单元测试框架介绍
Js 单元测试框架介绍
 
Mongoskin - Guilin
Mongoskin - GuilinMongoskin - Guilin
Mongoskin - Guilin
 
ESNext for humans - LvivJS 16 August 2014
ESNext for humans - LvivJS 16 August 2014ESNext for humans - LvivJS 16 August 2014
ESNext for humans - LvivJS 16 August 2014
 
MaintainStaffTable
MaintainStaffTableMaintainStaffTable
MaintainStaffTable
 
Ian 20150116 java script oop
Ian 20150116 java script oopIan 20150116 java script oop
Ian 20150116 java script oop
 
SOLID - Not Just a State of Matter, It's Principles for OO Propriety
SOLID - Not Just a State of Matter, It's Principles for OO ProprietySOLID - Not Just a State of Matter, It's Principles for OO Propriety
SOLID - Not Just a State of Matter, It's Principles for OO Propriety
 
Removing structural duplication
Removing structural duplicationRemoving structural duplication
Removing structural duplication
 
Andriy Slobodyanyk "How to Use Hibernate: Key Problems and Solutions"
Andriy Slobodyanyk "How to Use Hibernate: Key Problems and Solutions"Andriy Slobodyanyk "How to Use Hibernate: Key Problems and Solutions"
Andriy Slobodyanyk "How to Use Hibernate: Key Problems and Solutions"
 
Vaadin7
Vaadin7Vaadin7
Vaadin7
 
運用Closure Compiler 打造高品質的JavaScript
運用Closure Compiler 打造高品質的JavaScript運用Closure Compiler 打造高品質的JavaScript
運用Closure Compiler 打造高品質的JavaScript
 
Exercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera CymbronExercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera Cymbron
 
«Objective-C Runtime в примерах» — Алексей Сторожев, e-Legion
«Objective-C Runtime в примерах» — Алексей Сторожев, e-Legion«Objective-C Runtime в примерах» — Алексей Сторожев, e-Legion
«Objective-C Runtime в примерах» — Алексей Сторожев, e-Legion
 
Magic methods
Magic methodsMagic methods
Magic methods
 
The Ring programming language version 1.10 book - Part 17 of 212
The Ring programming language version 1.10 book - Part 17 of 212The Ring programming language version 1.10 book - Part 17 of 212
The Ring programming language version 1.10 book - Part 17 of 212
 
Refactoring group 1 - chapter 3,4,6
Refactoring   group 1 - chapter 3,4,6Refactoring   group 1 - chapter 3,4,6
Refactoring group 1 - chapter 3,4,6
 
PHP 5 Magic Methods
PHP 5 Magic MethodsPHP 5 Magic Methods
PHP 5 Magic Methods
 
Con5623 pdf 5623_001
Con5623 pdf 5623_001Con5623 pdf 5623_001
Con5623 pdf 5623_001
 

Viewers also liked

Rosemary Carter
Rosemary CarterRosemary Carter
Rosemary Carter
rosemarycarter
 
Rosemary Carter
Rosemary CarterRosemary Carter
Rosemary Carter
rosemarycarter
 
Joe Little - What's Lean got to do with it - The Lean within Scrum
Joe Little - What's Lean got to do with it - The Lean within ScrumJoe Little - What's Lean got to do with it - The Lean within Scrum
Joe Little - What's Lean got to do with it - The Lean within Scrum
SFA
 
Mike Cottmeyer - How to Own a Really big complex Product
Mike Cottmeyer - How to Own a Really big complex ProductMike Cottmeyer - How to Own a Really big complex Product
Mike Cottmeyer - How to Own a Really big complex Product
SFA
 
Machine Learning Comparative Analysis - Part 1
Machine Learning Comparative Analysis - Part 1Machine Learning Comparative Analysis - Part 1
Machine Learning Comparative Analysis - Part 1
Kaniska Mandal
 
Core concepts and Key technologies - Big Data Analytics
Core concepts and Key technologies - Big Data AnalyticsCore concepts and Key technologies - Big Data Analytics
Core concepts and Key technologies - Big Data AnalyticsKaniska Mandal
 

Viewers also liked (8)

Rosemary Carter (2)
Rosemary Carter (2)Rosemary Carter (2)
Rosemary Carter (2)
 
Rosemary Carter
Rosemary CarterRosemary Carter
Rosemary Carter
 
Rosemary Carter
Rosemary CarterRosemary Carter
Rosemary Carter
 
Joe Little - What's Lean got to do with it - The Lean within Scrum
Joe Little - What's Lean got to do with it - The Lean within ScrumJoe Little - What's Lean got to do with it - The Lean within Scrum
Joe Little - What's Lean got to do with it - The Lean within Scrum
 
Rosemary Carter (2)
Rosemary Carter (2)Rosemary Carter (2)
Rosemary Carter (2)
 
Mike Cottmeyer - How to Own a Really big complex Product
Mike Cottmeyer - How to Own a Really big complex ProductMike Cottmeyer - How to Own a Really big complex Product
Mike Cottmeyer - How to Own a Really big complex Product
 
Machine Learning Comparative Analysis - Part 1
Machine Learning Comparative Analysis - Part 1Machine Learning Comparative Analysis - Part 1
Machine Learning Comparative Analysis - Part 1
 
Core concepts and Key technologies - Big Data Analytics
Core concepts and Key technologies - Big Data AnalyticsCore concepts and Key technologies - Big Data Analytics
Core concepts and Key technologies - Big Data Analytics
 

Similar to Create a Customized GMF DnD Framework

DESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS.ppt
DESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS.pptDESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS.ppt
DESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS.ppt
AntoJoseph36
 
First Steps. (db4o - Object Oriented Database)
First Steps. (db4o - Object Oriented Database)First Steps. (db4o - Object Oriented Database)
First Steps. (db4o - Object Oriented Database)Wildan Maulana
 
Sharper Better Faster Dagger ‡ - Droidcon SF
Sharper Better Faster Dagger ‡ - Droidcon SFSharper Better Faster Dagger ‡ - Droidcon SF
Sharper Better Faster Dagger ‡ - Droidcon SF
Pierre-Yves Ricau
 
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo
A GWT Application with MVP Pattern Deploying to CloudFoundry using  Spring Roo A GWT Application with MVP Pattern Deploying to CloudFoundry using  Spring Roo
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo
Ali Parmaksiz
 
JavaScript - i och utanför webbläsaren (2010-03-03)
JavaScript - i och utanför webbläsaren (2010-03-03)JavaScript - i och utanför webbläsaren (2010-03-03)
JavaScript - i och utanför webbläsaren (2010-03-03)
Anders Jönsson
 
Zend Framework and the Doctrine2 MongoDB ODM (ZF1)
Zend Framework and the Doctrine2 MongoDB ODM (ZF1)Zend Framework and the Doctrine2 MongoDB ODM (ZF1)
Zend Framework and the Doctrine2 MongoDB ODM (ZF1)
Ryan Mauger
 
Using the Windows 8 Runtime from C++
Using the Windows 8 Runtime from C++Using the Windows 8 Runtime from C++
Clean Javascript
Clean JavascriptClean Javascript
Clean Javascript
Ryunosuke SATO
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
Lorna Mitchell
 
2. Design patterns. part #2
2. Design patterns. part #22. Design patterns. part #2
2. Design patterns. part #2
Leonid Maslov
 
6976.ppt
6976.ppt6976.ppt
MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012
MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012
MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012
Amazon Web Services
 
Unittests für Dummies
Unittests für DummiesUnittests für Dummies
Unittests für Dummies
Lars Jankowfsky
 
Wed 1630 greene_robert_color
Wed 1630 greene_robert_colorWed 1630 greene_robert_color
Wed 1630 greene_robert_colorDATAVERSITY
 
ZF2 for the ZF1 Developer
ZF2 for the ZF1 DeveloperZF2 for the ZF1 Developer
ZF2 for the ZF1 Developer
Gary Hockin
 
AngularJS Architecture
AngularJS ArchitectureAngularJS Architecture
AngularJS Architecture
Eyal Vardi
 
AngularJS Internal
AngularJS InternalAngularJS Internal
AngularJS Internal
Eyal Vardi
 

Similar to Create a Customized GMF DnD Framework (20)

DESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS.ppt
DESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS.pptDESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS.ppt
DESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS.ppt
 
Android workshop
Android workshopAndroid workshop
Android workshop
 
SOLID Principles
SOLID PrinciplesSOLID Principles
SOLID Principles
 
First Steps. (db4o - Object Oriented Database)
First Steps. (db4o - Object Oriented Database)First Steps. (db4o - Object Oriented Database)
First Steps. (db4o - Object Oriented Database)
 
Sharper Better Faster Dagger ‡ - Droidcon SF
Sharper Better Faster Dagger ‡ - Droidcon SFSharper Better Faster Dagger ‡ - Droidcon SF
Sharper Better Faster Dagger ‡ - Droidcon SF
 
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo
A GWT Application with MVP Pattern Deploying to CloudFoundry using  Spring Roo A GWT Application with MVP Pattern Deploying to CloudFoundry using  Spring Roo
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo
 
Backbone Basics with Examples
Backbone Basics with ExamplesBackbone Basics with Examples
Backbone Basics with Examples
 
JavaScript - i och utanför webbläsaren (2010-03-03)
JavaScript - i och utanför webbläsaren (2010-03-03)JavaScript - i och utanför webbläsaren (2010-03-03)
JavaScript - i och utanför webbläsaren (2010-03-03)
 
Zend Framework and the Doctrine2 MongoDB ODM (ZF1)
Zend Framework and the Doctrine2 MongoDB ODM (ZF1)Zend Framework and the Doctrine2 MongoDB ODM (ZF1)
Zend Framework and the Doctrine2 MongoDB ODM (ZF1)
 
Using the Windows 8 Runtime from C++
Using the Windows 8 Runtime from C++Using the Windows 8 Runtime from C++
Using the Windows 8 Runtime from C++
 
Clean Javascript
Clean JavascriptClean Javascript
Clean Javascript
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
2. Design patterns. part #2
2. Design patterns. part #22. Design patterns. part #2
2. Design patterns. part #2
 
6976.ppt
6976.ppt6976.ppt
6976.ppt
 
MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012
MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012
MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012
 
Unittests für Dummies
Unittests für DummiesUnittests für Dummies
Unittests für Dummies
 
Wed 1630 greene_robert_color
Wed 1630 greene_robert_colorWed 1630 greene_robert_color
Wed 1630 greene_robert_color
 
ZF2 for the ZF1 Developer
ZF2 for the ZF1 DeveloperZF2 for the ZF1 Developer
ZF2 for the ZF1 Developer
 
AngularJS Architecture
AngularJS ArchitectureAngularJS Architecture
AngularJS Architecture
 
AngularJS Internal
AngularJS InternalAngularJS Internal
AngularJS Internal
 

More from Kaniska Mandal

Machine learning advanced applications
Machine learning advanced applicationsMachine learning advanced applications
Machine learning advanced applications
Kaniska Mandal
 
MS CS - Selecting Machine Learning Algorithm
MS CS - Selecting Machine Learning AlgorithmMS CS - Selecting Machine Learning Algorithm
MS CS - Selecting Machine Learning Algorithm
Kaniska Mandal
 
Debugging over tcp and http
Debugging over tcp and httpDebugging over tcp and http
Debugging over tcp and httpKaniska Mandal
 
Concurrency Learning From Jdk Source
Concurrency Learning From Jdk SourceConcurrency Learning From Jdk Source
Concurrency Learning From Jdk SourceKaniska Mandal
 
Wondeland Of Modelling
Wondeland Of ModellingWondeland Of Modelling
Wondeland Of ModellingKaniska Mandal
 
The Road To Openness.Odt
The Road To Openness.OdtThe Road To Openness.Odt
The Road To Openness.OdtKaniska Mandal
 
Perils Of Url Class Loader
Perils Of Url Class LoaderPerils Of Url Class Loader
Perils Of Url Class LoaderKaniska Mandal
 
Making Applications Work Together In Eclipse
Making Applications Work Together In EclipseMaking Applications Work Together In Eclipse
Making Applications Work Together In EclipseKaniska Mandal
 
E4 Eclipse Super Force
E4 Eclipse Super ForceE4 Eclipse Super Force
E4 Eclipse Super ForceKaniska Mandal
 
Creating A Language Editor Using Dltk
Creating A Language Editor Using DltkCreating A Language Editor Using Dltk
Creating A Language Editor Using DltkKaniska Mandal
 
Advanced Hibernate Notes
Advanced Hibernate NotesAdvanced Hibernate Notes
Advanced Hibernate NotesKaniska Mandal
 
EMF Tips n Tricks
EMF Tips n TricksEMF Tips n Tricks
EMF Tips n Tricks
Kaniska Mandal
 
Graphical Model Transformation Framework
Graphical Model Transformation FrameworkGraphical Model Transformation Framework
Graphical Model Transformation Framework
Kaniska Mandal
 
Protocol For Streaming Media
Protocol For Streaming MediaProtocol For Streaming Media
Protocol For Streaming MediaKaniska Mandal
 
Rest With Json Vs Soap With Xml
Rest With Json Vs Soap With XmlRest With Json Vs Soap With Xml
Rest With Json Vs Soap With XmlKaniska Mandal
 
Riding The Semantic Wave
Riding The Semantic WaveRiding The Semantic Wave
Riding The Semantic WaveKaniska Mandal
 

More from Kaniska Mandal (20)

Machine learning advanced applications
Machine learning advanced applicationsMachine learning advanced applications
Machine learning advanced applications
 
MS CS - Selecting Machine Learning Algorithm
MS CS - Selecting Machine Learning AlgorithmMS CS - Selecting Machine Learning Algorithm
MS CS - Selecting Machine Learning Algorithm
 
Debugging over tcp and http
Debugging over tcp and httpDebugging over tcp and http
Debugging over tcp and http
 
Designing Better API
Designing Better APIDesigning Better API
Designing Better API
 
Concurrency Learning From Jdk Source
Concurrency Learning From Jdk SourceConcurrency Learning From Jdk Source
Concurrency Learning From Jdk Source
 
Wondeland Of Modelling
Wondeland Of ModellingWondeland Of Modelling
Wondeland Of Modelling
 
The Road To Openness.Odt
The Road To Openness.OdtThe Road To Openness.Odt
The Road To Openness.Odt
 
Perils Of Url Class Loader
Perils Of Url Class LoaderPerils Of Url Class Loader
Perils Of Url Class Loader
 
Making Applications Work Together In Eclipse
Making Applications Work Together In EclipseMaking Applications Work Together In Eclipse
Making Applications Work Together In Eclipse
 
Eclipse Tricks
Eclipse TricksEclipse Tricks
Eclipse Tricks
 
E4 Eclipse Super Force
E4 Eclipse Super ForceE4 Eclipse Super Force
E4 Eclipse Super Force
 
Creating A Language Editor Using Dltk
Creating A Language Editor Using DltkCreating A Language Editor Using Dltk
Creating A Language Editor Using Dltk
 
Advanced Hibernate Notes
Advanced Hibernate NotesAdvanced Hibernate Notes
Advanced Hibernate Notes
 
Best Of Jdk 7
Best Of Jdk 7Best Of Jdk 7
Best Of Jdk 7
 
EMF Tips n Tricks
EMF Tips n TricksEMF Tips n Tricks
EMF Tips n Tricks
 
Graphical Model Transformation Framework
Graphical Model Transformation FrameworkGraphical Model Transformation Framework
Graphical Model Transformation Framework
 
Mashup Magic
Mashup MagicMashup Magic
Mashup Magic
 
Protocol For Streaming Media
Protocol For Streaming MediaProtocol For Streaming Media
Protocol For Streaming Media
 
Rest With Json Vs Soap With Xml
Rest With Json Vs Soap With XmlRest With Json Vs Soap With Xml
Rest With Json Vs Soap With Xml
 
Riding The Semantic Wave
Riding The Semantic WaveRiding The Semantic Wave
Riding The Semantic Wave
 

Recently uploaded

Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 

Recently uploaded (20)

Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 

Create a Customized GMF DnD Framework

  • 1. Customizing GMF DnD Framework Step 1 : Contributing custom edit policy provider to GMF editor In our DnD handler plugin, we contribute com.tibco.xpd.cm.boma.dnd.core.BOMADnDEditPolicyProvider to the org.eclipse.gmf.runtime.diagram.ui.editpolicyProviders. This Presentation Edit Policy Provider extension point is used to define editpolicy providers for the editpolicy service. The editpolicy service allows plug-ins to modify or enhance the behavior of an editpart via an editpolicy without modifying the editpart code. Step 2 : Attach a custom edit policy and a drop target listener to the edit part public void createEditPolicies(EditPart editPart) { if (isEditPartValid(editPart)) { /** if the edit part is valid, install the dnd edit policy editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, dndPolicy); editPart.getViewer().addDropTargetListener(dndListner); **/ } } public boolean provides(IOperation operation) { if(operation instanceof CreateEditPoliciesOperation){ EditPart editPart = ((CreateEditPoliciesOperation) operation).getEditPart(); return isEditPartValid(editPart); } return false; // Custom Edit Policy public class BOMADragDropEditPolicy extends DragDropEditPolicy { //------ } Step 3 : Prepare the list of objects to be dropped and set it on the Drop Request @Override protected List<Object> getObjectsBeingDropped() { ISelection selection =
  • 2. LocalSelectionTransfer.getInstance().getSelection(); if (selection instanceof IStructuredSelection) { sourceObjectList = ((IStructuredSelection) selection).toList(); } return sourceObjectList; } @Override protected Request createTargetRequest() { DropObjectsRequest req = new DropObjectsRequest(); req.setObjects(getObjectsBeingDropped()); return req; } Step 4: Return an edit part that can produce an executable command for the target request private EditPart calculateTargetEditPart() { updateTargetRequest(); EditPart ep = getViewer() .findObjectAtExcluding( getDropLocation(), getExclusionSet(), new EditPartViewer.Conditional() { public boolean evaluate(EditPart editpart) { Command command = editpart.getCommand(getTargetRequest()); return command != null; } }); /*if (ep != null) { Command command = ep.getCommand(getTargetRequest()); return (command != null && command.canExecute())? ep : null; }*/ return ep; } Step 5: Return the required DnD command from the corresponding Edit Part /** * @generated NOT */ @Override public Command getCommand(Request _request) { if(_request instanceof DropObjectsRequest) {
  • 3. return getDnDEditPolicy().getCommand(_request); }else { return super.getCommand(_request); } } /** * @generated NOT * @return */ private EditPolicy getDnDEditPolicy() { EditPolicy dndPolicy = null; EditPolicyIterator i = getEditPolicyIterator(); while (i.hasNext()) { EditPolicy tempPolicy = i.next(); if (tempPolicy instanceof DragDropEditPolicy) { dndPolicy = tempPolicy; break; } } return dndPolicy; } // Custom Edit Policy public class BOMADragDropEditPolicy extends DragDropEditPolicy { @Override protected Command getDropElementCommand(EObject element, DropObjectsRequest request) { EObject modelObj = getHostObject(); TransactionalEditingDomain editDomain = (TransactionalEdit ingDomain)WorkingCopyUtil.getWorkingCopyFor(modelObj).getEditingDomain(); return getGMFWrapper(new BOMADragDropCommand(editDomain,request,modelObj,element)); } private Command getGMFWrapper(ICommand gmfCommand){ return new ICommandProxy(gmfCommand); } //------ } Step 6 : Execute the DnD Command to create the Concepts through corresponding Generator class
  • 4. public class BOMADragDropCommand extends AbstractTransactionalCommand{ private EObject modelObj; private EObject element; private IDataModelGenerator modelGen; /** * * @param editDomain * @param request * @param modelObj * @param element */ public BOMADragDropCommand (TransactionalEditingDomain editDomain,DropObjectsRequest request,EObject modelObj,EObject element){ super(editDomain,"DND",getAffectedFiles(request)); this.modelObj = modelObj; this.element = element; } @Override protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { Model model = null; // if(modelObj != null){ if(modelObj instanceof Model){ model = (Model)modelObj; int elementType = DropElementTypeResolver.getElementType(element); switch(elementType){ case DropElementTypeResolver.CONCEPT_TYPE: modelGen = new ConceptModelGenerator((Model)modelObj); modelGen.generateUMLModel(element); modelGen.setRelationships(); break; case DropElementTypeResolver.DB_TYPE: modelGen = new DB2UMLModelGenerator((Model)modelObj); modelGen.generateUMLModel(element); modelGen.setRelationships(); break; case DropElementTypeResolver.JAVA_TYPE: break; case DropElementTypeResolver.XSD_TYPE:
  • 5. break; } } } return CommandResult.newOKCommandResult(); } private static List getAffectedFiles(Request request){ return null; } }