Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan-Philipp Steghöfer2021-04-26 14:03:17 -0400
committerJan-Philipp Steghöfer2021-04-26 14:03:17 -0400
commit8de3f0da38b5507bf3afa1c4e1560d0f9057fea1 (patch)
treed8ce575a4c23a86b25d1b8e047d38982afbea4ec
parent706eeb150c2a2c92dc53895588e8e1f5034f9491 (diff)
downloadorg.eclipse.capra-8de3f0da38b5507bf3afa1c4e1560d0f9057fea1.tar.gz
org.eclipse.capra-8de3f0da38b5507bf3afa1c4e1560d0f9057fea1.tar.xz
org.eclipse.capra-8de3f0da38b5507bf3afa1c4e1560d0f9057fea1.zip
Sunburst view now redrawn on resize
This patch adds a listener that redraws the sunburst diagram whenever the ViewPart is resized. This means that the view is now updated and drawn to fill the entire view when the layout changes. Change-Id: Ibdc985c4a72a54fbabb5d086b37c6d2de0c6a72a
-rw-r--r--bundles/org.eclipse.capra.ui.sunburst/src/org/eclipse/capra/ui/sunburst/view/SunburstView.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/bundles/org.eclipse.capra.ui.sunburst/src/org/eclipse/capra/ui/sunburst/view/SunburstView.java b/bundles/org.eclipse.capra.ui.sunburst/src/org/eclipse/capra/ui/sunburst/view/SunburstView.java
index 6c84cfcf..2040706a 100644
--- a/bundles/org.eclipse.capra.ui.sunburst/src/org/eclipse/capra/ui/sunburst/view/SunburstView.java
+++ b/bundles/org.eclipse.capra.ui.sunburst/src/org/eclipse/capra/ui/sunburst/view/SunburstView.java
@@ -46,6 +46,8 @@ import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IWorkbenchPart;
@@ -102,6 +104,16 @@ public class SunburstView extends ViewPart {
private List<Object> selectedModels = new ArrayList<>();
+ /**
+ * A listener that redraws the sunburst diagram when an event occurred.
+ */
+ private Listener redrawListener = new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ browser.setText(createHTML());
+ }
+ };
+
private ISelectionListener listener = new ISelectionListener() {
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
@@ -134,6 +146,8 @@ public class SunburstView extends ViewPart {
makeActions();
contributeToActionBars();
getViewSite().getPage().addSelectionListener(listener);
+ // Add a listener that redraws the diagram when the parent is resized
+ parent.addListener(SWT.Resize, redrawListener);
}
/**

Back to the top