Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Memory Analyzer » java.lang.NoClassDefFoundError: org/eclipse/mat/ui/snapshot/editor/ISnapshotEditorInput(Trying to create a MAT Plugin to display Android Bitmaps as Images)
java.lang.NoClassDefFoundError: org/eclipse/mat/ui/snapshot/editor/ISnapshotEditorInput [message #878201] Mon, 28 May 2012 20:22 Go to next message
Spear Hend is currently offline Spear HendFriend
Messages: 1
Registered: May 2012
Junior Member
I am working to create a Eclipse MAT plugin that will display as an Image the contents of from a HPROF dump.

Please see attached Screenshot.


In attached screenshot, we have:

Item 1 - The button the user clicks to show the Image version of the Bitmap object
Item 2 - The Bitmap object selected by the user.
Item 3 - The InspectorView, that displays attributes of the selected Object.

Since InspectorView has access to 60% of the data I need to display the Bitmap, I referred to and modeled my plugin based off it.

| plugin.xml |

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
   <extension point="org.eclipse.mat.ui.editorContributions">
      <contribution class="mat.showbitmap.EditorContributor" editorClass="org.eclipse.mat.ui.snapshot.editor.HeapEditor" sequenceNr="2"/>

This allows my plugin to add the Icon to the toolbar. However, IMultiPaneEditorContributer is internal and its use is restricted. I chose to ignore this warning.

For now, let us not worry about the static MultiPaneEditor mEditor.

| |

package mat.showbitmap;

import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.mat.ui.editor.IMultiPaneEditorContributor;
import org.eclipse.mat.ui.editor.MultiPaneEditor;

public class EditorContributor implements IMultiPaneEditorContributor {
   UiAction uiAction = new UiAction();
   public static MultiPaneEditor mEditor = null;
   public void contributeToToolbar(IToolBarManager aManager) {
      aManager.add(new Separator());

   public void dispose() {

   public void init(MultiPaneEditor aEditor) {
      mEditor = aEditor;
      System.out.println("Editor is new " + mEditor);

| |

package mat.showbitmap;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mat.query.IContextObject;
import org.eclipse.mat.ui.editor.AbstractEditorPane;
import org.eclipse.mat.ui.snapshot.editor.ISnapshotEditorInput;
import org.eclipse.ui.IEditorInput;

public class UiAction extends Action {

   public UiAction() {
      super(Messages.SBUIAct_Icon_Text, Activator.getImageDescriptor(Activator.SHOW_BITMAP_ICON));
   public void run() {;
      if (null == EditorContributor.mEditor) {
      AbstractEditorPane activePane = EditorContributor.mEditor.getActiveEditor();
      System.out.println("Current pane " + activePane);
      if (!(activePane instanceof ISelectionProvider) || (null == activePane)) {
      ISelectionProvider selProv = (ISelectionProvider)activePane;
      ISelection sel = selProv.getSelection();
      if (null == sel) {
      System.out.println("Current selection " + sel);
      IContextObject objectSet = null;

      if (sel instanceof IStructuredSelection) {
         Object object = ((IStructuredSelection)sel).getFirstElement();
         if (object instanceof IContextObject) {
            objectSet = (IContextObject) object;
      if (null == objectSet) {
      int objectId = objectSet.getObjectId();
      System.out.println("Object id " + objectId);

      IEditorInput input = EditorContributor.mEditor.getPaneEditorInput();
      System.out.println("Input is " + input);
      if (null == input || !(input instanceof ISnapshotEditorInput)) {
      ISnapshotEditorInput editorInput = (ISnapshotEditorInput)input;
      System.out.println("Editor Input is " + editorInput);

The trouble starts when I try to use ISnapshotEditorInput. I get a Runtime error.

java.lang.NoClassDefFoundError: org/eclipse/mat/ui/snapshot/editor/ISnapshotEditorInput
	at org.eclipse.jface.action.Action.runWithEvent(
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(
	at org.eclipse.jface.action.ActionContributionItem.access$2(
	at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(
	at org.eclipse.swt.widgets.EventTable.sendEvent(
	at org.eclipse.swt.widgets.Widget.sendEvent(
	at org.eclipse.swt.widgets.Display.runDeferredEvents(
	at org.eclipse.swt.widgets.Display.readAndDispatch(
	at org.eclipse.ui.internal.Workbench.runEventLoop(
	at org.eclipse.ui.internal.Workbench.runUI(
	at org.eclipse.ui.internal.Workbench.access$4(
	at org.eclipse.ui.internal.Workbench$
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.lang.reflect.Method.invoke(
	at org.eclipse.equinox.launcher.Main.invokeFramework(
	at org.eclipse.equinox.launcher.Main.basicRun(
	at org.eclipse.equinox.launcher.Main.main(
Caused by: java.lang.ClassNotFoundException: org.eclipse.mat.ui.snapshot.editor.ISnapshotEditorInput
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(
	at java.lang.ClassLoader.loadClass(
	... 30 more

Here are my questions:

1. What is the best way to implement a plugin that can show the Image representation of an Am I on the right track or are there better ways?
2. IMultiPaneEditorContributor appears to be Internal. Is it advisable to use this interface in my plugin.
3. Why am I getting the NoClassDefFoundError? Is it because of a classpath problem or my plugin cannot access ISnapshotEditorInput? I did nothing special for IMultiPaneEditorContributor and it appears to be working fine.

Please let me know.
Re: java.lang.NoClassDefFoundError: org/eclipse/mat/ui/snapshot/editor/ISnapshotEditorInput [message #878338 is a reply to message #878201] Tue, 29 May 2012 05:32 Go to previous message
Andrew Johnson is currently offline Andrew JohnsonFriend
Messages: 124
Registered: July 2009
Senior Member
1.I'm not sure. This is how SWT images are displayed, but it isn't directly extensible Bugzilla 258224: InspectorView enhancement to render ImageData and RGBs.
A slightly similar suggestion is Bugzilla 274369: Add SWT smarts to inspector

2.None of the UI code is an API, so can be freely changed by the committers in releases or service updates.
If it is just for your own use, and you are prepared to rewrite it whenever MAT changes, then you could use it, but you aren't supposed to complain when that happens.

IMultiPaneEditorContributor is in the package org.eclipse.mat.ui.editor
This is exported via the, though is not intended for public access, which is why you got a warning

ISnapshotEditorInput is in the package org.eclipse.mat.ui.snapshot.editor
which is not exported via the
Previous Topic:My plugin is not loaded
Next Topic:Some Paths to GC root not found?
Goto Forum:

Current Time: Tue Dec 01 18:32:12 GMT 2015

Powered by FUDForum. Page generated in 0.08147 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software