@Override public void run() { IPath ignoreThrownExceptionsPath = PyExceptionBreakPointManager.getInstance().ignoreCaughtExceptionsWhenThrownFrom .getIgnoreThrownExceptionsPath(); File file = ignoreThrownExceptionsPath.toFile(); IEditorPart openFile = EditorUtils.openFile(file); if (openFile instanceof ITextEditor) { final ITextEditor textEditor = (ITextEditor) openFile; IDocumentProvider documentProvider = textEditor.getDocumentProvider(); final IEditorInput input = openFile.getEditorInput(); if (documentProvider instanceof IStorageDocumentProvider) { IStorageDocumentProvider storageDocumentProvider = (IStorageDocumentProvider) documentProvider; // Make sure the file is seen as UTF-8. storageDocumentProvider.setEncoding(input, "utf-8"); textEditor.doRevertToSaved(); } if (textEditor instanceof ISaveablePart) { IPropertyListener listener = new IPropertyListener() { @Override public void propertyChanged(Object source, int propId) { if (propId == IWorkbenchPartConstants.PROP_DIRTY) { if (source == textEditor) { if (textEditor.getEditorInput() == input) { if (!textEditor.isDirty()) { PyExceptionBreakPointManager.getInstance().ignoreCaughtExceptionsWhenThrownFrom .updateIgnoreThrownExceptions(); } } } } } }; textEditor.addPropertyListener(listener); } } // Code to provide a dialog to edit it (decided on opening the file instead). // Collection<IgnoredExceptionInfo> ignoreThrownExceptionsForEdition = PyExceptionBreakPointManager.getInstance() // .getIgnoreThrownExceptionsForEdition(); // HashMap<String, String> map = new HashMap<>(); // for (IgnoredExceptionInfo ignoredExceptionInfo : ignoreThrownExceptionsForEdition) { // map.put(ignoredExceptionInfo.filename + ": " + ignoredExceptionInfo.line, ignoredExceptionInfo.contents); // } // // EditIgnoredCaughtExceptionsDialog dialog = new EditIgnoredCaughtExceptionsDialog(EditorUtils.getShell(), map); // int open = dialog.open(); // if (open == dialog.OK) { // Map<String, String> result = dialog.getResult(); // // } else { // System.out.println("Cancel"); // } }