Skip to main content

Posts

Showing posts with the label Eclipse

Netbeans or Eclipse which one to choose

There are so many articles on the web discussing this, what I am going to do is just briefly explain the pros and cons of each which will help you choose better. Description Netbeans Eclipse Plugins It helps you extend the reach of your IDE to newer technologies without changing the IDE Good Good Code Refactor Reflects the change made in all the references Decent Good Getting Started The time it takes to get going on with your application Good Decent Enterprise Support Usage in big companies, spending effort in eclipse Decent Good Debugging Easy in which you can find a problem Decent Good UI Looks old Decent Good Spell Check Not Pres...

Interview at Progress Software

I have given a lot of interviews before however, this one was special. Let me start from the beginning. I got a call from Progress Software and was scheduled for the first telephonic discussion. Next day, I got a call from HR and she asked me questions on Java and a few basic puzzles.  After clearing the previous round, I got scheduled for the second telephonic interview. This interview covered Java, design-related problems and algorithms. After a week, I got a call from the HR for the onsite interviews in Hyderabad. This is the first time I googled about Progress Software. I said yes for the onsite interviews. Journey to onsite started not as planned after my flight got delayed. Because of fog-related delay in Delhi, I reached the PSI (Progress Software India) office couple of hours late.  HR introduced me to the first interviewer. The interviewer explained the first round. It was a coding round (I am not a big fan of coding rounds), the problem was ...

Hide empty last column from Table/Tree Viewer

1. How to remove last vestigial column from TableViewer You might have seen that there is dummy or vestigial column in the TableViewer (as marked by the red oval in the below figure) which  is annoying at times because not only it look ugly but more so it occupy;s the precious  real state from your component/control like shown in figure below: Solution: You can use  TableColumnLayout from  org.eclipse.jface.layout package inside  org.eclipse.jface plugin which allows to layout the columns in your TableViewer in essentially two ways: Firstly via mentioning the width in pixel for each column present in the Viewer  Secondly, we could mentioned weights The data could be supplied to the layout via of the implementation of  ColumnLayoutData. The following snippet shows how to achieve it: tableColumnLayout.setColumnData(tableColumn, new ColumnWeightData(1)); Explanation of the above line: tableColumnLayout is   instance of...

IAction and Widget mapping

This post explains how you can map a IAction as an model to a Button. In this case IAction will act as an model to your UI component Button by which you can control the behaviour of the button. In fact in the same way you can use IAction for MenuItem and ToolItem . IAction belong to jface and button is and SWT component. Well   ActionContributionItem in the package org.eclipse.jface.action from the plugin org.eclipse.jface comes to rescue, the class provides API for the conversion. Below are the step wise instructions needs to be followed to achieve it: Instantiate  ActionContributionItem  with IAction object Call the fill method on the  ActionContributionItem object with appropriate parameter (in our case it should be instanceof Composite ) That's all you are done now call a getWidget API to work on your SWT widget. Benefits: Listeners are managed automatically so you need bother about them Look an...

Null Pointer in ViewerColumn of TableViewer on call of setInput

If you are getting the the NPE whle creating the TableViewer and your stack trace looks somewhat like this: java.lang.NullPointerException at org.eclipse.jface.viewers.ViewerColumn.refresh(ViewerColumn.java:145) at org.eclipse.jface.viewers.AbstractTableViewer.doUpdateItem(AbstractTableViewer.java:399) at org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable.run(StructuredViewer.java:481) at org.eclipse.jface.util.SafeRunnable$1.run(SafeRunnable.java:128) at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175) at org.eclipse.jface.viewers.StructuredViewer.updateItem(StructuredViewer.java:2111) at org.eclipse.jface.viewers.AbstractTableViewer.createItem(AbstractTableViewer.java:277) at org.eclipse.jface.viewers.AbstractTableViewer.internalRefreshAll(AbstractTableViewer.java:757) at org.eclipse.jface.viewers.AbstractTableViewer.internalRefresh(AbstractTableViewer.java:649) at org.eclipse.jface.viewers.AbstractTableViewer.internalRefresh(Abstra...

JFace's IAction and SWT's Button Mapping

Has it ever occurred to you that, you use the IAction/Action as a model for the swt's button widget. Well there is very simple way of doing it, following steps help you achieve just that: Create and IAction object  Create the Wrapper around IAction object of ActionContributionItem Call the fill method (there are 3 overridden fill method are present choose as per your requirement) of the class ActionContributionItem passing the parent composite on which you want your button widget to be created That's it your button widget is ready with Action model on the backend :) Following are the benefits of keeping the model and UI separate: You don't have to bother about the state change and propagation of events   You can work on Action object on the back-end which is easier and simpler than working on UI objects Your UI layer can be automated without worrying about sync problems

Content Assist in DLTK editor

This post explains how to contribute your templates in the Dynamic Languages Toolkit (DLTK) editor's content assist. Its a common requirement to incorporate your custom library API's into existing API, hence provide developer with larger domain of predefined functionality to work with. The second step is to incorporate the options in all the existing IDE tools(the post covers only content assist) so that developer can easily leverage. There are couple extension point which make your job hell lot easier, following are the abstract dummy steps to accomplish the same: 1. First of all there is a extension point=" org.eclipse.dltk.ui.scriptCompletionProposalComputer " which essentially requires the ancestor as org.eclipse.dltk.ui.text.completion.ScriptCompletionProposalComputer (or its parent), apart from this some declarative options are also there. 2. Secondly you can provide static templates in the form of xml file via extension point=" org.eclipse.ui.edit...

SCM Tool for Eclipse IDE Users on Mac OS

Recently i got Mac PC to work on, no doubt the Mac experience is fabulous and gives you the feel that hardware is not an issue anymore with speed, graphics, UI etc. But one thing (as an software developer) which was very annoying to me was very little or should i say no choice in terms of complete SCM tool (like Tortoise SVN in windows). I tried couple of tools like svnX, scplugin etc. but none of them is completely usable as far as i am concerned. The latest tool i tried is subclipse . Its a plug-in for Eclipse and gives most of the features like Tortoise SVN. Tool feels better because of integration with eclipse learning cycle is almost nil. You can get the plug-in from the following update site: http://subclipse.tigris.org/ update_1.6.x

How to use Eclipse Compiler

Some use-cases require compiling the java file on the fly, hence using a class file with reflection API to the introspection. The scenario might not be frequent and there are plenty of ways to do it, but if you decide to use eclipse compiler (which can be debatable). That's how you can use it: Map m = new HashMap(); m.put(CompilerOptions.OPTION_Source, System.getProperty("java.specification.version")); org.eclipse.jdt.internal.compiler.batch.Main main = new org.eclipse.jdt.internal.compiler.batch.Main(new PrintWriter(System.out), new PrintWriter(System.err), false, m , null); return main.compile(new String[] { "-classpath ", classPathStr, srcFile.getAbsolutePath()});

Getting 3d effect from draw 2d

Last three months have been like a roller-coaster to say the least, to learn lot new things, mastering the existing and come up renovating yourself. The time we developed FID 1.2 which is open source and available for free download. The key feature shipped with FID1.2 is EIP Editor (to know about FID and EIP editor go to FUSE Team blogs ) and i got a chance to work on it to enhance the look and feel of the editor. The task was to make the shadowed figures of shapes likes Rectangle, circle, diamond etc using draw2d API. And since designing and development was proceeding hand-to-hand, their were lot of changes in colors and sizes so effectively we needed to design a system or framework which reflect requirement changes in no time. Following are some frequent requirement changes: Change the gradient colors (which includes start color and end color) New shapes diamonds, rounded rectangle etc. Change in sizes of the figures both width, height, insets etc. Clearly you can't j...

Master Detail

Master-Detail Eclipse Forms I just finished working on the editor which uses the Master-Detail pattern of the eclipse forms. During which I faced several problems like: In my master block, when the size of table-viewer increased, the master block shows the scrollbar instead of table-viewer. Also, it made the length of the detail and master parts equal which made my editor unusable Detail part having scroll problems like the one mentioned above Setting the details part data-dynamically was yet another area where I faced a lot of problem In this blog, I will be giving a brief introduction about the master-detail pattern and will be addressing the problems mentioned above. The article by Dejan Glozic is really helpful and explains the basics of the eclipse forms. I’ll be explaining the stuff using FUSE Integration Designer(FID) which is an open source and available for download . And the screen-shots will be from the Messaging module of the FID using the example of JMS Messages . In...