protected void adjustItemNumber() { if (fComposite == null) return; Control[] children= fComposite.getChildren(); int oldSize= children.length; int newSize= fInput == null ? 0 : fInput.fAnnotations.length; Display display= fShell.getDisplay(); // add missing items for (int i= oldSize; i < newSize; i++) { Canvas canvas= new Canvas(fComposite, SWT.NONE); Object gridData= fLayouter.getLayoutData(); canvas.setLayoutData(gridData); canvas.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); canvas.addPaintListener(fPaintListener); canvas.addMouseTrackListener(fMouseTrackListener); canvas.addMouseListener(fMouseListener); canvas.addListener(SWT.MenuDetect, fMenuDetectListener); canvas.addDisposeListener(fDisposeListener); } // dispose of exceeding resources for (int i= oldSize; i > newSize; i--) { Item item= (Item) children[i - 1].getData(); item.deselect(); children[i - 1].dispose(); } }
protected void adjustItemNumber() { if (fComposite == null) return; Control[] children= fComposite.getChildren(); int oldSize= children.length; int newSize= fInput == null ? 0 : fInput.fAnnotations.length; Display display= fShell.getDisplay(); // add missing items for (int i= oldSize; i < newSize; i++) { Canvas canvas= new Canvas(fComposite, SWT.NONE); Object gridData= fLayouter.getLayoutData(); canvas.setLayoutData(gridData); canvas.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); canvas.addPaintListener(fPaintListener); canvas.addMouseTrackListener(fMouseTrackListener); canvas.addMouseListener(fMouseListener); canvas.addListener(SWT.MenuDetect, fMenuDetectListener); canvas.addDisposeListener(fDisposeListener); } // dispose of exceeding resources for (int i= oldSize; i > newSize; i--) { Item item= (Item) children[i - 1].getData(); item.deselect(); children[i - 1].dispose(); } }
protected void adjustItemNumber() { if (fComposite == null) return; Control[] children= fComposite.getChildren(); int oldSize= children.length; int newSize= fInput == null ? 0 : fInput.fAnnotations.length; Display display= fShell.getDisplay(); // add missing items for (int i= oldSize; i < newSize; i++) { Canvas canvas= new Canvas(fComposite, SWT.NONE); Object gridData= fLayouter.getLayoutData(); canvas.setLayoutData(gridData); canvas.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); canvas.addPaintListener(fPaintListener); canvas.addMouseTrackListener(fMouseTrackListener); canvas.addMouseListener(fMouseListener); canvas.addListener(SWT.MenuDetect, fMenuDetectListener); canvas.addDisposeListener(fDisposeListener); } // dispose of exceeding resources for (int i= oldSize; i > newSize; i--) { Item item= (Item) children[i - 1].getData(); item.deselect(); children[i - 1].dispose(); } }
@Override public void mouseExit(MouseEvent e) { Item item= (Item) ((Widget) e.getSource()).getData(); if (item != null) item.deselect(); // if the event lies outside the entire popup, dispose org.eclipse.swt.graphics.Region region= fShell.getRegion(); Canvas can= (Canvas) e.getSource(); Point p= can.toDisplay(e.x, e.y); if (region == null) { Rectangle bounds= fShell.getBounds(); // p= fShell.toControl(p); if (!bounds.contains(p)) dispose(); } else { p= fShell.toControl(p); if (!region.contains(p)) dispose(); } }
@Override public void mouseExit(MouseEvent e) { Item item= (Item) ((Widget) e.getSource()).getData(); if (item != null) item.deselect(); // if the event lies outside the entire popup, dispose org.eclipse.swt.graphics.Region region= fShell.getRegion(); Canvas can= (Canvas) e.getSource(); Point p= can.toDisplay(e.x, e.y); if (region == null) { Rectangle bounds= fShell.getBounds(); // p= fShell.toControl(p); if (!bounds.contains(p)) dispose(); } else { p= fShell.toControl(p); if (!region.contains(p)) dispose(); } }
public void mouseExit(MouseEvent e) { Item item= (Item) ((Widget) e.getSource()).getData(); if (item != null) item.deselect(); // if the event lies outside the entire popup, dispose org.eclipse.swt.graphics.Region region= fShell.getRegion(); Canvas can= (Canvas) e.getSource(); Point p= can.toDisplay(e.x, e.y); if (region == null) { Rectangle bounds= fShell.getBounds(); // p= fShell.toControl(p); if (!bounds.contains(p)) dispose(); } else { p= fShell.toControl(p); if (!region.contains(p)) dispose(); } }
@Override public void widgetDisposed(DisposeEvent e) { Item item= (Item) ((Widget) e.getSource()).getData(); item.deselect(); item.canvas= null; item.fAnnotation= null; item.oldStyles= null; ((Widget) e.getSource()).setData(null); } }
@Override public void widgetDisposed(DisposeEvent e) { Item item= (Item) ((Widget) e.getSource()).getData(); item.deselect(); item.canvas= null; item.fAnnotation= null; item.oldStyles= null; ((Widget) e.getSource()).setData(null); } }
public void widgetDisposed(DisposeEvent e) { Item item= (Item) ((Widget) e.getSource()).getData(); item.deselect(); item.canvas= null; item.fAnnotation= null; item.oldStyles= null; ((Widget) e.getSource()).setData(null); } }