Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 74026 - OpenExternalFileAction doesn't inform user of invalid editor input
Summary: OpenExternalFileAction doesn't inform user of invalid editor input
Status: RESOLVED DUPLICATE of bug 58179
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-15 18:06 EDT by Dan Kehn CLA
Modified: 2005-09-22 10:27 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Kehn CLA 2004-09-15 18:06:11 EDT
Editors / views throw the PartInitException during their init method to 
indicate they can't display.  In the case of editors, the exception text 
usually indicates why the input wasn't acceptable.  Actions like 
ShowInNavigatorAction and GotoTaskAction correctly catch this exception and 
display a message to the user to inform them what's wrong.

The OpenExternalFileAction correctly catches the PartInitException but then 
fails to inform the user.  So if you use this menu choice for an editor that 
can't accept files from outside the workspace, the user gets no feedback why 
(even if the associated editor says the input is invalid).

OpenExternalFileAction should inform the user using the message text provided 
in the exception. See the code from OpenExternalFileAction below:

public void run() {
  File file= queryFile();
    if (file != null && file.exists()) {
      IEditorInput input= createEditorInput(file);
      String editorId= getEditorId(file);
      IWorkbenchPage page= fWindow.getActivePage();
      try {
        page.openEditor(input, editorId);
      } catch (PartInitException e) {
// ------------------------ inform user with MessageDialog ----
        e.printStackTrace();
     }
   } else if (file != null) {
     String msgFmt = TextEditorMessages.getString(...);
     String msg = MessageFormat.format(...);
     MessageDialog.openWarning(...), msg);		
    }
  }
Comment 1 Dani Megert CLA 2004-09-16 08:12:43 EDT

*** This bug has been marked as a duplicate of 58179 ***
Comment 2 Dani Megert CLA 2005-09-22 10:27:04 EDT
The exception is now shown inside the editor.