Eclipse Plug-in Development

Slides:



Advertisements
Similar presentations
1 Todays Objectives Announcements Homework #1 is due next week Return Quiz 1 – answers are posted on the Yahoo discussion page site Basic Java Programming.
Advertisements

Quality Center Test Management Tool. Overview Test Lab Module Tasks Performed in Test Lab Module.
1 org.eclips.ui package org.eclipse.ui. 2 Package org.eclipse.ui Description l Application programming interfaces for interaction with any extension of.
CS2200 Software Development Lecture: Object class A. O’Riordan, 2008.
Preferences in Eclipse 3.0 Present by Kun-Tse Wu.
1 Java Object Model Part 2: the Object class. 2 Object class Superclass for all Java classes Any class without explicit extends clause is a direct subclass.
Scott Grissom, copyright 2004Ch 3: Java Features Slide 1 Why Java? It is object-oriented provides many ready to use classes platform independent modern.
1 Eclipse Platform Plug-in developper Guide PDG HowTos.
Perspectives Dwight Deugo Nesa Matic
Preferences in the Eclipse Workbench UI Present by Kun-Tse Wu.
Views Dwight Deugo Nesa Matic
1 Plug-in Development Environment (PDE) Guide. 2 Introduction to PDE l What is PDE: »a tool designed to help you develop platform plug-ins while working.
Website Design CLA – Transportation. Defining a Site Select: Site – New - Site Click Next.
1 Identifiers  Identifiers are the words a programmer uses in a program  An identifier can be made up of letters, digits, the underscore character (
Go to the MTSD Home Page In the URL add “/admin”
JFace 吳昆澤. UI framework for plug-ins JFace provides classes for handling common UI programming tasks: Viewers handle the drudgery of populating, sorting,
Java: Chapter 1 Computer Systems Computer Programming II.
Presented by : Olivia Lin. Outline Preparation works –What software do I need? Source of sample codes –Online source: Supergeo Developer Network (SGDN)
Writing Widgets & Custom Script API for BOY Xihui Chen
IAdaptable Interface and Its Usage Te-Hsin Shih 03/26/2013.
OBJECTIVES  What is HTML  What tools are needed  Creating a Web drive on campus (done only once)  HTML file layout  Some HTML tags  Creating and.
ECE 452 / CS 446 / SE464 Design Patterns: Part 2 - Answers A Tutorial By Peter Kim Partially based on the tutorial by Michał Antkiewicz.
Introduction to Programming David Goldschmidt, Ph.D. Computer Science The College of Saint Rose Java Fundamentals (Comments, Variables, etc.)
Ontology Engineering and Plugin Development with the NeOn Toolkit Plug-in Development for the NeOn Toolkit June 1st, 2008 Michael Erdmann, Peter Haase,
CPSC 872 John D. McGregor Session 21 Architecture Design, cont’d.
Introduction to Eclipse CSC 216 Lecture 3 Ed Gehringer Using (with permission) slides developed by— Dwight Deugo Nesa Matic
Chapter 9 1 Chapter 9 – Part 1 l Overview of Streams and File I/O l Text File I/O l Binary File I/O l File Objects and File Names Streams and File I/O.
1 Recitation 8. 2 Outline Goals of this recitation: 1.Learn about loading files 2.Learn about command line arguments 3.Review of Exceptions.
Enterprise JavaBeans Understanding EJB Components Version 0.1 Kamal Wickramanayake
Application Specific Module Tutorial Akos Balasko 02/07/
Present by Wu Kun-Tse Simplifying Preference Pages with Field Editors.
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmer's Café Sakai Montreal CRIM Workshop Sakai code exercises Aaron Zeckoski.
Inheritance (Part 5) Odds and ends 1. Static Methods and Inheritance  there is a significant difference between calling a static method and calling a.
Navigation and Editing MOODLE. Editing Window:- One of the most common windows you will use is the Edit Window Here you can edit, add content, videos,
Chapter 5 Objects and Classes Inheritance. Solution Assignments 3 & 4 Review in class…..
A brief introduction to javadoc and doxygen. What’s in a program file? 1. Comments 2. Code.
1 Java and AWT CPS 470 Spring 1998 Laura Campbell.
Winter 2006CISC121 - Prof. McLeod1 Stuff We had better discuss a midterm date… –27 Feb. to 3 March or –6 to 10 March.
Hybris Payment Integration
Introduction to Java Programming by Laurie Murphy Revised 09/08/2016.
Streamline Dashboards With List Function Gadgets
Working with Java.
3 Introduction to Classes and Objects.
ATS Application Programming: Java Programming
CONTENT MANAGEMENT SYSTEM CSIR-NISCAIR, New Delhi
Accessing Files in Java
Introduction to javadoc
null, true, and false are also reserved.
Introduction to Java Programming
Eclipse Plug-in Development
Eclipse Database Plug-ins
Eclipse Plug-in Development
Embedding Graphics in Web Pages
18 File i/o, Parsing.
Eclipse Plug-in Development
JavaScript Reserved Words
CS288 Lab Exercise 2.
Eclipse Plug-in Development
Adding information to provider pages
Eclipse Plug-in Development
Please send any images as a separate file
Eclipse Plug-in Development
Eclipse Plug-in Development
Introduction to javadoc
Sadalage & Fowler (Amazon)
Eclipse Plug-in Development
Java IDE Dwight Deugo Nesa Matic Portions of the notes for this lecture include excerpts from.
Instructor: Alexander Stoytchev
Agenda Types and identifiers Practice Assignment Keywords in Java
Presentation transcript:

Eclipse Plug-in Development Eclipse Plug-in Development Part 2 Editors 12/31/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Contents Overview Editor extension point org.eclipse.ui.editors Classes for editor IEditorPart and EditorPart IEditorInput IEditorActionBarContributor and EditorActionBarContributor Working with editor Title and ToolTip Dirty and Save Opening editor Multiple page editor MultiPageEditorPart MultiPageEditorActionBarContributor Outline 12/31/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Overview 12/31/2018 Soyatec (http://www.soyatec.com)

Editor Extension Point org.eclipse.ui.editors id: unique name to identify the editor name: display name icon: display icon extensions: list of file types (separated by “,”) core: class: org.eclipse.ui.IEditorPart contributorClass: org.eclipse.ui.IEditorActionBarContributor matchingStrategy: org.eclipse.ui.IEditorMatchingStrategy command: launch an external editor launcher: org.eclipse.ui.IEditorLauncher default: default editor or not filenames: list of file names symbolicFontName: symbolic name of a font (org.eclipse.ui.fontDefinitions) 12/31/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Classes for editor IEditorPart and EditorPart public class SampleEditor extends EditorPart { public SampleEditor() { } public void doSave(IProgressMonitor monitor) { public void doSaveAs() { public void init(IEditorSite site, IEditorInput input) throws PartInitException { public boolean isDirty() { return false; public boolean isSaveAsAllowed() { public void createPartControl(Composite parent) { public void setFocus() { 12/31/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) IEditorPart Init() Verify the input Save site and input public void init(IEditorSite site, IEditorInput input) throws PartInitException { if (!(input instanceof IFileEditorInput)) { throw new PartInitException("Invalid Input: Must be IFileEditorInput"); } setSite(site); setInput(input); 12/31/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) IEditorPart Contents public void createPartControl(Composite parent) { control = new Composite(parent, SWT.NONE); // create editor control here } public void setFocus() { control.setFocus(); 12/31/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) IEditorPart Save and SaveAs public void doSave(IProgressMonitor monitor) { } public void doSaveAs() { public boolean isDirty() { return false; } public boolean isSaveAsAllowed() { 12/31/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) IEditorInput public class SampleEditorInput implements IEditorInput { public Object getAdapter(Class adapter) { return null; } public boolean exists() { return false; public ImageDescriptor getImageDescriptor() { public String getName() { public IPersistableElement getPersistable() { public String getToolTipText() { public int hashCode() { return super.hashCode(); public boolean equals(Object obj) { return super.equals(obj); IAdaptable (Platfrom’s adapter manager) Whether the editor input exists Returns the image descriptor for this input Returns the name of this editor input for display purposes Returns an object that can be used to save the state of this editor input. Returns the tool tip text for this editor input The IWorbenchPage.openEditor APIs are dependent on this to find an editor with the same input. 12/31/2018 Soyatec (http://www.soyatec.com)

IEditorActionBarContributor public class SampleEditorActionBarContributor extends EditorActionBarContributor { public void contributeToCoolBar(ICoolBarManager coolBarManager) { super.contributeToCoolBar(coolBarManager); } public void contributeToMenu(IMenuManager menuManager) { super.contributeToMenu(menuManager); public void contributeToToolBar(IToolBarManager toolBarManager) { super.contributeToToolBar(toolBarManager); public void contributeToStatusLine(IStatusLineManager statusLineManager) { super.contributeToStatusLine(statusLineManager); 12/31/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Title And ToolTip Title setPartName("Ecsoya - Sample editor"); ToolTip setTitleToolTip("Welcome to soyatec!"); firePropertyChange(IWorkbenchPart.PROP_TITLE); 12/31/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Dirty and Save Is dirty? Do save public boolean isDirty() { // return true if need to save. return false; } public void doSave(IProgressMonitor monitor) { // Save data of editor. firePropertyChange(PROP_DIRTY); } 12/31/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Opening editor // Workbench instance from our plugin instance. IWorkbench workbench = Activator.getDefault().getWorkbench(); // Active window instance. IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow(); // Active page instance. IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage(); try { SampleEditorInput editorInput = new SampleEditorInput(); // Open editor from the editor input and editor ID. activePage.openEditor(editorInput, SampleEditor.ID); // defined from extension. } catch (PartInitException e) { e.printStackTrace(); } 12/31/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Multiple page editor 12/31/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) MultiPageEditorPart public class SampleMultiPageEditor extends MultiPageEditorPart { protected void createPages() { // add other controls or editors here. addPage(control); addPage(editor, input); } public void doSave(IProgressMonitor monitor) { public void doSaveAs() { public boolean isSaveAsAllowed() { return false; 12/31/2018 Soyatec (http://www.soyatec.com)

MultiPageEditorActionBarContributor public class SampleMultiPageEditorActionBarContributor extends MultiPageEditorActionBarContributor { public void setActivePage(IEditorPart activeEditor) { } public void contributeToToolBar(IToolBarManager toolBarManager) { super.contributeToToolBar(toolBarManager); public void contributeToMenu(IMenuManager menuManager) { super.contributeToMenu(menuManager); 12/31/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Outline Call from editor class ContentOuline View PageBookView Page StackLayout IContentOutlinePage public Object getAdapter(Class adapter) { if (IContentOutlinePage.class == adapter) { return new SampleContentOutlinePage(); } return super.getAdapter(adapter); 12/31/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Outline Create outline page public class SampleContentOutlinePage extends ContentOutlinePage { private Label control; public void createControl(Composite parent) { control = new Label(parent, SWT.NONE); control.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_GREEN)); control.setText("Outline for sample editor"); } public Control getControl() { return control; public void setFocus() { control.setFocus(); 12/31/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Outline 12/31/2018 Soyatec (http://www.soyatec.com)

Skype: jin.liu.soyatec Email: jin.liu@soyatec.com Any Questions? Skype: jin.liu.soyatec Email: jin.liu@soyatec.com 12/31/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) The end 12/31/2018 Soyatec (http://www.soyatec.com)