use of org.eclipse.ui.IEditorDescriptor in project azure-tools-for-java by Microsoft.
the class UIHelperImpl method refreshBlobs.
@Override
public void refreshBlobs(Object projectObject, final String accountName, final BlobContainer container) {
IWorkbench workbench = PlatformUI.getWorkbench();
final IEditorDescriptor editorDescriptor = workbench.getEditorRegistry().findEditor("com.microsoft.azuretools.azureexplorer.editors.BlobExplorerFileEditor");
DefaultLoader.getIdeHelper().invokeLater(new Runnable() {
public void run() {
//TODO
// try {
// IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
// BlobExplorerFileEditor newEditor = (BlobExplorerFileEditor) page.openEditor(new StorageEditorInput(storageAccount, container), editorDescriptor.getId());
// newEditor.fillGrid();
// } catch (PartInitException e) {
// Activator.getDefault().log("Error opening container", e);
// }
}
});
}
use of org.eclipse.ui.IEditorDescriptor in project translationstudio8 by heartsome.
the class ConversionCompleteAction method run.
@Override
public void run() {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
Assert.isNotNull(window);
Shell shell = window.getShell();
if (status.getSeverity() == IStatus.ERROR) {
MessageDialog.openError(shell, Messages.getString("action.ConversionCompleteAction.msgTitle1"), status.getMessage());
} else {
// 转换完成后直接打开编辑器,不再进行弹框提示。
// MessageDialog.openInformation(shell, "文件转换完成", status.getMessage());
final String XLIFF_EDITOR_ID = "net.heartsome.cat.ts.ui.xliffeditor.nattable.editor";
String xliffFile = conversionResult.get(Converter.ATTR_XLIFF_FILE);
IWorkbenchPage page = window.getActivePage();
Assert.isNotNull(page, Messages.getString("action.ConversionCompleteAction.msg1"));
if (xliffFile != null) {
IEditorDescriptor editorDescriptor = PlatformUI.getWorkbench().getEditorRegistry().findEditor(XLIFF_EDITOR_ID);
if (editorDescriptor != null) {
try {
IDE.openEditor(page, new File(xliffFile).toURI(), XLIFF_EDITOR_ID, true);
} catch (PartInitException e) {
MessageDialog.openInformation(shell, Messages.getString("action.ConversionCompleteAction.msgTitle2"), Messages.getString("action.ConversionCompleteAction.msg2") + e.getMessage());
e.printStackTrace();
}
}
} else {
String targetFile = conversionResult.get(Converter.ATTR_TARGET_FILE);
if (targetFile == null) {
MessageDialog.openInformation(shell, Messages.getString("action.ConversionCompleteAction.msgTitle2"), Messages.getString("action.ConversionCompleteAction.msg3"));
} else {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IFile input = root.getFileForLocation(new Path(targetFile));
try {
// 使用外部编辑器(系统默认编辑器)打开文件。
IDE.openEditor(page, input, IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
} catch (PartInitException e) {
MessageDialog.openInformation(shell, Messages.getString("action.ConversionCompleteAction.msgTitle2"), Messages.getString("action.ConversionCompleteAction.msg4") + e.getMessage());
e.printStackTrace();
}
}
}
}
}
Aggregations