|
When does a plugin get started?
Each plug-in can be viewed as having a declarative section and a code section. The
declarative part is contained in the plugin.xml file. This file is loaded into a
registry when the platform starts up and so is always available, regardless of whether
a plug-in has started. The code section are laze loaded by default. They are activated
only when their functionality has been explicitly invoked by the user.
What are extensions and extension points?
Loose coupling in Eclipse is achieved partially through the mechanism of extensions
and extension points. When a plug-in wants to allow other plug-ins to extend or
customize portions of its functionality, it will declare an extension point. The
extension point declares a typically a combination of XML markup and Java interfaces,
that extensions must conform to. Plug-ins that want to connect to that extension
point must implement that contract in their extension.
How to access UI objects from a non-ui thread?
Use Display.getDefault().asyncExec(new Runnable()...) Display.asyncExec causes the
run() method of the runnable to be invoked by the user-interface thread at the next
reasonable opportunity. The caller of this method continues to run in parallel,
and is not notified when the runnable has completed.
How to fire a key event in my test code to make the program act as if a user pressed
a key?
Two ways to implement it in code: generating OS level key event use Display.post(Event)
or use Widge.notifyListeners(...) to just notify a widget's listeners.
Why
do I get the error "org.eclipse.swt.SWTException: Invalid thread access"?
SWT implements a single-threaded UI model often called apartment threading. In this
model, only the UI-thread can invoke UI operations. SWT strictly enforces this rule.
If you try and access an SWT object from outside the UI-thread, you get the exception
"org.eclipse.swt.SWTException: Invalid thread access". The following code
sets the text of a label from a background thread and waits for the operation to
complete: display.syncExec( new Runnable() { public void run(){ label.setText(text);
} });
How to config a plugin to start automatically during platform starts up?
Define the 'Eclipse-AutoStart=true' header in Manifest file.
What is the classpath of a plug-in?
The OSGi parent class loader. (Java boot class loader by default); The exported
libraries of all imported plug-ins; The declared libraries of the plug-in and all
its fragments.
Do we
need to explicitly invoke org.eclipse.swt.graphics.Image.dispose()?
Application code must explicitly invoke the Image.dispose() method to release the
operating system resources managed by each instance when those instances are no
longer required. This is because that the Java finalization is too weak to reliably
support management of operating system resources.
What is Display, what is Shell?
The Display class respresents the GUI process(thread), the Shell class represents
windows.
How to resize my shell to get my changed widgets to lay out again?
A layout is only performed automatically on a Composite's children when the
Composite is resized, including when it is initially shown. To make a Composite
lay out its children under any other circumstances, such as when children are created
or disposed, its layout() method must be called.
Is there a built-in facility to check whether a given value is valid compared to
the effective facets of its type?
To determine if a literal is valid with respect to a simple type, you can use either
XSDSimpleTypeDefinition.isValidLiteral or XSDSimpleTypeDefinition.assess.
How can I change the window icon in my application?
Define a product via the products extension point and specify the windowImages property
to refer to two image files, a 16x16 one and a 32x32 one.
What is optional dependency?
plug-in prerequisite elements can be made optional by adding the optional="true"
attribute in Manifest file(see below for an example). Marking an import as optional
simply states that if the specified plug-in is not found at runtime, the dependent
plug-in should be left enabled. This is used when a plug-in can be used in many
scenarios or it is reasonable to operate with reduced function. It allows the creation
of minimal installs that cover functional subsets. Require-Bundle: org.eclipse.swt;
optional="true"
What
is EMF?
The Eclipse Modeling Framework is a Java/XML framework for generating tools and
other applications based on simple class models. EMF helps you rapidly turn models
into efficient, correct, and easily customizable Java code. It is intended to provide
the benefits of formal modeling, but with a very low cost of entry. In addition
to code generation, it provides the ability to save objects as XML documents for
interchange with other tools and applications.
What is included in the Rich Client Platform?
Eclipse Runtime, SWt, JFace, Workbench
What are the differences between Require-Bundle and Import-Package?
There are two complementary ways of depending on something from outside a given
plug-in; Require-Bundle and Import-Package.
|