-
Notifications
You must be signed in to change notification settings - Fork 0
Developers Guide
This page is intended to collect basic guidelines used across whole reprotool project.
<wiki:toc max_depth="2" />
Eclipse has own mechanism to display and log exceptions.
Main parts are:
-
IStatus
- Wrapped information (message, exception) with severity. -
StatusManager
- Class accepting statuses and hints how to handle them. In the example below the status is passed with flagStatusManager.BLOCK | StatusManager.LOG
thus it will be logged to the file (and showed in the Problems view) and modal dialog will be shown to the user.
Example (from ProjectWizard.java)
IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error during project initialization", exception);
StatusManager.getManager().handle(status, StatusManager.BLOCK | StatusManager.LOG);
Log file is located in <workspace-dir>\.metadata\.log
More about eclipse error handling can be found at http://wiki.eclipse.org/Status_Handling_Best_Practices:)
See http://www.vogella.de/blog/2010/07/06/reading-resources-from-plugin/
Minimal requirement is to have top level comment for each class with @author
tag filled.
Desired situation is to have every public class/method/field
documented when work is finished.
Hint: Comments can be inserted with shortcut `alt + shift + j` |
Project reprotool.ide
has associated code-formatting settings to unify formatting style (i.e. indenting with tabs vs spaces, line length, ...). Style defined by this settings should be "the right one", so that the whole project can be reformatted with it.
To prevent eclipse from formatting your code, surround the code with @formatter
tags like this (this should be rather rare):
//@formatter:off
MyClass.method()
.anotherMethod()
.yetAnotherMethod();
//@formatter:on
Path to view/edit settings:
Project -> Properties -> Java Code Style -> Formatter -> Edit
Hint: Code can be formatted with shortcut `ctrl + shift + f` |
Externalized strings are placed by EMF code generator into into plugin.properties file. This how-to explains string externalization in non-generated EMF plugin.
- Open
META-INF/MANIFEST.MF
file and add"Bundle-Localization: plugin"
line.
- Right click on project, select Source and Externalize Strings...
- In Externalize Strings dialog change "Key" of each externalized string to something meaningful.
- Click on "Configure", change Class name to class containing plugin activator.
- Change Property file name to
plugin.properties
. - Click on "Configure" again and change "Substitution pattern" to
INSTANCE.getString(${key})
. - In Externalize Strings dialog click on Next and Finish.
- Move generated
plugin.properties
to plugin root folder. - Open
plugin.xml
, go to "Build" tab and check"plugin.properties"
in Binary Build. - Try to run plugin(s) with new configuration.
Open plugin.xml
and in "Overview" tab click to "Externalize Strings Wizard", select strings and finish dialog.
Data binding is mechanism for data synchronization between model and view. Using this framework is preferred over using property change listeners which may cause infinite loops or memory leaks when used incorrectly.
Note that !WindowBuilder Pro v1.0.0 does not have support for EMFEditProperties which interact with domain model trough EMF commands. Therefore GUI designer is not used to generate a binding and it is created manually.
[- tutorial about eclipse plugin development.
http://code.google.com/javadevtools/wbpro/features/swt/data_binding/index.html - eclipse databinding in !WindowBuilder Pro
[- eclipse databinding tutorial.
http://tomsondev.bestsolution.at/2009/06/06/galileo-improved-emf-databinding-support/ - series of blog posts about new EMF binding using EMF commands to interact with domain model.
[- Automatic creation of dialogs (panels, ...) with databinding.
- Open menu Run -> Run Configurations...
- Select an existing Launch Configuration or create a new one
- Select the Common tab
- Select Shared file and insert path to the directory where the configuration will be stored, such as
/myproject/.launch
- Adjust the checkboxes in Display in favorites menu (Run, Debug or both)
IExtensionPoint[](http://code.google.com/javadevtools/wbpro/wizards/databinding/automatic_0.html]) extPoints =
Platform.getExtensionRegistry().getExtensionPoints("my.plugin.id");
for (IExtensionPoint extPoint : extPoints) {
IExtension[] extensions = extPoint.getExtensions();
// do simething with extensions
}