Search in sources :

Example 1 with PortletResourcesRootNode

use of com.liferay.ide.portlet.ui.navigator.PortletResourcesRootNode in project liferay-ide by liferay.

the class OpenPortletResourceAction method initEditorPart.

protected IFile initEditorPart() {
    IFile file = null;
    if (selectedNode instanceof PortletsNode) {
        PortletsNode portletsNode = (PortletsNode) selectedNode;
        PortletResourcesRootNode rootNode = portletsNode.getParent();
        file = ProjectUtil.getPortletXmlFile(rootNode.getProject());
    } else if (selectedNode instanceof PortletNode) {
        PortletNode portletNode = (PortletNode) selectedNode;
        PortletResourcesRootNode rootNode = portletNode.getParent().getParent();
        file = ProjectUtil.getPortletXmlFile(rootNode.getProject());
    }
    if ((editorPart == null) && (file != null)) {
        IWorkbench workbench = PlatformUI.getWorkbench();
        IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
        IEditorReference[] editorReferences = page.getEditorReferences();
        for (IEditorReference iEditorReference : editorReferences) {
            if (file.getName().equals(iEditorReference.getName())) {
                editorPart = iEditorReference.getEditor(false);
            }
        }
    }
    return file;
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) IFile(org.eclipse.core.resources.IFile) IEditorReference(org.eclipse.ui.IEditorReference) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) PortletsNode(com.liferay.ide.portlet.ui.navigator.PortletsNode) PortletResourcesRootNode(com.liferay.ide.portlet.ui.navigator.PortletResourcesRootNode) PortletNode(com.liferay.ide.portlet.ui.navigator.PortletNode)

Aggregations

PortletNode (com.liferay.ide.portlet.ui.navigator.PortletNode)1 PortletResourcesRootNode (com.liferay.ide.portlet.ui.navigator.PortletResourcesRootNode)1 PortletsNode (com.liferay.ide.portlet.ui.navigator.PortletsNode)1 IFile (org.eclipse.core.resources.IFile)1 IEditorReference (org.eclipse.ui.IEditorReference)1 IWorkbench (org.eclipse.ui.IWorkbench)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1