1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 310425 - incorporate Marc's feedback

This commit is contained in:
Anton Leherbauer 2010-04-28 08:18:59 +00:00
parent 90380cf9ed
commit 0d4f5c71b6
2 changed files with 32 additions and 34 deletions

View file

@ -14,10 +14,7 @@ package org.eclipse.cdt.dsf.debug.internal.ui;
import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext;
import org.eclipse.cdt.dsf.debug.ui.IDsfDebugUIConstants;
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.model.IVariable;
import org.eclipse.debug.internal.ui.SWTFactory;
import org.eclipse.debug.internal.ui.model.elements.ElementContentProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputRequestor;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputUpdate;
@ -130,23 +127,7 @@ public class ExpressionInformationControlCreator implements IInformationControlC
private ViewerInputService fInputService;
/**
* Creates the content for the root element of the tree viewer in the hover
*/
private class TreeRoot extends ElementContentProvider {
@Override
protected int getChildCount(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException {
return 1;
}
@Override
protected Object[] getChildren(Object parent, int index, int length, IPresentationContext context, IViewerUpdate monitor) throws CoreException {
return new Object[] { fVariable };
}
@Override
protected boolean supportsContextId(String id) {
return true;
}
}
private IInformationControlCreator fInformationControlCreator;
/**
* Inner class implementing IDetailPaneContainer methods. Handles changes to detail
@ -463,20 +444,20 @@ public class ExpressionInformationControlCreator implements IInformationControlC
if (input instanceof IExpressionDMContext) {
fVariable = input;
fInputService.resolveViewerInput(input);
} else if (input instanceof IVariable) {
fVariable = input;
fViewer.setInput(new TreeRoot());
}
}
@Override
public IInformationControlCreator getInformationPresenterControlCreator() {
return new ExpressionInformationControlCreator(fShowDetailPane, fExpansionLevel) {
@Override
public IInformationControl createInformationControl(Shell shell) {
return new ExpressionInformationControl(shell, true);
}
};
if (fInformationControlCreator == null) {
fInformationControlCreator = new ExpressionInformationControlCreator(fShowDetailPane, fExpansionLevel) {
@Override
public IInformationControl createInformationControl(Shell shell) {
return new ExpressionInformationControl(shell, true);
}
};
}
return fInformationControlCreator;
}
public void viewerInputComplete(IViewerInputUpdate update) {
@ -491,7 +472,7 @@ public class ExpressionInformationControlCreator implements IInformationControlC
/**
* Create default expression information control creator.
* <p>
* Same as {@link ExpressionInformationControlCreator(true, 1)}.
* Same as {@code ExpressionInformationControlCreator(true, 1)}.
* </p>
*/
public ExpressionInformationControlCreator() {

View file

@ -157,9 +157,10 @@ abstract public class AbstractDsfDebugTextHover extends AbstractDebugTextHover i
/**
* Create an information control creator for the "advanced" hover.
* Called by {@link #getHoverControlCreator()} when {@link #useExpressionExplorer()}
* returns <code>true</code>.
*
* <p>
* Clients can call this method to create an information control creator
* with custom options.
* </p>
* @param showDetailPane whether the detail pane should be visible
* @param defaultExpansionLevel automatically expand the expression to this level
* @return the information control creator
@ -167,11 +168,27 @@ abstract public class AbstractDsfDebugTextHover extends AbstractDebugTextHover i
protected final IInformationControlCreator createExpressionInformationControlCreator(boolean showDetailPane, int defaultExpansionLevel) {
return new ExpressionInformationControlCreator(showDetailPane, defaultExpansionLevel);
}
/**
* Create an information control creator for the "advanced" hover.
* Called by {@link #getHoverControlCreator()} when {@link #useExpressionExplorer()}
* returns <code>true</code>.
* <p>
* The default implementation returns an information control creator with
* details pane enabled and default expansion level = 1.
* Clients may override this method to return an instance with different options.
* </p>
* @return the information control creator
* @see {@link #createExpressionInformationControlCreator(boolean, int)}
*/
protected IInformationControlCreator createExpressionInformationControlCreator() {
return createExpressionInformationControlCreator(true, 1);
}
@Override
public IInformationControlCreator getHoverControlCreator() {
if (useExpressionExplorer()) {
return createExpressionInformationControlCreator(true, 1);
return createExpressionInformationControlCreator();
} else {
return new IInformationControlCreator() {
public IInformationControl createInformationControl(Shell parent) {