SlideShare ist ein Scribd-Unternehmen logo
1 von 20
GraphitiThe Graphical Tooling Infrastructure Speaking Plain Java Michael Wenz SAP AG 03/23/2010 Graphiti are: Christian Brand Jürgen Pasch 	Matthias Gorning 	Michael Wenz 	Tim Kaiser
What Is Graphiti All About ? “The goal of Graphiti is to support the fast and easy creation of unified graphical tools, which can display and edit underlying domain models using a tool-defined graphical notation.”
What Is Graphiti All About ? “The goal of Graphiti is to support the fast and easy creation of unified graphical tools, which can display and edit underlying domain models using a tool-defined graphical notation.”
Why Should I Want to Use Graphiti ?
How Does Graphiti Work ?
What about the Diagram Type Agent ? Diagram Type Agent Feature Provider Diagram Type Provider A feature implements an operation for a domain object and defines the context in which the operation can be triggered Add Feature Create Feature Delete Feature … Specialized features for common user interactions available
Domain Hierarchie Pictogram Elements Links Visualization Graphics Algorithms EClass Container Shape Link EAttribute Attribute Text Shape Shape Shape Shape Container Shape Which Objects Do I Deal with ? Text Text EOperation Attribute Link Link Link Link Result Shape Container Shape
Well Then - How Do I Build a Tool ?
Well Then - How Do I Build a Tool ?
packageorg.eclipse.graphiti.tutorial;   importorg.eclipse.graphiti.dt.AbstractDiagramTypeProvider;   publicclassTutorialDiagramTypeProviderextendsAbstractDiagramTypeProvider {   publicTutorialDiagramTypeProvider() { super(); 	} } Well Then - How Do I Build a Tool ?
Well Then - How Do I Build a Tool ?
Well Then - How Do I Build a Tool ? … <extension point="org.eclipse.graphiti.eclipse.diagramTypes"> <diagramType 	id="org.eclipse.graphiti.tutorial.TutorialDiagramType„ 	type="tutorial„ 	name="Tutorial Diagram Type„ 	description="This is the diagram type for the Graphiti tutorial"> </diagramType> </extension> <extension point="org.eclipse.graphiti.eclipse.diagramTypeProviders">     <diagramTypeProvider 	id="org.eclipse.graphiti.tutorial.TutorialDiagramTypeProvider„ 	name="Tutorial Editor„ 	class="org.eclipse.graphiti.tutorial.TutorialDiagramTypeProvider„ 	description="This is the editor for the Graphiti tutorial"> <diagramType 	    id="org.eclipse.graphiti.tutorial.TutorialDiagramType"> 	</diagramType>     </diagramTypeProvider> </extension> …
Well Then - How Do I Build a Tool ?
Well Then - How Do I Build a Tool ? packageorg.eclipse.graphiti.tutorial; … publicclassTutorialFeatureProviderextendsDefaultFeatureProvider {   publicTutorialFeatureProvider(IDiagramTypeProviderdtp) { super(dtp); 	} } … publicTutorialDiagramTypeProvider() { super(); setFeatureProvider(newTutorialFeatureProvider(this)); 	} …
Well Then - How Do I Build a Tool ?
Well Then - How Do I Build a Tool ? … publicclassTutorialAddEClassFeatureextendsAbstractAddShapeFeature {   publicTutorialAddEClassFeature(IFeatureProviderfp) { super(fp); 	}   @Override public booleancanAdd(IAddContext context) { // Check if user wants to add an EClass if (context.getNewObject() instanceofEClass) { // Check if user wants to add to a diagram if (context.getTargetContainer() instanceof Diagram) { return true; 			} 		} return false; 	}   @Override publicPictogramElement add(IAddContext context) { … 	} }
Well Then - How Do I Build a Tool ? publicPictogramElement add(IAddContext context) { EClassaddedClass = (EClass) context.getNewObject(); 	Diagram targetDiagram = (Diagram) context.getTargetContainer(); int w = context.getWidth() <= 0 ? 100 : context.getWidth(); int h = context.getHeight() <= 0 ? 50 : context.getHeight(); ContainerShapecontainerShape = PeUtil.createContainerShape(targetDiagram, true); RoundedRectangleroundedRectangle = GaUtil.createRoundedRectangle(containerShape, 5, 5); roundedRectangle.setForeground(manageColor(CLASS_FOREGROUND)); roundedRectangle.setBackground(manageColor(CLASS_BACKGROUND)); roundedRectangle.setLineWidth(2); GaUtil.setLocationAndSizeOfGraphicsAlgorithm(roundedRectangle, context.getX(), context.getY(), w, h);  	link(containerShape, addedClass); 	Shape shape = PeUtil.createShape(containerShape, false); 	Text text = GaUtil.createDefaultText(shape, addedClass.getName()); text.setForeground(manageColor(CLASS_TEXT_FOREGROUND)); text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER); text.setVerticalAlignment(Orientation.ALIGNMENT_CENTER); text.getFont().setBold(true); GaUtil.setLocationAndSizeOfGraphicsAlgorithm(text, 0, 0, width, 20); 	shape = PeUtil.createShape(containerShape, false); Polylinepolyline = GaUtil.createPolyline(shape, newint[] { 0, 20, width, 20 }); polyline.setForeground(manageColor(CLASS_FOREGROUND)); polyline.setLineWidth(2); returncontainerShape; }
Well Then - How Do I Build a Tool ? publicclassTutorialFeatureProviderextendsDefaultFeatureProvider { … @Override public IAddFeature getAddFeature(IAddContext context) { if (context.getNewObject() instanceof EClass) { returnnew TutorialAddEClassFeature(this); 		} returnsuper.getAddFeature(context); 	} }
Graphiti – What else to Mention ?
Short Talk on Graphiti at EclipseCon 2010

Weitere ähnliche Inhalte

Ähnlich wie Short Talk on Graphiti at EclipseCon 2010

JavaScript 2.0 in Dreamweaver CS4
JavaScript 2.0 in Dreamweaver CS4JavaScript 2.0 in Dreamweaver CS4
JavaScript 2.0 in Dreamweaver CS4alexsaves
 
Grails 0.3-SNAPSHOT Presentation WJAX 2006 English
Grails 0.3-SNAPSHOT Presentation WJAX 2006 EnglishGrails 0.3-SNAPSHOT Presentation WJAX 2006 English
Grails 0.3-SNAPSHOT Presentation WJAX 2006 EnglishSven Haiges
 
Degrafa Overview
Degrafa OverviewDegrafa Overview
Degrafa OverviewBill White
 
What I Learned At Drupal Con Dc 2009
What I Learned At Drupal Con Dc 2009What I Learned At Drupal Con Dc 2009
What I Learned At Drupal Con Dc 2009Neil Giarratana
 
JavaScript and DOM Pattern Implementation
JavaScript and DOM Pattern ImplementationJavaScript and DOM Pattern Implementation
JavaScript and DOM Pattern Implementationdavejohnson
 
Real-World AJAX with ASP.NET
Real-World AJAX with ASP.NETReal-World AJAX with ASP.NET
Real-World AJAX with ASP.NETgoodfriday
 
The Web on OSGi: Here's How
The Web on OSGi: Here's HowThe Web on OSGi: Here's How
The Web on OSGi: Here's Howmrdon
 
Moving from AS3 to Flex - advantages, hazards, traps
Moving from AS3 to Flex - advantages, hazards, trapsMoving from AS3 to Flex - advantages, hazards, traps
Moving from AS3 to Flex - advantages, hazards, trapsFlorian Weil
 
Google Apps Script: Accessing G Suite & other Google services with JavaScript
Google Apps Script: Accessing G Suite & other Google services with JavaScriptGoogle Apps Script: Accessing G Suite & other Google services with JavaScript
Google Apps Script: Accessing G Suite & other Google services with JavaScriptwesley chun
 
Relevance trilogy may dream be with you! (dec17)
Relevance trilogy  may dream be with you! (dec17)Relevance trilogy  may dream be with you! (dec17)
Relevance trilogy may dream be with you! (dec17)Woonsan Ko
 
Spring18 Lightning Component Updates
Spring18 Lightning Component UpdatesSpring18 Lightning Component Updates
Spring18 Lightning Component UpdatesMohith Shrivastava
 
Introduction to Gradio library in python.pptx
Introduction to Gradio library in python.pptxIntroduction to Gradio library in python.pptx
Introduction to Gradio library in python.pptxvahid67ebrahimian
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Developing for LinkedIn's Application Platform
Developing for LinkedIn's Application PlatformDeveloping for LinkedIn's Application Platform
Developing for LinkedIn's Application PlatformTaylor Singletary
 
Microsoft and jQuery: A true love story - templating and other contributions
Microsoft and jQuery: A true love story - templating and other contributionsMicrosoft and jQuery: A true love story - templating and other contributions
Microsoft and jQuery: A true love story - templating and other contributionsjamessenior
 
MATE: A Flex Framework - "Extreme Makeover"
MATE: A Flex Framework - "Extreme Makeover"MATE: A Flex Framework - "Extreme Makeover"
MATE: A Flex Framework - "Extreme Makeover"Theo Rushin Jr
 

Ähnlich wie Short Talk on Graphiti at EclipseCon 2010 (20)

JavaScript 2.0 in Dreamweaver CS4
JavaScript 2.0 in Dreamweaver CS4JavaScript 2.0 in Dreamweaver CS4
JavaScript 2.0 in Dreamweaver CS4
 
Grails 0.3-SNAPSHOT Presentation WJAX 2006 English
Grails 0.3-SNAPSHOT Presentation WJAX 2006 EnglishGrails 0.3-SNAPSHOT Presentation WJAX 2006 English
Grails 0.3-SNAPSHOT Presentation WJAX 2006 English
 
Degrafa Overview
Degrafa OverviewDegrafa Overview
Degrafa Overview
 
What I Learned At Drupal Con Dc 2009
What I Learned At Drupal Con Dc 2009What I Learned At Drupal Con Dc 2009
What I Learned At Drupal Con Dc 2009
 
JavaScript and DOM Pattern Implementation
JavaScript and DOM Pattern ImplementationJavaScript and DOM Pattern Implementation
JavaScript and DOM Pattern Implementation
 
Real-World AJAX with ASP.NET
Real-World AJAX with ASP.NETReal-World AJAX with ASP.NET
Real-World AJAX with ASP.NET
 
The Web on OSGi: Here's How
The Web on OSGi: Here's HowThe Web on OSGi: Here's How
The Web on OSGi: Here's How
 
Moving from AS3 to Flex - advantages, hazards, traps
Moving from AS3 to Flex - advantages, hazards, trapsMoving from AS3 to Flex - advantages, hazards, traps
Moving from AS3 to Flex - advantages, hazards, traps
 
Google Apps Script: Accessing G Suite & other Google services with JavaScript
Google Apps Script: Accessing G Suite & other Google services with JavaScriptGoogle Apps Script: Accessing G Suite & other Google services with JavaScript
Google Apps Script: Accessing G Suite & other Google services with JavaScript
 
Relevance trilogy may dream be with you! (dec17)
Relevance trilogy  may dream be with you! (dec17)Relevance trilogy  may dream be with you! (dec17)
Relevance trilogy may dream be with you! (dec17)
 
Let's Jira do the work
Let's Jira do the workLet's Jira do the work
Let's Jira do the work
 
Building Web Hack Interfaces
Building Web Hack InterfacesBuilding Web Hack Interfaces
Building Web Hack Interfaces
 
CS267_Graph_Lab
CS267_Graph_LabCS267_Graph_Lab
CS267_Graph_Lab
 
Spring18 Lightning Component Updates
Spring18 Lightning Component UpdatesSpring18 Lightning Component Updates
Spring18 Lightning Component Updates
 
Introduction to Gradio library in python.pptx
Introduction to Gradio library in python.pptxIntroduction to Gradio library in python.pptx
Introduction to Gradio library in python.pptx
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Developing for LinkedIn's Application Platform
Developing for LinkedIn's Application PlatformDeveloping for LinkedIn's Application Platform
Developing for LinkedIn's Application Platform
 
Microsoft and jQuery: A true love story - templating and other contributions
Microsoft and jQuery: A true love story - templating and other contributionsMicrosoft and jQuery: A true love story - templating and other contributions
Microsoft and jQuery: A true love story - templating and other contributions
 
MATE: A Flex Framework - "Extreme Makeover"
MATE: A Flex Framework - "Extreme Makeover"MATE: A Flex Framework - "Extreme Makeover"
MATE: A Flex Framework - "Extreme Makeover"
 
Open event presentation.3 2
Open event presentation.3 2Open event presentation.3 2
Open event presentation.3 2
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 

Kürzlich hochgeladen (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 

Short Talk on Graphiti at EclipseCon 2010

  • 1. GraphitiThe Graphical Tooling Infrastructure Speaking Plain Java Michael Wenz SAP AG 03/23/2010 Graphiti are: Christian Brand Jürgen Pasch Matthias Gorning Michael Wenz Tim Kaiser
  • 2. What Is Graphiti All About ? “The goal of Graphiti is to support the fast and easy creation of unified graphical tools, which can display and edit underlying domain models using a tool-defined graphical notation.”
  • 3. What Is Graphiti All About ? “The goal of Graphiti is to support the fast and easy creation of unified graphical tools, which can display and edit underlying domain models using a tool-defined graphical notation.”
  • 4. Why Should I Want to Use Graphiti ?
  • 6. What about the Diagram Type Agent ? Diagram Type Agent Feature Provider Diagram Type Provider A feature implements an operation for a domain object and defines the context in which the operation can be triggered Add Feature Create Feature Delete Feature … Specialized features for common user interactions available
  • 7. Domain Hierarchie Pictogram Elements Links Visualization Graphics Algorithms EClass Container Shape Link EAttribute Attribute Text Shape Shape Shape Shape Container Shape Which Objects Do I Deal with ? Text Text EOperation Attribute Link Link Link Link Result Shape Container Shape
  • 8. Well Then - How Do I Build a Tool ?
  • 9. Well Then - How Do I Build a Tool ?
  • 10. packageorg.eclipse.graphiti.tutorial;   importorg.eclipse.graphiti.dt.AbstractDiagramTypeProvider;   publicclassTutorialDiagramTypeProviderextendsAbstractDiagramTypeProvider {   publicTutorialDiagramTypeProvider() { super(); } } Well Then - How Do I Build a Tool ?
  • 11. Well Then - How Do I Build a Tool ?
  • 12. Well Then - How Do I Build a Tool ? … <extension point="org.eclipse.graphiti.eclipse.diagramTypes"> <diagramType id="org.eclipse.graphiti.tutorial.TutorialDiagramType„ type="tutorial„ name="Tutorial Diagram Type„ description="This is the diagram type for the Graphiti tutorial"> </diagramType> </extension> <extension point="org.eclipse.graphiti.eclipse.diagramTypeProviders"> <diagramTypeProvider id="org.eclipse.graphiti.tutorial.TutorialDiagramTypeProvider„ name="Tutorial Editor„ class="org.eclipse.graphiti.tutorial.TutorialDiagramTypeProvider„ description="This is the editor for the Graphiti tutorial"> <diagramType id="org.eclipse.graphiti.tutorial.TutorialDiagramType"> </diagramType> </diagramTypeProvider> </extension> …
  • 13. Well Then - How Do I Build a Tool ?
  • 14. Well Then - How Do I Build a Tool ? packageorg.eclipse.graphiti.tutorial; … publicclassTutorialFeatureProviderextendsDefaultFeatureProvider {   publicTutorialFeatureProvider(IDiagramTypeProviderdtp) { super(dtp); } } … publicTutorialDiagramTypeProvider() { super(); setFeatureProvider(newTutorialFeatureProvider(this)); } …
  • 15. Well Then - How Do I Build a Tool ?
  • 16. Well Then - How Do I Build a Tool ? … publicclassTutorialAddEClassFeatureextendsAbstractAddShapeFeature {   publicTutorialAddEClassFeature(IFeatureProviderfp) { super(fp); }   @Override public booleancanAdd(IAddContext context) { // Check if user wants to add an EClass if (context.getNewObject() instanceofEClass) { // Check if user wants to add to a diagram if (context.getTargetContainer() instanceof Diagram) { return true; } } return false; }   @Override publicPictogramElement add(IAddContext context) { … } }
  • 17. Well Then - How Do I Build a Tool ? publicPictogramElement add(IAddContext context) { EClassaddedClass = (EClass) context.getNewObject(); Diagram targetDiagram = (Diagram) context.getTargetContainer(); int w = context.getWidth() <= 0 ? 100 : context.getWidth(); int h = context.getHeight() <= 0 ? 50 : context.getHeight(); ContainerShapecontainerShape = PeUtil.createContainerShape(targetDiagram, true); RoundedRectangleroundedRectangle = GaUtil.createRoundedRectangle(containerShape, 5, 5); roundedRectangle.setForeground(manageColor(CLASS_FOREGROUND)); roundedRectangle.setBackground(manageColor(CLASS_BACKGROUND)); roundedRectangle.setLineWidth(2); GaUtil.setLocationAndSizeOfGraphicsAlgorithm(roundedRectangle, context.getX(), context.getY(), w, h);   link(containerShape, addedClass); Shape shape = PeUtil.createShape(containerShape, false); Text text = GaUtil.createDefaultText(shape, addedClass.getName()); text.setForeground(manageColor(CLASS_TEXT_FOREGROUND)); text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER); text.setVerticalAlignment(Orientation.ALIGNMENT_CENTER); text.getFont().setBold(true); GaUtil.setLocationAndSizeOfGraphicsAlgorithm(text, 0, 0, width, 20); shape = PeUtil.createShape(containerShape, false); Polylinepolyline = GaUtil.createPolyline(shape, newint[] { 0, 20, width, 20 }); polyline.setForeground(manageColor(CLASS_FOREGROUND)); polyline.setLineWidth(2); returncontainerShape; }
  • 18. Well Then - How Do I Build a Tool ? publicclassTutorialFeatureProviderextendsDefaultFeatureProvider { … @Override public IAddFeature getAddFeature(IAddContext context) { if (context.getNewObject() instanceof EClass) { returnnew TutorialAddEClassFeature(this); } returnsuper.getAddFeature(context); } }
  • 19. Graphiti – What else to Mention ?