Search in sources :

Example 1 with PortletsNode

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

the class NewPortletAction method run.

/**
 * (non-Javadoc)
 *
 * @see org.eclipse.jface.action.Action#run()
 */
@Override
public void run() {
    if (isEnabled()) {
        if (selectedNode instanceof PortletsNode) {
            PortletsNode portletsNode = (PortletsNode) selectedNode;
            IProject currentProject = portletsNode.getParent().getProject();
            NewPortletWizard newPortletWizard = new NewPortletWizard(currentProject);
            WizardDialog wizardDialog = new WizardDialog(Display.getDefault().getActiveShell(), newPortletWizard);
            wizardDialog.create();
            wizardDialog.open();
        }
    }
}
Also used : NewPortletWizard(com.liferay.ide.portlet.ui.wizard.NewPortletWizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog) IProject(org.eclipse.core.resources.IProject) PortletsNode(com.liferay.ide.portlet.ui.navigator.PortletsNode)

Example 2 with PortletsNode

use of com.liferay.ide.portlet.ui.navigator.PortletsNode 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

PortletsNode (com.liferay.ide.portlet.ui.navigator.PortletsNode)2 PortletNode (com.liferay.ide.portlet.ui.navigator.PortletNode)1 PortletResourcesRootNode (com.liferay.ide.portlet.ui.navigator.PortletResourcesRootNode)1 NewPortletWizard (com.liferay.ide.portlet.ui.wizard.NewPortletWizard)1 IFile (org.eclipse.core.resources.IFile)1 IProject (org.eclipse.core.resources.IProject)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 IEditorReference (org.eclipse.ui.IEditorReference)1 IWorkbench (org.eclipse.ui.IWorkbench)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1