Commit 7d5a7a40 authored by Andrey Loskutov's avatar Andrey Loskutov

Adoption to Eclipse 4.8, editor input seem to have no adapter anymore

parent e03954fe
......@@ -9,6 +9,7 @@
package de.loskutov.bco.ui;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
......@@ -52,13 +53,19 @@ public class EclipseUtils {
* @return editor input as IJavaElement
*/
public static IJavaElement getJavaInput(IEditorPart part) {
IJavaElement input = part.getAdapter(IJavaElement.class);
if (input != null) {
return input;
}
IEditorInput editorInput = part.getEditorInput();
if (editorInput != null) {
IJavaElement input = (IJavaElement) editorInput
.getAdapter(IJavaElement.class);
input = editorInput.getAdapter(IJavaElement.class);
}
if (input != null) {
return input;
}
return null;
input = EditorUtility.getEditorInputJavaElement(part, false);
return input;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment