Next, since the Object in your scenario is a DataFolder, when a folder is
selected, the Action is automatically enabled because the folder has a
DataFolder built into its Lookup.

Now that the Action is enabled, you have the DataFolder available in the
constructor and can refer to it and use it and refer to it in the next part
of the logic in the ActionListener.

Gj

On Thu, 3 Dec 2020 at 09:26, Geertjan Wielenga <
[email protected]> wrote:

> The fact that the ActionListener takes an Object as an argument means that
> the annotations at the top of the class (or in the layer.xml file) will
> generate a context-sensitive Action that is sensitive to the Object in the
> argument. The Action will be enabled when the Object is available, i.e., in
> context, thanks to the Lookup.
>
> Gj
>
> On Thu, 3 Dec 2020 at 02:37, Sean Carrick <[email protected]> wrote:
>
>> Gj,
>>
>> Hello.
>>
>> I was looking at your tutorial (old, for NB8.1) for the RSS Reader. I
>> was especially looking at how you were storing new, user-created folders
>> and RSS feed files. However, reading through it, I was getting a little
>> confused, and want to make sure that I am properly understanding how
>> your last three code snippets are working together. First, I want to
>> explain how I am understanding it, then ask my questions of you.
>>
>> Toward the end of the section titled "Displaying the Node Hierarchy in
>> the Feed Window, in Step 4, you added code to the end of the
>> TopComponent's constructor with the BeanTreeView and a try...catch block.
>>
>> The two lines that I am particularly referring to are:
>>
>> FileObject rssFeedsFolder = FileUtil.getConfigFile("RssFeeds");
>>
>> Node rssFeedsNode = DataObject.find(rssFeedsFolder).getNodeDelegate();
>>
>> Down further in the tutorial, you have two code blocks: the first is the
>> AddRssAction class and the second is the AddFolderAction class. Both of
>> these classes' constructors take a DataFolder object as an argument.
>>
>> Now that I have laid all of that out, here is the way I am understanding
>> this, and I would like you to correct me if I am wrong, please.
>>
>> By creating the FileObject rssFeedsFolder and getting the config file
>> from FileUtil, when the DataObject.find() method is called, that gets
>> the rssFeedsFolder object into the constructors of the two Action
>> classes, correct?
>>
>> I do not see any other code regarding these Actions and, therefore, am
>> having trouble understanding how the two Action classes receive their
>> parameter value. With what I just explained of my understanding in the
>> paragraph above, am I even close to figuring this out? Or, do I need to
>> go back to kindergarten and re-learn reading comprehension? ;-}
>>
>> Regardless of how off I am, I am determined to learn this system. I
>> appreciate your assistance in getting me moving in the correct direction.
>>
>> Cheers,
>>
>> Sean C.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>> For further information about the NetBeans mailing lists, visit:
>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>
>>
>>
>>

Reply via email to