Eclipse PDE: dynamic StyleRange - eclipse-plugin

I need an ability to select a part of the text in the editor with some new background for example.
StyleRange works fine but as the text is modified the applied style is dropped.
Is there any solution that allows StyleRange entity to track document changes and redraw applied styles on the fly? I'd need a solution like RangeHighlighter in Intellij IDEA.

Related

How to override default WinUI 2.x styles in Blend?

Previously I had asked where to find the default styles for the WinUI 2.x controls, and was pointed to the appropriate repository in GitHub where those could be found. Thanks! However, what I really want is to be able to override some of the styles. I was expecting that I would be able to do so in Blend, but I have not been able to figure out how to do that.
For example, when I load my project in Blend and then try to edit the templates for the ContentDialog, I am offered the option to apply an existing style, but not to create a new one. I was expecting I could create a copy, which would give me the default styling as a starting point and allow me to make the small modifications I require. Regarding buttons, I was able to edit a copy of the template, but that only gave me access to the ControlTemplate where I want access to the equivalent of DefaultButtonStyle.
It has been a while since I've used Blend, so perhaps I am mis-remembering how the tool works. But in previous versions of our app I was able to generate resources that included the full styling of the controls that I was using, such as buttons and content dialogs. Can I do the same for our current app that uses WinUI 2.x? If so, how? And if not, what are my alternatives? I have considered copying the default templates I am interested in into the resources of my project and making modifications that way, but I am hopeful that there is a better way.
Rich
I am offered the option to apply an existing style, but not to create a new one
This is expected. For example, both the Visual Studio or the Blend for Visual Studio can't directly create a default DropDownButton style of WinUI. You need to manually copy the WinUI style from Github and put the style in your XAML.
For native UWP controls, you could just generate a copy of the style automatically.

IntelliJ IDEA doesn't want to indent with tab

I want to indent with tabs, so I checked "Use tab character" in settings. But when I open projects which were indented with tabs, IntelliJ IDEA still asks me if I want to convert the indenting to spaces or keep it that way. Also, it creates new classes with space indenting. How can I solve this?
Your screenshot shows the settings for your Default (1) scheme. Those settings are not applied to your project automatically. It's not enough to just select it in the combobox. You need to import this scheme into your project.
Click Manage... and Copy to Project, and it should work as expected. This needs to be done for all your projects.
Also, make sure you're changing the language-spefic settings, so instead Code Style select Code Style > Java (or whatever language you are using). Those settings may override the default code styles.

What is MarkSelection in Eclipse, it will be used in what scenario?

I know StructuredSelection will be used when you select a file in Package Explorer for example, and TextSelection will be used when you select some text in Editor, but not clear about MarkSelection, when it will be used?
MarkSelection is generated by TextViewer (so usually a text editor) and reports a change to a 'mark' selection. It will only be sent to selection change listeners for the text viewer.
The TextViewer.setMark method causes the mark selection changed event to be generated. This only seems to be used by incremental search and for marked regions used in Emacs style editing.

In Enterprise Architect, can I export the structured specification of an element's scenario into a report?

For each model element, there is the option in EA 10 to create internal requirements, constraints and scenarios. All of them end up in reports if you use the pre-defined Basic Template.
However, if you select "structured specification" instead of the default "description" text field for a scenario, then I end up with the steps of the structured specification being ignored in the report output.
How can I have them included in reports?
It sounds like you need to create your own reporting template. This may seem a bit daunting first time out and the template editor is pretty ornery, but luckily you can use an existing template as a starting point.
Hit F8 to bring up the Generate Documentation dialog, then select the Templates tab. Click New, specify a name and select a template you like to be copied. Don't bother with a template group, and leave the fragment checkbox unchecked.
In the editor, scroll down about halfway (assuming you selected to copy the Basic template) and locate the yellow scenario > tag.
Now in the checkbox tree on the left, scroll down do Package - Element - Scenario. Note that Scenario is checked, but Structured Scenarios is not. Check it.
In the editor, note the new structured scenarios > tag. Remove the right-click-to-insert text, then right-click and select Insert Field, then State etc.
It's more than a little fiddly, but if the Basic template is good enough to begin with you should be able to add the structured scenarios with a minimum of effort.
For more information, see the help file under Reporting - RTF Documents. Note that the individual fields aren't listed in the help file, you need to open up the template editor to see what specific information you can extract to your report.

How to add a button to the main toolbar in Eclipse programmatically

I've a question. I cannot find the way, how to add buttons to main toolbar programmatically. My problem is, that I've the task to dynamically (based on XML configuration file) build menus and toolbar. I found how to add a menu item programmatically, but not toolbar button.
Tutorials mostly show how to create buttons and menus using plugin descriptor (plugin.xml), but not how to do it programatically. It seems, that it is out of bounds of Eclipse plugin philosophy.
I've just found this:
There might be layout problems with this approach. I also don't
believe the framework will try and re-create your dynamic item except
at random toolbarmanager updates. With Menus they can be updated on an
SWT.Show event, which is why CompoundContributionItem only applies to
Menus.
What shall I do? Can I say Sorry, there is no way to build toolbar dynamically. I can do it just for menus? Collegue says, that it must be possible, but he does neither know how.
The only way to be able to create main toolbar entries programmatically is in an RCP app, where you supply the ActionBarAdvisor for the workbench window. This isn't dynamic, however, just called on window creation.
Another way to do it would be to use org.eclipse.ui.menus and contribute org.eclipse.ui.menus.ExtensionContributionFactory. It also works only on workbench window creation (not really dynamic), but you could read your own XML and provide IContributionItems for the main menu or toolbar.
How dynamic are you trying to be? Most solutions work well on startup/window creation.
PW
Whenever you try to do something programmatically in Eclipse that is normally done through plugin definitions you are walking on thin ice. I've tried it on a few occasions and it rarely ended up being easy or good.
Instead, think of what it is that you only know at runtime and need to be able to change on the fly. Is it the name or icon of the button? That can be changed at runtime.
Take a look at runtime commands, they can be confusing to define properly, but with them you can for example create buttons that are only visible if a condition is active. That condition could be set at runtime.