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 online Nitin DahyabhaiFriend
Messages: 4435
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: Tue Apr 23 13:27:17 GMT 2024

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

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

Back to the top