Search in sources :

Example 1 with JavaTypeName

use of org.eclipse.sapphire.java.JavaTypeName in project liferay-ide by liferay.

the class ServiceImplJavaTypeConstraintService method _getServiceTypes.

private Set<String> _getServiceTypes() {
    JavaTypeName type = _service.getServiceType().content(false);
    Set<String> types = new HashSet<>();
    if (type != null) {
        types.add(type.qualified() + "Wrapper");
    }
    return types;
}
Also used : JavaTypeName(org.eclipse.sapphire.java.JavaTypeName) HashSet(java.util.HashSet)

Example 2 with JavaTypeName

use of org.eclipse.sapphire.java.JavaTypeName in project liferay-ide by liferay.

the class ServiceTypeImplBrowseActionHandler method _getServiceType.

private String _getServiceType(Element element) {
    String retval = null;
    ServiceWrapper service = element.nearest(ServiceWrapper.class);
    JavaTypeName javaTypeName = service.getServiceType().content(false);
    if (javaTypeName != null) {
        retval = javaTypeName.qualified();
    }
    return retval;
}
Also used : ServiceWrapper(com.liferay.ide.hook.core.model.ServiceWrapper) JavaTypeName(org.eclipse.sapphire.java.JavaTypeName)

Example 3 with JavaTypeName

use of org.eclipse.sapphire.java.JavaTypeName in project liferay-ide by liferay.

the class OpenPortletResourceAction method openPortletJavaClass.

/**
 * @param file
 */
protected void openPortletJavaClass(IFile file) {
    Element modelElement = ((PortletNode) selectedNode).getModel();
    if (modelElement instanceof Portlet) {
        Portlet portlet = (Portlet) modelElement;
        JavaTypeName portletClassFile = portlet.getPortletClass().content();
        Runnable run = new Runnable() {

            public void run() {
                IJavaProject project = JavaCore.create(file.getProject());
                String fullyQualifiedName = portletClassFile.qualified();
                try {
                    IType type = project.findType(fullyQualifiedName);
                    if ((type != null) && type.exists()) {
                        IResource resource = type.getResource();
                        if (resource instanceof IFile) {
                            IFile javaFile = (IFile) resource;
                            IEditorDescriptor editorDescriptor = findEditor(javaFile);
                            IEditorPart editorPart = null;
                            if (editorDescriptor != null) {
                                IWorkbench workbench = PlatformUI.getWorkbench();
                                IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
                                try {
                                    editorPart = page.findEditor(new FileEditorInput(javaFile));
                                    if (editorPart == null) {
                                        editorPart = page.openEditor(new FileEditorInput(javaFile), editorDescriptor.getId());
                                    }
                                } catch (Exception e) {
                                    MessageDialog.openError(page.getWorkbenchWindow().getShell(), Msgs.errorOpeningFile, e.getMessage());
                                }
                            }
                        }
                    }
                } catch (JavaModelException jme) {
                    PortletUIPlugin.logError(jme);
                }
            }
        };
        Display.getDefault().asyncExec(run);
    }
}
Also used : JavaModelException(org.eclipse.jdt.core.JavaModelException) Portlet(com.liferay.ide.portlet.core.model.Portlet) IFile(org.eclipse.core.resources.IFile) Element(org.eclipse.sapphire.Element) IEditorDescriptor(org.eclipse.ui.IEditorDescriptor) IEditorPart(org.eclipse.ui.IEditorPart) JavaModelException(org.eclipse.jdt.core.JavaModelException) PortletNode(com.liferay.ide.portlet.ui.navigator.PortletNode) IType(org.eclipse.jdt.core.IType) IWorkbench(org.eclipse.ui.IWorkbench) IJavaProject(org.eclipse.jdt.core.IJavaProject) JavaTypeName(org.eclipse.sapphire.java.JavaTypeName) FileEditorInput(org.eclipse.ui.part.FileEditorInput) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IResource(org.eclipse.core.resources.IResource)

Aggregations

JavaTypeName (org.eclipse.sapphire.java.JavaTypeName)3 ServiceWrapper (com.liferay.ide.hook.core.model.ServiceWrapper)1 Portlet (com.liferay.ide.portlet.core.model.Portlet)1 PortletNode (com.liferay.ide.portlet.ui.navigator.PortletNode)1 HashSet (java.util.HashSet)1 IFile (org.eclipse.core.resources.IFile)1 IResource (org.eclipse.core.resources.IResource)1 IJavaProject (org.eclipse.jdt.core.IJavaProject)1 IType (org.eclipse.jdt.core.IType)1 JavaModelException (org.eclipse.jdt.core.JavaModelException)1 Element (org.eclipse.sapphire.Element)1 IEditorDescriptor (org.eclipse.ui.IEditorDescriptor)1 IEditorPart (org.eclipse.ui.IEditorPart)1 IWorkbench (org.eclipse.ui.IWorkbench)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 FileEditorInput (org.eclipse.ui.part.FileEditorInput)1