Java 类org.eclipse.gef.ui.properties.UndoablePropertySheetPage 实例源码

项目:gef-gwt    文件:GraphicalEditor.java   
/**
 * Returns the adapter for the specified key.
 * 
 * <P>
 * <EM>IMPORTANT</EM> certain requests, such as the property sheet, may be
 * made before or after {@link #createPartControl(Composite)} is called. The
 * order is unspecified by the Workbench.
 * 
 * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
 */
public Object getAdapter(Class type) {
    if (type == org.eclipse.ui.views.properties.IPropertySheetPage.class) {
        return new UndoablePropertySheetPage(getCommandStack(),
                getActionRegistry().getAction(ActionFactory.UNDO.getId()),
                getActionRegistry().getAction(ActionFactory.REDO.getId()));
    }
    if (type == GraphicalViewer.class)
        return getGraphicalViewer();
    if (type == CommandStack.class)
        return getCommandStack();
    if (type == ActionRegistry.class)
        return getActionRegistry();
    if (type == EditPart.class && getGraphicalViewer() != null)
        return getGraphicalViewer().getRootEditPart();
    if (type == IFigure.class && getGraphicalViewer() != null)
        return ((GraphicalEditPart) getGraphicalViewer().getRootEditPart())
                .getFigure();
    return super.getAdapter(type);
}