Archive for November, 2009

Poll results for -consoleLog as default option for new runtime configuration

Monday, November 30th, 2009

Update -console will be standard in Eclipse 3.6 – Curtis Windatt did apply the patch from Bug report

The result for Poll – Default launch configuration for Eclipse plugin / RCP development are in.

In total we had 88 reponses. 74 selected “Yes”, 16 selected “No” (two of the voters selected both “Yes” and “No” which was an error in the survey setup from my side ;-) ).

This makes the following statistic:

poll

Obviously the mayority of participants prefer “-consoleLog” as default option. I update the bug report with the details.

Upcoming Eclipse Democamp in the Bay Area

Thursday, November 26th, 2009

A Eclipse Demo camp is coming to the Bay Area on Dec 2, Wed, 5-9pm in the Cisco building, 510 McCarthy Blvd, Milpitas, CA 95035

The current program looks like the following:

  • Michael Enescu (Cisco Open Source CTO) – Introduction
  • Srikanth Ranganamyna (Cisco) – CDT in Cisco, Scalability & Enhancements
  • Eric Dillon (Cisco) – Tigerstripe, modeling and code generation for network management
  • Joep Rottinghuis (eBay) & Parag Raval(AvantSoft) – A peek into the Eclipse tools workshop at eBay
  • Dima Rekesh (IBM) – IBM Cloud for Smart Business Development
  • Google – Topic coming soon
  • Greg Stachnick (Oracle) – New Web Development tools in Oracle Enterprise Pack for Eclipse: A preview of Helios

I will also present the work of Boris Bokowski and Benjamin Cabé around the OpenSocial Gadgets in Eclipse E4.

Currently only few people have signed up (including the Executive Director of the Eclipse Foundation Mike Milinkovich ).

While the program seems a little big company heavy ;-) I hope that this is a good oppertunity to meet, chat and to learn about exciting technologies. Hope to meet your their. :-)

Sign up at Eclipse Demo Camp Bay Area. I believe they also still accepting presenters.

Getting the Eclipse source code via Git

Tuesday, November 24th, 2009

Eclipse recently started to provide Git mirrors of the cvs repositories.You find the location of the Git repository on the following website Eclipse Git repositories.

If you have the git commad line tools installed (Ubuntu: sudo apt-get git-core) you can use the following command to check these repositories out from the command line:

git clone url

for example to get the JFace snippets use the following command.

git clone git://dev.eclipse.org/org.eclipse.jface/org.eclipse.jface.snippets.git

After that checkout you can import the project into Eclipse via File -> Import -> General -> Existing Project into Workspace.

Of course you can use the EGit plugin to checkout Git repositories directly in Eclipse. Check the excellent EGit User Guide for this.

Via Git we have another nice option to get the Eclipse source code in additon to cvs and svn. :-)

I believe Git does currently not support Project Set Files (.psf) similar to cvs to get a consistent set of plugins but at least individual plugins can be checked out.

Update I have created a small introduction to Git Git Tutorial and to EGit Git with Eclipse – EGit Tutorial. Hope this helps.

Poll – Default launch configuration for Eclipse plugin / RCP development

Friday, November 20th, 2009

Eclipse shows errors during a launch via the log views in both the host and the target system and on the file system. In addition the developer can specify the flag “-consoleLog” in the launch configuration so see potential error messages in the console view.

Bug 284704 had been opened asking if the “-consoleLog” flag could be included by default in a new launch configuration.

What do you think? If you are a plugin or RCP developer please participate in the following survey:

Link to Survey

——————————
Please note that this is my first attempt using SurveyMonkey, I hope this works well. I believe the survey will close after the first 100 answers. If this number has not reached I’m planning to close the survey next week 27. Nov. 2009.

Fresh (and free) icons for applications

Thursday, November 19th, 2009

I always use the Eclipse icons for my applicatons. Recently one of my users complainted that my icons look “oldisch”….

I quick call for help via twitter returned the following sites which provide free and fantastic looking icons.

http://commons.wikimedia.org/wiki/Crystal_Clear
http://www.famfamfam.com
http://iconlet.com
http://www.iconfinder.net/browse

Thanks to everyone for the links. Hope this helps also others to spice up their applications. ;-)

(Disclaimer: Of course these icons are not specific to Eclipse and could be used in other applications as well)

Profiling Eclipse RCP applications with Eclipse TPTP

Wednesday, November 18th, 2009

I believe approx. one or two years ago I tried to profile an Eclipse RCP application with the Eclipse TPTP project. I believe at this point in time profiling an RCP application with TPTP was not possible.

I learned from Eugene Chan that the TPTP release which is part of Eclipse Galileo allows to profile Eclipse RCP applications.

I suggest you give it a try, it is as easy as profiling a standard ;-) Java application.

You find an updated description here: Eclipse TPTP Tutorial.

Thanks to Eugene Chan, Paul Slauenwhite and Kathy Chan from the TPTP team for feedback on the article.

Disassemble Java class files via javap

Monday, November 16th, 2009

Today I received the question how someone could see the Java code for a Java class file. You can disassemble the Java byte code via the command line tool javap.

Lets assume you have this tiny Java class Test.java

package test;

public class Test {

	int number = 5;

	public void sayHello() {
		System.out.println("Hello");
	}
}

Compile this class via javac Test. javaand you receive Java.class

If you you run javap Test you receive the attributes and method signatures.

C:\temp\javaptest>javap Test
Compiled from "Test.java"
public class test.Test extends java.lang.Object{
    int number;
    public test.Test();
    public void sayHello();
}

If you you run javap -C Test you receive the byte-code


C:\temp\javaptest>javap -c Test
Compiled from "Test.java"
public class test.Test extends java.lang.Object{
int number;

public test.Test();
  Code:
   0:   aload_0
   1:   invokespecial   #1; //Method java/lang/Object."<init>":()V
   4:   aload_0
   5:   iconst_5
   6:   putfield        #2; //Field number:I
   9:   return

public void sayHello();
  Code:
   0:   getstatic       #3; //Field java/lang/System.out:Ljava/io/PrintStream;
   3:   ldc     #4; //String Hello
   5:   invokevirtual   #5; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
   8:   return

}

To get the full Java source code you can use the tool jad.

16.11.2008 Updated entry based on comments from Eric and Phil. Thanks!

Quicksort in Scala

Friday, November 13th, 2009

Scala allows to define very short and precise the intension of the programmer. To demonstrate this I use Quicksort as an Example.

The following is an implementation of quicksort in Scala.


package de.vogella.scala.quicksort

/* Quicksort in Scala */
class Quicksort {
	def sort(a:Array[Int]): Array[Int] =
		if (a.length < 2) a
		else {
			val pivot = a(a.length / 2)
			sort (a filter (pivot>)) ++ (a filter (pivot == )) ++
				sort (a filter(pivot <))
		}
}

And a little test


package de.vogella.scala.quicksort

object Test {
  def main(args: Array[String]) = {
    val quicksort = new Quicksort
	val a = Array(5, 3, 2, 2, 1, 1, 9, 39 ,219)
	quicksort.sort(a).foreach(n=> (print(n), print (" " )))

  }
}

To learn more about Scala check out this introduction tutorial: Scala development with Eclipse

Update: this example is similar to the quicksort example from the excellent online Scala by Example book. Caution: The link is a pdf document.

Eclipse RCP – Removing the minimize and maximize buttons from Views

Friday, November 13th, 2009

I got the question how someone could remove the maximize and minimize buttons from a view in an Eclipse RCP application.

To archive this I know two ways.

Either set the layout to fixed in initialLayout() in Perspective.java


package de.vogella.intro.rcp.fixedview;

import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;

public class Perspective implements IPerspectiveFactory {

	public void createInitialLayout(IPageLayout layout) {
		String editorArea = layout.getEditorArea();
		layout.setEditorAreaVisible(false);
		layout.setFixed(true);

//		layout.addStandaloneView(View.ID,  false, IPageLayout.LEFT, 1.0f, editorArea);
	}

}

Or use the Perspective.java to add a standalone view.


package de.vogella.intro.rcp.fixedview;

import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;

public class Perspective implements IPerspectiveFactory {

	public void createInitialLayout(IPageLayout layout) {
		String editorArea = layout.getEditorArea();
		layout.setEditorAreaVisible(false);
//		layout.setFixed(true);

		layout.addStandaloneView(View.ID,  false, IPageLayout.LEFT, 1.0f, editorArea);
	}

}

If I add a standalone view via the extension “org.eclipse.ui.perspectiveExtensions” then the minimize and maximize buttons are still there.

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>

   <extension
         id="application"
         point="org.eclipse.core.runtime.applications">
      <application>
         <run
               class="de.vogella.intro.rcp.fixedview.Application">
         </run>
      </application>
   </extension>
   <extension
         point="org.eclipse.ui.perspectives">
      <perspective
            name="Perspective"
            class="de.vogella.intro.rcp.fixedview.Perspective"
            id="de.vogella.intro.rcp.fixedview.perspective">
      </perspective>
   </extension>
   <extension
         point="org.eclipse.ui.views">
      <view
            name="View"
            class="de.vogella.intro.rcp.fixedview.View"
            id="de.vogella.intro.rcp.fixedview.view">
      </view>
   </extension>
   <extension
         point="org.eclipse.ui.perspectiveExtensions">
      <perspectiveExtension
            targetID="*">
         <view
               id="de.vogella.intro.rcp.fixedview.view"
               minimized="false"
               ratio="1.0f"
               relationship="left"
               relative="org.eclipse.ui.editorss"
               standalone="true"
               visible="true">
         </view>
      </perspectiveExtension>
   </extension>

</plugin>

The behavior seems inconsistent. If I use coding to add a standalone view the minimize / maximize buttons are not there, if I use extension points they are still there.

Does anymore know if I’m missing something? Or is this a bug? If you know please comment on this blog post or contact me via twitter.

Update: Projekt attached.

FixedView.zip


Switch to our mobile site