XML Editor´s SelectionProvider
Oxygen general issues.
-
- Posts: 206
- Joined: Thu Dec 01, 2011 4:22 pm
- Location: Hamburg, Germany
XML Editor´s SelectionProvider
Hello,
Currently I am trying to use the SelectionService of Eclipse to view meta data of our business objects in the Eclipse Property View like it is described in the http://www.eclipse.org/articles/article ... index.html tutorial.
Using the org.eclipse.core.runtime.adapters extension to builds works quite well with our Objects and a suitable IPropertySource of those objects.
Now I would to know which kind of objects does the of your XML Editor provide?
I want to achieve something similar like this :
Unfortunately it seems that an AuthorNode is never provided by the SelectionService of Eclipse. But something similar must be provided I think because otherwise the outline view wouldn´t react either.
Hopefully this makes clear what I am aiming at, otherwise ask and I´ll try to describe my intent in more detail.
Currently I am trying to use the SelectionService of Eclipse to view meta data of our business objects in the Eclipse Property View like it is described in the http://www.eclipse.org/articles/article ... index.html tutorial.
Using the org.eclipse.core.runtime.adapters extension to build
Code: Select all
IAdapterFactory
Now I would to know which kind of objects does the
Code: Select all
ISelectionProvider
I want to achieve something similar like this :
Code: Select all
public class AuthorNodeAdapterFactory implements IAdapterFactory {
@Override
public Object getAdapter(Object adaptableObject, Class adapterType) {
if (adapterType == IPropertySource.class) {
return new AuthorNodePropertySource((AuthorNode) adaptableObject);
}
return null;
}
@Override
public Class[] getAdapterList() {
return new Class[] { IPropertySource.class };
}
}
Hopefully this makes clear what I am aiming at, otherwise ask and I´ll try to describe my intent in more detail.
Simon Scholz
vogella GmbH
http://www.vogella.com
vogella GmbH
http://www.vogella.com
-
- Posts: 9446
- Joined: Fri Jul 09, 2004 5:18 pm
Re: XML Editor´s SelectionProvider
Hi Simon,
I think I understand.
We have not been interested until now such extensions because we did not see benefits in implementing them.
For example our Author Outline implements an ISelectionProvider but does not manage listeners for firing selection events, so it's basically not functional.
Are you also interested in our Author page to implement such a selection provider? The Author page is 100% drawn on a Canvas so it lacks default support which would be available in a text viewer.
Are you interested in seeing in the Eclipse Properties view properties of a certain AuthorNode? If so, what properties would be useful to present for such an XML element? Or are you interested in calling the selection service from Eclipse and obtain the AuthorNode which is currently selected?
Regards,
Radu
I think I understand.
We have not been interested until now such extensions because we did not see benefits in implementing them.
For example our Author Outline implements an ISelectionProvider but does not manage listeners for firing selection events, so it's basically not functional.
Are you also interested in our Author page to implement such a selection provider? The Author page is 100% drawn on a Canvas so it lacks default support which would be available in a text viewer.
Are you interested in seeing in the Eclipse Properties view properties of a certain AuthorNode? If so, what properties would be useful to present for such an XML element? Or are you interested in calling the selection service from Eclipse and obtain the AuthorNode which is currently selected?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 206
- Joined: Thu Dec 01, 2011 4:22 pm
- Location: Hamburg, Germany
Re: XML Editor´s SelectionProvider
Hello Radu,
Now I´ve done it like that :
I started thinking about the Adapter Framework, when I faced the problem of having different business objects(oxygens and ours).
In order to have those objects loosely coupled, also for objects which may come in the future , I decided to realize the communication of those objects between the viewparts with those adapters.
Regards,
Simon
This is what I wanted to achieve.Or are you interested in calling the selection service from Eclipse and obtain the AuthorNode which is currently selected?
Now I´ve done it like that :
Code: Select all
public class OxygenEditorSelectionProvider {
private WSEditorPage currentEditorPage = null;
private AuthorCaretListener caretListener = new AuthorCaretListener() {
@Override
public void caretMoved(AuthorCaretEvent caretEvent) {
IEditorPart activeEditor = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage()
.getActiveEditor();
if (activeEditor != null) {
ISelectionProvider selectionProvider = activeEditor.getSite()
.getSelectionProvider();
if (selectionProvider instanceof MultiPageSelectionProvider) {
StructuredSelection structuredSelection = new StructuredSelection(
caretEvent.getNode());
SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(
selectionProvider, structuredSelection);
((MultiPageSelectionProvider) selectionProvider)
.firePostSelectionChanged(selectionChangedEvent);
}
}
}
};
public OxygenEditorSelectionProvider() {
super();
init();
}
private void init() {
IPartListener partListener = new IPartListener() {
@Override
public void partOpened(IWorkbenchPart workbenchPart) {
if (workbenchPart instanceof WSEditor) {
final WSEditor ed = (WSEditor) workbenchPart;
partWSEditorChanged(ed);
ed.addPageChangedListener(new WSEditorPageChangedListener() {
@Override
public void editorPageChanged() {
OxygenEditorSelectionProvider.this
.partWSEditorChanged(ed);
}
});
}
}
@Override
public void partDeactivated(IWorkbenchPart arg0) {
// TODO Auto-generated method stub
}
@Override
public void partClosed(IWorkbenchPart arg0) {
// TODO Auto-generated method stub
}
@Override
public void partBroughtToTop(IWorkbenchPart arg0) {
// TODO Auto-generated method stub
}
@Override
public void partActivated(IWorkbenchPart arg0) {
// TODO Auto-generated method stub
}
};
IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow();
IPartService partService = activeWorkbenchWindow.getPartService();
partService.addPartListener(partListener);
IEditorPart activeEditor = activeWorkbenchWindow.getActivePage()
.getActiveEditor();
if (activeEditor instanceof WSEditor) {
final WSEditor ed = (WSEditor) activeEditor;
partWSEditorChanged(ed);
ed.addPageChangedListener(new WSEditorPageChangedListener() {
@Override
public void editorPageChanged() {
OxygenEditorSelectionProvider.this.partWSEditorChanged(ed);
}
});
}
}
private void partWSEditorChanged(WSEditor editor) {
WSEditorPage currentPage = editor.getCurrentPage();
if (currentPage instanceof WSAuthorEditorPage) {
if (!(currentPage.equals(this.currentEditorPage))) {
if (this.currentEditorPage instanceof WSAuthorEditorPage) {
((WSAuthorEditorPage) this.currentEditorPage)
.removeAuthorCaretListener(caretListener);
}
((WSAuthorEditorPage) currentPage)
.addAuthorCaretListener(caretListener);
this.currentEditorPage = currentPage;
}
}
}
}
In order to have those objects loosely coupled, also for objects which may come in the future , I decided to realize the communication of those objects between the viewparts with those adapters.
As I mentioned in one of my former threads, we have one generic viewpart for showing meta information of a currently selected object in the RCP client. So this viewpart does nearly the same job as the standard property view, but in a more generic way. We want to avoid having several views for showing meta information about certain objects.Are you interested in seeing in the Eclipse Properties view properties of a certain AuthorNode? If so, what properties would be useful to present for such an XML element?
Regards,
Simon
Simon Scholz
vogella GmbH
http://www.vogella.com
vogella GmbH
http://www.vogella.com
-
- Posts: 206
- Joined: Thu Dec 01, 2011 4:22 pm
- Location: Hamburg, Germany
Re: XML Editor´s SelectionProvider
I forgot to response on that question:
I know you have the Attributes View which is great, but it would be another view so that it would break our wish to only have one view, which shows all the meta data of all objects.
We want to display the textcontent, the attributes and custom PIs over an AuthorNode.If so, what properties would be useful to present for such an XML element?
I know you have the Attributes View which is great, but it would be another view so that it would break our wish to only have one view, which shows all the meta data of all objects.
Simon Scholz
vogella GmbH
http://www.vogella.com
vogella GmbH
http://www.vogella.com
-
- Posts: 9446
- Joined: Fri Jul 09, 2004 5:18 pm
Re: XML Editor´s SelectionProvider
Hi Simon,
I understand, we will consider providing a better implementation for the selection providers both in the Author and Outline view.
Regards,
Radu
I understand, we will consider providing a better implementation for the selection providers both in the Author and Outline view.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service