Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 398682

Summary: [shell] shell incorrectly allows a required file parameter to be omitted
Product: [ECD] Orion Reporter: Mark Macdonald <mamacdon>
Component: ClientAssignee: Grant Gayed <grant_gayed>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: grant_gayed, libingw
Version: 2.0   
Target Milestone: 2.0 M2   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Mark Macdonald CLA 2013-01-21 15:02:00 EST
1. Create a plugin that registers a command taking a required file-typed parameter:

> provider.registerService('orion.shell.command', {
>   callback: function(args) { return 'foo'; }
> }, {
>   name: 'cool',
>   parameters: [
>   { // first argument -- required
>     name: 'thefile',
>     type: {name: "file", file: true, exist: true}, //$NON-NLS-0$
>     description: 'a file (required)'
>   },
>   { // second argument(s) -- optional
>     name: 'other_stuff',
>     type: { name: 'array', subtype: 'string' },
>     description: 'Optional arguments',
>     defaultValue: null
>   }]
> });

2. I expected that the first parameter (a valid filename) would be required to execute the command. However, the shell allows me to type only:
  cool 

And press Enter. This executes my command with a null args.thefile argument.

If I change the first parameter's type to "string" instead, I get the expected behavior (that is, you can't press Enter until you supply a value for the first param).