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;
}
Aggregations