Scroll from Source action customization
Answered
Similar question to https://intellij-support.jetbrains.com/hc/en-us/community/posts/360002682719-Scroll-from-Source-action-customization .
Is it possible to listen to the action of "Scroll from Source" / "Select Opened File"?
I would like to create a plugin with the following tasks:
- listen to "Scroll from Source" or similar approache
- resolve paths with "custom resolver" (based on the opened file path)
- search these paths in every open project and open the file "synchronously" or
- ask the user to create such a file with or without the same content
Please sign in to leave a comment.
"Select Opened File" action is handled by the
This class implements SelectInTarget which is used by the selectInTarget Extension Point, but in this case, it is dynamically created by the ProjectViewPane.
You may create an EP that extends that class and overrides createSelectInTarget method:
class MyProjectViewPane extends ProjectViewPane {
public MyProjectViewPane(Project project) {
super(project);
}
@NotNull
@Override
public SelectInTarget createSelectInTarget() {
return new ProjectPaneSelectInTarget(myProject) {
@Override
public void select(PsiElement element, boolean requestFocus) {
super.select(element, requestFocus);
// catch selection event
}
};
}
}
Nice!
unfortunately this doesnt work anymore. It looks like he does not register the MyProjectViewPane
https://github.com/comod/syncScrollFromSource/blob/master/src/main/resources/META-INF/plugin.xml
https://github.com/comod/syncScrollFromSource/blob/master/src/main/java/system/MyProjectViewPane.java
Whats the Problem?