Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Discouraged access: for the method getDefault()(I was trying to get the workspace path from where I run the Bot scripts and I get compliation errors with Activator class)
Discouraged access: for the method getDefault() [message #808707] Tue, 28 February 2012 03:15 Go to next message
Roopa V is currently offline Roopa VFriend
Messages: 4
Registered: February 2012
Junior Member
I am trying to access the test files in my working directory(from where I initiate the test run) during runtime. I used the following code to get the absolute path of the file during runtime.

In short I was trying to get the workspace path from where I run the Bot scripts and used the following code.

Code snippet
*********************************************************************************

@Test
public void setup1() throws Exception{
URL url = new URL(Activator.getDefault().getBundle().getEntry("/"),
"testdata/main.aql");
}
******************************************************************************

But I get the follwing compile errors and warnings .

Multiple markers at this line
- The method getBundle() is undefined for the type Activator
- Discouraged access: The method getDefault() from the type Activator is not accessible due to restriction on required library C:\eclipse\plugins
\org.eclipse.core.contenttype_3.4.100.v20100505-1235.jar
- Discouraged access: The type Activator is not accessible due to restriction on required library C:\eclipse\plugins
\org.eclipse.core.contenttype_3.4.100.v20100505-1235.jar


Can someone help me resolve the above errrors ?
Re: Discouraged access: for the method getDefault() [message #809913 is a reply to message #808707] Wed, 29 February 2012 12:36 Go to previous message
Roopa V is currently offline Roopa VFriend
Messages: 4
Registered: February 2012
Junior Member
Atlast I got it working as i just need the absolute path of a file and the following line worked .

System.out.print(new File("testdata/textanalytics/test_files/src/main.aql").getAbsolutePath());

Please note that when you use the relative file path do not start with a '/'.

Previous Topic:how to get path for files in the plugin?
Next Topic:SWTBotMenu.click
Goto Forum:
  


Current Time: Fri Mar 29 09:16:37 GMT 2024

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

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

Back to the top