Jump to: navigation, search

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

 
(23 intermediate revisions by 3 users not shown)
Line 3: Line 3:
 
By default, ECF supports doing shared editing with the JDT Java source code editor, and/or the default texteditor.
 
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.).
+
It's quite possible, however, 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.
+
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 [https://bugs.eclipse.org/bugs/show_bug.cgi?id=238029 #238029] to discuss further the capabilities described here.
  
Also, see ECF bug [https://bugs.eclipse.org/bugs/show_bug.cgi?id=238029 #238029].
+
==How '''Share Editor With''' Appears on an Editor's Context Menu==
 
+
==How ECF Shared Editing Appears on an Editor's Context Menu==
+
  
 
First, the [[DocShare_Plugin|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:
 
First, the [[DocShare_Plugin|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:
Line 18: Line 16:
 
In the plugin.xml of the ECF DocShare plugin is the following markup
 
In the plugin.xml of the ECF DocShare plugin is the following markup
  
<pre>
+
<source lang="xml">
 
<extension point="org.eclipse.ui.menus">
 
<extension point="org.eclipse.ui.menus">
 
   <menuContribution locationURI="popup:#CompilationUnitEditorContext">
 
   <menuContribution locationURI="popup:#CompilationUnitEditorContext">
     <dynamic class="org.eclipse.ecf.internal.provisional.docshare.menu.DocShareRosterMenuContributionItem"
+
     <dynamic class="org.eclipse.ecf.docshare.menu.DocShareRosterMenuContributionItem"
 
             id="org.eclipse.ecf.editorshare.dynamic1">
 
             id="org.eclipse.ecf.editorshare.dynamic1">
 
     </dynamic>
 
     </dynamic>
Line 29: Line 27:
 
<extension point="org.eclipse.ui.menus">
 
<extension point="org.eclipse.ui.menus">
 
   <menuContribution locationURI="popup:#TextEditorContext">
 
   <menuContribution locationURI="popup:#TextEditorContext">
     <dynamic class="org.eclipse.ecf.internal.provisional.docshare.menu.DocShareRosterMenuContributionItem"
+
     <dynamic class="org.eclipse.ecf.docshare.menu.DocShareRosterMenuContributionItem"
 
             id="org.eclipse.ecf.editorshare.dynamic2">
 
             id="org.eclipse.ecf.editorshare.dynamic2">
 
     </dynamic>
 
     </dynamic>
 
   </menuContribution>
 
   </menuContribution>
 
</extension>
 
</extension>
</pre>
+
</source>
  
[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.ecf/plugins/org.eclipse.ecf.docshare/plugin.xml?root=Technology_Project&view=log Here is the plugin.xml in the CVS repo]
+
[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.ecf/framework/bundles/org.eclipse.ecf.docshare/plugin.xml?root=RT_Project&view=log Here] is the plugin.xml in the CVS repository.
  
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'''.   
+
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'''.  [http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/workbench_advext_contexts.htm            Here is the Eclipse Help for Context ids].
  
[http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/workbench_advext_contexts.htm            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 [http://help.eclipse.org/stable/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/texteditor/ITextEditor.html 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.
  
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 [http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/texteditor/ITextEditor.html 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 [http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/jface/text/IDocumentListener.html IDocumentListener interface] among some other in the '''org.eclipse.ui.jface.text''' bundle.
+
==Adding '''Share Editor With''' Menu Item To Other Text Editors==
+
==Using ECF Shared Editing with 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 [http://www.eclipse.org/ecf/downloads/php here to download ECF 2.0].
+
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 [http://www.eclipse.org/ecf/downloads.php here to download ECF 2.0]).
  
Then given a text editor with context id '''com.foo.MyContextID''' in either a new plugin, or an existing plugin, one can place markup like the following:
+
For example, in the [http://www.eclipse.org/pdt PDT] PHP source editor, the  context ID is '''org.eclipse.php.core.phpsource.source.EditorContext'''.  With this context ID, one can create markup like the following:
  
<pre>
+
<source lang="xml">
 
<extension point="org.eclipse.ui.menus">
 
<extension point="org.eclipse.ui.menus">
   <menuContribution locationURI="popup:com.foo.MyContextID">
+
   <menuContribution locationURI="popup:org.eclipse.php.core.phpsource.source.EditorContext">
     <dynamic class="org.eclipse.ecf.internal.provisional.docshare.menu.DocShareRosterMenuContributionItem"
+
     <dynamic class="org.eclipse.ecf.docshare.menu.DocShareRosterMenuContributionItem"
             id="com.foo.MyContextID.dynamic1">
+
             id="com.foo.MyEditorContextID.dynamic1">
 
     </dynamic>
 
     </dynamic>
 
   </menuContribution>
 
   </menuContribution>
 
</extension>
 
</extension>
 +
</source>
  
</pre>
+
The new or existing plugin that has this markup will have a dependency on the '''org.eclipse.ecf.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 '''org.eclipse.ui''' plugin.  When the plugin running this is run, and the user clicks on the PHP source editor's context menu, the '''Share Editor with''' menu item will appear.  And since the editor implements ITextEditor and IDocumentListener as described above, the ECF real-time shared editing will work to show and synchronize the editor state.
  
This new or existing plugin will have a dependency on the '''org.eclipse.ecf.internal.provisional.docshare.menu.DocShareRosterMenuContributionItem''' class, as well as the '''org.eclipse.ui.menus''' extension point exposed by the Eclipse Platform.
+
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'''.
  
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.
+
NOTE: People that wish to define a new/other UI for access to starting/stopping real-time shared editing may do so as they wish, and use the new Sync API (org.eclipse.ecf.sync) and the [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.ecf/framework/bundles/org.eclipse.ecf.docshare/?root=RT_Project DocShare src code] as example.
  
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'''.
+
==Creating a New Plugin==
 +
 
 +
To create a new plugin, so that the markup above can be added to the plugin.xml, do the following
 +
 
 +
*Choose File->New->Project...->Plug-in Project->Next
 +
*Give new project/plugin name->Next->Next
 +
*Unselect the "Create a plug-in using one of the templates" check box->Finish
 +
*Add org.eclipse.ecf.docshare plugin to Dependencies
 +
*Add the markup like the above to plugin.xml (substituting your editor's context id for '''org.eclipse.php.core.phpsource.source.EditorContext''' and a new id for '''com.foo.MyEditorContextID.dynamic1'''.
 +
 
 +
Then run/debug a new Eclipse Application, and include your new plugin.  After connecting to an XMPP/XMPPS account, and opening the editor, you should see the '''Share Editor with''' item on the context menu.
 +
 
 +
 
 +
{{ECF}}
 +
[[Category:Eclipse Communication Framework]]
 +
[[Category:EclipseRT]]
 +
[[Category:Draft Documentation]]

Latest revision as of 14:46, 2 November 2009

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, 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.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.docshare.menu.DocShareRosterMenuContributionItem"
             id="org.eclipse.ecf.editorshare.dynamic2">
    </dynamic>
  </menuContribution>
</extension>

Here is the plugin.xml in the CVS repository.

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.

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).

For example, in the PDT PHP source editor, the context ID is org.eclipse.php.core.phpsource.source.EditorContext. With this context ID, one can create markup like the following:

<extension point="org.eclipse.ui.menus">
  <menuContribution locationURI="popup:org.eclipse.php.core.phpsource.source.EditorContext">
    <dynamic class="org.eclipse.ecf.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.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 org.eclipse.ui plugin. When the plugin running this is run, and the user clicks on the PHP source editor's context menu, the Share Editor with menu item will appear. And since the editor implements ITextEditor and IDocumentListener as described above, the ECF real-time shared editing will work to show and synchronize the editor state.

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.

NOTE: People that wish to define a new/other UI for access to starting/stopping real-time shared editing may do so as they wish, and use the new Sync API (org.eclipse.ecf.sync) and the DocShare src code as example.

Creating a New Plugin

To create a new plugin, so that the markup above can be added to the plugin.xml, do the following

  • Choose File->New->Project...->Plug-in Project->Next
  • Give new project/plugin name->Next->Next
  • Unselect the "Create a plug-in using one of the templates" check box->Finish
  • Add org.eclipse.ecf.docshare plugin to Dependencies
  • Add the markup like the above to plugin.xml (substituting your editor's context id for org.eclipse.php.core.phpsource.source.EditorContext and a new id for com.foo.MyEditorContextID.dynamic1.

Then run/debug a new Eclipse Application, and include your new plugin. After connecting to an XMPP/XMPPS account, and opening the editor, you should see the Share Editor with item on the context menu.


Eclipse Communication Framework
API
API DocumentationJavadocProviders
Development
Development GuidelinesIntegrators Guide