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() {
@Override
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 azure-tools-for-java by Microsoft.
the class UIHelperImpl method openItem.
@Override
public <T extends StorageServiceTreeItem> void openItem(Object projectObject, final ClientStorageAccount clientStorageAccount, final T item, String itemType, String itemName, String iconName) {
// Display.getDefault().syncExec(new Runnable() {
// @Override
// public void run() {
// try {
// BlobExplorerView view = (BlobExplorerView) PlatformUI
// .getWorkbench().getActiveWorkbenchWindow()
// .getActivePage().showView("com.microsoft.azureexplorer.views.BlobExplorerView");
// view.init(storageAccount, (BlobContainer) blobContainer);
// } catch (PartInitException e) {
// Activator.getDefault().log("Error opening container", e);
// }
// }
// });
IWorkbench workbench = PlatformUI.getWorkbench();
IEditorDescriptor editorDescriptor = workbench.getEditorRegistry().findEditor(type2Editor.get(item.getClass()));
try {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorPart newEditor = page.openEditor(new StorageEditorInput(clientStorageAccount.getName(), clientStorageAccount.getConnectionString(), item), editorDescriptor.getId());
} catch (PartInitException e) {
Activator.getDefault().log("Error opening " + item.getName(), e);
}
}
use of org.eclipse.ui.IEditorDescriptor in project azure-tools-for-java by Microsoft.
the class UIHelperImpl method openContainerRegistryPropertyView.
@Override
public void openContainerRegistryPropertyView(@NotNull ContainerRegistryNode node) {
String sid = node.getSubscriptionId();
String resId = node.getResourceId();
if (Utils.isEmptyString(sid) || Utils.isEmptyString(resId)) {
return;
}
IWorkbench workbench = PlatformUI.getWorkbench();
ContainerRegistryExplorerEditorInput input = new ContainerRegistryExplorerEditorInput(sid, resId, node.getName());
IEditorDescriptor descriptor = workbench.getEditorRegistry().findEditor(ContainerRegistryExplorerEditor.ID);
openEditor(EditorType.CONTAINER_EXPLORER, input, descriptor);
}
use of org.eclipse.ui.IEditorDescriptor in project titan.EclipsePlug-ins by eclipse.
the class ReferenceSearchResultView method showMatch.
@Override
protected void showMatch(final Match match, final int currentOffset, final int currentLength) throws PartInitException {
if (!(match instanceof ReferenceSearchMatch)) {
return;
}
IStructuredSelection selection = (IStructuredSelection) getViewer().getSelection();
if (selection != null && !selection.toList().contains(match)) {
getViewer().setSelection(new StructuredSelection(match));
}
IFile file = (IFile) match.getElement();
IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(file.getName());
if (desc == null) {
return;
}
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorPart part = page.openEditor(new FileEditorInput(file), desc.getId(), false);
if (part != null && part instanceof ITextEditor) {
ITextEditor textEditor = (ITextEditor) part;
textEditor.selectAndReveal(currentOffset, currentLength);
}
}
use of org.eclipse.ui.IEditorDescriptor in project titan.EclipsePlug-ins by eclipse.
the class FindDefinitionAction method showInEditor.
private void showInEditor(final ILocateableNode node) {
final Location location = node.getLocation();
final IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(location.getFile().getName());
if (desc == null) {
TITANDebugConsole.println("Cannot find the editor");
return;
}
final IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
try {
final IEditorPart editorPart = activePage.openEditor(new FileEditorInput((IFile) location.getFile()), desc.getId());
if (editorPart != null && (editorPart instanceof AbstractTextEditor)) {
((AbstractTextEditor) editorPart).selectAndReveal(location.getOffset(), location.getEndOffset() - location.getOffset());
}
} catch (PartInitException e) {
ErrorReporter.logExceptionStackTrace("Error while opening the editor", e);
}
}
Aggregations