Naming conventions and guidelines for the Eclipse Platform:
org.eclipse. The
first package name component after org.eclipse is called
the major package name. The following major packages of org.eclipse
are assigned in the Eclipse 4.3 release:
The following package name segments are reserved:org.eclipse.ant[.*]- Ant supportorg.eclipse.compare[.*]- Compare supportorg.eclipse.core[.*]- Platform coreorg.eclipse.debug[.*]- Debugorg.eclipse.equinox[.*]- Equinox sub-projectorg.eclipse.help[.*]- Help supportorg.eclipse.jdi[.*]- Eclipse implementation of Java Debug Interface (JDI)org.eclipse.jdt[.*]- Java development toolsorg.eclipse.jface[.*]- JFaceorg.eclipse.jsch[.*]- Jsch SSH library supportorg.eclipse.ltk[.*]- Generic language tool infrastructureorg.eclipse.osgi[.*]- Eclipse API for interacting with OSGiorg.eclipse.pde[.*]- Plug-in Development Environmentorg.eclipse.search[.*]- Search supportorg.eclipse.swt[.*]- Standard Widget Toolkitorg.eclipse.team[.*]- Team support and Version and Configuration Managementorg.eclipse.text[.*]- Text editor frameworkorg.eclipse.ui[.*]- Workbenchorg.eclipse.update[.*]- Update/install
These name are used as qualifiers, and must only appear following the major package name. For example,internal- indicates an internal implementation package that contains no APItests- indicates a non-API package that contains only test suitesexamples- indicates a non-API package that contains only examples
org.eclipse.core.internal.resources- Correct usageorg.eclipse.internal.core.resources- Incorrect.internalprecedes major package name.org.eclipse.core.resources.internal- Incorrect.internaldoes not immediately follow major package name.
Aside on how the Eclipse Platform is structured: The Eclipse Platform is divided up into Core and UI. Anything classified as Core is independent of the window system; applications and plug-ins that depend on the Core and not on the UI can run headless. The distinction between Core and UI does not align with the distinction between API and non-API; both Core and UI contain API. The UI portion of the Eclipse Platform is known as the Workbench. The Workbench is a high-level UI framework for building products with sophisticated UIs built from pluggable components. The Workbench is built atop JFace, SWT, and the Platform Core. SWT (Standard Widget Toolkit) is a low-level, OS-platform-independent means of talking to the native window system. JFace is a mid-level UI framework useful for building complex UI pieces such as property viewers. SWT and JFace are UI by definition. The Java tooling is a Java IDE built atop the workbench. End aside.
API Packages API packages are ones that contain classes
and interfaces that must be made available to ISVs. The names of API packages
need to make sense to the ISV. The number of different packages that the
ISV needs to remember should be small, since a profusion of API packages
can make it difficult for ISVs to know which packages they need to import.
Within an API package, all public classes and interfaces are considered
API. The names of API packages should not contain internal,
tests,
or examples to avoid confusion with the scheme for naming
non-API packages.
Internal Implementation Packages All packages that are
part of the platform implementation but contain no API that should be exposed
to ISVs are considered internal implementation packages. All implementation
packages should be flagged as internal, with the tag occurring
just after the major package name. ISVs will be told that all packages
marked internal are out of bounds. (A simple text search
for ".internal." detects suspicious reference in source files;
likewise, "/internal/" is suspicious in .class files).
Test Suite Packages All packages containing test suites
should be flagged as tests, with the tag occurring just
after the major package name. Fully automated tests are the norm; so, for
example,
org.eclipse.core.tests.resources would contain automated
tests for API in org.eclipse.core.resources. Interactive tests
(ones requiring a hands-on tester) should be flagged with interactive
as the last package name segment; so, for example, org.eclipse.core.tests.resources.interactive
would contain the corresponding interactive tests.
Examples Packages All packages containing examples that
ship to ISVs should be flagged as examples, with the tag
occurring just after the major package name. For example,
org.eclipse.swt.examples
would contain examples for how to use the SWT API.
Additional rules:
_ or dollar sign $ characters.Java's naming guidelines state
Class names should be nouns, in mixed case with the first letter of each internal word capitalized. Try to keep your class names simple and descriptive. Use whole words - avoid acronyms and abbreviations (unless the abbreviation is much more widely used than the long form, such as URL or HTML).
Examples:class Raster;class ImageSprite;
Interface names should be capitalized like class names.
For interface names, we follow the "I"-for-interface convention: all interface
names are prefixed with an "I". For example, "IWorkspace"
or "IIndex". This convention aids code readability by making interface
names more readily recognizable. (Microsoft COM interfaces subscribe to
this convention).
Additional rules:
Exception) should
follow the common practice of ending in "Exception".Java's naming guidelines state
Methods should be verbs, in mixed case with the first letter lowercase, with the first letter of each internal word capitalized.Additional rules:
Examples:run();runFast();getBackground();
getX()),
setters (setX()), and predicates (isX(),
hasX()).Java's naming guidelines state
Except for variables, all instance, class, and class constants are in mixed case with a lowercase first letter. Internal words start with capital letters. Variable names should not start with underscore_or dollar sign$characters, even though both are allowed.
Variable names should be short yet meaningful. The choice of a variable name should be mnemonic - that is, designed to indicate to the casual observer the intent of its use. One-character variable names should be avoided except for temporary "throwaway" variables. Common names for temporary variables arei,j,k,m, andnfor integers;c,d, andefor characters.
Examples:int i;char c;float myWidth;
(Note: we are no longer following the convention that prefixes non-constant
field names with "f", such as "fWidget".)
Java's naming guidelines states
The names of variables declared class constants and of ANSI constants should be all uppercase with words separated by underscores ("_").
Examples:static final int MIN_WIDTH = 4;static final int MAX_WIDTH = 999;static final int GET_THE_CPU = 1;
All plug-ins, including the ones that are part of the Eclipse Platform,
like the Resources and Workbench plug-ins, must have unique identifiers
following the same naming pattern as Java packages. For example, workbench
plug-ins are named org.eclipse.ui[.*].
The plug-in namespace is managed hierarchically; do not create plug-in without prior approval from the owner of the enclosing namespace.
Extension points that expect multiple extensions should have plural
names. For example, "builders" rather than "builder".