Skip to content

Commit 11833c8

Browse files
Mailaenderakurtakov
authored andcommitted
Add syntax highlight to code blocks.
1 parent 8473e6b commit 11833c8

File tree

5 files changed

+126
-101
lines changed

5 files changed

+126
-101
lines changed

docs/Event_Model.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,20 @@ Posting an Event
3434

3535
Publishing an event on the global event bus is as simple as calling one of two methods
3636

37+
```java
3738
IEventBroker.post(String topic, Object data) // asynchronous delivery
38-
39+
```
3940
or
40-
41+
```java
4142
IEventBroker.send(String topic, Object data) // synchronous delivery
43+
```
4244

4345
Example:
44-
46+
```java
4547
...
4648
foo.Bar payload = getPayload();
4749
boolean wasDispatchedSuccessfully = eventBroker.send(TOPIC_STRING, payload);
50+
```
4851

4952
If the payload of the send or post command is a regular Java object, the payload is attached to the OSGi event as a property with the key IEventBroker.DATA. If the payload is a Dictionary or a Map, all the values from the collection are added as properties with their associated keys.
5053

@@ -58,10 +61,12 @@ Dependency Injection
5861

5962
Whenever possible you should use dependency injection to register and respond to events. This technique results in less code, is easier to read and maintain and has fewer anonymous inner classes. Internally, the E4 code base does not currently use this technique for subscribing to its own events. However, this is the result of a limitation that was late in the M4 cycle. Early in the M5 cycle, we will be changing our implementations to use the dependency injection technique for UI event handling.
6063

64+
```java
6165
@Inject @Optional
6266
void closeHandler(@UIEventTopic(''TOPIC_STRING'') foo.Bar payload) {
6367
// Useful work that has access to payload. The instance of foo.Bar that the event poster placed on the global event bus with the topic ''TOPIC_STRING''
6468
}
69+
```
6570

6671
A quick note on the visibility of the injected handler methods.
6772

@@ -77,7 +82,7 @@ In some circumstances you will not be able to use dependency injection and must
7782
You also can not use dependency injection if the topic string you are registering is constructed at run time. The annotation strings need to be available and complete at compile time to be used by @UIEventTopic() (This is the reason we have not previously used dependency injection internally to subscribe to UIEvents ... but that will be changing in M5)
7883

7984

80-
85+
```java
8186
IEventBroker eventBroker;
8287
8388
void addSubscribers() {
@@ -97,6 +102,7 @@ You also can not use dependency injection if the topic string you are registerin
97102
// Useful work that has access
98103
foo.Bar payload = (foo.Bar) event.getProperty(IEventBroker.DATA);
99104
}
105+
```
100106

101107
UI Model Events
102108
===============
@@ -113,7 +119,7 @@ UIEvents Structure
113119
Each EMF model element has a corresponding interface defined in UIEvents. Each interface has two constants defined for each attribute of the model element.
114120

115121
Here is the example for the UILabel model element
116-
122+
```java
117123
public static interface UILabel {
118124

119125
// Topics that can be subscribed to
@@ -127,13 +133,16 @@ Here is the example for the UILabel model element
127133
public static final String LABEL = "label"; //$NON-NLS-1$
128134
public static final String TOOLTIP = "tooltip"; //$NON-NLS-1$
129135
}
136+
```
130137

131138
The TOPIC_* constants are used to subscribe to events generated when the corresponding attribute changes. The constant can be used by either the dependency injection technique or the IEventBroker.subscribe() technique described above. The TOPIC_ALL constant is used to register for changes on all the attributes of a model element. If the dependency injection technique is used, the event payload is the event itself.
132139

140+
```java
133141
@Inject @Optional
134142
private void closeHandler(@UIEventTopic(UIEvents.UILifeCycle.ACTIVATE) org.osgi.service.event.Event event) {
135143
...
136144
}
145+
```
137146

138147
The constants named directly for the element attribute (LABEL, TOOLTIP and ICONURI from the example above) are used in event handlers if you need to inspect the event and determine which attributes have actually changed. This works because UIEventPublisher adds the attribute name from the source EMF event to the OSGi event with the property key UIEvents.EventTags.ATTNAME. The other UIEvents.EventTags.* constants list other values that may be published in an event depending on the event type. Different event types will store different tags in the event.
139148

docs/JFaceDataBindingFAQ.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The JFace Data Binding plug-ins can be found in any of the following distributio
2323
* RCP Runtime/SDK
2424
* Platform Runtime/SDK
2525

26-
26+
2727
Just select the desired build (e.g. stable, integration, nightly) and download one of the above distributions.
2828

2929
The plug-ins or JAR files that you need are these:
@@ -35,32 +35,31 @@ The plug-ins or JAR files that you need are these:
3535
* org.eclipse.jface.databinding (if your want SWT and JFace databinding)
3636
* org.eclipse.core.databinding.beans (if you want databinding to Java beans).
3737

38-
38+
3939
The databinding framework is accessible using Maven with these dependencies:
4040

41+
```xml
4142
<!-- The core databinding framework -->
4243
<dependency>
4344
<groupId>org.eclipse.platform</groupId>
4445
<artifactId>org.eclipse.core.databinding</artifactId>
4546
<version>1.9.0</version>
4647
</dependency>
47-
48+
4849
<!-- If you want databinding to Java beans -->
4950
<dependency>
5051
<groupId>org.eclipse.platform</groupId>
5152
<artifactId>org.eclipse.core.databinding.beans</artifactId>
5253
<version>1.6.100</version>
5354
</dependency>
54-
55+
5556
<!-- If you want JFace and SWT databinding -->
5657
<dependency>
5758
<groupId>org.eclipse.platform</groupId>
5859
<artifactId>org.eclipse.jface.databinding</artifactId>
5960
<version>1.11.100</version>
6061
</dependency>
61-
62-
63-
62+
```
6463

6564
### What is a Realm, and do I need to care?
6665

0 commit comments

Comments
 (0)