diff --git a/org.eclipse.jdt.ui/plugin.xml b/org.eclipse.jdt.ui/plugin.xml
index 5c21a366586..b5dd509de89 100644
--- a/org.eclipse.jdt.ui/plugin.xml
+++ b/org.eclipse.jdt.ui/plugin.xml
@@ -7830,4 +7830,18 @@
file-extensions="class without source">
+
+
+
+
+
+
+
+
+
+
+
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/StickyLinesProviderJava.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/StickyLinesProviderJava.java
new file mode 100644
index 00000000000..b37be8fcf7f
--- /dev/null
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/StickyLinesProviderJava.java
@@ -0,0 +1,51 @@
+package org.eclipse.jdt.internal.ui.javaeditor;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.source.ISourceViewer;
+
+import org.eclipse.ui.texteditor.stickyscroll.IStickyLine;
+import org.eclipse.ui.texteditor.stickyscroll.IStickyLinesProvider;
+import org.eclipse.ui.texteditor.stickyscroll.StickyLine;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.ISourceRange;
+import org.eclipse.jdt.core.ISourceReference;
+import org.eclipse.jdt.core.JavaModelException;
+
+public class StickyLinesProviderJava implements IStickyLinesProvider {
+
+ @Override
+ public List getStickyLines(ISourceViewer sourceViewer, int lineNumber, StickyLinesProperties properties) {
+ LinkedList stickyLines= new LinkedList<>();
+ JavaEditor javaEditor= (JavaEditor) properties.editor();
+
+ IJavaElement element= null;
+ try {
+ element= javaEditor.getElementAt(sourceViewer.getDocument().getLineOffset(lineNumber));
+ } catch (BadLocationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ while (element != null) {
+ if (element.getElementType() == IJavaElement.METHOD || element.getElementType() == IJavaElement.TYPE) {
+ try {
+ ISourceRange sourceRange= ((ISourceReference) element).getNameRange();
+ int offset= sourceRange.getOffset();
+ int stickyLineNumber= sourceViewer.getDocument().getLineOfOffset(offset);
+ stickyLines.addFirst(new StickyLine(stickyLineNumber, sourceViewer));
+ } catch (JavaModelException | BadLocationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ element= element.getParent();
+ }
+
+ return stickyLines;
+ }
+
+}