Thursday, December 20, 2007
Poznan Demo Camp video
Time to say goodbye
As the year is about to end and my contract in IBM is almost over, there is some space for summary. It was great time to work with my team (thank you guys) and within the community (thank you community ;) ). My Eclipse skills has developed as well as my Eclipse friendships. But the work was only a part of my life. I am also Phd student and in February im going to Frankfurt am Main for exchange program.
What does it mean for me in Eclipse context? I don't want stop working on Eclipse (especially now when I've started working on PDE more intensively). Maybe I will try find some challenging work in Frankfurt or focus only on PDE development. We will see what time brings :) Once again I want to say "Thank you very much" Piet, Asia, Łukasz, Chris, Kuba and Jacek.
Friday, December 14, 2007
Friday, November 30, 2007
Eclipse DemoCamp in Poznan
We would like to thank all the participants and speakers for their time and effort.
And for the end you can look at our pictures from the event:
Tuesday, November 27, 2007
Eclipse 3.4 update site
But luckily there is an update site
http://download.eclipse.org/releases/ganymede/staging/
that keep everything in one place. I think that will simplyfy installation process :-).
Friday, November 23, 2007
The first part of Eclipse DemoCamp in Poznan
Some pictures from the event:
I would like to thank everyone who attended and invite for the next meeting of Eclipse DemoCamp in Poznan, which will take place on next Wednesday.
Thursday, November 22, 2007
Adding bugzilla task in Mylyn
Is there any easier way ?
Eclipse Build will wake me up tomorrow
Have you noticed? New option on build schedule page is now available.
You can now import build info to your google calendar or use calendar form the build page. This is a great chance to make your life integrated continuously ;). Eclipse night build in Polish time zone takes place at 6.10am so if you have problems with morning getting up you can use google events.
The last step is to find a nice ring tone for my SMS signal :D
Friday, November 16, 2007
Eclipse-LazyStart and testing plugins
My first move was changing org.hsia Eclipse-LazyStart to false.
"The Eclipse-LazyStart header is used to specify if a bundle should be started before the first class or resource is accessed from that bundle" so, I thought if lazy start is false plugin will be started during the platform start - wrong (thanks Chris).
The problem in my case was that I didn't call any of the org.hsia classes. Solution in this case is simple, set org.hsia Eclipse-LazyStart to true and call:
@BeforeClass
public static void setUpEditor() {
//force Editor activator to be called
MetricsEditorPlugin.getPlugin();
}
in the test.
Why I've posted that. Maybe you have the same problem, and somentimes is better to lern on sbd else mistakes :)
Thursday, November 15, 2007
Eclipse Demo Camp in Poznan - next week!
Monday, November 12, 2007
Eclipse Forum PL
Please visit eclipseforum.org.pl and sign in.
How to find other versions of Eclipse?
If you go to the Eclipse download page you will find the Find out more... link (this was the hardest thing to find and I think that the text "Find out more" can mislead people):
On the next page follow the All versions link:
And here it is!
Monday, October 8, 2007
Tuesday, October 2, 2007
PDE enhancement
As you probably know we've just finished Eclipse Summer School workshops. It was great time, but now we are back to work. Recently I'm working on new PDE enhancement called "Convert jars to Plug-in Project". How it works, you can select jars in your project and transform them into plug-in project. You can also decide to change references in other project, that contains that jar's, to the new project.
It still needs some work but you can take a look and put your comments in bugzilla.
But this is only context to issue I want to share with you :).
As we all know laziness is a bliss and good programmer is a lazy one. I decided to put it into life when working on this bug. I needed to filter a list of jar files to finds a duplicates. Two jars are the same when have the same manifests (this is only an assumption for this project). This is a great occasion to use TreeSet. I've written a comparator for jar files but I didn't know what to do when two manifests are different. I followed the rule from the beginning of this paragraph and decide that when two manifest are different then result of comparison is jar1.hashCode() - jar2.hasCode(). Of course it couldn't work and I've spent a hour to find what is going on.
So I decide to change my paradigm of good programmer: "good programmer is lazy one but have to know what he is doing".
Custom Property Source for EMF generated RCP application
In this post I will show you how to generate simple date editor for the EMF application.
Here is the model:
As you see, it is not very complicated. If we generate RCP appliaction we will receive something like that:
and additional three plugins in your workspace (.edit, .editor, and .tests).
So we start to work.
In the pluging .editor we open our application Editor, and then, in the method getPropertySheetPage() we replace the
propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));
with
propertySheetPage.setPropertySourceProvider(new CustomizedAdapterFactoryContentProvider(adapterFactory));
Such a class does not exists, so we have to create it (it should extend AdapterFactoryContentProvider) and override method createPropertySource:
protected IPropertySource createPropertySource(Object object,
IItemPropertySource itemPropertySource) {
return new CustomizedPropertySource(object, itemPropertySource);
}
We do not have CustomizedPropertySource yet, so we create one, and override
createPropertyDescriptor() method:
protected IPropertyDescriptor createPropertyDescriptor(
IItemPropertyDescriptor itemPropertyDescriptor) {
return new CustomizedPropertyDescriptor(object, itemPropertyDescriptor);
}
We do not have one. We have to create it and override createPropertyEditor, finally;):
public CellEditor createPropertyEditor(Composite composite) {
CellEditor result = super.createPropertyEditor(composite);
if(result == null) return result;
EClassifier eType = ((EStructuralFeature)itemPropertyDescriptor.getFeature(object)).getEType();
if (eType instanceof EDataType) {
EDataType eDataType = (EDataType) eType;
if(eDataType.getInstanceClass() == Date.class){
result = new ExtendedDialogCellEditor(composite, getEditLabelProvider()){
protected Object openDialogBox(Control cellEditorWindow) {
final DateTime dateTime[] = new DateTime[1];
final Date[] date = new Date[1];
Dialog d = new Dialog(cellEditorWindow.getShell()){
protected Control createDialogArea(Composite parent) {
Composite dialogArea = (Composite) super.createDialogArea(parent);
dateTime[0] = new DateTime(dialogArea, SWT.CALENDAR);
dateTime[0].addSelectionListener(new SelectionAdapter(){
public void widgetSelected(SelectionEvent e) {
Date dateValue = new Date();
dateValue.setYear(dateTime[0].getYear());
dateValue.setMonth(dateTime[0].getMonth());
dateValue.setDate(dateTime[0].getDay());
date[0] = dateValue;
super.widgetSelected(e);
}
});
return dialogArea;
}
};
d.setBlockOnOpen(true);
d.open();
if(d.getReturnCode() == Dialog.OK){
return date[0];
}
return null;
}
};
}
}
return result;
}
In this method we provide date property editor, but also we have to check, if the property is editable and if it is really a date, because our method will take care about all properties. So, if this is not a date, we pass everything to the super implementation.
And voila :) Here it is:
Hope that will help you :).
Monday, October 1, 2007
Tips & Tricks for debugging in Eclipse
1) Debug details formatter
When you debug your application you probably use the Variables view. One of the disadvantages is that you cannot see the data inside complex objects (unless they implement toString() method). Eclipse allows you to write your own formatter for displaying the content you are interested in. You can do it in the Eclipse preferences under Java->Debug->Detail Formatters.
Lets consider the following class:
When you want to check the value of the an object of this class during the debugging session you have to expand the object and inspect the value of all it’s parts. (see the picture below).
Let’s write our own formatter:
And now in the Variables view we can see that the person object is shown differently:
If you want to see the formatter in the labels for variables you have to select the following option in the Eclipse preferences:
This allows you to see the result of your formatter in the value field of the Variables view:
I find this option very useful also for the standard classes (e.g. ArrayList), then instead of:
I can see:
2) Toggling class breakpoints on the class without the source code
When you want to stop the execution of your application in the moment when some of your class is loaded by the class loader you can use the class breakpoints (just toggle the breakpoint on the line when the declaration of the class begins). But what about the situation when you want the same behavior when a class, which you don’t have the sources for, is loaded? How to toggle such a breakpoint without the source code? Actually this was the question from one of our students and I had no idea how to answer it. Fortunately Jacek was in the room with me and he found the answer very quickly. You just have to go to the main menu and choose Run->Add Class Load Breakpoint…
3) Displaying all references of an object (new in Eclipse 3.3)
Sometimes it is worth to see all references of some object. How to achieve this? There are two ways of doing this. If you want to display references of the specific object, right click on the object in the Variables view and choose All References. The popup window will appear with all references. If you want to see all references of all available objects go to the menu in the Variables view and choose Java->Show References.
4) Displaying all instances of a class (new in Eclipse 3.3)
If you want to see all instances of a class just mark this class in the Java editor and choose All Instanced from the context menu.
Saturday, September 29, 2007
Eclipse Summer School 2007 has just completed!
The training took 6 days, 8 hours/day (the participants and presenters were very brave to complete it) and we managed to cover most interesting parts of Eclipse: Eclipse as an IDE, Plugin Architecture, SWT/JFace, EMF, Views, Perspectives, Editors, RCP, GMF, BIRT.
We are proud to announce, that the feedback was very positive! The average overall experience was 4.96 (very good, in 1-6 scale) and 100% of the participants would recommend our training to their colleagues.
I hope this feedback is so high, not only because Alicja (one of our presenters) has great freckles and male participants have fallen in love with her ;-)
Eclipse Summer School 2007 website is at: www.eclipsesummerschool.com - you can see pictures from the event and download the slides (in Polish only).
Tuesday, September 25, 2007
catchy questions
So today morning we were debugging JUnit tests and got caught by "Why Drop To Frame is inactive?".
Luckly, Darin Wright already answered to this question some time ago on bugzilla:
"the Java debugger supports the operation when
debugging on a VM that supports it (1.4.x or higher), and there are no native
methods on the call stack above the point you want to drop to."
That was the hit, as we had JUnit native methods on the stack.
Monday, September 17, 2007
Nice GMF video for newcomers
Thursday, September 13, 2007
Programmer day
http://www.teachersparadise.com/ency/en/wikipedia/p/pr/programmer_s_day.html
Thursday, August 23, 2007
Enormously long eclipse update
Please call your network administrator and tell him to configure DNS to answer server failed, and not to pretend to not exist... cause Update Manager contacts eclipse update sites *before* displaying the first update window... and it does it a lot of times. Default timeout for DNS query is about half a minute...
And now good news: new update manager will be shipped with Eclipse 3.4 (next summer).
Cheers!
Tuesday, August 7, 2007
Eclipse data binding with java beans
I’ve been thinking about how to provide easiest tutorial on data binding allowing you to go through all steps smoothly. I was thinking and coding and it is a little bit more complex than I planned ;)
Since code was ready couple of things has changed so I need to check if all dependencies in this project are needed. I’ll will show you a standalone application example but to make things easier (in my opinion) let me start from plug-in project. This will allow us (if we are building on Eclipse 3.3) to add all needed libraries from our Eclipse distribution.
This will be example of bidirectional synchronization between Java Bean and simple form which presents bean’s content. So let’s start.
Build java bean class.
This can be something simple (I will take a Address class with two fields street and city)
Defining an user interface
To build a screen in an automatic way we will use java.beans.Introspector
. But let start from beginning. We must add dependencies to JFace library to our build path. As our project is plug-in project it can be done as adding dependency to JFace.
To build fields for our bean’s properties we can use following code fragment:
BeanInfo beanInfo = null;
try {
beanInfo = Introspector.getBeanInfo(bean.getClass());
} catch (IntrospectionException e) {
e.printStackTrace();
return;
}
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
for (PropertyDescriptor descriptor : propertyDescriptors) {
if("class".equals(descriptor.getName())) continue;
Label label = new Label(shell, SWT.NONE);
label.setText(descriptor.getName());
Text t = new Text(shell, SWT.BORDER);
//here will be data binding added
}
Rest of source code can be found in attached project file. After running application (as Java application) this should look very similar to :
Adding data binding (from UI to bean)
Now there is a high time to add data binding to our simple application.
Add core binding, jface and bean bindings (org.eclipse.core.databinding
, org.eclipse.core.databinding.beans
, org.eclipse.jface.databinding
). This will allow us to connect Text components with its data model (which is our address bean).
We need to create binding context and realm:
Realm realm = SWTObservables.getRealm(shell.getDisplay());
DataBindingContext bindingContext = new DataBindingContext(realm);
Using bindContext we are able to connect our text components with data:
private void bindValue(DataBindingContext context, Text text, String name) {
IObservableValue observeValue = BeansObservables.observeValue(context.getValidationRealm(), bean, name);
ISWTObservableValue observeText = SWTObservables.observeText(text, SWT.Modify);
context.bindValue(observeText, observeValue, null, null);
}
But when we try to run this application you will get a unresolved dependencies (NoClassDeffinitionFound exception). We need to add additional dependencies to our project (org.eclipse.core.runtime
).
If you followed this article you should get something similar to:
We have one another feature for free now. If you change name of the street or city this changes from our simple windows are applied to data object. Let’s try to add opposite direction data shifting.
Adding data binding (from bean to UI)
To make our data object to be source of changes we must implement basic property change support.
abstract class AbstractModelObject {
public void addPropertyChangeListener(PropertyChangeListener listener);
public void addPropertyChangeListener(String propertyName,
PropertyChangeListener listener);
public void removePropertyChangeListener(PropertyChangeListener listener);
public void removePropertyChangeListener(String propertyName,
PropertyChangeListener listener);
protected void firePropertyChange(String propertyName, Object oldValue,
Object newValue);
}
And let our AddressBean
class extends AbstractModelObject
. The only think we must remember is to add firePropertyChange
for each set method.
One again we win twice. First of all we can add change listener to our data object. Second we have bidirectional data synchronization between our graphic and data component.
Fun, fun, fun
The only last step to show power of data binding is adding a thread which will update data object. All this changes are visible in our simple control.
Adding other type of field is a piece of cake. First we need com.ibm.icu in our dependencies. Second adding field of other type (e.g. int or data).
Hope this article will help you to start your journey through Eclipse data binding features. Article source code can be found here
The final result is following:
Monday, August 6, 2007
Eclipse and Proxy Settings
In Eclipse Callisto (3.2) proxy settings
were integrated into general eclipse network preferences in Europa (3.3):
As you see it solves many problems: now you can use update manager even if you have ssl authentication server and you do not need to enter your security credentials every time...
But please imagine you have much more complicated situation: your product on internal update site and you have proxy server that isolates your company network from internet and you rely on eclipse community projects...
Now it is pain!
In this situation eclipse should have set:
- Proxy Settings for your proxy server
- Internal update site in No Proxy for.
You can achieve your goal adding internal update server host name, server http address (but without http:// and IP address...). It means there are 3 entries per one server.
Then it will work.
Database server is down
For more than two hours I see this message:
(Can't contact the database server: Too many connections (dbmaster))
I don't have access to bugzilla to wiki, I cannot even download eclipse distros.
Do you think I should take day off ? ;)
Instead I will work on data binding tutorial (Yes I know that taking day off is better idea ;)
Thursday, July 26, 2007
paste'n'run
(I don't see the movie)
Friday, July 20, 2007
Compare folders on Windows
But hey, Eclipse compares folders all the same as it compares our Java code.
You simply create new project, create two new linked folders, that point to somewhere in your filesystem, select, "Compare -> With Each Other" from popup and voila
Friday, July 6, 2007
How to deal with many Eclipses
Sometimes you are not only a Java, C++, Python, Ruby or web programmer. There are days when you need to deal with many technologies. And even if you are only a Java developer – remember we are in Eclipse Europe age. This means many great tools but also huge plugins set. If you are lucky then probably you will newer suffer from memory shortages or Windows Vista behavior in your Eclipse.
I want to tell you about nothing newest and noteworthy but something old and forgotten (especially at my university).
At first I will tell you how does it look now. If you need only Java you download fast and furious Eclipse from eclipse.org. But after that you needs some testing, code coverage, debugging and profiling. So EMF, TPTP flies to your plugin folder. After some time simple web application is needed – WTP. And so on and so on. Oh, I’ve forgot about Mylyn – we are task oriented ;). But with every minute (and with a workspace size) our Eclipse is slower and more space consuming.
Till today I had four Eclipses. One for C/C++ developing one for web, plugins and Java one for profiling and one for experiments ;).
But there is an option how to reuse one eclipse installation - -configuration switch. This is my solution:
Download each feature to separate location.
Choose needed features from update site. You can specify location for each feature separately.
Add locations to your product configuration
This should be already done if you followed last paragraph. But something could happen between lines. So lets assume you have only one site with CDT but you also need Mylyn.
Above is my product configuration. One this you can do is disabling the specific feature location. So if you want remove some functions temporary from your Eclipse this is option for you. To add new location use view menu
Clone product configurations
This is very easy step and can be done in two ways.
First – copy configuration dir to different location.
Second – use eclipse –initialize – configuration
Modify it to your needs
To deal with different set of features one file is needed
<?xml version="1.0" encoding="UTF-8"?>
<config date="1183550870687" transient="false" version="3.0">
<site enabled="true" policy="USER-EXCLUDE" updateable="true" url="file:../plugins/mylyn/eclipse/">
<feature id="org.eclipse.mylyn.java_feature" plugin-identifier="org.eclipse.mylyn" url="features/org.eclipse.mylyn.java_feature_2.0.0.v20070628-1000/" version="2.0.0.v20070628-1000">
…
</site>
<site enabled="true" policy="USER-EXCLUDE" updateable="true" url="platform:/base/">
</site>
<site enabled="true" policy="USER-EXCLUDE" updateable="true" url="file:../plugins/cdt/eclipse/">
<feature id="org.eclipse.cdt" url="features/org.eclipse.cdt_4.0.0.200706261300/" version="4.0.0.200706261300">
</feature>
</site>
</config>
You have many (in this example two ;) ) with different features. So if you need configuration for Java + profiling you choose TPTP and basic site.
That’s all now you need to start your Eclipse with suitable parameter.
It is even more useful if you work in team. Then only thing you need is to put all features to network drive. Additional advantage is that all developers have almost the same Eclipse configuration.
Hope it helps ;)
Wednesday, June 20, 2007
GMF project in 5 minutes with GMF Dashboard
The GMF Dashboard distinguishes all the models that have to be created and combined to create the editor. Domain Model can be found in the center and all the other models, that are derived form it, are placed around. Although the Dashboard only starts the appropriate wizards, it helps not to forget about anything important and shows all the time on what stage of the process we are.
I think that it is a great thing for all the newcomers, who have just started using GMF and are afraid of the complexity of this framework (so it is perfect for me ;-) ). It's maybe not something new, but for sure worth noticing.
Wednesday, June 13, 2007
Eclipse Summer School 2007 in Poland!
The presentations and labs will be in Polish and we would like to invite students and companies to participate.
You can find more information at: http://www.eclipsesummerschool.com.
Tuesday, May 22, 2007
Modelling by diagramming
After adding GMF to your Eclipse, new wizard appears in "File -> New..." as well as in .ecore file context menu. It initializes ecore diagram out of normal .ecore and lets you drag classes around, make connections, and all you were always dreaming about. Thanks to that, diagram editor and ecore editor can be used simultaniously, as they work on the same file and changes are immediately visible in both of them.
So that is EMF model diagram editor. Despite the fact, we've got EMF inside, it's still very nice class diagram editor, maybe more conformant with XSD than UML, but enough for most cases.
Another diagramming equipment comes bundled in UML2Tools. This feature grows on UML2 model implemented in EMF, a part of Eclipse Modelling top-project. Besides classes, it supports creating activity, component, profile and state machine diagrams. We're still waiting for first release, but there is already a loot to look at:
What i was most surprised about, is that this diagrams, or rather designed UML model, can be also used to build ecore (see the image below). Unfortunately right now, conversion is one-way only, which finally makes you end up with ecore model, uml model and uml diagram. Good news is that, first UML2Tools release is planned for June.