diff options
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb')
7 files changed, 94 insertions, 94 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/AbstractBreadcrumb.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/AbstractBreadcrumb.java index 58dc2e865..6d2b8c633 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/AbstractBreadcrumb.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/AbstractBreadcrumb.java @@ -122,7 +122,7 @@ public abstract class AbstractBreadcrumb { fBreadcrumbViewer.refresh(); } } - + /** * Activates the breadcrumb. This sets the keyboard focus * inside this breadcrumb and retargets the editor @@ -170,7 +170,7 @@ public abstract class AbstractBreadcrumb { @Override public void handleEvent(Event event) { if (fComposite.isDisposed()) return; - + if (isBreadcrumbEvent(event)) { if (fHasFocus) return; @@ -230,7 +230,7 @@ public abstract class AbstractBreadcrumb { */ private void doOpen(ISelection selection) { if (open(selection)) { - fBreadcrumbViewer.setInput(getCurrentInput()); + fBreadcrumbViewer.setInput(getCurrentInput()); } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItem.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItem.java index 2a7d9d672..f6bc59242 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItem.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItem.java @@ -38,7 +38,7 @@ import org.eclipse.swt.widgets.Shell; class BreadcrumbItem extends Item { private TreePath fPath; - + private final BreadcrumbViewer fParent; private Composite fContainer; @@ -92,11 +92,11 @@ class BreadcrumbItem extends Item { public TreePath getPath() { return fPath; } - + public void setPath(TreePath path) { fPath = path; } - + /** * Should this item show a text label. * diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDetails.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDetails.java index 6482c4ac2..c5a756760 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDetails.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDetails.java @@ -368,7 +368,7 @@ class BreadcrumbItemDetails { private void openDropDown() { Shell shell = fParent.getDropDownShell(); - if (shell == null) { + if (shell == null) { fParent.openDropDownMenu(); shell = fParent.getDropDownShell(); } @@ -417,7 +417,7 @@ class BreadcrumbItemDetails { viewer.selectItem(fParent); if (shell == null && e.button == 1 && e.stateMask == 0) { fParent.getViewer().fireDoubleClick(); - } + } } @Override diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java index 84f9f1de0..c29ac5500 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java @@ -153,7 +153,7 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite { // the size is not adjusted correctly in a virtual tree. private static final int DROP_DOWN_MIN_WIDTH= 500; private static final int DROP_DOWN_MAX_WIDTH= 501; - + private static final int DROP_DOWN_DEFAULT_MIN_HEIGHT= 100; private static final int DROP_DOWN_DEFAULT_MAX_HEIGHT= 500; @@ -171,7 +171,7 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite { private boolean fIsResizingProgrammatically; private int fCurrentWidth = -1; private int fCurrentHeight = -1; - + public BreadcrumbItemDropDown(BreadcrumbItem parent, Composite composite) { fParent= parent; @@ -280,7 +280,7 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite { if (DebugUIPlugin.DEBUG_BREADCRUMB) { DebugUIPlugin.trace(" creating new shell"); //$NON-NLS-1$ } - + fShell.addControlListener(new ControlAdapter() { /* * @see org.eclipse.swt.events.ControlAdapter#controlResized(org.eclipse.swt.events.ControlEvent) @@ -289,7 +289,7 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite { public void controlResized(ControlEvent e) { if (fIsResizingProgrammatically) return; - + Point size= fShell.getSize(); fCurrentWidth = size.x; fCurrentHeight = size.y; @@ -313,7 +313,7 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite { TreePath path= fParent.getPath(); Control control = fParent.getViewer().createDropDown(composite, this, path); - + control.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); setShellBounds(fShell); @@ -439,7 +439,7 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite { settings= javaSettings.addNewSection(DIALOG_SETTINGS); return settings; } - + private int getMaxWidth() { try { return getDialogSettings().getInt(DIALOG_WIDTH); @@ -462,7 +462,7 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite { * @param shell the shell to calculate the size for. */ private void setShellBounds(Shell shell) { - + Rectangle rect= fParentComposite.getBounds(); Rectangle toolbarBounds= fToolBar.getBounds(); @@ -474,16 +474,16 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite { if (fParent.getImage() != null) { imageBoundsX= fParent.getImage().getImageData().width; } - + Rectangle trim= fShell.computeTrim(0, 0, width, height); int x= toolbarBounds.x + toolbarBounds.width + 2 + trim.x - imageBoundsX; if (!isLeft()) x+= width; - + int y = rect.y; - if (isTop()) + if (isTop()) y+= rect.height; - else + else y-= height; Point pt= new Point(x, y); @@ -551,7 +551,7 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite { private void resizeShell(final Shell shell) { int maxHeight= getMaxHeight(); int maxWidth = getMaxWidth(); - + if (fCurrentHeight >= maxHeight && fCurrentWidth >= maxWidth) return; @@ -561,7 +561,7 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite { if (fCurrentWidth >= DROP_DOWN_MAX_WIDTH) { newWidth= fCurrentWidth; } else { - // Workaround for bug 319612: Do not resize width below the + // Workaround for bug 319612: Do not resize width below the // DROP_DOWN_MIN_WIDTH. This can happen because the Shell.getSize() // is incorrectly small on Linux. newWidth= Math.min(Math.max(Math.max(preferedSize.x, fCurrentWidth), DROP_DOWN_MIN_WIDTH), maxWidth); @@ -580,7 +580,7 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite { shell.setSize(newWidth, newHeight); fCurrentWidth = newWidth; fCurrentHeight = newHeight; - + Point location = shell.getLocation(); Point newLocation = location; if (!isLeft()) { @@ -588,7 +588,7 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite { } if (!isTop()) { newLocation = new Point(newLocation.x, newLocation.y - (newHeight - fCurrentHeight)); - } + } if (!location.equals(newLocation)) { shell.setLocation(newLocation.x, newLocation.y); } @@ -610,7 +610,7 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite { return (fParentComposite.getStyle() & SWT.RIGHT_TO_LEFT) == 0 && (fParent.getViewer().getStyle() & SWT.RIGHT) == 0; } - + /** * Tells whether this the breadcrumb is in LTR mode or RTL mode. Or whether the breadcrumb * is on the right-side status coolbar, which has the same effect on layout. @@ -628,12 +628,12 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite { fShell.close(); } } - + @Override public void notifySelection(ISelection selection) { - fParent.getViewer().fireMenuSelection(selection); + fParent.getViewer().fireMenuSelection(selection); } - + @Override public void updateSize() { if (fShell != null && !fShell.isDisposed()) { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbViewer.java index 304369f20..fb83b9a8f 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbViewer.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbViewer.java @@ -75,7 +75,7 @@ public abstract class BreadcrumbViewer extends StructuredViewer { private Image fGradientBackground; private BreadcrumbItem fSelectedItem; - + /** * Create a new <code>BreadcrumbViewer</code>. * <p> @@ -150,17 +150,17 @@ public abstract class BreadcrumbViewer extends StructuredViewer { int getStyle() { return fStyle; } - + /** * Configure the given drop down viewer. The given input is used for the viewers input. Clients * must at least set the label and the content provider for the viewer. - * @param parent the parent composite + * @param parent the parent composite * @param site the site to create the drop down for * @param path the path to show * @return the drop down control */ protected abstract Control createDropDown(Composite parent, IBreadcrumbDropDownSite site, TreePath path); - + /* * @see org.eclipse.jface.viewers.Viewer#getControl() */ @@ -319,7 +319,7 @@ public abstract class BreadcrumbViewer extends StructuredViewer { protected void doUpdateItem(Widget widget, Object element, boolean fullMap) { myDoUpdateItem(widget, element, fullMap); } - + private boolean myDoUpdateItem(Widget widget, Object element, boolean fullMap) { if (widget instanceof BreadcrumbItem) { final BreadcrumbItem item= (BreadcrumbItem) widget; @@ -371,7 +371,7 @@ public abstract class BreadcrumbViewer extends StructuredViewer { } return null; } - + /* * @see org.eclipse.jface.viewers.StructuredViewer#getSelectionFromWidget() */ @@ -399,7 +399,7 @@ public abstract class BreadcrumbViewer extends StructuredViewer { disableRedraw(); try { boolean layoutChanged = false; - + BreadcrumbItem item= (BreadcrumbItem) doFindItem(element); if (item == null || element != null && element.equals(getInput())) { for (int i= 0, size= fBreadcrumbItems.size(); i < size; i++) { @@ -409,7 +409,7 @@ public abstract class BreadcrumbViewer extends StructuredViewer { } else { layoutChanged = refreshItem(item) || layoutChanged; } - + if (layoutChanged) { updateSize(); fContainer.layout(true, true); @@ -426,7 +426,7 @@ public abstract class BreadcrumbViewer extends StructuredViewer { protected void setSelectionToWidget(List l, boolean reveal) { BreadcrumbItem focusItem= null; - // Unselect the currently selected items, and remember the focused item. + // Unselect the currently selected items, and remember the focused item. for (int i= 0, size= fBreadcrumbItems.size(); i < size; i++) { BreadcrumbItem item= fBreadcrumbItems.get(i); if (item.hasFocus()) { @@ -453,8 +453,8 @@ public abstract class BreadcrumbViewer extends StructuredViewer { } } } - - // If there is a new selection, and it does not overlap the old selection, + + // If there is a new selection, and it does not overlap the old selection, // remove the focus marker from the old focus item. if (fSelectedItem != null && focusItem != null) { focusItem.setFocus(false); @@ -590,41 +590,41 @@ public abstract class BreadcrumbViewer extends StructuredViewer { BreadcrumbItem last= fBreadcrumbItems.get(fBreadcrumbItems.size() - 1); last.setIsLastItem(false); } - + int index = 0; boolean updateLayout = false; if (input != null) { ITreePathContentProvider contentProvider= (ITreePathContentProvider) getContentProvider(); TreePath path = new TreePath(new Object[0]); - - // Top level elements need to be retrieved using getElements(), rest + + // Top level elements need to be retrieved using getElements(), rest // using getChildren(). Object[] children = contentProvider.getElements(input); Object element = children != null && children.length != 0 ? children[0] : null; while (element != null) { path = path.createChildPath(element); - + // All but last item are hidden if the viewer is in a vertical toolbar. children = contentProvider.getChildren(path); if ((getStyle() & SWT.VERTICAL) == 0 || children == null || children.length == 0) { updateLayout = updateOrCreateItem(index++, path, element) || updateLayout; } - + if (children != null && children.length != 0) { element = children[0]; } else { break; } - - } + + } } - + BreadcrumbItem last = null; if (index <= fBreadcrumbItems.size()) { last = (fBreadcrumbItems.get(index - 1)); last.setIsLastItem(true); } - + while (index < fBreadcrumbItems.size()) { updateLayout = true; BreadcrumbItem item= fBreadcrumbItems.remove(fBreadcrumbItems.size() - 1); @@ -646,13 +646,13 @@ public abstract class BreadcrumbViewer extends StructuredViewer { } } - /** + /** * @param item Item to refresh. * @return returns whether the item's size and layout needs to be updated. */ private boolean refreshItem(BreadcrumbItem item) { boolean layoutChanged = false; - + TreePath path = getTreePathFromItem(item); ViewerLabel label = new ViewerLabel(item.getText(), item.getImage()); @@ -671,10 +671,10 @@ public abstract class BreadcrumbViewer extends StructuredViewer { } return layoutChanged; } - + /** * Creates or updates a breadcrumb item. - * @param index the index + * @param index the index * @param path the path * @param element the element * @@ -693,7 +693,7 @@ public abstract class BreadcrumbViewer extends StructuredViewer { } boolean updateLayout = false; - + if (equals(element, item.getData())) { item.setPath(path); updateLayout = myDoUpdateItem(item, element, false); @@ -703,7 +703,7 @@ public abstract class BreadcrumbViewer extends StructuredViewer { mapElement(element, item); updateLayout = refreshItem(item); } - + return updateLayout; } @@ -864,7 +864,7 @@ public abstract class BreadcrumbViewer extends StructuredViewer { /** * Blends c1 and c2 based in the provided ratio. - * + * * @param c1 * first color * @param c2 @@ -880,10 +880,10 @@ public abstract class BreadcrumbViewer extends StructuredViewer { int b = blend(c1.blue, c2.blue, ratio); return new RGB(r, g, b); } - + /** * Blends two primary color components based on the provided ratio. - * + * * @param v1 * first component * @param v2 @@ -900,7 +900,7 @@ public abstract class BreadcrumbViewer extends StructuredViewer { /* * @see * org.eclipse.jface.viewers.StructuredViewer#handleDispose(org.eclipse.swt.events.DisposeEvent) - * + * * @since 3.7 */ @Override diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/IBreadcrumbDropDownSite.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/IBreadcrumbDropDownSite.java index adea89dfd..eb1004a7b 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/IBreadcrumbDropDownSite.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/IBreadcrumbDropDownSite.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * Wind River Systems - initial API and implementation *******************************************************************************/ @@ -14,26 +14,26 @@ import org.eclipse.jface.viewers.ISelection; /** * Interface allowing breadcrumb drop-down implementors to communicate with their - * containing breadcrumb. - * + * containing breadcrumb. + * * @since 3.5 */ public interface IBreadcrumbDropDownSite { - + /** * Notifies the breadcrumb that the given selection was made in the drop-down * viewer. * @param selection Selection to set to breadcrumb. */ public void notifySelection(ISelection selection); - + /** * Notifies the breadcrumb that the drop-down viewer should be closed. */ public void close(); - + /** - * Notifies the breadcrumb that the drop-down viewer's contents have + * Notifies the breadcrumb that the drop-down viewer's contents have * changed and viewer shell should be adjusted for the new size. */ public void updateSize(); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/TreeViewerDropDown.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/TreeViewerDropDown.java index 365c5a400..2c3afc4a6 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/TreeViewerDropDown.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/TreeViewerDropDown.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * Wind River Systems - initial API and implementation * IBM Corporation - ongoing bug fixes and enhancements @@ -44,22 +44,22 @@ import org.eclipse.swt.widgets.TreeItem; import org.eclipse.ui.progress.UIJob; /** - * A breadcrumb drop-down which shows a tree viewer. It implements mouse and + * A breadcrumb drop-down which shows a tree viewer. It implements mouse and * key listeners to handle selection and expansion behavior of the viewer. - * This class needs to be extended to implement - * {@link #createTreeViewer(Composite, int, TreePath)} to instantiate the - * concrete {@link TreeViewer} object. - * + * This class needs to be extended to implement + * {@link #createTreeViewer(Composite, int, TreePath)} to instantiate the + * concrete {@link TreeViewer} object. + * * @since 3.5 */ public abstract class TreeViewerDropDown { - + /** - * Delay to control scrolling when the mouse pointer reaches the edge of - * the tree viewer. + * Delay to control scrolling when the mouse pointer reaches the edge of + * the tree viewer. */ private static long MOUSE_MOVE_SCROLL_DELAY = 500; - + /** * The breadcrumb site in which the viewer is created. */ @@ -72,16 +72,16 @@ public abstract class TreeViewerDropDown { /** * Creates the viewer and installs the listeners. - * + * * @param composite Parent control of the viewer. * @param site Breadcrumb site for the viewer. * @param path Path to the element for which the drop-down is being opened. * @return The control created for the viewer. */ public Control createDropDown(Composite composite, IBreadcrumbDropDownSite site, TreePath path) { - + fDropDownSite = site; - fDropDownViewer= createTreeViewer(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL, path); + fDropDownViewer= createTreeViewer(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL, path); fDropDownViewer.addOpenListener(new IOpenListener() { @Override @@ -92,9 +92,9 @@ public abstract class TreeViewerDropDown { openElement(event.getSelection()); } }); - + final Tree tree = fDropDownViewer.getTree(); - + tree.addMouseListener(new MouseListener() { @Override public void mouseUp(MouseEvent e) { @@ -123,7 +123,7 @@ public abstract class TreeViewerDropDown { pathElements.add(0, data); item = item.getParentItem(); } - + openElement(new TreeSelection(new TreePath(pathElements.toArray()))); } @@ -154,7 +154,7 @@ public abstract class TreeViewerDropDown { fLastItem= (TreeItem) o; tree.setSelection(new TreeItem[] { fLastItem }); } else if (System.currentTimeMillis() > (fLastScrollTime + MOUSE_MOVE_SCROLL_DELAY)) { - if (e.y < tree.getItemHeight() / 4) + if (e.y < tree.getItemHeight() / 4) { // Scroll up if (currentItem.getParentItem() == null) { @@ -162,7 +162,7 @@ public abstract class TreeViewerDropDown { if (index < 1) { return; } - + fLastItem= tree.getItem(index - 1); tree.setSelection(new TreeItem[] { fLastItem }); } else { @@ -181,7 +181,7 @@ public abstract class TreeViewerDropDown { if (index >= tree.getItemCount() - 1) { return; } - + fLastItem= tree.getItem(index + 1); tree.setSelection(new TreeItem[] { fLastItem }); } else { @@ -211,7 +211,7 @@ public abstract class TreeViewerDropDown { fDropDownSite.close(); return; } - + TreeItem[] selection= tree.getSelection(); if (selection.length != 1) { return; @@ -254,28 +254,28 @@ public abstract class TreeViewerDropDown { } }.schedule(); } - + }); return tree; } - + /** * Creates and returns the tree viewer. - * + * * @param composite Parent control of the viewer. * @param style Style flags to use in creating the tree viewer. * @param path Path to the element for which the drop-down is being opened. * @return The newly created tree viewer. */ protected abstract TreeViewer createTreeViewer(Composite composite, int style, TreePath path); - + /** - * Called when the given element was selected in the viewer. It causes the - * breadcrumb viewer to fire an opened event. If the viewer loses focus - * as a result of the open operation, then the drop-down is closed. + * Called when the given element was selected in the viewer. It causes the + * breadcrumb viewer to fire an opened event. If the viewer loses focus + * as a result of the open operation, then the drop-down is closed. * Otherwise the selected element is expanded. - * + * * @param selection The selection to open. */ protected void openElement(ISelection selection) { @@ -287,7 +287,7 @@ public abstract class TreeViewerDropDown { fDropDownSite.notifySelection(selection); Tree tree = fDropDownViewer.getTree(); - + boolean treeHasFocus= !tree.isDisposed() && tree.isFocusControl(); if (DebugUIPlugin.DEBUG_TREE_VIEWER_DROPDOWN) { @@ -323,6 +323,6 @@ public abstract class TreeViewerDropDown { } } - + } |