Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Getting a filename from the WidgetSelected method
Getting a filename from the WidgetSelected method [message #1829546] Mon, 06 July 2020 17:32 Go to next message
Katya Doersam is currently offline Katya DoersamFriend
Messages: 26
Registered: June 2020
Junior Member
I created a handler class for my eclipse plugin. Currently, I have a window pop that pops up which contains a button. That button, when clicked, opens a file dialog. I want to be able to in the main class of the handler, assign the fileName received in the WidgetSelected method to a String variable. I want to be able to display the fileName received in the window as a textbox. Is there a way to do this without making the fileName a global variable?
Re: Getting a filename from the WidgetSelected method [message #1829561 is a reply to message #1829546] Mon, 06 July 2020 20:31 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 3904
Registered: July 2009
Senior Member

If you're just trying to make the value visible outside of the scope of your anonymous SelectionListener, there are multiple ways to do it. The simplest, and you'll see this done in a lot of Eclipse code, is to create a final array with a length of 1 and have your listener store the value inside the array.

Nitin Dahyabhai
Eclipse Web Tools Platform
Previous Topic:Garbled characters in Eclipse/Spring Tool Suite UI
Next Topic:Cannot retry install
Goto Forum:

Current Time: Thu Nov 26 23:37:36 GMT 2020

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

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

Back to the top