Difference between revisions of "FAQ How do activities get enabled?"

From Eclipsepedia

Jump to: navigation, search
m (Added <source lang="java">)
m (Corrected in-page links)
 
(2 intermediate revisions by one user not shown)
Line 1: Line 1:
''
+
There are two kinds of activities
 
+
#[[#1. Conventional activities|Conventional activities]]
 
+
#[[#2. Expression-enabled activities|Expression-enabled activities]]
 
+
 
+
  
 +
== 1. Conventional activities ==
 
When a user starts a new workspace, all activities will typically be disabled.
 
When a user starts a new workspace, all activities will typically be disabled.
 
As the user explores the application and starts to use new features, more
 
As the user explores the application and starts to use new features, more
Line 48: Line 47:
 
points in the user interface for seamlessly enabling activities.
 
points in the user interface for seamlessly enabling activities.
  
 +
== 2. Expression-enabled activities ==
 +
For a description of expression-enabled activities look at [[FAQ What is the purpose of activities?]].<br/>
 +
Expression-enabled activities can, of course, only be enabled through an enablement of their expressions.
 +
 +
<br/>
 
<hr><font size=-2>This FAQ was originally published in [http://www.eclipsefaq.org Official Eclipse 3.0 FAQs]. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the [http://www.eclipse.org/legal/epl-v10.html Eclipse Public License v1.0].</font>
 
<hr><font size=-2>This FAQ was originally published in [http://www.eclipsefaq.org Official Eclipse 3.0 FAQs]. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the [http://www.eclipse.org/legal/epl-v10.html Eclipse Public License v1.0].</font>

Latest revision as of 18:45, 9 June 2008

There are two kinds of activities

  1. Conventional activities
  2. Expression-enabled activities

[edit] 1. Conventional activities

When a user starts a new workspace, all activities will typically be disabled. As the user explores the application and starts to use new features, more activities can become enabled as they are needed. This enablement typically happens automatically when the workbench determines that a user is starting to use features defined in a disabled activity. The workbench defines a number of trigger points, UI interactions that signal the introduction of a new activity. For example, the Eclipse IDE workbench considers creation of a project to be a trigger point. When a project is created, the workbench looks at the natures on that project and enables any activities that have pattern bindings matching any of the nature IDs.


You can define your own trigger points for any logical place where new plug-in functionality will be introduced. The trigger point itself doesn’t need to know about any particular activities; it simply needs to define an identifier that represents the new functionality. The identifier should be in the form either <plugin-id>/<local-id> or simply <local-id>. Using that ID, you can enable any matching activities as follows:

String id = ...
IWorkbench wb = PlatformUI.getWorkbench();
IWorkbenchActivitySupport as = wb.getActivitySupport();
IActivityManager am = as.getActivityManager();
IIdentifier identifier = am.getIdentifier(id);
Set activities = new HashSet(am.getEnabledActivityIds());
if (activities.addAll(identifier.getActivityIds())) {
   as.setEnabledActivityIds(activities);
}

The exact format of the ID used for your trigger point should be well documented so that activity writers will be able to write appropriate pattern bindings for activating their activities using your trigger points.


Activities can also be enabled or disabled explicitly by an end user. Again, this is something only the advanced user will do. The success of activities as a mechanism for scalability and progressive disclosure relies on carefully chosen trigger points in the user interface for seamlessly enabling activities.

[edit] 2. Expression-enabled activities

For a description of expression-enabled activities look at FAQ What is the purpose of activities?.
Expression-enabled activities can, of course, only be enabled through an enablement of their expressions.



This FAQ was originally published in Official Eclipse 3.0 FAQs. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the Eclipse Public License v1.0.