TimeGT launching soon!

 

Getting TPTP installed in Ubuntu - first post from Ivar

One of the Codehoopers started to blog about Eclipse and programming, welcome aboard! :)

As he doesn’t have much readers yet I guess it’s ok to point to his first post: Eclipse TPTP and Ubuntu”

It’s about getting TPTP running. Especially under Linux. Don’t underestimate the complexity of this - it’s not that easy :)

Nice post, thank you!

PS. Some old-time readers might remember that Ivar has been featured at this blog also before - Four is the Magical Number - and so is 5920.

Share:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg
  • Reddit
Comments (0) Thursday, February 7, 9:16 pm

Eclipse workspace fails to start after crash - quick fix

Here’s a quick HOWTO for resolving Eclipse startup workspace loading problems. If you have a better suggestion then please leave a comment!

There can be a lot of other issues but here is one of the quite common ones - eclipse resources cache or state gets out of sync/corrupted.

This can happen when your IDE crashes OR also without crashing. For non-crashing case it’s more likely a logic/bug problem and whenever possible, try to file a bug at bugs.eclipse.org!

Sometimes, just SOMETIMES, you’ll get exceptions like following when launching Eclipse IDE after crashing it:

Root exception:
org.eclipse.core.internal.resources.ResourceException(null)[567]:
java.io.UTFDataFormatException: malformed input around byte 394
at java.io.DataInputStream.readUTF(Unknown Source)
at java.io.DataInputStream.readUTF(Unknown Source)
at org.eclipse.core.internal.resources.WorkspaceTreeReader_1.
readPluginsSavedStates(WorkspaceTreeReader_1.java:111)
at org.eclipse.core.internal.resources.WorkspaceTreeReader_1.
readTree(WorkspaceTreeReader_1.java:159)
at org.eclipse.core.internal.resources.SaveManager.restoreTree(SaveManager.java:916)
at org.eclipse.core.internal.resources.SaveManager.restore(SaveManager.java:647)
at org.eclipse.core.internal.resources.SaveManager.startup(SaveManager.java:1319)
at org.eclipse.core.internal.resources.Workspace.startup(Workspace.java:1949)
at org.eclipse.core.internal.resources.Workspace.open(Workspace.java:1713)
at org.eclipse.core.resources.ResourcesPlugin.start(ResourcesPlugin.java:363)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.
run(BundleContextImpl.java:999)
at java.security.AccessController.doPrivileged(Native Method)

The key here is row “org.eclipse.core.internal.resources.SaveManager.restore(SaveManager.java:647)”.

This stakctrace means your root .tree file is damaged and thereby unable to restore your opened projects.

The quickest way to fix this or any other resource-related exception is to:

  1. Shut down Eclipse IDE
  2. Remove and backup your workspace/.metadata/.plugins/org.eclipse.core.resources directory
  3. Start Eclipse IDE (with -clean to be super-safe)
  4. Reimport all projects (UPDATE: Just use File->Import->Existing Project into Workspace and browse your workspace/project directory)
  5. Enjoy

Maybe deleting workspace/.metadata/.plugins/org.eclipse.core.resources/.root/*tree would have been good enough for my case but it’s definitely not a workaround for other possible workspace resource state and cache related exceptions.

I’m not sure if this information without any reproducible steps is useful for bugs.eclipse.org. Not filing it this time. Or should I?

Share:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg
  • Reddit
Comments (10) Tuesday, January 15, 2:47 pm

Configuring Eclipse SVN (Subclipse) to use JavaHL(JNI)

 

Configuring JavaHL for Eclipse is not as straightforward as it could be so posting a quick HOWTO. Following applies mostly to Linux users.

With Ubuntu the fool-proof steps are:

  1. Make sure libsvn-java, subversion and libsvn1 packages are installed
  2. Add following to the end of your eclipse.ini file: -Djava.library.path=/usr/lib/jni
  3. Restart eclipse and make sure JavaHL is selected under Window->Preferences->Team->SVN

By using JavaHL it gets more likely that your svn repo doesn’t get screwed up when using both command-line/shell and subclipse for svn.



Configuring Eclipse to use native SVN client - JavaHL

Share:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg
  • Reddit
Comments (1) Thursday, January 10, 4:04 pm

Avoid useless Plugin Initialization and/or Class Loading

Here’s a tip for initializing your plugins or any other singleton-like repository only when needed.

Consider a code like this:

if (isConfigurable()) {
  Bundle bundleCopy = bundle;
  Preferences[] preferencesCopy = new Preferences[1];
  preferencesCopy[0] = new org.eclipse.core.internal.
			preferences.legacy.PreferenceForwarder(
			this, bundleCopy.getSymbolicName());
  return preferencesCopy;
}
return null;

Do you see what’s wrong there?

The problem is that if your #isConfigurable is always FALSE then your code still:

  1. loads PreferencesForwarder class
  2. initializes all PreferencesForwarder’s static variables
  3. forces Preferences plugin to load

Always, if possible and makes sense, isolate your class loading into a simple Runnable inner class if there is some static init or plugin activation trigger involved!

Then the code would become:

if (isConfigurable()) {
  final Bundle bundleCopy = bundle;
  final Preferences[] preferencesCopy = new Preferences[1];
  Runnable innerCall = new Runnable() {
    public void run() {
      preferencesCopy[0] = new org.eclipse.core.internal.
			       preferences.legacy.PreferenceForwarder(
				 this, bundleCopy.getSymbolicName());
    }
  };
  innerCall.run();
}
return null;

When you think of it - this pattern is somewhat similar to the singleton pattern implementation - the one of the very few thread-safe and fast singleton patterns that is bugfree and truly lazy!

Quoting wonderful singleton impl from wikipedia:

public class Singleton {
   private Singleton() {}
   private static class SingletonHolder {
     private final static Singleton INSTANCE = new Singleton();
   }
   public static Singleton getInstance() {
     return SingletonHolder.INSTANCE;
   }
 }

(OK, to be fully honest, since java1.5 you can also trust volatile flags but - trust noone, use the old stuff:P)

For the reference, the PreferencesForwarder example was taken from the org.eclipse.core.runtime.Plugin#getPluginPreferences class and modified a bit.

UPDATE: This post is not fully correct! Never assume something to be true even if it comes from a trustworthy source like eclipse core runtime source. Please see the comments for explanation!

Share:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg
  • Reddit
Comments (3) Wednesday, December 19, 2:08 pm

Eclipse Top 5 Annoyances

 

Here is the list of Top 5 Eclipse Annoyances we came up today at the coffee-table, possibly nice to share (in the order of importance).

Also serves as a good wish-list to my Santa Claus!

1. Update Manager

With the help of p2 provisioning and hard work this will be hopefully solved for 3.5. Please don’t mess it up this time! :)

There was also some provisioning-related work done as part of 2007 Google Summer of Code.

When talking about “enemies” - Netbeans update manager is much more decent (yet less flexible)

2. Cannot have editors for “no-extension” files
no-Extension-Support bugzilla

Well, files without an extensions SHOULD be treated as any regular file - don’t make them feel like crap! :)

YET! At the same time we treat filenames without a filename properly - .project has the extension but no filename :P

3. Opening files from command line
command-line file opening bugzilla

Getting closer I hope, there is a summer-of-code project related to command line commands (about triggering eclipse actions from web-sites). Plus a proof-of-concept thin text-editor padclipse.

Dear Eclipse, give command-line file-open and other configurable command line options. My neighbor Netbeans has it, I want it too.

4. Word Wrap
word wrap bugzilla

HAHAHA! You can take it from here, the official eclipse word wrap page. It works but has it’s drawbacks like bugs with ruler line numbers etc.
More seriously - it won’t be there in any near timeframe IMHO. Architecturally there has been a little flaw in the very core of Eclipse - SWT.

In SWT StyledText making up all these editors is missing a difference between physical and visual line numbers. Because of that a lot of plugins use one set of API methods for both visual and physical line numbers. To make sure transition is causing no harm, existing API should probably keep showing physical line numbers. But that would break quite a few things - rulers etc.

Not sure how many 3rd party plugins use line info and how to treat them nice while transitioning. Or if that ever happens.

5. Split Editor
Split Editor bugzilla link

What the heck is with this feature? People vote and ask for it.

Do you really need this? You can have many editors for the same file anyway just by choosing New Editor from the tab view popup.

What’s your greatest Eclipse New-Year-Wish?

Share:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg
  • Reddit
Comments (10) Tuesday, December 18, 2:07 pm