Java Code Examples for org.eclipse.core.variables.IStringVariable

The following examples show how to use org.eclipse.core.variables.IStringVariable. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * Returns the variable expression the user generated from this dialog, or
 * <code>null</code> if none.
 * 
 * @return variable expression the user generated from this dialog, or
 *         <code>null</code> if none
 */
public String getVariableExpression( )
{
	Object[] selected = getResult( );
	if ( selected != null && selected.length == 1 )
	{
		IStringVariable variable = (IStringVariable) selected[0];
		StringBuffer buffer = new StringBuffer( );
		buffer.append( "${" ); //$NON-NLS-1$
		buffer.append( variable.getName( ) );
		
		buffer.append( "}" ); //$NON-NLS-1$
		return buffer.toString( );
	}
	return null;
}
 
Example 2
/**
 * Update variable description and argument button enablement.
 * 
 * @see org.eclipse.ui.dialogs.AbstractElementListSelectionDialog#handleSelectionChanged()
 */
protected void handleSelectionChanged( )
{
	super.handleSelectionChanged( );
	Object[] objects = getSelectedElements( );
	String text = null;
	if ( objects.length == 1 )
	{
		IStringVariable variable = (IStringVariable) objects[0];
		text = variable.getDescription( );
	}
	if ( text == null )
	{
		text = ""; //$NON-NLS-1$
	}
	
	fDescriptionText.setText( text );
}
 
Example 3
public String getText( Object element )
{
	if ( element instanceof IStringVariable )
	{
		IStringVariable variable = (IStringVariable) element;
		return variable.getName( );
	}
	return super.getText( element );
}
 
Example 4
Source Project: goclipse   Source File: VariablesResolver.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Override
public IStringVariable[] getVariables() {
	IValueVariable[] valueVars = getValueVariables();
	IDynamicVariable[] dynVars = getDynamicVariables();
	
	ArrayList2<IStringVariable> variables = new ArrayList2<>(valueVars.length + dynVars.length);
	variables.addElements(dynVars);
	variables.addElements(valueVars);
	return variables.toArray(IStringVariable.class);
}
 
Example 5
Source Project: Pydev   Source File: MockStringVariableManager.java    License: Eclipse Public License 1.0 4 votes vote down vote up
@Override
public IStringVariable[] getVariables() {
    throw new AssertionFailedError("Unexpected method call in MockStringVariableManager");
}
 
Example 6
Source Project: Pydev   Source File: MockStringVariableManager.java    License: Eclipse Public License 1.0 4 votes vote down vote up
@Override
public String getContributingPluginId(IStringVariable variable) {
    throw new AssertionFailedError("Unexpected method call in MockStringVariableManager");
}
 
Example 7
@Override
public IStringVariable[] getVariables() {
	return parentVarMgr.getVariables();
}
 
Example 8
@Override
public String getContributingPluginId(IStringVariable variable) {
	return parentVarMgr.getContributingPluginId(variable);
}