1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 17:26: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.service.IExpressions.IExpressionDMContext;
import org.eclipse.cdt.dsf.debug.ui.IDsfDebugUIConstants; import org.eclipse.cdt.dsf.debug.ui.IDsfDebugUIConstants;
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin; 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.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.IPresentationContext;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputRequestor; import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputRequestor;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputUpdate;
@ -130,23 +127,7 @@ public class ExpressionInformationControlCreator implements IInformationControlC
private ViewerInputService fInputService; private ViewerInputService fInputService;
/** private IInformationControlCreator fInformationControlCreator;
* 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;
}
}
/** /**
* Inner class implementing IDetailPaneContainer methods. Handles changes to detail * Inner class implementing IDetailPaneContainer methods. Handles changes to detail
@ -463,20 +444,20 @@ public class ExpressionInformationControlCreator implements IInformationControlC
if (input instanceof IExpressionDMContext) { if (input instanceof IExpressionDMContext) {
fVariable = input; fVariable = input;
fInputService.resolveViewerInput(input); fInputService.resolveViewerInput(input);
} else if (input instanceof IVariable) {
fVariable = input;
fViewer.setInput(new TreeRoot());
} }
} }
@Override @Override
public IInformationControlCreator getInformationPresenterControlCreator() { public IInformationControlCreator getInformationPresenterControlCreator() {
return new ExpressionInformationControlCreator(fShowDetailPane, fExpansionLevel) { if (fInformationControlCreator == null) {
@Override fInformationControlCreator = new ExpressionInformationControlCreator(fShowDetailPane, fExpansionLevel) {
public IInformationControl createInformationControl(Shell shell) { @Override
return new ExpressionInformationControl(shell, true); public IInformationControl createInformationControl(Shell shell) {
} return new ExpressionInformationControl(shell, true);
}; }
};
}
return fInformationControlCreator;
} }
public void viewerInputComplete(IViewerInputUpdate update) { public void viewerInputComplete(IViewerInputUpdate update) {
@ -491,7 +472,7 @@ public class ExpressionInformationControlCreator implements IInformationControlC
/** /**
* Create default expression information control creator. * Create default expression information control creator.
* <p> * <p>
* Same as {@link ExpressionInformationControlCreator(true, 1)}. * Same as {@code ExpressionInformationControlCreator(true, 1)}.
* </p> * </p>
*/ */
public ExpressionInformationControlCreator() { public ExpressionInformationControlCreator() {

View file

@ -157,9 +157,10 @@ abstract public class AbstractDsfDebugTextHover extends AbstractDebugTextHover i
/** /**
* Create an information control creator for the "advanced" hover. * Create an information control creator for the "advanced" hover.
* Called by {@link #getHoverControlCreator()} when {@link #useExpressionExplorer()} * <p>
* returns <code>true</code>. * 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 showDetailPane whether the detail pane should be visible
* @param defaultExpansionLevel automatically expand the expression to this level * @param defaultExpansionLevel automatically expand the expression to this level
* @return the information control creator * @return the information control creator
@ -168,10 +169,26 @@ abstract public class AbstractDsfDebugTextHover extends AbstractDebugTextHover i
return new ExpressionInformationControlCreator(showDetailPane, 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 @Override
public IInformationControlCreator getHoverControlCreator() { public IInformationControlCreator getHoverControlCreator() {
if (useExpressionExplorer()) { if (useExpressionExplorer()) {
return createExpressionInformationControlCreator(true, 1); return createExpressionInformationControlCreator();
} else { } else {
return new IInformationControlCreator() { return new IInformationControlCreator() {
public IInformationControl createInformationControl(Shell parent) { public IInformationControl createInformationControl(Shell parent) {