All pastes #590991 Raw Edit

Anonymous

public text v1 · immutable
#590991 ·published 2007-06-26 22:06 UTC
rendered paste body
public void createPartControl(Composite parent) {
		if (Functions.init())	
		{
			System.out.println("dir: "+Globals.PLUGIN_DIR);
			Globals.loadIcons();
			currentCommentsChannel = new ParserHtml(Globals.RSS_COMMENTS_FNAME).getChannel();
			
			currentPostsChannel = new ParserHtml(Globals.RSS_POSTS_FNAME).getChannel();
			
			
			currentEditsChannel= new ParserHtml(Globals.RSS_EDITS_FNAME).getChannel();
			
			
			try {Thread.sleep(4000);} catch (InterruptedException e) {e.printStackTrace();}
			currentCommentsChannel.setIcon(Globals.ICON_RSS_FUX);
			currentPostsChannel.setIcon(Globals.ICON_RSS_BLUE);
			currentEditsChannel.setIcon(Globals.ICON_RSS_GREEN);
	
			
			
			//***************here i create an instance of the insidecomposite 
	
			cont = new InsideComposite(parent, currentCommentsChannel, currentPostsChannel, currentEditsChannel);
.......
.............
....

/7*************the constructor of InsideComposite class

public InsideComposite(Composite parent, Channel currentCommentsChannel, Channel currentPostsChannel,Channel currentEditsChannel){
		super(parent, SWT.NONE);
		this.currentEditsChannel = currentEditsChannel;
		this.currentPostsChannel = currentPostsChannel;
		this.currentCommentsChannel = currentCommentsChannel;
		
		
		currentChannel = currentCommentsChannel;
		
		GridLayout gl = new GridLayout();
		gl.numColumns = 1;
		Functions.setFontSize();
		this.setLayout(gl);

		
		TOOLBAR = new ToolsBar(this);
		TITLELABEL = new Label(this, SWT.HORIZONTAL|SWT.CENTER);
		TOOLBAR.setLayoutData();
		
		setTitleLabel(currentChannel);
		
		TABLE = new ItemsTable(this);
		
		TABLE.setLayoutData();
		
		BRW = new Browser(this, SWT.DEFAULT|SWT.BORDER);
		GridData gd = new GridData(GridData.FILL_HORIZONTAL|GridData.HORIZONTAL_ALIGN_FILL|GridData.GRAB_HORIZONTAL|GridData.GRAB_VERTICAL);
		gd.heightHint = 350;
		gd.grabExcessHorizontalSpace = true;//both width false it doesn't work !!
		gd.grabExcessVerticalSpace = true;//both width false it doesn't work !!
		gd.verticalAlignment = SWT.TOP;
		
		BRW.setLayoutData(gd);
	}
	
	public void setTitleLabel(Channel ch){
		String str = ch.getTitle();
		str += "  ("+ch.getItemsInfo()[0]+" items, "+ ch.getItemsInfo()[1]+" read)";
		str += "  -  "+ch.getPubdate();
		TITLELABEL.setText(str);
	}
	
	
	public void channelsUpdate(){
		currentCommentsChannel = new ParserHtml(Globals.RSS_COMMENTS_FNAME).getChannel();
		
		currentPostsChannel = new ParserHtml(Globals.RSS_POSTS_FNAME).getChannel();
		
		currentEditsChannel= new ParserHtml(Globals.RSS_EDITS_FNAME).getChannel();
		
		try {Thread.sleep(4000);} catch (InterruptedException e) {e.printStackTrace();}
		currentCommentsChannel.setIcon(Globals.ICON_RSS_FUX);
		currentPostsChannel.setIcon(Globals.ICON_RSS_BLUE);
		currentEditsChannel.setIcon(Globals.ICON_RSS_GREEN);
	}
	
	
	
	public void showMessage(String message) {
		MessageDialog.openInformation(
			new Shell(),
			"Sample View",
			message);
	}