[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipse-scripting-dev] EASE ideas

Hi Christian,

On Fri, Nov 15, 2013 at 3:54 PM, Christian Pontesegger <christian.pontesegger@xxxxxx> wrote:
Enabled when:
First I would like to rename it to visibleWhen, as this is, what it does: when the _expression_ evaluates to false, the script is not visible in the context menu.
To edit such expressions I would love to reuse the editor we use for plugin extensions when we define activeWhen, visibleWhen, ... expressions. Not sure how easy it would be to reuse that forms editor page just for our certain usecase.

Just FYI:

The visibleWhen/enabledWhen support that's already in the platform comes in 3 parts.

The first 2 are PDE related. Part 1 is where we define visibleWhen/enabledWhen in schema [1]. The schema could be re-used by any tools that wanted to read it. That definition allows the PDE editor (Part 2) to define visibleWhen elements when working in the Extensions tab. I'm not sure how re-usable the Extensions tab from the PDE editor is, as it's normally targetted at plugin.xml files and requires PDE to be installed.

The 3rd part is the core expressions engine that processes Expressions and org.eclipse.core.expressions.IEvaluationContext (the state of the system) to return TRUE or FALSE.

The core.expressions engine is pretty low level, and can be re-used without the Workbench. The core _expression_ engine can parse plugin.xml from the IExtensionRegistry or it can parse XML directly.

If you are using the Workbench, org.eclipse.ui.services.IEvaluationService is a service that allows core expressions to be tied into the workbench application state (a running RCP or IDE application).

[1] http://git.eclipse.org/c/platform/eclipse.platform.runtime.git/tree/bundles/org.eclipse.core.expressions/schema/expressionLanguage.exsd

Attaching scrips to UI:
Right now we can attach scripts to context menus. It would be great if we could also attach to toolbars and menus all over eclipse. Maybe we could reuse some parts of the discovery mechanism of the menu spy. Like "please click on the toolbar where you want to attach your script to".

While not as dynamic as your usecase above, you can use org.eclipse.ui.menus and the CompoundContributionItem to contribute scripts to a menu (either a top-level Scripts menu or to a Scripts submenu in a couple of places, like File, Edit, or Window).

The CompoundContributionItem gets invoked just before Menus get shown, and allow you to list the scripts currently available for execution.

There are other ways to contribute into the workbench menuing system if needed.


Paul Webster
Hi floor. Make me a sammich! - GIR