loadProject needs restart to work ?
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 7
- Joined: Wed Dec 01, 2021 1:32 pm
loadProject needs restart to work ?
Hi,
I'm using the method in order to update some profiling attributes automatically.
In order to do that, I update the existing project file programmatically. When calling, nothing appends on UI (no confirm dialog or something) which is OK.
But if I go after that in my preferences, profiling attributes aren't updated :
Regards
I'm using the method
Code: Select all
ro.sync.exml.workspace.api.standalone.project.ProjectController#loadProject
In order to do that, I update the existing project file programmatically. When calling
Code: Select all
loadProject
But if I go after that in my preferences, profiling attributes aren't updated :
profiling-attr-1.png
If I restart my Oxygen editor, and then go back to my preferences without doing something, profiling attributes seems to be OK :
profiling-attr-2.png
Is there any way to do that without restarting Oxygen ?Regards
You do not have the required permissions to view the files attached to this post.
-
- Posts: 78
- Joined: Wed Jun 22, 2016 2:48 pm
Re: loadProject needs restart to work ?
Post by adrian_sorop »
Hi!
No, this API does not need Oxygen restart to work.
I've tested on my side (with Oxygen 24.0) and the work as expected.
All settings were loaded without restarting Oxygen.
A "blind" advice would be to try loading the project on AWT: use
Give it a try and let me know if this was usefull.
If this doesn't work, please give us more infomation: Oxygen version, how the API is used (a small code snippet), where is the new project located (on a local drive, on a web drive) and other information that you might consider important.
Best regards,
Adrian S.
No, this API does not need Oxygen restart to work.
I've tested on my side (with Oxygen 24.0) and the
Code: Select all
ro.sync.exml.workspace.api.standalone.project.ProjectController.loadProject(File)
All settings were loaded without restarting Oxygen.
A "blind" advice would be to try loading the project on AWT: use
Code: Select all
javax.swing.SwingUtilities.invokeLater(Runnable)
If this doesn't work, please give us more infomation: Oxygen version, how the API is used (a small code snippet), where is the new project located (on a local drive, on a web drive) and other information that you might consider important.
Best regards,
Adrian S.
Adrian Sorop
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 7
- Joined: Wed Dec 01, 2021 1:32 pm
Re: loadProject needs restart to work ?
Hi,
Thanks for your answer.
I've updated a little bit my code and still doesn't have the expected result.
I think I'm not using correctly the loadProject function.
Here is a piece of code, perhaps you could help me ?
Some additional explanations :
- Before doing this, I copy the file with my new profiling attributes in current project file (.xpr)
- 'existingProjectFile' is the current .xpr file.
Now I've got this result :
- Nothing is updated in my preferences but when I go to project view, it detects that the project file was updated (if I click on 'reload' then it's ok)
In my first atempt, I was not calling 'open' function. I don't know if this is required or not.
Any help would be appreciated
Thanks for your answer.
I've updated a little bit my code and still doesn't have the expected result.
I think I'm not using correctly the loadProject function.
Here is a piece of code, perhaps you could help me ?
Code: Select all
PluginWorkspaceProvider.getPluginWorkspace().open(existingProjectFile.toURI().toURL()); //open updated file with profiling attributes
final StandalonePluginWorkspace standalonePluginWorkspace = (StandalonePluginWorkspace) PluginWorkspaceProvider.getPluginWorkspace();
standalonePluginWorkspace.getProjectManager().loadProject(existingProjectFile); //trying to load project file
- Before doing this, I copy the file with my new profiling attributes in current project file (.xpr)
- 'existingProjectFile' is the current .xpr file.
Now I've got this result :
- Nothing is updated in my preferences but when I go to project view, it detects that the project file was updated (if I click on 'reload' then it's ok)
In my first atempt, I was not calling 'open' function. I don't know if this is required or not.
Any help would be appreciated
-
- Posts: 78
- Joined: Wed Jun 22, 2016 2:48 pm
Re: loadProject needs restart to work ?
Post by adrian_sorop »
All right,
Now I fully undestand what and how you want to do.
I've tested and reproduced the problem.
The options are not recognized becaused Oxygen doesn't "undestand" that you use the loadProject() API like a refresh.
The Project Controller uses the a File Change Watcher and the file change watcher decides when the data should be read from disk and when is read from memeory. Because you bypass the file change watcher, the options used are the one cached (from memory).
I'll log an issue to treat this use-case.
Meanwhile, the first workaround I can think of is to load a dummy project.
After the dummy project is loaded, load again the original project.
This way, Oxygen will be forced to read the "real" options from disk, not the cached ones.
The downside for this issue is that you might see a flicker when the project switching occurs
Let me know if this works out for you,
Adrian S
Now I fully undestand what and how you want to do.
I've tested and reproduced the problem.
The options are not recognized becaused Oxygen doesn't "undestand" that you use the loadProject() API like a refresh.
The Project Controller uses the a File Change Watcher and the file change watcher decides when the data should be read from disk and when is read from memeory. Because you bypass the file change watcher, the options used are the one cached (from memory).
I'll log an issue to treat this use-case.
Meanwhile, the first workaround I can think of is to load a dummy project.
After the dummy project is loaded, load again the original project.
This way, Oxygen will be forced to read the "real" options from disk, not the cached ones.
The downside for this issue is that you might see a flicker when the project switching occurs
Code: Select all
StandalonePluginWorkspace pluginWorkspace = (StandalonePluginWorkspace) PluginWorkspaceProvider.getPluginWorkspace();
ProjectController projectController = pluginWorkspace.getProjectManager();
File theRealProjectFile = new File(projectController.getCurrentProjectURL().toURI());
// do here the changes you need
// load a dummy project
projectController.loadProject(new File("file/path/to/a/dummy/project.xpr"));
// load the real project, this time the values will be read from disk, not from memory
projectController.loadProject(theRealProjectFile);
Adrian S
Adrian Sorop
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “SDK-API, Frameworks - Document Types”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ 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