blob: 4f93fec49b34b86c4c65a109f7b58c4436ec0536 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2005, 2009 IBM Corporation 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.ant.internal.launching.debug.model;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IValue;
import org.eclipse.debug.core.model.IVariable;
public class AntProperties extends AntDebugElement implements IVariable {
private IValue fValue;
private String fName;
private boolean fValid= true;
public AntProperties(AntDebugTarget target, String name) {
super(target);
fName= name;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IVariable#getValue()
*/
public synchronized IValue getValue() throws DebugException {
int attempts= 0;
while (!fValid && !getDebugTarget().isTerminated()) {
try {
wait(50);
} catch (InterruptedException e) {
}
if (attempts == 20 && !fValid && !getDebugTarget().isTerminated()) {
throwDebugException(DebugModelMessages.AntProperties_1);
}
attempts++;
}
return fValue;
}
public IValue getLastValue() {
return fValue;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IVariable#getName()
*/
public String getName() {
return fName;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IVariable#getReferenceTypeName()
*/
public String getReferenceTypeName() {
return ""; //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IVariable#hasValueChanged()
*/
public boolean hasValueChanged() {
return false;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValueModification#setValue(java.lang.String)
*/
public void setValue(String expression) {
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValueModification#setValue(org.eclipse.debug.core.model.IValue)
*/
public void setValue(IValue value) {
fValue= value;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValueModification#supportsValueModification()
*/
public boolean supportsValueModification() {
return false;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValueModification#verifyValue(java.lang.String)
*/
public boolean verifyValue(String expression) {
return false;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValueModification#verifyValue(org.eclipse.debug.core.model.IValue)
*/
public boolean verifyValue(IValue value) {
return false;
}
public synchronized void setValid(boolean valid) {
fValid= valid;
notifyAll();
}
}