Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Oomph » Resource Creation tasks not executed in new workspace
Resource Creation tasks not executed in new workspace [message #1751882] Mon, 16 January 2017 13:20 Go to next message
Andrey Loskutov is currently offline Andrey LoskutovFriend
Messages: 89
Registered: July 2009
Member
I've made a setup which includes Resource Creation tasks *for the installation* like this below:

<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<setup:ResourceCreationTask
    xmi:version="2.0"
    xmlns:xmi="http://www.omg.org/XMI"
    xmlns:setup="http://www.eclipse.org/oomph/setup/1.0"
    content="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>&#xA;&lt;section name=&quot;Workbench&quot;>&#xA;&#x9;&lt;section name=&quot;org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart&quot;>&#xA;&#x9;&#x9;&lt;item value=&quot;2&quot; key=&quot;layout&quot;/>&#xA;&#x9;&#x9;&lt;item value=&quot;true&quot; key=&quot;group_libraries&quot;/>&#xA;&#x9;&#x9;&lt;item value=&quot;2&quot; key=&quot;rootMode&quot;/>&#xA;&#x9;&#x9;&lt;item value=&quot;true&quot; key=&quot;linkWithEditor&quot;/>&#xA;&#x9;&lt;/section>&#xA;&lt;/section>"
    targetURL="${workspace.location|uri}/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml"
    encoding="UTF-8"/>


That works fine if I run the installer and start Eclipse with the workspace configured by installer.

However, if I simply say from the properly configured Eclipse "File->Switch Workspace->Other..." and enter a non-existing workspace path, the Eclipse instance started with the new workspace, executes only Preferences Tasks, but does *not* execute any of Resource Creation tasks (even if they are specified for "installation").

I guess the problem here is that the workspace starts JDT (or other plugins) *before* Oomph so that they manage to create those files before setup engine can create them (e.g. .metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml).

How I can deal with that? I would like that those files are "touched" once by Oomph even if they exists already. Is there any trick to do so?
Re: Resource Creation tasks not executed in new workspace [message #1751887 is a reply to message #1751882] Mon, 16 January 2017 14:29 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33258
Registered: July 2009
Senior Member
What kind of setup? Note that workspace.location is only known if there is a Workspace task (as in the Project catalogs in the standard index). If you want the installation to do such a thing for all workspace's even when there is no project stream referenced by the workspace's workspace.setup, you can use ${osgi.instance.area|file} instead.

It might well be that dialog settings files are created early, and then it's also likely that you changing the contents of that file won't be noticed until after the IDE restarts. There is a Resource Modification task for modifying resources, but if the settings are inspected on startup before Oomph performs its tasks, that's not likely to help...


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Resource Creation tasks not executed in new workspace [message #1751893 is a reply to message #1751887] Mon, 16 January 2017 15:08 Go to previous messageGo to next message
Andrey Loskutov is currently offline Andrey LoskutovFriend
Messages: 89
Registered: July 2009
Member
Ed Merks wrote on Mon, 16 January 2017 15:29
What kind of setup?

I'm trying to setup the entire product/workspace/project chain.

Ed Merks wrote on Mon, 16 January 2017 15:29

Note that workspace.location is only known if there is a Workspace task (as in the Project catalogs in the standard index).

Yep, there is a Workspace task.

Ed Merks wrote on Mon, 16 January 2017 15:29

If you want the installation to do such a thing for all workspace's even when there is no project stream referenced by the workspace's workspace.setup, you can use ${osgi.instance.area|file} instead.

Dou you mean, instead of writing
${workspace.location|uri}/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml

I should use
${osgi.instance.area|file}/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml

What would be the difference? Wouldn't be the same location then?

If I try to use this, installer tolds me that "osgi.instance.area" variable is undefined (in the variables page), so I have to remove BOOTSTRAP from the triggers. After that Eclipse can't resolve the variable at startup either, so the files aren't created at all.

Probably what would help (but need to be implemented): it would be nice if Oomph could plug-in itself into the "Switch workspace" dialog, so that it could run the Resource Creation tasks for the new workspace before workspace is started.

What wonders me: everything works absolutely fine for the workspaces created with the installer. I guess the installer runs the "Resource Creation" tasks *before* workspace startup?

Or the difference is, that if installer creates workspace, it creates the files for the selected project/stream but while switching to the new workspace there is no stream configured yet for that workspace?

Re: Resource Creation tasks not executed in new workspace [message #1751908 is a reply to message #1751893] Mon, 16 January 2017 18:12 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33258
Registered: July 2009
Senior Member
The point is that if you open a new workspace, there is no stream linked into that workspace.setp (which is demand created but empty), so it's a question of whether there is a workspace task in scope for the resource creation task you've specified. That's why I asked what kind of setup. Is the resource creation task in a project setup? If not, then in a new workspace there will be nothing to define the vale of that variable.

And yes, it's a question of when does that task perform. If it performs at bootstrap time, and a workspace task is in scope, then it will do it's thing (creating the resource) while the installer is running and so the resource will exist when the IDE runs. A resource creation task does not necessarily involve the workspace locations at all, so performing tasks during workspace switching (before the IDE actually launches with that workspace)) could affect any number of tasks and types of tasks. So yes, a new workspace has no streams so will not perform any tasks that are defined by some project setup...


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Import of multiple Maven Projects with same name
Next Topic:Creating WST runtimes
Goto Forum:
  


Current Time: Sun Dec 08 00:23:29 GMT 2024

Powered by FUDForum. Page generated in 0.03570 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top