2019 up to now | 2018 2017  |  2016  | 2015 | 2014 | 2013 | 2012

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