Hover text for Marker in Eclipse plugin - eclipse-plugin

I have a custom editor with problem markers.
The markers display correctly in the "problems" view with icon, location and text, and the problem icons display correctly in the left margin of the editor.
I would like to display the same error message text in a popup when hovering over the problem marker icon in the margin, just as it happens in the Java editor. Right now there in no popup.
Is there an easy way to achieve this?
Answer :
OK, it doesn't look like the functionality is built-in in the marker-system. It seems a patch have been submitted, so it will probably be added in a later version, but until then it is also pretty easy create by hand.
Create an class that implements IAnnotationHover and implement getHoverInfo().
Return the class in getAnnotationHover() method in the SourceViewerConfiguration.
In getHoverInfo() method, call ISourceViewer.getAnnotationModel().getAnnotationIterator() to get all markers.
Select the marker(s) that correspond to the line number, and return the marker text.

In your class that extends org.eclipse.jface.text.source.SourceViewerConfiguration, just include the following:
#Override
public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
return new DefaultAnnotationHover();
}
this includes the text of all markers of a line in the hover text of the problem marker in the margins of the text editor.

This bug in eclipse plug-in xtext proposes a patch to show a marker tooltip on hover and status line. If you look at the attached patches you could find the answers you need.

Related

How to show image instead of bullets in react native html text?

I'm using react-native-htmlview to render html text this package gives a lot of customization options what I want to ask is how can I replace bullets with an image or may be a react-native-vector-icon component the library gives an option to replace bullet with a text string can I replace it with icon or image?
Any help would appreciated you may suggest some other light weight package that serve this purpose I also need please keep in mind that I want to apply styles based on the tags and my styles includes the custom font.

How to highlight the area while taking Screen shot?

Is there any way to highlight the components in screen shot when a test case is passed or failed in for a particular test.
I am using below method to take screen shot.
private void writeScreenshotToFile(WebDriver driver, File screenshot) {
try {
FileOutputStream screenshotStream = new FileOutputStream(screenshot);
screenshotStream.write(((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES));
screenshotStream.close();
} catch (IOException unableToWriteScreenshot) {
System.err.println("Unable to write " + screenshot.getAbsolutePath());
unableToWriteScreenshot.printStackTrace();
Please keep in mind that there are many reasons that can cause failure, like timeout, Wedbriver exception, stale element, element not found, etc..
I can't see how anything from that list can be highlighted so it will make sense. What can you highlight if the element you were looking for is not there? Or what to highlight when timeout occurs? The whole page?
Regardless, if you want to highlight a specific element, have a look at this answer here.
Just to give you some hints and ideas.
The screen shot is a image which contains the component you know as a text like a list of result of some text. If you know the text value of the element and you know the error comes from expected result which does not match the page and NOT other underlying selenium exceptions; there is a java library which called Java OCR
that extract text from image. Now having the text found on the image, it will give you the text location; using java 2D api, you make some off set and market the surrounding area of the text location inside the image file.
Hope this can help.
Alan Mehio
London, UK
As Eugene stated, for some types of Exceptions it is not appropriate to highlight a screenshot (for example, if an element you expect to be on the page is not there). However, there are lots of situations where you may want to highlight an element, such as if the text of an element is not what you expect.
Rather than highlighting something in the actual screenshot, it is possible (using Javascript) to highlight the element on the page itself. You can then take a screenshot and the highlighting will be visible.
An explanation of how to do this can be found here: https://www.qaautomation.co.in/2018/11/highlight-element-in-screenshot-store-selenium.html.

Adding custom html tags to Intellij?

When I hover over a custom html tag that I'm using from a platform (Polymer) or even a custom one I made it says that you can mark such a tag as custom somewhere. Is there a place to do this in Intellij? I'm using the latest version (14).
Here is a screenshot of what I'm talking about:
Any help would be appreciated! It would be nice to get rid of all these error highlights when I'm working with Polymer. Thanks!
Place the caret over the highlighted tag, hit ALT+ENTER and select Add tag to custom tags.
However that works only for current project. If you want to set the ignored tags globally, try this:
Go to Settings/Inspections, find the Unknown HTML tag inspection, select the Default profile instead of Project Default and specify the tags separated by comma in the textfield in the bottom right corner. Here is a screenshot:

ExtJS - Changing default button styles and fonts

I have this requirement where I have to change the default styles on my Ext JS application. I am not talking about changing stuff in CSS files yet. I am not that ambitious yet. Here is what I am looking for:
Suppose I need a Submit and Cancel buttons, I use xtype:button and text:Save ( or Cancel ). This will render buttons with the text on them. What should I do if I want to change the look and feel of the button? Or replace the button with a cool Save or Cancel image?
Right now I have all the texts on the application with the default font that ExtJS shows. What am I supposed to do if I want all the text on the application changed to a different font? Everything right from the data in forms/grids and the titles of each component should be changed to some other font my customer prefers. What am I supposed to do?
I understand these are very basic and a generic questions, but I am looking for a good headsup before I proceed with my task.
Thank you all in advance. Waiting for answers :)
Update: So, I found out how we deal with CSS and change the fonts. Can anyone help about the Chaning the look and feel for Submit/Cancel buttons.
I recommend you to use SASS and compass to build your own themes, or better said to change one the existing themes. In the Ext JS documentation you can find the css variables which you can set according to your needs.
If you are not ready for theming with SASS just yet take a look at this example of button configs from the sencha docs:
Stanadalone Example page: http://docs.sencha.com/extjs/4.1.3/extjs-build/examples/button/button.html
CSS that adds customized images to the buttons: http://docs.sencha.com/extjs/4.1.3/extjs-build/examples/button/button.css
JS that shows button configs: http://docs.sencha.com/extjs/4.1.3/extjs-build/examples/button/button.js
Essentially this shows how to use iconCls property on the button config along with a simple CSS class to add desired image to your button.

Using tab key for navigation in TextEdit

I have two TextEdit boxes and one custom button widget, I wish to change focus in the following order using the tab key on my keyboard:
TextEdit1 <-> TextEdit2 <-> Button
I have specified something similar to the following for each widget in order to obtain the chain above:
KeyNavigation.tab: TextEdit2
KeyNavigation.backtab: TextEdit1
My problem is however that the tab keystroke is caught in the TextEdit, and cannot be used to navigate. How can I disable tabs in the TextEdit and instead use it for changing focus?
I found the problem.
By default the key events are first sent to the item which is receiving the event - not to KeyNavigation. This behavior can be changed by setting
KeyNavigation.priority: KeyNavigation.BeforeItem
The complete code thus becomes
KeyNavigation.tab: TextEdit2
KeyNavigation.backtab: TextEdit1
KeyNavigation.priority: KeyNavigation.BeforeItem
Read about the Qml Keys element.
You can do something like this :
TextEdit
{
width : 40
height: 40
text : "junk"
Keys.onTabPressed:
{
// Write logic to transfer focus to whomsoever you want
}
}
While searching for a solution to a similar problem, I came across this option in Qt Creator and seems to solve the thing. Now I can move out of the QTextEdit object with tab key, instead of inserting a tab character into the field.
I see that the topic is old and already solved but maybe this convenient simple option was made available with a more recent update to Qt, I don't know. I just came across it and I hope it helps someone searching for the same solution as me.