diff options
Diffstat (limited to 'examples/org.eclipse.tcf.examples.presentation/src/org/eclipse/tcf/examples/presentation/PresentationExample.java')
-rw-r--r-- | examples/org.eclipse.tcf.examples.presentation/src/org/eclipse/tcf/examples/presentation/PresentationExample.java | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/examples/org.eclipse.tcf.examples.presentation/src/org/eclipse/tcf/examples/presentation/PresentationExample.java b/examples/org.eclipse.tcf.examples.presentation/src/org/eclipse/tcf/examples/presentation/PresentationExample.java new file mode 100644 index 000000000..904546701 --- /dev/null +++ b/examples/org.eclipse.tcf.examples.presentation/src/org/eclipse/tcf/examples/presentation/PresentationExample.java @@ -0,0 +1,61 @@ +/******************************************************************************* + * Copyright (c) 2012 Xilinx, Inc. and others. + * All rights reserved. This program and the accompanying materials + * 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: + * Xilinx - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.examples.presentation; + +import org.eclipse.debug.core.IRequest; +import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate; +import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.tcf.debug.ui.ITCFModel; +import org.eclipse.tcf.debug.ui.ITCFPresentationProvider; + +/** + * This example demonstrates how to provide icons in the Registers view. + * Using this approach, clients can alter all aspects of TCF debug model presentation. + */ +@SuppressWarnings("restriction") +public class PresentationExample implements ITCFPresentationProvider { + + @Override + public boolean onModelCreated(ITCFModel model) { + /* true means we want to listen for UI requests on this model */ + return true; + } + + @Override + public void onModelDisposed(ITCFModel model) { + } + + @Override + public boolean updateStarted(IRequest request) { + /* true means we want the model to start handling of this request */ + return true; + } + + @Override + public boolean updateComplete(IRequest request) { + if (request instanceof ILabelUpdate) { + ILabelUpdate update = (ILabelUpdate)request; + String id = update.getPresentationContext().getId(); + if (IDebugUIConstants.ID_REGISTER_VIEW.equals(id)) { + /* This request is for label in the Registers view. + * Let's override the default icon with something else. + */ + ImageDescriptor image = DebugUITools.getImageDescriptor( + IDebugUIConstants.IMG_OBJS_VARIABLE); + update.setImageDescriptor(image, 0); + } + } + /* true means we want the model to finish handling of this request */ + return true; + } +} |