diff options
Diffstat (limited to 'dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/RootVMNode.java')
-rw-r--r-- | dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/RootVMNode.java | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/RootVMNode.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/RootVMNode.java new file mode 100644 index 00000000000..41bbef29e45 --- /dev/null +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/RootVMNode.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * Copyright (c) 2006, 2008 Wind River Systems 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.dsf.ui.viewmodel; + +import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; +import org.eclipse.cdt.dsf.concurrent.RequestMonitor; +import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate; +import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate; +import org.eclipse.debug.internal.ui.viewers.model.provisional.IHasChildrenUpdate; +import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta; + +/** + * Default implementation of a root view model node. This class may be sub-classed + * to implement model-specific event handling. + */ +@SuppressWarnings("restriction") +public class RootVMNode extends AbstractVMNode implements IRootVMNode { + + public RootVMNode(AbstractVMProvider provider) { + super(provider); + } + + public void update(IChildrenUpdate[] updates) { + throw new UnsupportedOperationException("Root view model node should never be queried for list of elements."); //$NON-NLS-1$ + } + + public void update(IChildrenCountUpdate[] updates) { + throw new UnsupportedOperationException("Root view model node should never be queried for list of elements."); //$NON-NLS-1$ + } + + public void update(IHasChildrenUpdate[] updates) { + throw new UnsupportedOperationException("Root view model node should never be queried for list of elements."); //$NON-NLS-1$ + } + + /** + * Default implementation does not examine the event and assumes that every + * event should be processed to generate a delta. + */ + public boolean isDeltaEvent(Object rootObject, Object event) { + if (event instanceof ModelProxyInstalledEvent) { + return rootObject.equals( ((ModelProxyInstalledEvent)event).getRootElement() ); + } + return true; + } + + /** + * Default implementation creates a delta assuming that the root layout node + * is the input object into the view. + */ + public void createRootDelta(Object rootObject, Object event, final DataRequestMonitor<VMDelta> rm) { + rm.setData(new VMDelta(rootObject, 0, IModelDelta.NO_CHANGE)); + rm.done(); + } + + + public int getDeltaFlags(Object event) { + return IModelDelta.NO_CHANGE; + } + + public void buildDelta(Object event, VMDelta parent, int nodeOffset, RequestMonitor requestMonitor) { + requestMonitor.done(); + } +} |