mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 14:55:41 +02:00
Add support for resizing of view.
This commit is contained in:
parent
5117703634
commit
820844d7c2
1 changed files with 40 additions and 14 deletions
|
@ -74,6 +74,16 @@ public class ProblemVisualizer extends GraphicCanvasVisualizer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class ResizableGraphicCanvas extends GraphicCanvas {
|
||||||
|
public ResizableGraphicCanvas(Composite parent) {
|
||||||
|
super(parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resized(Rectangle bounds) {
|
||||||
|
ProblemVisualizer.this.refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
/** The canvas on which we'll draw our bars */
|
/** The canvas on which we'll draw our bars */
|
||||||
private GraphicCanvas m_canvas;
|
private GraphicCanvas m_canvas;
|
||||||
|
|
||||||
|
@ -105,7 +115,7 @@ public class ProblemVisualizer extends GraphicCanvasVisualizer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GraphicCanvas createCanvas(Composite parent) {
|
public GraphicCanvas createCanvas(Composite parent) {
|
||||||
m_canvas = new GraphicCanvas(parent);
|
m_canvas = new ResizableGraphicCanvas(parent);
|
||||||
return m_canvas;
|
return m_canvas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,6 +125,15 @@ public class ProblemVisualizer extends GraphicCanvasVisualizer {
|
||||||
m_canvas.setForeground(MAIN_FOREGROUND_COLOR);
|
m_canvas.setForeground(MAIN_FOREGROUND_COLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disposeCanvas()
|
||||||
|
{
|
||||||
|
if (m_canvas != null) {
|
||||||
|
m_canvas.dispose();
|
||||||
|
m_canvas = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int handlesSelection(ISelection selection) {
|
public int handlesSelection(ISelection selection) {
|
||||||
Object sel = SelectionUtils.getSelectedObject(selection);
|
Object sel = SelectionUtils.getSelectedObject(selection);
|
||||||
|
@ -219,8 +238,10 @@ public class ProblemVisualizer extends GraphicCanvasVisualizer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
public void workbenchSelectionChanged(ISelection selection) {
|
* Refresh the visualizer display based on the existing data.
|
||||||
|
*/
|
||||||
|
public void refresh() {
|
||||||
m_canvas.clear();
|
m_canvas.clear();
|
||||||
|
|
||||||
// First create the outline bars
|
// First create the outline bars
|
||||||
|
@ -229,21 +250,26 @@ public class ProblemVisualizer extends GraphicCanvasVisualizer {
|
||||||
m_canvas.add(bar);
|
m_canvas.add(bar);
|
||||||
}
|
}
|
||||||
|
|
||||||
Object sel = SelectionUtils.getSelectedObject(selection);
|
|
||||||
if (sel instanceof IResource) {
|
|
||||||
// Now, create the inside bars
|
// Now, create the inside bars
|
||||||
|
|
||||||
setMarkerCount((IResource)sel);
|
|
||||||
|
|
||||||
bars = getBars(false);
|
bars = getBars(false);
|
||||||
for (BarGraphicObject bar : bars) {
|
for (BarGraphicObject bar : bars) {
|
||||||
m_canvas.add(bar);
|
m_canvas.add(bar);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
m_canvas.redraw();
|
m_canvas.redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void workbenchSelectionChanged(ISelection selection) {
|
||||||
|
Object sel = SelectionUtils.getSelectedObject(selection);
|
||||||
|
if (sel instanceof IResource) {
|
||||||
|
// Update the data
|
||||||
|
setMarkerCount((IResource)sel);
|
||||||
|
}
|
||||||
|
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
|
||||||
public SelectionManager getSelectionManager() {
|
public SelectionManager getSelectionManager() {
|
||||||
return m_selectionManager;
|
return m_selectionManager;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue