1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
   | 		columnDataList[1] = new ColumnData("Progress", 175, SWT.LEFT, "Progress of the scnenarios",
				new CellLabelProvider() {			 		
				 	public void update(ViewerCell cell) {
				 		if(progressBar){
				 		if(cell.getElement() instanceof ScenarioNode && 
				 				((ScenarioNode)cell.getElement()).getParent() instanceof ScenarioNode
				 				&& ((ScenarioNode)cell.getElement()).getProgressBar() == null){
					 		final TreeItem item = (TreeItem) cell.getItem();
					 		DisposeListener listener = new DisposeListener() {
 
					 			public void widgetDisposed(DisposeEvent e) {
					 				if( item.getData("EDITOR") != null ) {
					 					TreeEditor editor = (TreeEditor) item.getData("EDITOR");
					 					editor.getEditor().dispose();
					 					editor.dispose();
					 				}
					 			}
 
					 		};
 
							if (item.getData("EDITOR") != null) {
								TreeEditor editor = (TreeEditor) item.getData("EDITOR");
						 		editor.getEditor().dispose();
						 		editor.dispose();
							}
 
							if( item.getData("DISPOSELISTNER") != null ) {
								item.removeDisposeListener((DisposeListener) item.getData("DISPOSELISTNER"));
							}
 
							TreeEditor editor = new TreeEditor(item.getParent());
						 	item.setData("EDITOR", editor);
						 	Composite comp = new Composite(item.getParent(), SWT.NONE);
						 	comp.setBackground(item.getParent().getBackground());
						 	comp.setBackgroundMode(SWT.INHERIT_DEFAULT);
						 	RowLayout l = new RowLayout();
							l.marginHeight = 0;
						 	l.marginWidth = 0;
						 	l.marginTop = 0;
						 	l.marginBottom = 0;
						 	comp.setLayout(l);
 
							final ProgressBar progressBar = new ProgressBar(comp, SWT.HORIZONTAL);
							progressBar.setMinimum(0);
							progressBar.setMaximum(((((ScenarioNode) ((ScenarioNode)cell.getElement()).getParent()).getTotalNbEvents())));
							progressBar.setSelection((int) (((ScenarioNode) cell.getElement()).getNbEvents()));
							((ScenarioNode) cell.getElement()).setProgressBar(progressBar);
 
						 	editor.grabHorizontal = true;
						 	editor.setEditor(comp, item, 1);
 
						 	item.addDisposeListener(listener);
						 	item.setData("DISPOSELISTNER",listener);
				 		} else if(cell.getElement() instanceof ScenarioNode && 
				 				((ScenarioNode)cell.getElement()).getParent() instanceof ScenarioNode
				 				&& ((ScenarioNode)cell.getElement()).getProgressBar() != null){
				 			((ScenarioNode) cell.getElement()).getProgressBar().setSelection(((ScenarioNode) cell.getElement()).filtersCounter);		 			
				 		} else {
				 			cell.setText("");
				 		}
				 	}
				 	}
 
			 	} ,null, null); | 
Partager