Is there a way to have some manual-layout edits in a Spring Integration graph re-order elements in the underlying XML context file? - eclipse

I'm currently using Spring Tool Suite (STS) (Version: 3.6.3.CI-B2266066, Build Id: 201411050946, Platform: Eclipse Luna SR1 (4.4.1)) with Spring Integration 4.1.0.
I have a Spring configuration XML file that includes the Spring Integration namespace. I go into the integration-graph tab and go into "manual layout" mode to spruce-up my flow. If I then turn "Enable Automatic Layout" back on the graph reverts back to how it looked before I made my manual edits. If I then go back into "manual layout" mode my edits are still saved. That works as expected.
It appears that the automatic-layout is somewhat tied to the order that elements are defined within the Spring context XML file itself. Meaning that if I change the order of elements within the XML file the layout on the graph will also change. It might be a nice feature to allow someone to perform some manual layouts then have the editor do a best-effort to save those edits to the underlying XML file. We have some decent sized XML files and often use the automatic-layout mode. It's cumbersome to then have to manually move things around in the XML file to make the layout show properly in the graph. I know not all edits would be able to be saved in the XML file (i.e. exact positioning and edits would be lost) but some of the edits probably could be saved (i.e. this channel needs to be defined above this channel in the XML file since it's showing in the manually-edited graph above that channel.
Perhaps there's a way to do that already that I'm missing?

No, there is no way to edit this graph manually... If this is allowed then the layout data needs to be persisted somehow. There is a possibility of adding more layouts to chose from from the GEF Zest project. This could be an alternative for what you are asking. Please submit a JIRA request for enhacement against Spring Tool Suite project :-) (https://issuetracker.springsource.com/browse/)

Related

How to transform from nunjucks to java then back to a nunjucks template

We are creating a microservice bootstrap project with a code-generator using a Backstage application directory - allowing users to create a starter microservice project using the backstage app wizard.
This means we have some java application code that was then templatized using nunjucks.
However, if other developers want to modify or evolve that template code, they would have to render the template to java code (a spring boot app) then develop on it: modify, test, debug. And then when they are done, they would have to re-templatize the code before committing the template code back to backstage.
My question is how can we automate or simplify that re-templatizing step back to nunjucks. Maybe we can preserve some of the templating info in comments so that we can automatically re-apply templating to those areas? Is there another simpler way to automate or assist turning the code back into a template?
Since multiple developers will be working on this over a long period of time, I think it would be unrealistic to expect users to update back template expressions everywhere if they become interspersed throughout the code.

Why can't my bpmn xml file be displayed correctly in Eclipse BPMN2 Modeler?

I programmatically generated an XML format .bpmn file with no BPMN Diagram elements. I want to use Eclipse BPMN2 Modeler to generate the diagram elements automatically for me. But when I open the file using the Eclipse Bpmn2 Diagram Editor, it only shows me empty pools with nothing in it. I cannot see any detail of my processes.
Could anyone tell me why it is so and how to fix the problem to make it display all the information of my processes?
Due to character number limit, I cannot paste my bpmn file here
Below is the link for you to download my original bpmn xml file and the wrongly generated picture:
https://drive.google.com/drive/folders/1_A_UydpVTsUYPbZT0zHazegLVc4ihGbI?usp=sharing
Thank you!
Your BPMN is not valid.
I tried to load it into an online BPMN editor at https://demo.bpmn.io/
, But below is the error.
I suggest to validate your BPMN manually or try to add some tasks to your process and re-try.
Update:
As per the official docs of Eclipse BPMN2 Modeler, this feature is NOT stable.
BPMN2 Modeler has the ability to import files that do not contain DI
metadata and will generate it using an auto layout algorithm. This
algorithm is still in the experimental phase as of this version – it
does a fair, but not optimal job of arranging the business logic
elements. If, after importing such a BPMN file, any elements that
appear “out of place” or not optimally placed can simply be dragged
around on the canvas for more visually pleasing configurations. Once
these changes have been saved, the DI metadata is added to the file
and the new layout is restored next time the file is opened.

Can I set apart changes I did in Moodle core to plugin?

I have changed the source code in the /lib/coursecatlib.php file. Can I set apart this changes to plugin?
There are some changes that can be made entirely withing plugins, by using the hooks made available in Moodle.
You haven't said what changes you have made to coursecatlib.php, but I suspect that anything you have done there will be hard/impossible to transfer into a plugin.
The closest you can get is usually to minimise the changes by adding a single line of code that calls a function in a custom plugin (preferably one in an automatically loaded class).

How to refresh the Eclipse main menu programmatically on runtime

I am looking for a way to to force Eclipse to refresh/rebuild its own main menu or even the whole view on runtime programmatically.
The reason why i need it this way is, because i have a plugin that iterates through a project and depending on the configuration of the selected project it loads a project specific plugin at runtime with:
FrameworkUtil.getBundle(this.getClass()).getBundleContext().installBundle(String).start()
Now the loaded plugin contributes to the org.eclipse.ui.main.menu extension point and even though the plugin is installed I don't see the new menu entry.
FYI: I am using Eclipse 3.x and E4 Tools
Now my questions are:
Is there acutally a way to refresh/rebuild parts of the Eclipse ui or maybe even the whole ui?
If not, can someone think of another approach? I thought of having a plugin which contributes only the menu and add the menu items programmatically.
But i couldn't believe that there is no way to refresh the view so i am asking this question.
I checked whether MMenu had a refresh method itself so i could get the object and just call the refresh method.
But in the end i didn't find a way to do this.
P.S. I am pretty new to Plugin Development and RCP so please don't blame me if the solution was obvious but i didn't realize it
Refresh/Rebuild UI
Short answer: no
In many places Eclipse extension points are loaded and information is stored in static fields (often in a Singleton). The plugin.xml data is not reloaded during the lifetime of the application, and certainly these bundles do not listen bundle events that would allow them to detect such changes.
Therefore, even if there were some method to call refresh on the whole UI, at least some (most?) of the code handling extension points would not see the effects of the new plugin.xmls.
Another Approach
To answer what you are trying to do, the "normal" thing to do would be to have each menu contribution's visibility be dependent on some expression, e.g. if the current selection adapts to MySpecialProject you could have it visible.
When you do it the normal way, and you leave everything to be lazily loaded, the java code for all those project type plug-ins will not be loaded until the commands are actually invoked for the first time.
To go the next step, you would probably have a main ui plug-in that defined a bunch of commands (e.g. build project, flash leds, format file, etc), but have no command handlers associated in that main plug-in. In each project type plug-in, have command handlers that are enabled when only the correct project type is active.
Assuming you have already worked through a basic tutorial on commands in Eclipse, there is a good advanced one on vogella.com that covers many useful features for being properly dynamic.

Eclipse - Is it possible to link to a file from within a Java comment?

I am looking for a way to link from a comment inside a .java file to another file somewhere in the project folder (like CMD-clicking a Java Type links to the Type declaration). In my case I am working on a (Spring Roo backed) web application, so I have controllers and view files.
What I have in mind may look like this (Javadoc-oriented but of course not parsed but used directly as a link):
public String orderlist(ModelMap modelMap){
modelMap.addAttribute("orders", Order.findAllOrders());
// #link("/WEB-INF/views/order/list.jspx")
return "order/list";
}
I want to CMD-click on the comment link to open the file.
I am heavily using Working Sets, filters and of course CMD+SHIFT+R ("Open Resource"), which are all great, but this might come in handy working on a controller and the corresponding view (especially in a team). Is this possible somehow, a basic feature that I missed completely so far or even total nonsense for some reason? I realize that those links should be considered when, for example, refactor|move the view file.
The feature you're describing is Eclipse's hyperlink detectors: http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_workbench_texteditor_hyperlinkDetectors.html. Unfortunately I'm not sure an implementation as you're describing is likely available.
There's an URLHyperlinkDetector that can pick up URLs, so you could potentially put a file:// URL in a comment and link to that, but I think that Eclipse is hard-wired to assume it's something that can be opened in it's browser. It's worth a shot, but of course the absolute paths would break sharing across teams/machines.
You could try your hand at contributing your own via a plugin that your team could install. Here's an implementation we created in Aptana Studio for picking up relative URIs in files and opening them in editors if possible: https://github.com/aptana/studio3/blob/development/plugins/com.aptana.editor.common/src/com/aptana/editor/common/text/hyperlink/HyperlinkDetector.java