Skip to content

Commit

Permalink
Added ability to update diagram from last used view
Browse files Browse the repository at this point in the history
As an extension to issue hallvard#93, this commit introduces
changes to allow updating the diagram based on the
view that PlantUML last used (i.e., the currentPart)
instead of the view that is currently in focus. To make
this work, PlantUML now ignores its own view (i.e., does
not set the view in which it renders the diagram as the
current part) and has a new method
updateDiagramTextFromCurrentPart() which updates the
diagram based on the currently set currentPart.
  • Loading branch information
Jan-Philipp Steghöfer committed Mar 27, 2020
1 parent 38c7003 commit 13cb8be
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,9 @@ public void run() {
private IWorkbenchPart currentPart;

private void handlePartChange(final IWorkbenchPart part) {
if (part.equals(this)) {
return;
}
if (currentPart != null) {
currentPart.removePropertyListener(diagramTextChangedListener);
}
Expand Down Expand Up @@ -390,9 +393,17 @@ public void run() {
}
};
}

/**
* Updates the diagram text using the part that was last used by PlantUML.
* That makes it possible to programmatically update the current diagram.
*/
public void updateDiagramTextFromCurrentPart() {
updateDiagramText(true, currentPart, null);
}

/**
* Updates the diagram text from the current part (if linked to it) and the current selection.
* Updates the diagram text from the part that is currently active in the IDE (if linked to it) and the current selection.
*/
public void updateDiagramText() {
updateDiagramText(true, null, null);
Expand Down

0 comments on commit 13cb8be

Please sign in to comment.