KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ant > internal > ui > debug > model > AntProperties


1 /*******************************************************************************
2  * Copyright (c) 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.ant.internal.ui.debug.model;
12
13 import org.eclipse.debug.core.DebugException;
14 import org.eclipse.debug.core.model.IValue;
15 import org.eclipse.debug.core.model.IVariable;
16
17 public class AntProperties extends AntDebugElement implements IVariable {
18     
19     private IValue fValue;
20     private String JavaDoc fName;
21     private boolean fValid= true;
22
23     public AntProperties(AntDebugTarget target, String JavaDoc name) {
24         super(target);
25         fName= name;
26     }
27
28     /* (non-Javadoc)
29      * @see org.eclipse.debug.core.model.IVariable#getValue()
30      */

31     public synchronized IValue getValue() throws DebugException {
32         int attempts= 0;
33         while (!fValid && !getDebugTarget().isTerminated()) {
34             try {
35                 wait(50);
36             } catch (InterruptedException JavaDoc e) {
37             }
38             if (attempts == 20 && !fValid && !getDebugTarget().isTerminated()) {
39                 throwDebugException(DebugModelMessages.AntProperties_1);
40             }
41             attempts++;
42         }
43         return fValue;
44     }
45     
46     protected IValue getLastValue() {
47         return fValue;
48     }
49
50     /* (non-Javadoc)
51      * @see org.eclipse.debug.core.model.IVariable#getName()
52      */

53     public String JavaDoc getName() {
54         return fName;
55     }
56
57     /* (non-Javadoc)
58      * @see org.eclipse.debug.core.model.IVariable#getReferenceTypeName()
59      */

60     public String JavaDoc getReferenceTypeName() {
61         return ""; //$NON-NLS-1$
62
}
63
64     /* (non-Javadoc)
65      * @see org.eclipse.debug.core.model.IVariable#hasValueChanged()
66      */

67     public boolean hasValueChanged() {
68         return false;
69     }
70
71     /* (non-Javadoc)
72      * @see org.eclipse.debug.core.model.IValueModification#setValue(java.lang.String)
73      */

74     public void setValue(String JavaDoc expression) {
75     }
76
77     /* (non-Javadoc)
78      * @see org.eclipse.debug.core.model.IValueModification#setValue(org.eclipse.debug.core.model.IValue)
79      */

80     public void setValue(IValue value) {
81         fValue= value;
82     }
83
84     /* (non-Javadoc)
85      * @see org.eclipse.debug.core.model.IValueModification#supportsValueModification()
86      */

87     public boolean supportsValueModification() {
88         return false;
89     }
90
91     /* (non-Javadoc)
92      * @see org.eclipse.debug.core.model.IValueModification#verifyValue(java.lang.String)
93      */

94     public boolean verifyValue(String JavaDoc expression) {
95         return false;
96     }
97
98     /* (non-Javadoc)
99      * @see org.eclipse.debug.core.model.IValueModification#verifyValue(org.eclipse.debug.core.model.IValue)
100      */

101     public boolean verifyValue(IValue value) {
102         return false;
103     }
104
105     protected synchronized void setValid(boolean valid) {
106         fValid= valid;
107         notifyAll();
108     }
109 }
110
Popular Tags