Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Extending Real-Time Shared Editing for Use with Other Editors"

(Adding '''Share Editor With''' Menu Item To Other Text Editors)
(Adding '''Share Editor With''' Menu Item To Other Text Editors)
Line 56: Line 56:
 
</pre>
 
</pre>
  
The new or existing plugin that has this markup will have a dependency on the '''org.eclipse.ecf.internal.provisional.docshare.menu.DocShareRosterMenuContributionItem''' class (and therefore the '''org.eclipse.ecf.docshare''' plugin), as well as the '''org.eclipse.ui.menus''' extension point exposed by the Eclipse Platform UI.
+
The new or existing plugin that has this markup will have a dependency on the '''org.eclipse.ecf.internal.provisional.docshare.menu.DocShareRosterMenuContributionItem''' class (and therefore the '''org.eclipse.ecf.docshare''' plugin), as well as the '''org.eclipse.ui.menus''' extension point exposed by the Eclipse Platform UI.
 +
 
 +
NOTE:  The DocShare API is provisional, and is very likely to change in future versions of ECF as per [https://bugs.eclipse.org/bugs/show_bug.cgi?id=234142 bug 234142].  That is why the package for the contribution item classes are in 'internal.provisional' package.  Note also that people that wish to define a new other user interface for access to starting/stopping real-time shared editing may do so as they wish, and use the [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.ecf/plugins/org.eclipse.ecf.docshare/?root=Technology_Project DocShare src code] as example.
 +
 
 +
[[Image:Example.jpg]]
  
 
When the plugin running this is run, and the user clicks on the editor's context menu, the '''Share Editor with''' menu item should be on the context menu.  And if the editor implements ITextEditor and IDocumentListener as described above, then the ECF real-time shared editing should work with that editor.
 
When the plugin running this is run, and the user clicks on the editor's context menu, the '''Share Editor with''' menu item should be on the context menu.  And if the editor implements ITextEditor and IDocumentListener as described above, then the ECF real-time shared editing should work with that editor.
  
 
If it does not, for whatever reason, please [https://bugs.eclipse.org/bugs/enter_bug.cgi?product=ECF file a bug at bugs.eclipse.org under Technology->ECF] and write to '''ecf-dev at eclipse.org'''.
 
If it does not, for whatever reason, please [https://bugs.eclipse.org/bugs/enter_bug.cgi?product=ECF file a bug at bugs.eclipse.org under Technology->ECF] and write to '''ecf-dev at eclipse.org'''.

Revision as of 12:06, 22 June 2008

With ECF 2.0.0/Ganymede, ECF introduces Real-Time Shared Editing.

By default, ECF supports doing shared editing with the JDT Java source code editor, and/or the default texteditor.

It's quite possible, however, and even easy, to support using the ECF real-time shared editing and synchronization with other types of text editors...for supporting shared editing source code for other languages (e.g. php, C/C++, javascript, xml editors, others) as well as shared editing of other types of text documents (properties editors, manifest/meta-data editors, etc.).

Below is a short explanation of how ECF supports doing real-time shared editing for the Java source code editor and the default text editor, and a short example of how ECF real-time shared editing can be added to other text editors. Also, see ECF bug #238029 to discuss further the capabilities described here.

How Share Editor With Appears on an Editor's Context Menu

First, the DocShare plugin supports the Java source code editor and the default text editor by associating a menu contribution with the editor's context id. The current context ids for the java source code editor and default text editor are:

Java Source Code Editor Context ID: #CompilationUnitEditorContext Default Text Editor Context ID: #TextEditorContext

In the plugin.xml of the ECF DocShare plugin is the following markup

<extension point="org.eclipse.ui.menus">
  <menuContribution locationURI="popup:#CompilationUnitEditorContext">
    <dynamic class="org.eclipse.ecf.internal.provisional.docshare.menu.DocShareRosterMenuContributionItem"
             id="org.eclipse.ecf.editorshare.dynamic1">
    </dynamic>
  </menuContribution>
</extension>

<extension point="org.eclipse.ui.menus">
  <menuContribution locationURI="popup:#TextEditorContext">
    <dynamic class="org.eclipse.ecf.internal.provisional.docshare.menu.DocShareRosterMenuContributionItem"
             id="org.eclipse.ecf.editorshare.dynamic2">
    </dynamic>
  </menuContribution>
</extension>

Here is the plugin.xml in the CVS repo

The markup above results in the appearance of the Share Editor with menu item on the context menus of the Java Source Editor and the Default Text Editor. Note that the menu item will also appear on all editors that use/reuse these context ids. Here is the Eclipse Help for Context ids.

If your editor uses/reuses these two ids as it's context id, then the ECF "Share Editor with" menu should appear in the editor's context view at runtime (when connected to an account that supports the ECF datashare API), and as long as the editor implements the ITextEditor interface, the ECF shared editing should work properly. If the editor supports this interface, but does not work properly, it is likely due to some problem with the editor implementation. It must, for example, support the IDocumentListener interface among some other in the org.eclipse.ui.jface.text bundle.

Adding Share Editor With Menu Item To Other Text Editors

Given the approach above, it's rather easy to add the ECF Real-Time Shared Editing to other text editors. To do so, all that's required is ECF 2.0 with DocShare installed. ECF 2.0 runs on either Eclipse 3.3 or Eclipse 3.4 (see here to download ECF 2.0).

Then given a text editor with context id com.foo.MyEditorContextID in either a new plugin, or an existing plugin, one can place markup like the following:

<extension point="org.eclipse.ui.menus">
  <menuContribution locationURI="popup:com.foo.MyEditorContextID">
    <dynamic class="org.eclipse.ecf.internal.provisional.docshare.menu.DocShareRosterMenuContributionItem"
             id="com.foo.MyEditorContextID.dynamic1">
    </dynamic>
  </menuContribution>
</extension>

The new or existing plugin that has this markup will have a dependency on the org.eclipse.ecf.internal.provisional.docshare.menu.DocShareRosterMenuContributionItem class (and therefore the org.eclipse.ecf.docshare plugin), as well as the org.eclipse.ui.menus extension point exposed by the Eclipse Platform UI.

NOTE: The DocShare API is provisional, and is very likely to change in future versions of ECF as per bug 234142. That is why the package for the contribution item classes are in 'internal.provisional' package. Note also that people that wish to define a new other user interface for access to starting/stopping real-time shared editing may do so as they wish, and use the DocShare src code as example.

Example.jpg

When the plugin running this is run, and the user clicks on the editor's context menu, the Share Editor with menu item should be on the context menu. And if the editor implements ITextEditor and IDocumentListener as described above, then the ECF real-time shared editing should work with that editor.

If it does not, for whatever reason, please file a bug at bugs.eclipse.org under Technology->ECF and write to ecf-dev at eclipse.org.

Back to the top