Changeset 180


Ignore:
Timestamp:
07/31/08 17:26:51 (16 years ago)
Author:
ra33
Message:

syncronised simple and actions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/actions/Simple.java

    r176 r180  
    27842784                        DisplayIO.setCursorPosition(x, y);
    27852785                } else {
    2786                         throw new RuntimeException("Unknown statement");
     2786                        //Check the available actions
     2787                        if(!executeAction(tokens, context)){
     2788                                throw new RuntimeException("Unknown statement");
     2789                        }
    27872790                }
    27882791                return Status.OK;
     2792        }
     2793
     2794        private static boolean executeAction(String[] tokens, Context context) throws Exception{
     2795                StringBuffer command = new StringBuffer();
     2796                command.append(tokens[0]);
     2797                int param = 1;
     2798               
     2799                Frame source = null;
     2800                //Check if the first param is a frame
     2801                if(param < tokens.length && tokens[param].startsWith(SPointer.framePrefix)){
     2802                        source = (Frame)context.getPointers().getVariable(tokens[param]).getValue();
     2803                        param++;
     2804                }
     2805                //Check if the next param is an item
     2806                Item launcher = null;
     2807                if(param < tokens.length && tokens[param].startsWith(SPointer.itemPrefix)){
     2808                        launcher = (Item)context.getPointers().getVariable(tokens[param]).getValue();
     2809                        param++;
     2810                }
     2811                for(int i = param; i < tokens.length; i++){
     2812                        command.append(' ').append(context.getPrimitives().getStringValue(tokens[i]));
     2813                }
     2814                if(source == null)
     2815                        source = DisplayIO.getCurrentFrame();
     2816                //Finally add the rest of the params as Strings
     2817                Actions.PerformAction(source, launcher, command.toString());
     2818                return true;
    27892819        }
    27902820
Note: See TracChangeset for help on using the changeset viewer.