You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Pierre-Arnaud Marcelot <pa...@marcelot.net> on 2009/08/10 18:00:49 UTC

[Studio] Adding extensibility to Entry Editor

Hi all,
We've had an interesting discussing on IRC with Stefan S. about adding
extensibility to the Entry Editor.

We'd like to introduce a new mechanism to allow the addition of new editors.
This will allow us to have for example a single-window editor and a
multi-window editor for entries.

To do so, we'll introduce a new custom extension point with the following
properties:

   - the class name of the editor
   - a name
   - if it is single-window or multi-window
   - a priority
   - an image
   - a description

The class of the editor should implement our Editor's interface which
defines only one method:

   - boolean canHandle(IEntry entry) /** This method indicates if the editor
   can handle the given entry. */

This feature should be part of the 1.5 release of Studio

Regards
Pierre-Arnaud

Re: [Studio] Adding extensibility to Entry Editor

Posted by Pierre-Arnaud Marcelot <pa...@marcelot.net>.
Hi again,
Actually there's no need to get the properties of the General Preference
Page of Eclipse and to initialize the OpenStrategy object with an open
method.

All this is done by the Workbench plugin.

The only thing we need to do is to add an IOpenEventListener:

        OpenStrategy handler = new OpenStrategy(
view.getMainWidget().getViewer().getTree() );

        handler.addOpenListener( new IOpenEventListener()

        {

            public void handleOpen( SelectionEvent e )

            {

                System.out.println( "handleOpen() " + e );

            }

        } );

I tested it and it works fine. :)
Regards,
Pierre-Arnaud

On Wed, Aug 12, 2009 at 5:19 PM, Pierre-Arnaud Marcelot <pa...@marcelot.net>wrote:

> Stefan S.,
> FYI, here's how to access the properties of the General Preference page of
> Eclipse for "Open mode":
>
>    - OPEN_ON_SINGLE_CLICK  --
>     WorkbenchPlugin.getDefault().getPreferenceStore().getBoolean(
>    IPreferenceConstants.OPEN_ON_SINGLE_CLICK );
>    - SELECT_ON_HOVER  --
>     WorkbenchPlugin.getDefault().getPreferenceStore().getBoolean(
>    IPreferenceConstants.SELECT_ON_HOVER );
>    - OPEN_AFTER_DELAY ("Open when using arrow keys" in the preference
>    page)  --  WorkbenchPlugin.getDefault().getPreferenceStore().getBoolean(
>    IPreferenceConstants.OPEN_AFTER_DELAY );
>
> Eclipse is using the "OpenStrategy.setOpenMethod(singleClickMethod);"
> instruction to set the open mode globally.
>
> And uses this code to determine if an object should be opened:
>
> OpenStrategy handler = new OpenStrategy(control);
>
> handler.addOpenListener(new IOpenEventListener() {
>
> public void handleOpen(SelectionEvent e) {
>
> ... // code to handle the open event.
>
> }
>
> });
>
> Regards,
> Pierre-Arnaud
>
>
> On Wed, Aug 12, 2009 at 2:30 PM, Pierre-Arnaud Marcelot <pa...@marcelot.net>wrote:
>
>> Hi all,
>> Yesterday Stefan created the extension point and I created a preference
>> page where the user will be able to reorder the editors.
>>
>> When it is defined in the plugin.xml file of a plugin, each Entry Editor
>> is assigned a priority.
>> This priority is an integer based property.
>> All Entry Editors are sorted by priority.
>>
>> When a new editor needs to be opened, we're going to get an ordered list
>> of these Entry Editors and iterate on this list
>> until we find an editor that can handle ('boolean canHandle(...)' method)
>> the given entry.
>>
>> Stefan and I would like to allow the user to reorder the editors via the
>> preference page.
>>
>> As soon as the user reorders the editors, the original priority value is
>> discarded and the user's order is saved in the plugin's preferences.
>>
>> Now, I have a question.
>>
>> Let's say the user has re-organized the Entry Editors and he adds a new
>> plugin that has a new entry editor.
>> At the next launch of Apache Directory Studio, we'll notice that a new
>> Entry Editor is available, but what should we do with it ? Where should we
>> place it in the Entry Editors order ?
>>
>> I think we should discard the priority information since the user has
>> defined his own order and that this new editor should be placed at the end
>> of the list.
>>
>> Thoughts ?
>>
>> Thanks,
>> Pierre-Arnaud
>>
>> On Mon, Aug 10, 2009 at 6:00 PM, Pierre-Arnaud Marcelot <pa...@marcelot.net>wrote:
>>
>>> Hi all,
>>> We've had an interesting discussing on IRC with Stefan S. about adding
>>> extensibility to the Entry Editor.
>>>
>>> We'd like to introduce a new mechanism to allow the addition of new
>>> editors.
>>> This will allow us to have for example a single-window editor and a
>>> multi-window editor for entries.
>>>
>>> To do so, we'll introduce a new custom extension point with the following
>>> properties:
>>>
>>>    - the class name of the editor
>>>    - a name
>>>    - if it is single-window or multi-window
>>>    - a priority
>>>    - an image
>>>    - a description
>>>
>>> The class of the editor should implement our Editor's interface which
>>> defines only one method:
>>>
>>>    - boolean canHandle(IEntry entry) /** This method indicates if the
>>>    editor can handle the given entry. */
>>>
>>> This feature should be part of the 1.5 release of Studio
>>>
>>> Regards
>>> Pierre-Arnaud
>>>
>>
>>
>

Re: [Studio] Adding extensibility to Entry Editor

Posted by Pierre-Arnaud Marcelot <pa...@marcelot.net>.
Stefan S.,
FYI, here's how to access the properties of the General Preference page of
Eclipse for "Open mode":

   - OPEN_ON_SINGLE_CLICK  --
    WorkbenchPlugin.getDefault().getPreferenceStore().getBoolean(
   IPreferenceConstants.OPEN_ON_SINGLE_CLICK );
   - SELECT_ON_HOVER  --
    WorkbenchPlugin.getDefault().getPreferenceStore().getBoolean(
   IPreferenceConstants.SELECT_ON_HOVER );
   - OPEN_AFTER_DELAY ("Open when using arrow keys" in the preference page)
    --  WorkbenchPlugin.getDefault().getPreferenceStore().getBoolean(
   IPreferenceConstants.OPEN_AFTER_DELAY );

Eclipse is using the "OpenStrategy.setOpenMethod(singleClickMethod);"
instruction to set the open mode globally.

And uses this code to determine if an object should be opened:

OpenStrategy handler = new OpenStrategy(control);

handler.addOpenListener(new IOpenEventListener() {

public void handleOpen(SelectionEvent e) {

... // code to handle the open event.

}

});

Regards,
Pierre-Arnaud


On Wed, Aug 12, 2009 at 2:30 PM, Pierre-Arnaud Marcelot <pa...@marcelot.net>wrote:

> Hi all,
> Yesterday Stefan created the extension point and I created a preference
> page where the user will be able to reorder the editors.
>
> When it is defined in the plugin.xml file of a plugin, each Entry Editor is
> assigned a priority.
> This priority is an integer based property.
> All Entry Editors are sorted by priority.
>
> When a new editor needs to be opened, we're going to get an ordered list of
> these Entry Editors and iterate on this list
> until we find an editor that can handle ('boolean canHandle(...)' method)
> the given entry.
>
> Stefan and I would like to allow the user to reorder the editors via the
> preference page.
>
> As soon as the user reorders the editors, the original priority value is
> discarded and the user's order is saved in the plugin's preferences.
>
> Now, I have a question.
>
> Let's say the user has re-organized the Entry Editors and he adds a new
> plugin that has a new entry editor.
> At the next launch of Apache Directory Studio, we'll notice that a new
> Entry Editor is available, but what should we do with it ? Where should we
> place it in the Entry Editors order ?
>
> I think we should discard the priority information since the user has
> defined his own order and that this new editor should be placed at the end
> of the list.
>
> Thoughts ?
>
> Thanks,
> Pierre-Arnaud
>
> On Mon, Aug 10, 2009 at 6:00 PM, Pierre-Arnaud Marcelot <pa...@marcelot.net>wrote:
>
>> Hi all,
>> We've had an interesting discussing on IRC with Stefan S. about adding
>> extensibility to the Entry Editor.
>>
>> We'd like to introduce a new mechanism to allow the addition of new
>> editors.
>> This will allow us to have for example a single-window editor and a
>> multi-window editor for entries.
>>
>> To do so, we'll introduce a new custom extension point with the following
>> properties:
>>
>>    - the class name of the editor
>>    - a name
>>    - if it is single-window or multi-window
>>    - a priority
>>    - an image
>>    - a description
>>
>> The class of the editor should implement our Editor's interface which
>> defines only one method:
>>
>>    - boolean canHandle(IEntry entry) /** This method indicates if the
>>    editor can handle the given entry. */
>>
>> This feature should be part of the 1.5 release of Studio
>>
>> Regards
>> Pierre-Arnaud
>>
>
>

Re: [Studio] Adding extensibility to Entry Editor

Posted by Stefan Seelmann <se...@apache.org>.
Pierre-Arnaud Marcelot wrote:
 > Let's say the user has re-organized the Entry Editors and he adds a new
> plugin that has a new entry editor.
> At the next launch of Apache Directory Studio, we'll notice that a new
> Entry Editor is available, but what should we do with it ? Where should
> we place it in the Entry Editors order ?
> 
> I think we should discard the priority information since the user has
> defined his own order and that this new editor should be placed at the
> end of the list.
> 

Yes, I agree. Perhaps we could prompt the user about the new available
Entry Editor and ask him/her to check the order in the prefernce page?

Kind Regards,
Stefan

Re: [Studio] Adding extensibility to Entry Editor

Posted by Pierre-Arnaud Marcelot <pa...@marcelot.net>.
Hi all,
Yesterday Stefan created the extension point and I created a preference page
where the user will be able to reorder the editors.

When it is defined in the plugin.xml file of a plugin, each Entry Editor is
assigned a priority.
This priority is an integer based property.
All Entry Editors are sorted by priority.

When a new editor needs to be opened, we're going to get an ordered list of
these Entry Editors and iterate on this list
until we find an editor that can handle ('boolean canHandle(...)' method)
the given entry.

Stefan and I would like to allow the user to reorder the editors via the
preference page.

As soon as the user reorders the editors, the original priority value is
discarded and the user's order is saved in the plugin's preferences.

Now, I have a question.

Let's say the user has re-organized the Entry Editors and he adds a new
plugin that has a new entry editor.
At the next launch of Apache Directory Studio, we'll notice that a new Entry
Editor is available, but what should we do with it ? Where should we place
it in the Entry Editors order ?

I think we should discard the priority information since the user has
defined his own order and that this new editor should be placed at the end
of the list.

Thoughts ?

Thanks,
Pierre-Arnaud

On Mon, Aug 10, 2009 at 6:00 PM, Pierre-Arnaud Marcelot <pa...@marcelot.net>wrote:

> Hi all,
> We've had an interesting discussing on IRC with Stefan S. about adding
> extensibility to the Entry Editor.
>
> We'd like to introduce a new mechanism to allow the addition of new
> editors.
> This will allow us to have for example a single-window editor and a
> multi-window editor for entries.
>
> To do so, we'll introduce a new custom extension point with the following
> properties:
>
>    - the class name of the editor
>    - a name
>    - if it is single-window or multi-window
>    - a priority
>    - an image
>    - a description
>
> The class of the editor should implement our Editor's interface which
> defines only one method:
>
>    - boolean canHandle(IEntry entry) /** This method indicates if the
>    editor can handle the given entry. */
>
> This feature should be part of the 1.5 release of Studio
>
> Regards
> Pierre-Arnaud
>