Eclipse plugin like Intellij's InspectionGadget? - eclipse

is there a plugin for eclipse like the InspectionGadget for Intellij?
On Intellij when you write some code that can be simplify you have a warning message/dialog on the editor and you have information to how to change the code.
Just a very simple example:
private int foobar(){
int test = someCalculation();
return test;
}
i get a warning message that this code can be changed to
return someCalculation();
and other similar helps.
Thanks.

As for as code analysis FindBugs is pretty good.. But that should not work with following example :)

No, I don't think there is.

Related

How does babel option ""auxiliaryCommentBefore" or "auxiliaryCommentAfter" work?

I installed Babel("babel-cli": "^6.26.0") and and made a .babelrc like
{
"auxiliaryCommentBefore": "testBefore",
"auxiliaryCommentAfter": "testAfter"
}
and also made a simple test.js like
var a = 5;
and finally run babel test.js.
It secceded but no comment above is attached..
My expectation is something like below.
testBefore
var a = 5;
testAfter
Is there anything required missing??
The honest answer to your question is "they don't" :D
The specific behavior of those two options are extremely under-defined and I would love to rip them out of Babel entirely, and I would except that I don't want to needlessly break existing users when they upgrade.
If you need to annotate some input code in a particular way, you should write your own Babel plugin to inject whatever you need instead.

How to use `dataTaskDidReceiveResponse` callback?

I'm trying to use dataTaskDidReceiveResponse of the SessionDelegateof the manager but can't find how to use it. I'm new to swift (but experienced with objective-c) and can't found the correct syntax.
I have tried something like
manager.delegate.dataTaskDidReceiveResponse = {
return NSURLSessionResponseDisposition.Allow
}((session:NSURLSession, task:NSURLSessionDataTask, response:NSURLResponse)-> NSURLSessionResponseDisposition)
and some other variants. I don't know if it's just a syntax issue or my comprehension of swift/Alamofire that is lacking.
Can anyone help me found the right path?
Thanks.
Found it:
manager.delegate.dataTaskDidReceiveResponse =
{(session:NSURLSession, dataTask:NSURLSessionDataTask, response:NSURLResponse) -> NSURLSessionResponseDisposition in
return NSURLSessionResponseDisposition.Allow
}

Eclipse Project MenuManager MenuListener MenuShown?

I want to override org.eclipse.ui.project.cleanAction.
Simple org.eclipse.ui. commands & handlers doesnt work because of structure of WorkbenchActionBuilder. I have solved it with code :
MenuManager menu = (MenuManager) ((WorkbenchWindow)PlatformUI.getWorkbench().getActiveWorkbenchWindow()).getActionBars().getMenuManager();
menu = (MenuManager) menu.find( "project" );
menu.replaceItem( "buildClean", new ActionContributionItem( new ABCBuildCleanAction( PlatformUI.getWorkbench().getActiveWorkbenchWindow() ) ) );
Now how can I make this code piece work when I press Project from menu? This is a MenuManager and I thought MenuAdapter (MenuListener) menuShown method can help but how can I make it run? I searched for a solution via plugin.xml Extensions but as which extension point should I add it?
Any Idea? Please don't hesitate to ask for more information...
We put that code piece under :
Bundle-Activator : in MANIFEST.MF file (It is the Activator.) That XXPlugin class extends AbstractUIPlugin class. In the start method I put my code to work.
This solved my problem, now when eclipse starts It loads this code and my code works instead of CleanDialog class...
ilke

Trigger formatter in a custom plug-in in Eclipse

I writing my own text editor plugin for eclipse. I am now working on my own formatter. Actually, following that link http://wiki.eclipse.org/FAQ_How_do_I_support_formatting_in_my_editor%3F.
I have written my Strategy, I have overridden getContentFormatter in my SourceViewerConfiguration..
As I run my plugin and press Ctrl+Shift+F - and nothing happens.
I think that I'm missing a step here. Should I create a handler or something?
Thanks
Might it be you skipped the last part of the linked page?
Finally, you will need to create an action that invokes the formatter. No generic formatting action is defined by the text infrastructure, but it is quite easy to create one of your own. The action’s run method can simply call the following on the source viewer to invoke the formatter:
sourceViewer.doOperation(ISourceViewer.FORMAT);
What helped me. I have created a handler with the following executors body:
//get the editorPart
if (editorPart != null) {
ITextOperationTarget target = (ITextOperationTarget) editorPart
.getAdapter(ITextOperationTarget.class);
if (target instanceof ISourceViewer) {
ISourceViewer textViewer = (ISourceViewer) target;
((ITextOperationTarget) textViewer)
.doOperation(ISourceViewer.FORMAT);
}
}
Then just create menu items and bind them to the handler.

NullPointerException in Jasper Reports?

When I export a report using jasper report (version 1.2.4), it throws NPE. And I cant find any solution to the problem online. Can anyone help me in this regard please?
If I remove one problematic column in my report and export it, it exports fine. Couldn't find whats the problem with that column as it contains large data.
Many Thanks in Advance !
Posting the exception below :
java.lang.NullPointerException|
at java.awt.font.TextLayout.getBaselineFromGraphic(Unknown Source)|
at java.awt.font.TextMeasurer.initAll(Unknown Source)|
at java.awt.font.TextMeasurer.<init>(Unknown Source)|
at java.awt.font.LineBreakMeasurer.<init>(Unknown Source)|
at java.awt.font.LineBreakMeasurer.<init>(Unknown Source)|
at net.sf.jasperreports.engine.fill.TextMeasurer.renderParagraph(TextMeasurer.java:259)|
at net.sf.jasperreports.engine.fill.TextMeasurer.measure(TextMeasurer.java:220)|
at net.sf.jasperreports.engine.fill.JRFillTextElement.chopTextElement(JRFillTextElement.java:528)|
at net.sf.jasperreports.engine.fill.JRFillTextField.prepare(JRFillTextField.java:501)|
at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:345)|
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:311)|
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:275)|
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:1291)|
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:631)|
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportContent(JRVerticalFiller.java:248)|
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:132)|
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:750)|
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:666)|
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:89)|
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:601)
You can get the exact same error using pure JRE code, like this:
#Test
public void testText()
{
String text = "\uFFFF\u0300";
JTextArea textArea = new JTextArea(text);
JOptionPane.showMessageDialog(null, textArea);
}
Because of this, I have been assuming it's a JRE bug and already submitted it to Oracle. The workaround is presumably to cull whatever character sequence is causing it, but I obviously don't know what you are feeding in.
This is likely either (1) a bug in the version of the JRE you're using, or (2) a threading bug. We've had the same top five lines in stack traces in a project I work on.