Java Code Examples for com.ibm.icu.util.StringTokenizer#nextToken()

The following examples show how to use com.ibm.icu.util.StringTokenizer#nextToken() . 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
Source File: ReportLauncherUtils.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public static TreeSet parseDeselectedWSIds( ILaunchConfiguration config )
		throws CoreException
{
	TreeSet deselected = new TreeSet( );
	String ids = config.getAttribute( IReportLauncherSettings.IMPORTPROJECT,
			(String) null );
	if ( ids != null && ids.length( ) > 0 )
	{
		StringTokenizer token = new StringTokenizer( ids, ";" ); //$NON-NLS-1$
		while ( token.hasMoreTokens( ) )
		{
			String str = token.nextToken( );
			int index = str.lastIndexOf( File.separator );
			if ( index > 0 )
			{
				str = str.substring( index + 1 );
			}
			deselected.add( str );
		}
	}
	return deselected;
}
 
Example 2
Source File: ReportLauncherUtils.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public static TreeSet parseDeselectedOpenFileNames(
		ILaunchConfiguration config ) throws CoreException
{
	TreeSet deselected = new TreeSet( );
	String ids = config.getAttribute( IReportLauncherSettings.OPENFILENAMES,
			(String) null );
	if ( ids != null && ids.length( ) > 0 )
	{
		StringTokenizer token = new StringTokenizer( ids, ";" ); //$NON-NLS-1$
		while ( token.hasMoreTokens( ) )
		{
			String str = token.nextToken( );
			int index = str.lastIndexOf( File.separator );
			if ( index > 0 )
			{
				str = str.substring( index + 1 );
			}
			deselected.add( str );
		}
	}
	return deselected;
}
 
Example 3
Source File: ReportLauncherUtils.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public static TreeSet parseDeselectedClassIds( ILaunchConfiguration config )
		throws CoreException
{
	TreeSet deselected = new TreeSet( );
	String ids = config.getAttribute( IReportLauncherSettings.IMPORTPROJECTNAMES,
			(String) null );
	if ( ids != null && ids.length( ) > 0 )
	{
		StringTokenizer token = new StringTokenizer( ids, ";" ); //$NON-NLS-1$
		while ( token.hasMoreTokens( ) )
		{
			String str = token.nextToken( );
			int index = str.lastIndexOf( File.separator );
			if ( index > 0 )
			{
				str = str.substring( index + 1 );
			}
			deselected.add( str );
		}
	}
	return deselected;
}
 
Example 4
Source File: ItemContentProvider.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Retrieve all the item names belonging to a specific category from dFile.
 * 
 * @param categoryName Category name
 */
private void parseItems( String categoryName )
{
	String sTmp = dFile.toString( );
	String startCategory = categoryName + ">"; //$NON-NLS-1$
	String endCategory = "/" + categoryName + ">"; //$NON-NLS-1$ //$NON-NLS-2$
	StringTokenizer tokens = new StringTokenizer( sTmp, "<" ); //$NON-NLS-1$
	boolean bThisCategory = false;
	iTypes = new ArrayList<String>( );
	while ( tokens.hasMoreTokens( ) )
	{
		String token = tokens.nextToken( );
		if ( startCategory.equals( token ) )
		{
			bThisCategory = true;
		}
		else if ( endCategory.equals( token ) )
		{
			break;
		}
		else if ( bThisCategory )
		{
			String sKey = token.substring( 0, token.indexOf( ">" ) ); //$NON-NLS-1$
			iTypes.add( sKey );
		}			
	}
}
 
Example 5
Source File: WorkspaceClassPathFinder.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public String getClassPath( String projects )
{
	if ( projects == null || projects.length( ) == 0 )
	{
		return null;
	}

	StringBuffer wbuf = new StringBuffer( );

	StringTokenizer token = new StringTokenizer( projects,
			PROPERTYSEPARATOR );
	boolean hasHeader = false;
	while ( token.hasMoreTokens( ) )
	{
		String projectName = token.nextToken( );
		List paths = getProjectPaths( projectName );
		for ( int i = 0; i < paths.size( ); i++ )
		{
			String url = (String) paths.get( i );
			if ( url != null && url.length( ) != 0 )
				if ( i == 0 && !hasHeader )
				{
					wbuf.append( url );
					hasHeader = true;
				}
				else
				{
					wbuf.append( PROPERTYSEPARATOR + url );
				}
		}

	}

	return wbuf.toString( );
}
 
Example 6
Source File: NavTree.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Adds nodes with full path and display name.
 * 
 * @param nodePath
 *            Full path is used to search. Every section of path is stored
 *            in item's data.
 * @param displayName
 *            Name is used to display only. If null or blank, use current
 *            path instead.
 */
public boolean addNode( String nodePath, String displayName )
{
	StringTokenizer stk = new StringTokenizer( nodePath, SEPARATOR );
	TreeItem currentItem = null;
	while ( stk.hasMoreTokens( ) )
	{
		String str = stk.nextToken( );
		currentItem = findAndAdd( str, currentItem, displayName );
	}
	return true;
}
 
Example 7
Source File: NavTree.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Finds tree item according to full path.
 * 
 * @param nodePath
 *            Full path with <code>NavTree.SEPARATOR</code>.
 * @return TreeItem or null if not found
 */
public TreeItem findTreeItem( String nodePath )
{
	if ( nodePath == null )
	{
		return null;
	}
	StringTokenizer tokens = new StringTokenizer( nodePath,
			NavTree.SEPARATOR );
	TreeItem item = null;
	TreeItem[] children = getItems( );
	while ( tokens.hasMoreTokens( ) )
	{
		String nodeText = tokens.nextToken( );
		if ( children.length == 0 )
		{
			return item;
		}

		boolean isFound = false;
		for ( int i = 0; i < children.length; i++ )
		{
			if ( children[i].getData( ).equals( nodeText ) )
			{
				isFound = true;
				item = children[i];
				children = item.getItems( );
				break;
			}
		}
		if ( !isFound )
		{
			return null;
		}
	}
	return item;
}
 
Example 8
Source File: ReportLocationListener.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void changing( LocationEvent event )
{
	if ( event.location.startsWith( "birt://" ) ) //$NON-NLS-1$
	{
		try
		{
			String urlstr = URLDecoder.decode( event.location, "UTF-8" ); //$NON-NLS-1$
			urlstr = urlstr.substring( urlstr.indexOf( "?" ) + 1 ); //$NON-NLS-1$
			StringTokenizer st = new StringTokenizer( urlstr, "&" ); //$NON-NLS-1$

			final Map options = new HashMap( );
			while ( st.hasMoreTokens( ) )
			{
				String option = st.nextToken( );
				int index = option.indexOf( "=" ); //$NON-NLS-1$
				if ( index > 0 )
				{
					options.put( option.substring( 0, index ),
							URLDecoder.decode( option.substring( index + 1,
									option.length( ) ), "UTF-8" ) ); //$NON-NLS-1$
				}
				else
				{
					options.put( option, "" ); //$NON-NLS-1$
				}
			}
			event.doit = false;
			Display.getCurrent( ).asyncExec( new Runnable( ) {

				public void run( )
				{
					viewer.setReportDesignFile( (String) options.get( "__report" ) ); //$NON-NLS-1$
					viewer.setParamValues( options );
					viewer.setCurrentPage( 1 );
					viewer.render( );
				}
			} );
		}
		catch ( UnsupportedEncodingException e )
		{
		}
	}

}