KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > update > internal > ui > model > UIModelObject


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.update.internal.ui.model;
12
13 import org.eclipse.core.runtime.*;
14 import org.eclipse.jface.resource.*;
15 import org.eclipse.ui.model.*;
16
17
18 public class UIModelObject extends PlatformObject implements IWorkbenchAdapter {
19     UpdateModel model;
20     
21     public void setModel(UpdateModel model) {
22         this.model = model;
23     }
24     
25     public UpdateModel getModel() {
26         return model;
27     }
28     
29     protected void notifyObjectChanged(String JavaDoc property) {
30         if (model==null) return;
31         model.fireObjectChanged(this, property);
32     }
33     
34     protected void notifyObjectsAdded(Object JavaDoc parent, Object JavaDoc [] objects) {
35         if (model==null) return;
36         model.fireObjectsAdded(parent, objects);
37     }
38     
39     protected void notifyObjectsRemoved(Object JavaDoc parent, Object JavaDoc [] objects) {
40         if (model==null) return;
41         model.fireObjectsRemoved(parent, objects);
42     }
43     
44     public Object JavaDoc [] getChildren(Object JavaDoc obj) {
45         return new Object JavaDoc[0];
46     }
47     
48     public Object JavaDoc getParent(Object JavaDoc obj) {
49         return null;
50     }
51     public String JavaDoc getLabel(Object JavaDoc obj) {
52         return toString();
53     }
54     public ImageDescriptor getImageDescriptor(Object JavaDoc obj) {
55         return null;
56     }
57 }
58
Popular Tags