Package org.eclipse.ui

Examples of org.eclipse.ui.IEditorPart


public class ExpandCollapseAllHandler extends AbstractHandler {

    @Override
    public Object execute(final ExecutionEvent event) throws ExecutionException {
        final IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
        if (!(activeEditor instanceof ErlangEditor)) {
            return null;
        }
        final ErlangEditor editor = (ErlangEditor) activeEditor;
        final boolean collapse = event.getParameter(
View Full Code Here


    public void run() {

        if (isEnabled()) {
            try {
                if (selectedElement2 != null) {
                    final IEditorPart part = EditorUtility.openInEditor(selectedElement,
                            true);
                    EditorUtility.revealInEditor(part, selectedElement);
                }
                if (selectedElement != null) {
                    if (selectedElement instanceof IErlExternal) {
                        final StructuredViewer structuredViewer = site
                                .getStructuredViewer();
                        if (structuredViewer instanceof AbstractTreeViewer) {
                            final AbstractTreeViewer treeViewer = (AbstractTreeViewer) structuredViewer;
                            final boolean expanded = treeViewer
                                    .getExpandedState(selectedElement);
                            treeViewer.setExpandedState(selectedElement, !expanded);
                        }
                    } else {
                        final IEditorPart part = EditorUtility.openInEditor(
                                selectedElement, true);
                        EditorUtility.revealInEditor(part, selectedElement);
                    }
                } else if (!selectedClosedProjects.isEmpty()) {
                    openResourceAction.selectionChanged((IStructuredSelection) provider
View Full Code Here

        } else if (obj.getClass().equals(FunctionStats.class)) {

            final FunctionStats fs = (FunctionStats) obj;

            final String moduleName = ((StatsTreeObject) fs.getParent()).getLabel();
            final IEditorPart p = openInEditor(moduleName + ".erl");

            if (p == null || !(p instanceof ErlangEditor)) {
                return;
            }
View Full Code Here

                .getStore(fileToOpen.toURI());
        final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
                .getActivePage();

        try {
            final IEditorPart p = IDE.openEditorOnFileStore(page, fileStore);

            log.info(p.getClass());

            return p;

        } catch (final PartInitException e) {
            ErlLogger.error(e);
View Full Code Here

        final IWorkbenchWindow window = getSite().getWorkbenchWindow();
        final IWorkbenchPage page = window.getActivePage();
        if (page == null) {
            return false;
        }
        final IEditorPart activeEditor = page.getActiveEditor();
        return activeEditor != null && activeEditor.equals(this);
    }
View Full Code Here

            final boolean activate) throws PartInitException {
        final IEditorInput input = getEditorInput(inputElement);
        if (input == null) {
            return null;
        }
        final IEditorPart editorPart = openInEditor(input,
                getEditorID(input, inputElement), activate);

        if (editorPart != null && inputElement instanceof IErlElement) {
            revealInEditor(editorPart, (IErlElement) inputElement);
            return editorPart;
View Full Code Here

    private static IEditorPart openInEditor(final IFile file, final boolean activate)
            throws PartInitException {
        if (file != null) {
            final IWorkbenchPage p = ErlideUIPlugin.getActivePage();
            if (p != null) {
                final IEditorPart editorPart = IDE.openEditor(p, file, activate);
                return editorPart;
            }
        }
        return null;
    }
View Full Code Here

    private static IEditorPart openInEditor(final IEditorInput input,
            final String editorID, final boolean activate) throws PartInitException {
        if (input != null) {
            final IWorkbenchPage p = ErlideUIPlugin.getActivePage();
            if (p != null) {
                final IEditorPart editorPart = p.openEditor(input, editorID, activate);
                return editorPart;
            }
        }
        return null;
    }
View Full Code Here

    /**
     * Opens the editor on the given element and subsequently selects it.
     */
    public static void openElementInEditor(final Object element, final boolean activate)
            throws PartInitException {
        final IEditorPart part = EditorUtility.openInEditor(element, activate);
        if (element instanceof IErlElement) {
            EditorUtility.revealInEditor(part, (IErlElement) element);
        }
    }
View Full Code Here

     * return null
     */
    public static IErlElement getActiveEditorErlangInput() {
        final IWorkbenchPage page = ErlideUIPlugin.getActivePage();
        if (page != null) {
            final IEditorPart part = page.getActiveEditor();
            if (part != null) {
                final IEditorInput editorInput = part.getEditorInput();
                if (editorInput != null) {
                    return (IErlElement) editorInput.getAdapter(IErlElement.class);
                    // return JavaUI.getEditorInputJavaElement(editorInput);
                }
            }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.IEditorPart

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.