Search in sources :

Example 51 with PartInitException

use of org.eclipse.ui.PartInitException in project dbeaver by serge-rider.

the class NavigatorHandlerProjectSelect method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    final DBeaverCore core = DBeaverCore.getInstance();
    final DBNProject projectNode = core.getNavigatorModel().getRoot().getProject(core.getProjectRegistry().getActiveProject());
    if (projectNode != null) {
        final IWorkbenchWindow workbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
        try {
            final ProjectNavigatorView projectsView = (ProjectNavigatorView) workbenchWindow.getActivePage().showView(ProjectNavigatorView.VIEW_ID);
            if (projectsView != null) {
                projectsView.showNode(projectNode);
            }
        } catch (PartInitException e) {
            log.error(e);
        }
    }
    return null;
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) DBNProject(org.jkiss.dbeaver.model.navigator.DBNProject) DBeaverCore(org.jkiss.dbeaver.core.DBeaverCore) ProjectNavigatorView(org.jkiss.dbeaver.ui.navigator.project.ProjectNavigatorView) PartInitException(org.eclipse.ui.PartInitException)

Example 52 with PartInitException

use of org.eclipse.ui.PartInitException in project dbeaver by serge-rider.

the class XMLPanelEditor method createControl.

@Override
public StyledText createControl(IValueController valueController) {
    this.valueController = valueController;
    this.subSite = new SubEditorSite(valueController.getValueSite());
    editor = new XMLEditor();
    try {
        editor.init(subSite, StringEditorInput.EMPTY_INPUT);
    } catch (PartInitException e) {
        valueController.showMessage(e.getMessage(), DBPMessageType.ERROR);
        return new StyledText(valueController.getEditPlaceholder(), SWT.NONE);
    }
    editor.createPartControl(valueController.getEditPlaceholder());
    ContentPanelEditor.setEditorSettings(editor.getEditorControl());
    return editor.getEditorControl();
}
Also used : SubEditorSite(org.jkiss.dbeaver.ui.editors.SubEditorSite) StyledText(org.eclipse.swt.custom.StyledText) PartInitException(org.eclipse.ui.PartInitException) XMLEditor(org.jkiss.dbeaver.ui.editors.xml.XMLEditor)

Example 53 with PartInitException

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

the class OpenViewHandler method execute.

/**
	 * the command has been executed, so extract extract the needed information from the application context.
	 */
public Object execute(ExecutionEvent event) throws ExecutionException {
    String viewId = event.getParameter("ViewId");
    if (viewId == null) {
        return null;
    }
    IWorkbenchPage workbenchPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    IViewPart view = workbenchPage.findView(viewId);
    if (view == null) {
        try {
            workbenchPage.showView(viewId);
        } catch (PartInitException e) {
            e.printStackTrace();
        }
    } else {
        workbenchPage.hideView(view);
    }
    //		commandService.refreshElements(event.getCommand().getId(), null);
    return null;
}
Also used : IViewPart(org.eclipse.ui.IViewPart) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) PartInitException(org.eclipse.ui.PartInitException)

Example 54 with PartInitException

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

the class WebSearchHandler method execute.

/** (non-Javadoc)
	 * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
	 */
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IEditorPart editor = HandlerUtil.getActiveEditor(event);
    String selectPureText = "";
    if (editor instanceof IXliffEditor) {
        IXliffEditor xliffEditor = (IXliffEditor) editor;
        selectPureText = xliffEditor.getSelectPureText();
    }
    try {
        IViewPart showView = getActivePage().showView(BrowserViewPart.ID);
        if (showView instanceof BrowserViewPart) {
            BrowserViewPart browserViewPart = (BrowserViewPart) showView;
            browserViewPart.setKeyWord(selectPureText, true);
        }
    } catch (PartInitException e) {
        e.printStackTrace();
        logger.error("", e);
    }
    return null;
}
Also used : IViewPart(org.eclipse.ui.IViewPart) BrowserViewPart(net.heartsome.cat.ts.websearch.ui.view.BrowserViewPart) IEditorPart(org.eclipse.ui.IEditorPart) PartInitException(org.eclipse.ui.PartInitException) IXliffEditor(net.heartsome.cat.ts.ui.editors.IXliffEditor)

Example 55 with PartInitException

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

the class EditProgressFA method printTransProgFAReslut.

public void printTransProgFAReslut() {
    String htmlPath = createFAResultHtml();
    try {
        model.getAnalysisIFileList().get(0).getProject().getFolder("Intermediate").getFolder("Report").refreshLocal(IResource.DEPTH_ONE, null);
    } catch (CoreException e1) {
        e1.printStackTrace();
        logger.error(Messages.getString("qa.fileAnalysis.EditProgressFA.log1"), e1);
    }
    final FileEditorInput input = new FileEditorInput(ResourceUtils.fileToIFile(htmlPath));
    Display.getDefault().asyncExec(new Runnable() {

        public void run() {
            try {
                PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(input, QAConstant.FA_HtmlBrowserEditor, true);
            } catch (PartInitException e) {
                e.printStackTrace();
                logger.error(Messages.getString("qa.fileAnalysis.EditProgressFA.log2"), e);
            }
        }
    });
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) FileEditorInput(org.eclipse.ui.part.FileEditorInput) PartInitException(org.eclipse.ui.PartInitException)

Aggregations

PartInitException (org.eclipse.ui.PartInitException)720 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)300 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)177 IFile (org.eclipse.core.resources.IFile)146 IEditorPart (org.eclipse.ui.IEditorPart)141 CoreException (org.eclipse.core.runtime.CoreException)94 FileEditorInput (org.eclipse.ui.part.FileEditorInput)88 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)82 IEditorInput (org.eclipse.ui.IEditorInput)74 ISelection (org.eclipse.jface.viewers.ISelection)62 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)60 IResource (org.eclipse.core.resources.IResource)59 IEditorReference (org.eclipse.ui.IEditorReference)53 IViewPart (org.eclipse.ui.IViewPart)53 IOException (java.io.IOException)42 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)41 Point (org.eclipse.swt.graphics.Point)40 IWorkbench (org.eclipse.ui.IWorkbench)40 Path (org.eclipse.core.runtime.Path)39 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)39