[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[jdt-ui-dev] How to call Javadoc view?
|
Hello everybody,
I wrote a new editor to document my APIs. It also supports Java and Javadoc. I would like to show the Javadoc of the current selected method by my editor in the Javadoc view (like the Project Explorer does with Java-Files). But I didn't get it working yet.
In my editor I implemented the interface ISelectionProvider:
<code>
private Set<ISelectionChangedListener> listeners = new HashSet<ISelectionChangedListener>();
@Override
public void setSelection(ISelection arg0)
{
// Get the selected method from my editor...
IJavaElement selection = (IJavaElement) ...;
if (selection != null)
{
Object[] elements = new Object[1];
elements[0] = selection;
StructuredSelection sel = new StructuredSelection(elements);
SelectionChangedEvent event = new SelectionChangedEvent(this, sel);
for (ISelectionChangedListener listener : listeners)
{
listener.selectionChanged(event);
}
}
@Override
public void removeSelectionChangedListener(ISelectionChangedListener arg0)
{
listeners.remove(arg0);
}
@Override
public ISelection getSelection()
{
// Get the method from my editor ...
IJavaElement selection = (IJavaElement)...;
if (selection != null)
{
Object[] elements = new Object[1];
elements[0] = selection;
StructuredSelection sel = new StructuredSelection(elements);
return sel;
}
return null;
}
@Override
public void addSelectionChangedListener(ISelectionChangedListener arg0)
{
listeners.add(arg0);
}
</code>
In the init-method I register my selection provider
<code>
getSite().setSelectionProvider(this);
</code>
But when changing my selected method, the Javadoc View does not react. By using the debugger I could see that the changed selection is set to the listeners. But there is no Javadoc view in there. Is my approach correct? Could anybody give me a hint or an example?
Greetings
Jan Chistian