Bug 4842 - Can't launch external editors. (1GKEYOE)
Summary: Can't launch external editors. (1GKEYOE)
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.0   Edit
Hardware: All Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Felipe Heidrich CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-11 14:24 EDT by Eduardo Pereira CLA
Modified: 2002-04-24 14:37 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eduardo Pereira CLA 2001-10-11 14:24:00 EDT
Steps:
		1) Create a file a.txt
		2) Preferences->Workbench->File Editors->Select *.txt
		3) Add extenal editor -> "wordpad document"
		4) close a.txt if opened.
		5) Select a.txt
		6) File->Open with-> WordPad

	A dialog will be open with a CoreException.
	See ExternalEditor>>#open() throws CoreException

NOTES:
	EJP (9/21/2001 1:38:00 PM)
		The problem in the Program.execute
		On NT the instance var command = full path name of the executable.
		On 2000 command = %SystemRoot%\system32\NOTEPAD.EXE 

	EJP (9/21/2001 1:49:26 PM)
		When using Wordpad the var is %Program files%
Comment 1 DJ Houghton CLA 2001-10-29 16:42:47 EST
PRODUCT VERSION:
	Eclipse Build 136 - Win2000

Comment 2 Eduardo Pereira CLA 2002-04-23 16:59:35 EDT
Could we increase the priority of this bug. Some times it is usefull to launch 
external programs?
It would be interesting to fix bug 4835 as well since it is related.
Comment 3 Mike Wilson CLA 2002-04-24 08:47:12 EDT
FH to investigate. Talk to SSQ about it.
Comment 4 Felipe Heidrich CLA 2002-04-24 11:29:12 EDT
Small code that shows the bug
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
import java.io.File;
import org.eclipse.swt.program.Program;
public class TestProgram {
public static void main(String[] args){
 Program[] programs = Program.getPrograms();
 Program program = null;
 for (int i = 0; i < programs.length; i++) {
  Program p = programs[i];
  if( p.getName().equals("WordPad Document") ) {
   program = p;
   break;
  }
 }
 if (program == null) {
  System.out.println("Program not found");
  return;
 }
 String filename = "D:\\eclipse\\runtime-workspace\\Test\\a.txt";
 File f = new File (filename);
 if( f.exists() ) //just to be sure...
  System.out.println("Sucess: "+program.execute(filename));
 }
}

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Exception hide inside the Program.execute:
java.io.IOException: CreateProcess: "%ProgramFiles%\Windows 
NT\Accessories\WORDPAD.EXE" "D:\eclipse\runtime-workspace\Test\a.txt" error=2
Comment 5 Felipe Heidrich CLA 2002-04-24 14:37:44 EDT
Fixed > 20020424