use of org.eclipse.sapphire.ui.swt.xml.editor.SapphireEditorForXml in project liferay-ide by liferay.
the class OpenPortletResourceAction method selectAndRevealItem.
/**
* @param editor
* TODO: need to work on to fix to reveal the selected node
*/
protected void selectAndRevealItem(IEditorPart editorPart) {
if (this.editorPart instanceof SapphireEditor) {
SapphireEditorForXml editor = (SapphireEditorForXml) editorPart;
PortletNode portletNavigatorNode = (PortletNode) selectedNode;
Element selectedModelElement = portletNavigatorNode.getModel();
if (selectedModelElement != null) {
MasterDetailsEditorPage mdepDetailsEditorPage = (MasterDetailsEditorPage) editor.getActivePageInstance();
if (mdepDetailsEditorPage != null) {
MasterDetailsContentOutline contentOutline = mdepDetailsEditorPage.outline();
MasterDetailsContentNodePart rootNode = contentOutline.getRoot();
if (rootNode != null) {
MasterDetailsContentNodeList nodes = rootNode.nodes();
MasterDetailsContentNodePart portletAppNode = nodes.visible().get(0);
MasterDetailsContentNodePart portletsNode = portletAppNode.findNode(_PORTLETS_NODE_LABEL);
if (portletsNode != null) {
if (selectedModelElement instanceof Portlet) {
Portlet selectedPortlet = (Portlet) selectedModelElement;
for (MasterDetailsContentNodePart childNode : portletsNode.nodes().visible()) {
String selectedPortletName = selectedPortlet.getPortletName().content();
if (childNode.getModelElement() instanceof Portlet) {
Portlet mpContentNodePortlet = (Portlet) childNode.getModelElement();
String mpContentNodePortletName = mpContentNodePortlet.getPortletName().content();
if (selectedPortletName.equals(mpContentNodePortletName)) {
childNode.select();
childNode.setExpanded(true);
break;
}
}
}
}
}
}
}
}
}
}
use of org.eclipse.sapphire.ui.swt.xml.editor.SapphireEditorForXml in project liferay-ide by liferay.
the class UITestsUtils method getEditor.
public static StructuredTextEditor getEditor(IFile file) {
StructuredTextEditor editor = (StructuredTextEditor) fileToEditorMap.get(file);
if (editor == null) {
try {
final IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
final IWorkbenchPage page = workbenchWindow.getActivePage();
final IEditorPart editorPart = IDE.openEditor(page, file, true, true);
assertNotNull(editorPart);
if (editorPart instanceof SapphireEditorForXml) {
editor = ((SapphireEditorForXml) editorPart).getXmlEditor();
} else if (editorPart instanceof StructuredTextEditor) {
editor = ((StructuredTextEditor) editorPart);
} else if (editorPart instanceof XMLMultiPageEditorPart) {
XMLMultiPageEditorPart xmlEditorPart = (XMLMultiPageEditorPart) editorPart;
editor = (StructuredTextEditor) xmlEditorPart.getAdapter(StructuredTextEditor.class);
}
assertNotNull(editor);
standardizeLineEndings(editor);
fileToEditorMap.put(file, editor);
} catch (Exception e) {
fail("Could not open editor for " + file + " exception: " + e.getMessage());
}
}
return editor;
}
Aggregations