8. • go back to your local Java site
• select a Project you want to share
• Right click on the Project > Team > Share Project…
• Similar procedures as ‘import a new Project into a SVN Project…’
http://help.collab.net/index.jsp?topic=/org.tigris.subclip
se.doc/topics/new-location.html
9. • must specify the folder
name where you want
to store the project
• The folder name is
relative to the URL of
the repository location
you specified in the
previous step.
• All intermediate folders
must already exist in the
repository, but the final
folder name must NOT
already exist.
(e.g., ProjectName must
exist; trunk must NOT)
• You can use the
Browse... button to help
you create
(intermediate) folders.
• the convention of
storing the project in a
ProjectName/trunk
structure.
10. • SVN’s default folders: trunk, branches
• Files must be placed under trunk
before uploading them
• Trunk is like a root
If any error occurred, see the next slide
11. Files must be placed
under trunk before
commit them to a
remote platform, such
at Github
http://chrislin1015-
blog.logdown.com/posts/1
082135-svn-and-encounter-
mkcol-not-allowed-github-
upload-error-messages
12.
13.
14. • making a copy of a project from a repository into your local workspace
• In SVN, the check out process creates a working copy.
• A working copy is a specially formatted folder structure which contains
additional .svn folders that store SVN information, as well as a pristine copy of
each item that is checked out.
• Process
• navigate to
the SVN Repository
Exploring Perspective
15. • If an Eclipse .project file already exists in the selected repository folder, the check out
wizard will automatically default the method of checkout and using the project
definition file.
• If no .project file exists in the selected repository location, the wizard will give you the
option of checking out the folder as a regular Eclipse project or launching the New
Project Wizard.
• To select an alternative
location, uncheck the use default workspace
location option and type or Browse for a
new target location.
17. What is CBI
• Maven with the Tycho plugins
• Tycho plugins teach Maven how to build Eclipse plugins and OSGi bundles.
• This enables building Eclipse projects with “maven clean install” just as one would
build other Maven projects.
• Common services
• Jar signing facility
• MacOS signing facility
• Windows signing facility
• mature templates and common pom.xml files will be provided
• part of CBI
• Git, Hudson, the build slaves
• Nexus (aka. the artifact repository & server side of Maven)
• Gerrit, Bugzilla, and the Downloads site
18. • Before using tycho, create a short
sample project consisting of a small
eclipse-like product along with an
additional feature.
• Download sample project from here
https://github.com/Pontesegger/code
andme/blob/master/Code%20&%20
Me%20Blog/tycho_01_build_plugins.
zip?raw=true
21. • The wizard asks for a Group Id.
• All projects that belong together will get the same Group Id.
• Use a name that represents the component you want to build.
• Artifact Id should match the Bundle-SymbolicName found in MANIFEST.MF.
• Version should be set accordingly to Bundle-Version from the manifest.
• SNAPSHOT in maven is similar to qualifier in you plug-in version.
• Packaging tells maven what type of build instructions to use.
• Set it to eclipse-plugin.
22. • Maven creates a pom.xml for you !
• Current version of Tycho version is
1.4.0
• Replace the codes
• Build our bundle
https://www.eclipse.org/tycho/
23. • Replace the codes
• property for the tycho version to be used.
• For future tycho versions you will need to upgrade this.
• the Mars p2 repository for resolving dependencies during build time.
• build section tells maven to use the tycho plug-in for the build process.
• You will see some errors/problems.
• Build our bundle
• Right click on the project → select Run As → Maven build...
• Under Goals enter clean install.
• Goals are related to the maven lifecycle. we tell maven to delete previous
build artifacts, to build our plug-in and to install build results.
http://codeandme.blogspot.com/2012/12/tycho-build-1-building-plug-ins.html
28. • Extension (contribution): contribute functionality to a certain type of API
• Contribution can be code or data
• Extension point: to define the type of API by a plug-in
• Plug-in: contains the necessary code to …
• defines extension point
• declare the extension point in its plugin.xml file
• be responsible for evaluating the extensions
• allow other plug-ins to add contributions (extensions) to the extension point.
• provides an extension (contribution) based on the contract defined by an existing
extension point
29. Prerequisites
• you should have basic understanding of development for the Eclipse
platform. Eclipse RCP Tutorial or Eclipse Plug-in Tutorial.
Please complete the following steps:
• 3. Install the e4 tools
• 4. Install the e4 spies
• 5. Create an RCP application with the wizard
30. Creating an extension point
• an XML schema file
• contains code to evaluate the extensions
32. Accessing extensions
• After adding one extension you can right-click on it to add elements
or attributes.
• The information about the available extension points and the
provided extensions are stored in a class of type IExtensionRegistry.
• The Eclipse platform reads the extension points and provided
extensions once the plug-in is in the RESOLVED life cycle status as
defined by the OSGi specification.
• You can use the dependency injection mechanism to get the
IExtensionRegistry class injected.
33. Extension factories
• If you create your class directly via the IConfigurationElement class of
the extension you are limited to classes which have a default
constructor. To avoid this restriction you can use extension factories.
• To use a factory implement the interface
IExecutableExtensionFactory in the class attribute of your extension
point definition. The factory receives the configuration elements and
can construct the required object.
34. Exercise: create two new plug-ins
Create and evaluate an extension point
1. Creating a plug-in for the extension point definition
35. 2. Create an extension point
Open the MANIFEST.MF file or the plugin.xml file and select
the Extension Points tab.
36. • The definition of the extension is generated
and the schema editor opens.
• Switch to the Definition tab.
37. 3. Add New Element and New Attributes to the extension point.
Implement =
Interface name
This interface doesn’t exit yet. Press on the hyperlink
called Implements to create it based on the following code.
38.
39. • Go back to your extension point definition and add a choice to the
extension point.
• This defines how often the extension “zkl" can be provided by
contributing plug-ins. We will set no restrictions (unbound).
40.
41. 4. Export the package
Select the MANIFEST.MF file switch to the Runtime tab and export the
package which contains the com.phh.expointphh.Interface.
42. 5. Add dependencies
• Add the following dependencies via the MANIFEST.MF file of your new plug-in:
org.eclipse.core.runtime
org.eclipse.e4.core.di
6. Evaluating the registered extensions
- create a handler class which can evaluate the existing extensions.
43.
44. • The code uses the
ISafeRunnable interface.
This interface protects the
plug-in which defines the
extension point from
malfunction extensions.
• If an extension throws an
Exception, it will be caught
by ISafeRunnable and the
remaining extensions will
still get executed.
• Review the .exsd schema
file and the reference to this
file in the plugin.xml file
45. 7. Create a menu entry and add it to
your product
in the MANIFEST.MF file of
your application plug-in.
Add a dependency to the
com.phh.extpointphh plug-in
Afterwards create a new menu entry
called Evaluate extensions and
define a command and handler for this
menu entry. In the handler point to the
EvaluateContributionsHandler class.
46. 8. Providing an extension
• Create a new simple plug-in
• Open
the MANIFEST.MF editor of
this new plug-in and select
the Dependencies tab.
• Add the
org.eclipse.core.runtime and
the plug-ins you created as
dependencies.
• Make sure your plug-in has
the This plug-in is a
singleton flag set on
the Overview tab for
your MANIFEST.MF file.
47. • Switch to the Extensions tab
• Select your custom extension point to Finish
• Add zkl to your extension point via right-click.
49. 9. Add the new plug-ins to your product
com.phh.extpointphh
com.phh.extpointphh2
10. Validate
• Start your application via the product
configuration file. This updates the plug-
ins included in the run configuration.
• In your running application select your
new menu entry. The handler class write
the output of your extensions to
the Console view of your Eclipse IDE.
51. SWT Snippets
• minimal stand-alone programs
• demonstrate specific techniques or functionality
• if you are programming with JFace, you may find JFace Snippets useful
• To run a snippet
• import SWT .zip file into your workspace
• File > import …> Existing Projects Into Workspace
• create a project called org.eclipse.swt in your workspace.
• Your Java projects can then add the SWT project as a dependency.
• Open the properties dialog of your Java project
• on the Java Build Path page, include the org.eclipse.swt project.
https://download.eclipse.org/eclipse/downloads/
https://download.eclipse.org/eclipse/downloads/drops4/R-4.13-201909161045/
https://www.eclipse.org/swt/snippets/
52. • copy the desired snippet
(e.g., JFaceSnippets) to the
clipboard, and paste it
into a new snippet
class (under src folder).
JFaceSnippets
https://wiki.eclipse.org/JFaceSnip
pets#Snippet012_-
_Dialog_with_Image_Buttons
53. SWT Examples
• much larger and more
comprehensive than SWT
Snippets.
1. Install the examples
• Running the SWT Examples
inside Eclipse
• Installing the examples
• Ensure Group items by category is
unchecked.
• Type "Eclipse SDK Examples" in the
search field.
• Next > Next > accept the license
terms > Finish
• Restart Eclipse to take effect.
https://www.eclipse.org/swt/examples.php
54. • You may also installing
examples manually
• Download the appropriate Eclipse
SDK Example zip file from the
Eclipse project web site at
http://download.eclipse.org/eclip
se.
• Extract the contents of the zip file
to a new empty directory inside
the dropins directory of your
Eclipse installation.
• Start or restart Eclipse.
• You can verify that examples have
been installed by looking for
File > New > Example... in the
workbench menu bar.
55. 2. Running the SWT examples
with the SWT Example Launcher
56. 3. Running the SWT standalone
examples
Browse ... button to locate the following
directory (according to the Eclipse version and
the original installation location):
eclipse/plugins/org.eclipse.sdk.examples.source
_3.1.0/src/org.eclipse.swt.examples_3.1.0
C:Userspclabeclipsejava-2019-
09eclipsepluginsorg.eclipse.sdk.examples.source-4.13plugins
57. Next > Project > Add > org.eclipse.swt >
OK > Finish
• At this point your SWT examples
should be compiled without any errors.
• Check the Problems view for errors.
• If you get an error like "java.lang.Object
not found" it means you have not
configured a JRE.
• Go to the Window > Preferences ... dialog
and select the Java > Installed JREs
preference page.
• Ensure that a JRE is installed and that the
path to the JRE is correct.
58. • run the SWT standalone examples
• Open the Java perspective.
• In the Packages view, select the main
class that you want to run.
• Select Run > Run As... > Java
Application from the main menu.
64. JFace
you need to create a SWT Project before starting with JFace
Step 1. http://wikiict.org/java/java-swt-programming-tutorials/java-desktop-application-programming-using-swt/
note: follow the instruction of “7- Using WindowBuilder”
Step 2. download the SWT Binary and Source (see next slide, you should have installed)
Step 3. create a new plug-in project (you should know how to do it)
note: RCP Plugin Project has to be created no matter what.
http://wikiict.org/eclipse/eclipse-jface-tutorial/
68. JFace resource manager for
Colors, Fonts and Images
• SWT is based on the native widgets of the OS.
• Whenever an SWT widget is allocated, a corresponding OS specific widget is created.
• The Java garbage collector cannot automatically clean-up these OS-specific widget references.
• Fortunately all widgets which are created based on a parent widget are automatically disposed when the
parent Composite is disposed.
• If you develop Eclipse plug-ins, the Composite of a part is automatically disposed once the part is closed.
• Therefore, these SWT widgets are handled automatically in Eclipse plug-in projects.
• However, this rule does NOT apply for colors, fonts and images, as these may be reused in other places.
• For this reason, they need to be explicitly disposed.
• JFace provides the ResourceManager and its derived classes for managing such resources automatically.
• An instance of the LocalResourceManager class is created with a reference to a Control. If this Control is
disposed, the resources created by the LocalResourceManager are also disposed.
https://www.vogella.com/tutorials/EclipseJFace/article.html#jface_localresoucemanager
You should use always use a JFace ResouceManager if possible.
This avoids problems with system resources or even a "No more handles" SWTException.
69. • create a Package
• copy and paste an
image
• create another
Package to test
how SWT manage
data sources
(color, font, image)
and how JFace
manages
71. • A class SWTResourceManager is automatically created.
• It is a class with utility methods for managing image, Font, Color.
You may change the title “SWT Application”
e.g., “Rsdemo Application”
Go to Properties > text in the Design tab
72.
73. • You may also change
the foreground and
font style.
Then, see the code is generated from Source tab for the
class which was the one automatically generated when you
create a Package to test JFace RS (resource) manager
74. • Please read those codes…and try to understand how/what they work/do
75. Using Decoration control
• The ControlDecoration class allows you to place image decorations on SWT
controls to show additional information about the control.
• These decorations can also have a description text which is displayed once
the user places the mouse over them.
• During the layout of your screen you need to make sure that enough space
is available to display these decorations.
• For example, to highlight a Text field requires input
1. create a Package as the way how you create SWT Application (File > New > Other… >
WindowBuilder > SWT Designer > SWT > Application Window)
2. go to Design tab
3. add a Text field
add ControlDecoration from JFace
(see next two slides)
4. go to Source tab
add the codes
http://wikiict.org/eclipse/eclipse-jface-tutorial/ to copy the codes
https://www.vogella.com/tutorials/EclipseJFace/article.html#controldecoration
76.
77. Q1. How to re-allocate the Text field ?
Q2. How to input from Right ?
Answers are in the next slide !!!
78. A: SWT Widgets
Q1. Layouts > Grid >
Q2. Properties > Style >
Note: Widgets can
contain other widgets
(container)
http://wikiict.org/java/java-swt-programming-tutorials/java-
desktop-application-programming-using-swt/
You can view the demo of the
Control at the link below, it’s
RWT (RAP Widget Toolkit)
Control, but they are essentially
the same as SWT control.
http://rap.eclipsesource.com/de
mo/release/controls/
79. JFaceSnippets
• Select one snippet
• The header section of each snippet is a link to the plain source.
• Copy the source and then Paste it directly on the src folder or package
in an eclipse project.
• The package and the class will be created automatically.
• Run the snippet as Java Application
https://wiki.eclipse.org/JFaceSnippets
83. Preparation
• Maker sure WindowBuilder has been installed
• Create RCP Plugin Project: File > New > Other…
• Add swt library: MANIFEST.MF > Dependencies > Add
org.eclipse.swt
org.eclipse.swt.win32.win32x86_64
• SWT snippets
https://www.eclipse.org/swt/snippets/#browser
copy and paste the desired snippet into a new snippet class (under src folder).
84. Method 1:
• Window > Perspective > Open Perspective >
Java
• File > Import... > Plug-in Development >
Plug-ins and Fragments > Next
Method 2:
• Open page
http://download.eclipse.org/eclipse/downloads/#La
test_Release in your web browser
• go to the latest release build
• find the SWT Binary and Source
• Download zip file for your platform
(e.g., swt-4.4.2-win32-win32-x86_64.zip)
• do NOT extract the zip file
• File > Import …
• select Existing Projects into Workspace
• click Next
• specify the archive file you downloaded
• click Finish
85. SWT (standard) layout classes
• in the SWT library are:
• FillLayout – the simplest layout class. It lays out equal-sized widgets in a single row
or column. It does NOT wrap, and you canNOT specify margins or spacing.
https://youtu.be/RmGN7DPCRZc
• RowLayout – more commonly used for its ability to wrap, and for its configurable
margins and spacing. It lays out widgets in a row or rows, with fill, wrap, and spacing
options. The height and width of each widget in this layout can be specified by
setting a RowData object into the widget using setLayoutData.
https://youtu.be/NzNiQijx96g
• GridLayout – the most useful and powerful of the standard layouts, but it is also the
most complicated. It lays out widget children of a Composite in a grid. It has a
number of configuration fields (just like RowLayout), the widgets it lays out can have
an associated layout data object, called GridData.
https://youtu.be/vun90MHAGJc
86.
87.
88.
89.
90. SWT (standard) layout classes
• in the SWT library are:
• FillLayout – the simplest layout class. It lays out equal-sized widgets in a single row
or column. It does NOT wrap, and you canNOT specify margins or spacing.
https://youtu.be/RmGN7DPCRZc
• RowLayout – more commonly used for its ability to wrap, and for its configurable
margins and spacing. It lays out widgets in a row or rows, with fill, wrap, and spacing
options. The height and width of each widget in this layout can be specified by
setting a RowData object into the widget using setLayoutData.
https://youtu.be/NzNiQijx96g
• GridLayout – the most useful and powerful of the standard layouts, but it is also the
most complicated. It lays out widget children of a Composite in a grid. It has a
number of configuration fields (just like RowLayout), the widgets it lays out can have
an associated layout data object, called GridData.
https://youtu.be/vun90MHAGJc
93. SWT (standard) layout classes
• in the SWT library are:
• FillLayout – the simplest layout class. It lays out equal-sized widgets in a single row
or column. It does NOT wrap, and you canNOT specify margins or spacing.
https://youtu.be/RmGN7DPCRZc
• RowLayout – more commonly used for its ability to wrap, and for its configurable
margins and spacing. It lays out widgets in a row or rows, with fill, wrap, and spacing
options. The height and width of each widget in this layout can be specified by
setting a RowData object into the widget using setLayoutData.
https://youtu.be/NzNiQijx96g
• GridLayout – the most useful and powerful of the standard layouts, but it is also the
most complicated. It lays out widget children of a Composite in a grid. It has a
number of configuration fields (just like RowLayout), the widgets it lays out can have
an associated layout data object, called GridData.
https://youtu.be/vun90MHAGJc
97. SWT StackLayout
• stacks all the controls one on top of the
other and resizes all controls to have the
same size and location.
• topControl is visible and all other
controls are not visible.
• Users must set the topControl value to
flip between the visible items and then
call layout() method on the composite
which has the StackLayout.
103. • Similarly, create class
BottomComposite
• Similarly create class
MainComposite:
drag and drop to the main
Finally, create a Java app by
using the main composite !
105. JFace Viewer (makes coding life easier when creating Tables)
• allows you to display a domain model in a standard SWT widget
• E.g., list, combo, tree or table
• without converting the domain model beforehand.
• allows you to set a content provider which provides the data for the viewer
and makes no assumption about the presentation of the data model.
• You can also assign at least one label provider to a viewer so as to define
how the data from the model will be displayed in the viewer.
• Standard JFace viewer (ComboViewer, ListViewer, TreeViewer, TableViewer)
• These viewers are part of the org.eclipse.jface.viewers package
• Standard content provider (IStructuredContentProvider, ITreeContentProvider)
• Standard label provider (ILabelProvider, CellLabelProvider)
• JFace ComboViewer
• The ComboViewer class simplifies the implementation of a SWT Combo (Drop-down box).
https://www.vogella.com/tutorials/EclipseJFace/article.html#purpose-of-the-jface-viewer-framework
107. Model & Content/Label Provider
• Please read the codes in the following java classes…and try to
understand how/what they work/do.
• AppMenu.java
• Article.java
• Employee.java
• Department.java
• DataModel.java
• How to differentiate which provider should be implemented for the
following java classes?
• AbstractComboContentLabelProvider.java
• AbstractTableContentLabelProvider.java
• AbstractTreeContentLabelProvider.java
• AbstractTreeTableContentLabelProvider.java
126. Creating
Ant buildfiles
• by default the Ant editor
only has an association with
build.xml named files.
• as long as the file has a .xml
extension, Eclipse will
consider it to be a possible
Ant buildfile
• create a *.xml first
• right click the *.xml
• Add an association between
*.xml and the Ant editor.
131. Running Ant buildfiles
• Any file with a .xml extension can be run as an Ant buildfile.
• not all such files really are Ant buildfiles, but no harm is done if an attempt is
made to mistakenly run a non-Ant .xml file as an Ant buildfile.
132.
133. Saving & Reusing Ant options
• Creating multiple launch configurations in this manner allows you to
quickly run your Ant buildfile in any configuration by simply specifying
the corresponding launch configuration.
137. • The history is ordered so that the most frequently run configurations
are at the top of the drop-down.
138. Using the Ant view
• The main advantage of this view is that you can work with all of your
Ant buildfiles in one place, as opposed to hunting them down in one
of the navigation views.
143. • You can change the order so that
your Ant buildfile runs before the
Java builder, though that wouldn't
make sense in this example.
• The Java builder runs the internal
Eclipse Java compiler which inturn is
responsible for indexing your source
so that searching, refactoring and
many other features are available.
• Thus it is not possible to replace the
internal Eclipse Java compiler by
using a project builder. You can
disable the Java builder and you can
control when the Java Builder runs
with respect to the project builders
that you define.
145. Track Resource Changes
to keep track of resource changes in the workspace
(as the files and folders that have been added,
modified, and removed from the workspace)
interface org.eclipse.core.resources.*;
146. public interface IResourceChangeEvent
• According to Eclipse API Specification, there are currently 5+1 different
types of resource change events
• PRE_BUILD
• POST_BUILD
• POST_CHANGE
• PRE_CLOSE
• PRE_DELETE
• PRE_REFRESH
https://help.eclipse.org/kepler/nftopic/org.eclipse.platform.doc.isv/referenc
e/api/org/eclipse/core/resources/IResourceChangeEvent.html
https://www.wideskills.com/eclipse-plugin-tutorial/eclipse-
plugin-track-resource-changes-tutorial
147. PRE_BUILD
• Before-the-fact batch reports of arbitrary creations, deletions and
modifications to one or more resources expressed as a hierarchical
resource delta. Event type is PRE_BUILD, and getDelta returns the
hierarchical delta rooted at the workspace root. The getBuildKind method
returns the kind of build that is about to occur, and the getSource method
returns the scope of the build (either the workspace or a single project).
These events are broadcast to interested parties immediately before each
build operation. If autobuilding is not enabled, these events still occur at
times when autobuild would have occurred. The workspace is open for
change during notification of these events. The delta reported in this event
cycle is identical across all listeners registered for this type of event.
Resource changes attempted during a PRE_BUILD callback must be done in
the thread doing the notification.
148. POST_BUILD
• After-the-fact batch reports of arbitrary creations, deletions and
modifications to one or more resources expressed as a hierarchical
resource delta. Event type is POST_BUILD, and getDelta returns the
hierarchical delta rooted at the workspace root. The getBuildKind method
returns the kind of build that occurred, and the getSource method returns
the scope of the build (either the workspace or a single project). These
events are broadcast to interested parties at the end of every build
operation. If autobuilding is not enabled, these events still occur at times
when autobuild would have occurred. The workspace is open for change
during notification of these events. The delta reported in this event cycle is
identical across all listeners registered for this type of event. Resource
changes attempted during a POST_BUILD callback must be done in the
thread doing the notification.
149. POST_CHANGE
• After-the-fact batch reports of arbitrary creations, deletions and
modifications to one or more resources expressed as a hierarchical
resource delta. Event type is POST_CHANGE, and getDelta returns the
hierarchical delta. The resource delta is rooted at the workspace root.
These events are broadcast to interested parties after a set of
resource changes and happen whether or not autobuilding is
enabled. The workspace is closed for change during notification of
these events. The delta reported in this event cycle is identical across
all listeners registered for this type of event.
150. PRE_CLOSE
• Before-the-fact reports of the impending closure of a single project.
Event type is PRE_CLOSE, and getResource returns the project being
closed. The workspace is closed for change during notification of
these events.
• Before-the-fact reports of the impending deletion of a single project.
Event type is PRE_DELETE, and getResource returns the project being
deleted. The workspace is closed for change during notification of
these events.
PRE_DELETE
151. • Before-the-fact reports of the impending refresh of a single project or
the workspace. Event type is PRE_REFRESH and the getSource
method returns the scope of the refresh (either the workspace or a
single project). If the event is fired by a project refresh the
getResource method returns the project being refreshed. The
workspace is closed for changes during notification of these events.
PRE_REFRESH
152. public interface IResourceChangeListener
extends EventListener
void resourceChanged (IResourceChangeEvent event)
• To modify PropertyManagerView so as to implement
IResourceChangeListener and use IResourceChangeEvent to update
itself.
153. public interface IResourceDelta
extends IAdaptable
• A resource delta represents changes in the state of a resource
tree between two discrete points in time.
• To modify PropertyManagerView so as to implement the
IAdaptable interface; extensions are managed by the platform's
adapter manager.
154. EGit
• Help > Install new Software
• …complete the installation
http://download.eclipse.org/egit/updates
https://wiki.eclipse.org/EGit/User_Guide
http://javaandeclipse.blogspot.com/p/egit-and-eclipse.html
若無法安裝可取消勾選,否則重新安裝更新版的Eclipse
155. setting up EGit
• Window > Preferences
or change the Default
repository folder
156.
157. Working with a local Git repository
• create a new Java project and a package
• add one sample class like following
• select the project > Team
> Share Project
158. • It is recommended to place your Git
repositories outside the Eclipse
workspace. After pressing
the Finish button in create dialog,
the wizard displays the settings for
your local Git repository.
• Select the Finish button again to put
your repository under Git version
control.
• You have created a local Git
repository. The Git repository is in this
case directly stored in the specified
folder in a .git folder.
159. • Window > Perspective > Open Perspective > Team Synchronizing
• Creating a file .gitignore in the project folder with the
following content:
160. • A gitignore file specifies intentionally
untracked files that Git should ignore.
• Files already tracked by Git are not affected.
• All files and directories which apply to the
pattern described in this file will be ignored
by Git. In this example all files in the bin and
the .metadata directory will be ignored.
161. • Using the Git Staging view drag only the all files you want to commit
into the Staged Changes area, write a meaningful commit message
and press the commit button.
• Right click the project > Window > Show View > Team > History
• Alt+Shift+W shortcut > History
162. • dirty (folder) - At least one file below the folder is dirty; that means that it has
changes in the working tree that are neither in the index nor in the repository.
• tracked - The resource is known to the Git repository and hence under version
control.
• untracked - The resource is not known to the Git repository and will not be version
controlled until it is explicitly added.
• ignored - The resource is ignored by the Git team provider. The preference settings
under Team -> Ignored Resources, "derived" flag and settings from .gitignore files are
taken into account.
• dirty - The resource has changes in the working tree that are neither in the index
nor in the repository.
• staged - The resource has changes which have been added to the index. Note that
adding changes to the index is currently possible only in the commit dialog via the
context menu of a resource.
• partially-staged - The resource has changes which are added to the index and
additional changes in the working tree that neither reached the index nor have been
committed to the repository. See partial staging from the Git Staging view for how to
do that.
• added - The resource has not yet reached any commit in the repository but has
been freshly added to the Git repository in order to be tracked in future.
• removed - The resource is staged for removal from the Git repository.
• conflict - A merge conflict exists for the file.
• assume-valid - The resource has the "assume unchanged" flag. This means that Git
stops checking the working tree files for possible modifications, so you need to
manually unset the bit to tell Git when you change the working tree file.
The button's icon changes
depending on the selected mode.
http://javaandeclipse.blogspot.com/p/egit-and-eclipse.html#egit-Inspecting-State-Of-Repository
163. • to add an existing local Git repository to the view,
• to clone a Git repository
• to create a new Git repository
The button's icon changes
depending on the selected mode.
164. • The content area shows the existing
Git repositories and the structural
elements of this view.
• A right-click (context menu) on an
element in the Git repository view
allows you to perform related Git
operations.
166. • enter the location
of the remote
repository.
• note: URI, Host and
Repository path
may be different
167. • choose which branches shall be
cloned from the remote repository.
• define where you want to store the
repository on the local file system
and define some initial settings.
• note: The default is "origin"
168.
169. Performing Git operations
• Once you have placed a
project under version control
you can start using team
operations on your project.
• The team operations are
available via right-click on
your project or file.
170. The most important operations are described in the following list. Select:
• Team -> Add to index, to add the selected resource(s) to the index of Git
• Team -> Commit, to open the commit dialog for committing to your Git repository
• Team -> Create Patch..., to create a patch
• Team -> Apply Patch..., to apply a patch to your file system
• Team -> Ignore, to add the file to a .gitignore file
• Team -> Show in History, to display the selected files and folders in the History view
• Team -> Pull to pull in changes from your remote Git repository
• Team -> Fetch to fetch the current state from the remote repository
• Team -> Switch To to switch or create new branches.
• Team -> Push to push changes to your remote Git repository
• Team -> Tag to create and manage tags.
http://javaandeclipse.blogspot.com/p/egit-and-eclipse.html#egit-PerformingGitOperations
171. • If you recognize that you
missed something when
committing a change
you may fix this: open
the staging view or
commit dialog again and
specify that the current
commit shall "amend"
the previous commit in
the current branch.
• note: do NOT amend
commits if they have
already been published
to a shared repository
since this may disturb
others if they already
based their changes on
the published change.
drag
173. • You may switch back to ‘master’
• select the branch to rename
• enter the new branch name > OK
174. • two alternative ways to Rename Branch…
• Deleting a Branch takes
the same three ways to
complete as mentioned
above when renaming a
branch.
• The currently checked out
branch can not be deleted
• If deletion of the branch
may result in data loss, a
warning is displayed that
must be confirmed
175. Merging • A merge include changes from another
branch or tag, since the time their
histories diverged from the current branch,
into the currently checked out branch.
176. • A merge can result in conflicts which require user action.
• select the top level resource showing the red conflict label decorator.
• click Team -> Merge Tool
• select the merge mode Use HEAD (the last local version) of conflicting files and click OK
• more details about how conflicts are presented:
https://mirrors.edge.kernel.org/pub/software/scm/git/docs/git-
merge.html#_how_conflicts_are_presented
• Ways to resolve the conflicts:
• Using Merge Tool
• Manually editing the conflicting resource by telling EGit (Team > Add) to resolve the
conflict (Team > Commit)
• Finding conflicting files to resolve the conflicts.
• Committing or Aborting a merge
177. Rebasing
• The Git Repositories view
allows you to rebase your
currently checkout branch
onto another branch.
• If the rebase was successful a
dialog is shown.
• You have to resolve rebase
conflicts if they occur.
• if you want to cancel the
rebase operation select Rebase
-> Skip and Rebase -> Abort.
178.
179. • You may also reset to specific
branch or tag: Select Team ->
Reset... on a project (or
(Repositories view or History view)
• You may also revert all local and
staged changes: reset to the
current HEAD by using a hard
reset. (right click on a project or
Repositories view or History view)
• soft - the HEAD points now to the new commit,
the index and the working tree are unchanged.
• mixed - the HEAD points now to the new
commit, the index is updated, the working tree
is unchanged.
• hard - the HEAD points now to the new commit,
the index and the working tree are updated
180. More details about EGit, please open Eclipse
> Help > EGit Documentation > EGit User Guide
181. Builders, Markers and Natures
https://www.wideskills.com/eclipse-plugin-tutorial/eclipse-builders-natures-and-markers
182. • builders are used to take java source as input and generate
corresponding class files
• Incremental Builders - These contribute to performance improvement by
rebuilding only the delta since last full build.
• markers are used to mark error locations, warnings, book marks etc. in
(Java) editor.
• natures are used to link project with various functionalities such as
builders in a project.
• For ex: if we add java nature to a project inside eclipse. It associates project with
incremental java compiler. natures are added in .project file of the project.
183. Creating Builders Nature using existing templates
• an builder's (incremental) name: sample
builder
• this builder validates XML file and if
required adds a problem marker to
problematic xml files
• this builder will run only for projects
which have declared themselves as having
sample nature projects
• Creating a plug-in project first !
File > New > Project… > Plug-in
Development > Plug-in Project >
MANIFEST.MF
185. Eclipse Builders
• New builder is created by extending the
org.eclipse.core.resources.builders extension point.
• ID and name are used to give builder a data value and
name respectively.
• the builder element.
• the hasNature attribute
flags whether this builder
is associated with any
nature.
• the run element.
• the class attribute
• here we specify the actual
java class which provides
the functionality of the
builder.
186. IncrementalProjectBuilder
• the java class (testplugin.builder.SampleBuilder) needs more attention as
this is the class which is doing the actual work.
• Any builder class must be a subclass of IncrementalProjectBuilder.
• All builders must subclass this class according to the following guidelines:
• Subclasses should implement the build method of this class
• Subclasses may implement remaining methods
• Subclasses should supply a public and NO arg constructor
• More details about class IncrementalProjectBuilder
https://help.eclipse.org/kepler/index.jsp?topic=/org.eclipse.platform.doc.isv
/reference/api/org/eclipse/core/resources/IncrementalProjectBuilder.html
187. • The build method requires special attention as well.
• This method of the builder is called whenever build is required
188. build (int kind, Map args, IProgressMonitor monitor)
we are using kind parameter to understand the kind of build request.
• kind: what kind of build is required?
• kind parameter could be a FULL_BUILD, INCREMENTAL_BUILD, and AUTO_BUILD.
• args: a Map to pass arguments/information to builder.
• monitor: a progress monitor
• Eclipse will call build method of the builder whenever any type of build is
required.
• Here has implemented two methods for each kind of build
• full build
• incremental build
189. • we are delegating calls to Visitors.
• visitor will visit all the resources (in
case of delta only the modified
resources since last build).
• For each resource we are calling
checkXML() method.
• CheckXML method essentially
delegates call to XMLErrorHandler
defined in builder class which will
check if XML document is well
formed or not.
• In case it is not well formed it will
create a marker (as shown below).
190. Markers
• There are many types of predefined markers defined as constants in
IMarker interface.
• org.eclipse.core.resources.bookmarkIMarker.BOOKMARK
org.eclipse.core.resources.markerIMarker.MARKER
org.eclipse.core.resources.problemmarker IMarker.PROBLEM
org.eclipse.core.resources.taskmarkerIMarker.TASK
org.eclipse.core.resources.textmarkerIMarker.TEXT
191. IMarker
• New marker is created by extending
org.eclipse.core.resources.markers extension point.
• ID and Name are datavalue and name respectively.
• Next, we need to define the super type marker for
new marker.
• Since we want to show errors in Problems View we are using
org.eclipse.core.resources.problemmarker as supertype.
IMarker is the main interface when we are dealing with eclipse markers.
• Next is the
persistent element.
• Since we want this
markers to persist
across eclipse
sessions we are
setting this property
to true.
192. • addMarker method in SampleBuilder class is used to show above
defined marker in the editor whenever problem/error occurs.
• more details about IMarker interface
https://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2F
reference%2Fapi%2Forg%2Feclipse%2Fcore%2Fresources%2FIMarker.html
193. Natures
• Natures are not only used to associate builders but are also used to
define many other functionalities
• for ex: only java nature projects are shown in Package Explorer.
• Some of the predefined natures are
org.eclipse.jdt.core.javanature,org.eclipse.pde.PluginNature.
• Nature is created by extending org.eclipse.core.resources.natures
extension point.
• ID is the unique identifier for this nature.
• Name is the human readable name of the nature.
194. • Next element is the builder. Here we will add a builder to this nature.
• We have associated SampleBuilder created earlier with this nature. So that
projects with SampleNature use SampleBuilder whenever an XML file is saved.
195. • Next elements are runtime and run. Here
we will specify a class named
SampleNature which will be used to
configure/deconfigure project with
Sample Nature.
• With the help of this class we will be able to
configure non Sample Nature project to
Sample Nature project at run time.
• OR we will be able to convert Sample Nature
Project to non Sample Nature project.
• Repercussions of making a Project as
Sample Nature project will be that a
Sample builder will be attached to project
which will run whenever an XML file is
saved and will look for any errors in XML.
196. IProjectNature
• It can configure a project with the project nature, or de-configure it.
• Please refer to Eclipse API Specification to know more about this class.
• Here, user is provided with toggle action to convert non Sample Nature
project to Sample Nature project. Following method from
SampleNature class will be called to associate the project with
SampleNature.
• Every workbench project contains a .project file that contains build
commands. Executing above method causes the following to appear in
the buildSpec section of the project's .project file. Also Sample nature is
added in natures section.
https://help.eclipse.org/kepler/index.jsp?topic=/org.eclipse.platform.doc.isv/
reference/api/org/eclipse/core/resources/IncrementalProjectBuilder.html
199. The Eclipse help system
• uses a browser-based presentation and therefore has full support for HTML.
• search is automatically included in the help system
• context help and keyword index are supported if you provide the appropriate
content files.
1. Create a Rich Client Application
• File > New > Project... > Plug-in Project
2. Create a Product Configuration
3. Add Source Code
4. Test
5. Add Required Plug-ins
6. Test Again
7. Add Sample Help Content
8. Add Context Help Support
9. Test context help
10. Setting Help Preferences
200.
201. 2. Create a Product Configuration
• Switch to the Plug-in Development perspective
• Select "File > New > Product Configuration" from the main menu.
• Select "org.eclipse.helprcp" in the resulting "New Product Configuration" wizard page.
• Input "helprcp.product" into the "File name" text box.
• Select the "Use an existing product" radio button inside the "Initialize the file content"
group and click "Finish". The "Product Configuration Editor" will open.
202. 2. Create a Product Configuration (continued)
• Input "Help RCP Application" into the "Product Name" text box.
• Verify "org.eclipse.helprcp.product" is the default value in the "Product ID" drop down menu.
• Select "File > Save" from the main menu.
• From the "Overview" tab of the "Product Configuration Editor" click on "Launch an Eclipse
Application" and verify that the application launches.
203. 3. Add Source Code
• make a few source changes to add the help actions
to the menu.
• add the lines marked "// NEW" to the class
• add the lines marked "// NEW" to function
"ApplicationActionBarAdvisor.makeActions()"
• add the lines marked "// NEW" to function
"ApplicationActionBarAdvisor.fillMenuBar()"
https://www.eclipse.org/articles/article.php
?file=Article-AddingHelpToRCP/index.html
4. Test
Launch the application from the
"Product Configuration Editor"
> Help > now has additional entries
but neither of them does anything.
This is because we still need to
import the plug-ins that comprise
the Eclipse help system.
204. 5. Add Required Plug-ins
1) Click the “product configuration" link in the Overview tab
2) Add "org.eclipse.help.webapp" and "org.eclipse.help.ui" to the list in the "Plug-ins and Fragments"
section.
3) Click the "Add Required Plug-ins" button.
4) Select the checkbox to "Include optional dependencies when computing required plug-ins".
• If you omit this step the help system will not have all the plug-ins it needs and you will see an exception at startup.
5) Select "File > Save" from the main menu.
208. Custom Text Editor
Eclipse provides rich support for creating editors that operate on text,
such as programming language editors or document editors.
209. • change font style for a text file
• change text color by modifying the Appearance color
options for Foreground and Background color
https://stackoverflow.com/questions/59251808/changing-font-and-colour-of-text-in-eclipse-text-editor
210. various plug-ins that provide facilities for
text processing
• org.eclipse.text: provides a model for manipulating text and has no visual components, so it can
be used by headless programs that process or manipulate text.
• org.eclipse.swt: the class StyledText is the SWT user-interface object for displaying and editing
text. Everything the user sees is rooted here: colors, fonts, selections, the caret (I-beam cursor),
and more. You can add all kinds of listeners to this widget to follow what the user is doing. It also
supports some fancier features, such as word wrapping and printing.
• org.eclipse.jface.text: This is the marriage of the model provided by org.eclipse.text and the view
provided by StyledText. It is the heart of the text framework.
• org.eclipse.ui.workbench.texteditor: You can't use the features provided here without being part
of a running Eclipse workbench. It supports text editors that appear in the workbench editor area
and features a large collection of Action subclasses for manipulating the contents of an editor, as
well as support for annotations, incremental search, and more.
• org.eclipse.ui.editors: It provides the main concrete editor in the base Eclipse Platform, the
default text editor.
• and more text infrastructures…
https://wiki.eclipse.org/FAQ_What_support_is_there_for_creating_custom_text_editors%3F
211. All editors start by making a subclass of EditorPart
from the org.eclipse.ui.part package.
• create a plug-in project
• add one or more new extensions by using Extension Wizards
• MANIFEST > Extension > Add > Extension Wizard > Editor or Extensible Editor…
• E.g., a simple XML Editor will be created > go to “src” folder > search XMLEditor and
XMLConfiguration java classes > modify the constructor of the XMLEditor class >
modify XMLConfiguration class
• note: debug a little bit by yourself; since it is an XML Editor, only quoted strings
should be spell checked and the XML tags should be skipped.
http://blog.ankursharma.org/2009/08/adding-spellchecking-to-custom-editors_19.html
212. • If you are using a product, add your new plug-ins
(org.eclipse.core.contenttype.contentTypes and org.eclipse.ui.editors) to
your feature and start a runtime Eclipse via the product.
• set the preferenceStore for checking dictionary and other preferences from
Window > Preferences > General > Editors > Text Editors > Spelling .
https://www.vogella.com/tutorials/EclipseEditors/article.html
214. Rich Text Editor
• Help -> Install New Software...
• Add a new site using the url http://static-
tmsoftstudio.appspot.com/richtexteditor to the Eclipse Update Manager.
• Select the bundles from the list that you would like to install and click Next.
https://marketplace.eclipse.org/content/rich-text-editor/help
https://projects.eclipse.org/projects/technology.dltk/releases/6.0
Note: Eclipse Dynamic Languages Toolkit 5.11 is a part of Eclipse IDE 2019-09
216. The Common component provides key concepts and infrastructure to be potentially used by all other GEF
components
https://help.eclipse.org/2019-09/index.jsp?topic=%2Forg.eclipse.gef.layout.doc%2Freference%2Fwiki%2FLayout.html
218. • an open source framework dedicated to
providing a rich, consistent graphical editing
environment for applications on the Eclipse
Platform
• https://wiki.eclipse.org/GEF/Developer_FAQ
• GEF (MVC) is interactive model-view-
controler fraDraw2d-based graphical
editors mework, which fosters the
implementation of SWT-based tree and for
the Eclipse Workbench UI.
• https://www.eclipse.org/gef/gef_mvc/
• https://www.eclipse.org/gef/
• Download GEF update 5.3.0 (latest *.zip)
• https://www.eclipse.org/gef/download.php?fil
e=/tools/gef/downloads/drops//5.3.0/I201912
070301/GEF-Update-5.3.0.zip
• https://www.eclipse.org/gef/downloads/index
.php?showAll=1&hlbuild=S201905091638
• https://projects.eclipse.org/projects/tools.gef
219. • After complete the install, follow the steps on this page
• https://github.com/eclipse/gef#eclipse-graphical-editing-framework-gef
• Set up an Eclipse IDE
• Set up a Target Definition containing GEF
• Run the examples
• Other resources
• https://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.gef.doc.isv%2F
guide%2Fguide.html
• https://www.eclipse.org/articles/Article-GEF-diagram-editor/shape.html