Logo QF-Test

Finding valuable answers
in the Mailing List Archive.


Free Trial  Download  Buy

Thomas Max, QF-Test training and support

Use the full-text search on our web site to find helpful tips on the mailing list.

Thomas Max, 
Sr. Software Engineer & Trainer, QFS

2017 up to now  | 2016 | 2015 | 2014 | 2013 | 2012 | 2011 | 2010 | 2009 | 2008 | 2007

(older archive entries before 2007 are not shown here, but included in the onsite-search)

Mailing List - Entries of 2012

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [QF-Test] Eclipse Class Loading/Imports in SUT scripts

  • Subject: Re: [QF-Test] Eclipse Class Loading/Imports in SUT scripts
  • From: "Robert Lahmer, QFS support" <support@?.de>
  • Date: Fri, 30 Nov 2012 14:24:58 +0100

Hello Sean,

it seems you picked up the wrong ClassLoader. While

 wb = rc.getComponent("WorkbenchWindow")
 classLoader = wb.getData().getClass().getClassLoader()
 TheClass = classLoader.loadClass(...)

most of the time loads classes from org.eclipse.... successfully, it may fail in some cases. For example, to load a class from the draw2d package (used in GEF), you'll need another ClassLoader:

def getEditor(shell):
   wbw = shell.getData()
   pages = wbw.getPages()
   for i in range(len(pages)):
       wbp = pages[i]
       editor = wbp.getActiveEditor()
       return editor

wb = rc.getComponent("WorkbenchWindow")
ed = getEditor(wb)
classLoader = ed.getClass().getClassLoader()
Point = classLoader.loadClass("org.eclipse.draw2d.geometry.Point")

Provided that the active editor is a GEF editor (e.g. LogicEditor), the above code will load the Point class from draw2d.

Best regards,

--On Donnerstag, November 29, 2012 10:29:28 +0000 Sean Jones <sean.jones@?.com> wrote:


I am having trouble loading classes that are not included in the standard
eclipse package.  They are installed as plugins though.

The code:

produces the error:
java.lang.ClassNotFoundException: java.lang.ClassNotFoundException:

I have tried changing the META-INF/MANIFEST.MF to include the

Eclipse-BuddyPolicy: registered


Eclipse-RegisterBuddy: org.eclipse.swt

as it is mentioned on the mailing list but this unfortunately causes
eclipse to crash on start-up.
Any help would be appreciated.

qftest-list mailing list

Get the most out of QF-Test - through training directly from the authors
* via webinar       http://www.qfs.de/en/info/OnlineTraining_QF-Test.pdf
* here at QFS             http://www.qfs.de/en/info/Training_QF-Test.pdf
QFS Support - Robert Lahmer
Quality First Software GmbH                http://www.qfs.de
Tulpenstr. 41                         Tel: +49 8171 38648-20
DE-82538 Geretsried                   Fax: +49 8171 38648-16
GF: Gregor Schmid, Karlheinz Kellerer     HRB München 140833

Videos Downloads Documentation Buy Free Trial