org.eclipse.ui.PlatformUI.getWorkbench().saveAll(..)
should do the trick.
If you want to save the active editor, please try
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorPart editor = page.getActiveEditor();
page.saveEditor(editor, true /* confirm */);
Note that the elements in the navigation path may be null.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…