What is the Function of Class AbstractAction JAVASEE 7?

0

Hi, I'm looking at the following code:

/**
 * On default select the represented agent and do the former original action
 * @return
 */
@Override
public Action getPreferredAction() {
    return new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            IPogamutEnvironments environments = Lookup.getDefault().lookup(IPogamutEnvironments.class);
            if (environments == null)
                return;

            environments.getEnvironmentSelection(map).changeSelected(agent);

            // Do the original action
            Action original = UnrealAgentNode.super.getPreferredAction();
            if (original != null)
                original.actionPerformed(e);
        }
    };
}

I'm looking at example 1 on this page:

this

I understand everything well but here I already lost myself and I did not understand, someone could explain to me what it is that they are trying to do, I am saying this part:

environments.getEnvironmentSelection(map).changeSelected(agent);

        // Do the original action
        Action original = UnrealAgentNode.super.getPreferredAction();

    
asked by simon 19.02.2018 в 19:22
source

0 answers