public void activateEditor()

in eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/LinkHelper.java [91:137]


	public void activateEditor(IWorkbenchPage aPage,
			IStructuredSelection aSelection) {
		final Object selectedElement = aSelection.getFirstElement();
		if (!(selectedElement instanceof JcrNode)) {
			return;
		}
		final JcrNode node = (JcrNode) selectedElement;
		// bring properties view to top, if it is open
		// SLING-3641 : moved link-with-editor behavior to the JCR Properties view atm
		//TODO: to be reviewed at a later stage with SLING-3641
//		IViewPart propertiesView = aPage.findView(IPageLayout.ID_PROP_SHEET);
//		if (propertiesView!=null) {
//			aPage.bringToTop(propertiesView);
//		}
		final IResource resource = node.getResource();
		if (resource==null || !(resource instanceof IFile)) {
			return;
		}
		final IFile selectedFile = (IFile)resource;
		for (final IEditorReference reference : aPage.getEditorReferences()) {
			if (reference==null) {
				continue;
			}
			final IEditorInput editorInput;
			try {
				editorInput = reference.getEditorInput();
			} catch (PartInitException e) {
				//TODO proper logging
				e.printStackTrace();
				continue;
			}
			if (editorInput==null) {
				continue;
			}
			if (!(editorInput instanceof IFileEditorInput)) {
				continue;
			}
			final IFileEditorInput fileEditorInput = (IFileEditorInput) editorInput;
			final IFile file = fileEditorInput.getFile();
			if (file==null) {
				continue;
			}
			if (file.equals(selectedFile)) {
				aPage.bringToTop(reference.getEditor(true));
			}
		}
	}