Search in sources :

Example 6 with IEditorDescriptor

use of org.eclipse.ui.IEditorDescriptor in project translationstudio8 by heartsome.

the class HtmlBrowserEditor method init.

@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
    setSite(site);
    setInput(input);
    setPartName(input.getName());
    Image oldTitleImage = titleImage;
    if (input != null) {
        IEditorRegistry editorRegistry = PlatformUI.getWorkbench().getEditorRegistry();
        IEditorDescriptor editorDesc = editorRegistry.findEditor(getSite().getId());
        ImageDescriptor imageDesc = editorDesc != null ? editorDesc.getImageDescriptor() : null;
        titleImage = imageDesc != null ? imageDesc.createImage() : null;
    }
    setTitleImage(titleImage);
    if (oldTitleImage != null && !oldTitleImage.isDisposed()) {
        oldTitleImage.dispose();
    }
    FileEditorInput fileInput = (FileEditorInput) input;
    htmlUrl = fileInput.getFile().getLocation().toOSString();
}
Also used : IEditorDescriptor(org.eclipse.ui.IEditorDescriptor) FileEditorInput(org.eclipse.ui.part.FileEditorInput) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) Image(org.eclipse.swt.graphics.Image) IEditorRegistry(org.eclipse.ui.IEditorRegistry)

Example 7 with IEditorDescriptor

use of org.eclipse.ui.IEditorDescriptor in project translationstudio8 by heartsome.

the class XLFEditor method init.

@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("init(IEditorSite site, IEditorInput input)");
    }
    setSite(site);
    setInput(input);
    // 设置Editor标题栏的显示名称,否则名称用plugin.xml中的name属性
    setPartName(input.getName());
    Image oldTitleImage = titleImage;
    if (input != null) {
        IEditorRegistry editorRegistry = PlatformUI.getWorkbench().getEditorRegistry();
        IEditorDescriptor editorDesc = editorRegistry.findEditor(getSite().getId());
        ImageDescriptor imageDesc = editorDesc != null ? editorDesc.getImageDescriptor() : null;
        titleImage = imageDesc != null ? imageDesc.createImage() : null;
    }
    setTitleImage(titleImage);
    if (oldTitleImage != null && !oldTitleImage.isDisposed()) {
        oldTitleImage.dispose();
    }
    getSite().setSelectionProvider(this);
    cursorIbeam = new Cursor(null, SWT.CURSOR_IBEAM);
    cursorArrow = new Cursor(null, SWT.CURSOR_ARROW);
    hookListener();
}
Also used : IEditorDescriptor(org.eclipse.ui.IEditorDescriptor) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) Image(org.eclipse.swt.graphics.Image) Cursor(org.eclipse.swt.graphics.Cursor) IEditorRegistry(org.eclipse.ui.IEditorRegistry)

Example 8 with IEditorDescriptor

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);
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) StorageEditorInput(com.microsoft.azuretools.azureexplorer.editors.StorageEditorInput) IEditorDescriptor(org.eclipse.ui.IEditorDescriptor) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart) PartInitException(org.eclipse.ui.PartInitException)

Example 9 with IEditorDescriptor

use of org.eclipse.ui.IEditorDescriptor in project azure-tools-for-java by Microsoft.

the class UIHelperImpl method refreshTable.

@Override
public void refreshTable(Object projectObject, final StorageAccount storageAccount, final Table table) {
    IWorkbench workbench = PlatformUI.getWorkbench();
    final IEditorDescriptor editorDescriptor = workbench.getEditorRegistry().findEditor("com.microsoft.azuretools.azureexplorer.editors.TableFileEditor");
    DefaultLoader.getIdeHelper().invokeLater(new Runnable() {

        public void run() {
        // TODO
        /*try {
                    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
                    TableFileEditor newEditor = (TableFileEditor) page.openEditor(new StorageEditorInput(storageAccount, table), editorDescriptor.getId());
                    newEditor.fillGrid();
                } catch (PartInitException e) {
                    Activator.getDefault().log("Error opening container", e);
                }*/
        }
    });
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) IEditorDescriptor(org.eclipse.ui.IEditorDescriptor)

Example 10 with IEditorDescriptor

use of org.eclipse.ui.IEditorDescriptor in project azure-tools-for-java by Microsoft.

the class HDInsightHelperImpl method openJobViewEditor.

public void openJobViewEditor(Object projectObject, String uuid) {
    try {
        loadHDInsightPlugin();
    } catch (BundleException bundleException) {
        Activator.getDefault().log("Error loading plugin " + HDINSIHGT_BUNDLE_ID, bundleException);
    }
    IClusterDetail clusterDetail = JobViewManager.getCluster(uuid);
    IWorkbench workbench = PlatformUI.getWorkbench();
    IEditorDescriptor editorDescriptor = workbench.getEditorRegistry().findEditor("com.microsoft.azure.hdinsight.jobview");
    try {
        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        IEditorPart newEditor = page.openEditor(new JobViewInput(clusterDetail, uuid), editorDescriptor.getId());
    } catch (PartInitException e2) {
        Activator.getDefault().log("Error opening " + clusterDetail.getName(), e2);
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) IEditorDescriptor(org.eclipse.ui.IEditorDescriptor) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) BundleException(org.osgi.framework.BundleException) IEditorPart(org.eclipse.ui.IEditorPart) PartInitException(org.eclipse.ui.PartInitException) IClusterDetail(com.microsoft.azure.hdinsight.sdk.cluster.IClusterDetail) JobViewInput(com.microsoft.azuretools.azureexplorer.editors.JobViewInput)

Aggregations

IEditorDescriptor (org.eclipse.ui.IEditorDescriptor)12 IWorkbench (org.eclipse.ui.IWorkbench)6 PartInitException (org.eclipse.ui.PartInitException)6 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)4 Image (org.eclipse.swt.graphics.Image)4 IEditorRegistry (org.eclipse.ui.IEditorRegistry)4 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)4 IEditorPart (org.eclipse.ui.IEditorPart)3 StorageEditorInput (com.microsoft.azuretools.azureexplorer.editors.StorageEditorInput)2 IFile (org.eclipse.core.resources.IFile)2 IClusterDetail (com.microsoft.azure.hdinsight.sdk.cluster.IClusterDetail)1 JobViewInput (com.microsoft.azuretools.azureexplorer.editors.JobViewInput)1 File (java.io.File)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)1 Path (org.eclipse.core.runtime.Path)1 ProgressMonitorDialog (org.eclipse.jface.dialogs.ProgressMonitorDialog)1 Cursor (org.eclipse.swt.graphics.Cursor)1 Point (org.eclipse.swt.graphics.Point)1 Shell (org.eclipse.swt.widgets.Shell)1