Source:
<code>protected void buttonPressed(int buttonId) { if (buttonId == DETAIL_BUTTON) { final Shell shell = getShell(); Rectangle trim = shell.computeTrim(0, 0, 0, 0); int xOffset = 0; int xDelta = -trim.x + 3; int yOffset = 0; int yDelta = -trim.y - 3; final LinkedList<PullResultDialog> dialogs= new LinkedList<PullResultDialog>(); IStructuredSelection sel = (IStructuredSelection) tv.getSelection(); for (Entry<Repository, Object> item : (List<Entry<Repository, Object>>) sel .toList()) { if (item.getValue() instanceof PullResult) { final int x = xOffset; final int y = yOffset; xOffset += xDelta; yOffset += yDelta; final PullResultDialog dialog = new PullResultDialog(shell, item.getKey(), (PullResult) item.getValue()) { private Point initialLocation; @Override protected Point getInitialLocation(Point initialSize) { initialLocation = super .getInitialLocation(initialSize); initialLocation.x += x; initialLocation.y += y; return initialLocation; } @Override public boolean close() { Shell resultShell = getShell(); if (resultShell != null && !resultShell.isDisposed()) { Point location = resultShell.getLocation(); if (location.equals(initialLocation)) { resultShell.setVisible(false); resultShell.setLocation(location.x - x, location.y - y); } } boolean result = super.close(); dialogs.remove(this); <START> if (dialogs.size() > 0) { <END> dialogs.getLast().getShell().setActive(); } return result; } }; dialog.create(); dialog.getShell().addShellListener(new ShellAdapter() { public void shellActivated(org.eclipse.swt.events.ShellEvent e) { dialogs.remove(dialog); dialogs.add(dialog); } }); dialog.open(); } } } super.buttonPressed(buttonId); }</code><technical_language>style nit: braces single line blocks</technical_language>

Target:
protected void buttonPressed(int buttonId) { if (buttonId == DETAIL_BUTTON) { final Shell shell = getShell(); Rectangle trim = shell.computeTrim(0, 0, 0, 0); int xOffset = 0; int xDelta = -trim.x + 3; int yOffset = 0; int yDelta = -trim.y - 3; final LinkedList<PullResultDialog> dialogs= new LinkedList<PullResultDialog>(); IStructuredSelection sel = (IStructuredSelection) tv.getSelection(); for (Entry<Repository, Object> item : (List<Entry<Repository, Object>>) sel .toList()) { if (item.getValue() instanceof PullResult) { final int x = xOffset; final int y = yOffset; xOffset += xDelta; yOffset += yDelta; final PullResultDialog dialog = new PullResultDialog(shell, item.getKey(), (PullResult) item.getValue()) { private Point initialLocation; @Override protected Point getInitialLocation(Point initialSize) { initialLocation = super .getInitialLocation(initialSize); initialLocation.x += x; initialLocation.y += y; return initialLocation; } @Override public boolean close() { Shell resultShell = getShell(); if (resultShell != null && !resultShell.isDisposed()) { Point location = resultShell.getLocation(); if (location.equals(initialLocation)) { resultShell.setVisible(false); resultShell.setLocation(location.x - x, location.y - y); } } boolean result = super.close(); dialogs.remove(this); if (dialogs.size() > 0) dialogs.getLast().getShell().setActive(); return result; } }; dialog.create(); dialog.getShell().addShellListener(new ShellAdapter() { public void shellActivated(org.eclipse.swt.events.ShellEvent e) { dialogs.remove(dialog); dialogs.add(dialog); } }); dialog.open(); } } } super.buttonPressed(buttonId); }