getFullySelectedNode throws NullPointerException
Oxygen general issues.
-
- Posts: 47
- Joined: Thu Jun 19, 2014 3:55 pm
getFullySelectedNode throws NullPointerException
Hi
we are using the Eclipse Oxygen Author in Version 15.2
I create a PropertyTester, which check if a node is fullySelected.
Now I load a file with this content:
The editor shows the content in the text-tab. When I jump to the author tab I get this exception:
Best regards
Denis
we are using the Eclipse Oxygen Author in Version 15.2
I create a PropertyTester, which check if a node is fullySelected
Code: Select all
AuthorNode fullySelectedNode = authorEditorPage.getFullySelectedNode();
Now I load a file with this content:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?><note nodeid="000001"><?graphic_path C:\Users\dzy\graphics/?><?tag ?><?rev A.1?><paragraph></paragraph></note>
Code: Select all
java.lang.NullPointerException
at ro.sync.exml.workspace.b.e.b.b.b.getSelectionStart(Unknown Source)
at ro.sync.exml.workspace.b.e.b.b.b.getFullySelectedNode(Unknown Source)
at ro.sync.ecss.extensions.g.getFullySelectedNode(Unknown Source)
at de.kgucms.kgu.tps.client.oxygen.integration.propertytester.EditorNodePropertyTester.test(EditorNodePropertyTester.java:47)
at org.eclipse.core.internal.expressions.Property.test(Property.java:58)
at org.eclipse.core.internal.expressions.TestExpression.evaluate(TestExpression.java:99)
at org.eclipse.core.internal.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:53)
at org.eclipse.core.internal.expressions.WithExpression.evaluate(WithExpression.java:72)
at org.eclipse.core.internal.expressions.ReferenceExpression.evaluate(ReferenceExpression.java:70)
at org.eclipse.core.internal.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:53)
at org.eclipse.core.internal.expressions.AndExpression.evaluate(AndExpression.java:29)
at org.eclipse.ui.internal.handlers.HandlerProxy.setEnabled(HandlerProxy.java:224)
at org.eclipse.core.commands.Command.setEnabled(Command.java:857)
at org.eclipse.ui.menus.CommandContributionItem.isEnabled(CommandContributionItem.java:968)
at org.eclipse.ui.menus.CommandContributionItem.updateToolItem(CommandContributionItem.java:661)
Denis
Denis Zygann
KGU Consulting GmbH
http://www.kgu-consulting.com
KGU Consulting GmbH
http://www.kgu-consulting.com
-
- Posts: 9472
- Joined: Fri Jul 09, 2004 5:18 pm
Re: getFullySelectedNode throws NullPointerException
Hi Denis,
The method seems to be called very early, before the document was properly loaded in the Author editor mode.
If on the method "EditorNodePropertyTester.test" you catch and log this exception, does it occur every time or only when the document is opened?
So somehow you should avoid calling the API while the document is being opened and is thus not properly instantiated.
Regards,
Radu
The method seems to be called very early, before the document was properly loaded in the Author editor mode.
If on the method "EditorNodePropertyTester.test" you catch and log this exception, does it occur every time or only when the document is opened?
So somehow you should avoid calling the API while the document is being opened and is thus not properly instantiated.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 47
- Joined: Thu Jun 19, 2014 3:55 pm
Re: getFullySelectedNode throws NullPointerException
Hi
The exception occurs only, when I switch from the Text editor mode to the Author editor mode (I check if the page is an WSAuthorEditorPage). So you are right.
Is it possible to fix this NullPointerException and get null back, in the next version?
Best regards,
Denis
The exception occurs only, when I switch from the Text editor mode to the Author editor mode (I check if the page is an WSAuthorEditorPage). So you are right.
Is it possible to fix this NullPointerException and get null back, in the next version?
Best regards,
Denis
Denis Zygann
KGU Consulting GmbH
http://www.kgu-consulting.com
KGU Consulting GmbH
http://www.kgu-consulting.com
-
- Posts: 9472
- Joined: Fri Jul 09, 2004 5:18 pm
Re: getFullySelectedNode throws NullPointerException
Hi Denis,
I can do that but any API call would probably break with unexpected errors at this stage as the switch is not yet completed.
I do not know much about what you are doing, did you add a contribution item on the internal toolbar of the Author editor mode?
I'm not sure how you could check via the API if the page switch has fully finished.
Regards,
Radu
I can do that but any API call would probably break with unexpected errors at this stage as the switch is not yet completed.
I do not know much about what you are doing, did you add a contribution item on the internal toolbar of the Author editor mode?
I'm not sure how you could check via the API if the page switch has fully finished.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 47
- Joined: Thu Jun 19, 2014 3:55 pm
Re: getFullySelectedNode throws NullPointerException
Hi Radu,
you are right, I did add a contribution item to the internal toolbar. This item is only available, when a fullySelectedNode is selected. For that reason I add the property Tester.
In this case it is sufficient to return null. Instead of throwing a NullPointerException.
Best regards,
Denis
you are right, I did add a contribution item to the internal toolbar. This item is only available, when a fullySelectedNode is selected. For that reason I add the property Tester.
Code: Select all
if (currentPage instanceof WSAuthorEditorPage) {
WSAuthorEditorPage authorEditorPage = (WSAuthorEditorPage) currentPage;
try {
AuthorNode fullySelectedNode = authorEditorPage.getFullySelectedNode();
return fullySelectedNode != null;
} catch (NullPointerException e) {
return false;
}
}
Best regards,
Denis
Denis Zygann
KGU Consulting GmbH
http://www.kgu-consulting.com
KGU Consulting GmbH
http://www.kgu-consulting.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