/** * Binds the viewer to the specified input, using the specified label * property to generate labels. * * @param viewer * the viewer to set up * @param input * the input to set on the viewer * @param labelProperty * the property to use for labels */ public static void bind(StructuredViewer viewer, IObservableList input, IValueProperty labelProperty) { bind(viewer, input, new IValueProperty[] { labelProperty }); }
/** * Binds the viewer to the specified input, using the specified label * property to generate labels. * * @param viewer * the viewer to set up * @param input * the input to set on the viewer * @param labelProperty * the property to use for labels */ public static void bind(StructuredViewer viewer, IObservableSet input, IValueProperty labelProperty) { bind(viewer, input, new IValueProperty[] { labelProperty }); }
/** * Binds the viewer to the specified input, using the specified children * property to generate child nodes, and the specified label property to * generate labels. * * @param viewer * the tree viewer to set up * @param input * the input to set on the viewer * @param childrenProperty * the property to use as the children of an element * @param labelProperty * the property to use for labels */ public static void bind(AbstractTreeViewer viewer, Object input, IListProperty childrenProperty, IValueProperty labelProperty) { bind(viewer, input, childrenProperty, new IValueProperty[] { labelProperty }); }
/** * Binds the viewer to the specified input, using the specified children * property to generate child nodes, and the specified label property to * generate labels. * * @param viewer * the tree viewer to set up * @param input * the input to set on the viewer * @param childrenProperty * the property to use as the children of an element * @param labelProperty * the property to use for labels */ public static void bind(AbstractTreeViewer viewer, Object input, ISetProperty childrenProperty, IValueProperty labelProperty) { bind(viewer, input, childrenProperty, new IValueProperty[] { labelProperty }); }
@Override public void createPart ( final Composite parent ) { super.createPart ( parent ); this.viewer = new TableViewer ( parent, SWT.FULL_SELECTION ); final TableLayout tableLayout = new TableLayout (); final TableViewerColumn col1 = new TableViewerColumn ( this.viewer, SWT.NONE ); col1.getColumn ().setText ( Messages.AttributesPart_NameLabel ); tableLayout.addColumnData ( new ColumnWeightData ( 50 ) ); final TableViewerColumn col2 = new TableViewerColumn ( this.viewer, SWT.NONE ); col2.getColumn ().setText ( Messages.AttributesPart_TypeLabel ); tableLayout.addColumnData ( new ColumnWeightData ( 20 ) ); final TableViewerColumn col3 = new TableViewerColumn ( this.viewer, SWT.NONE ); col3.getColumn ().setText ( Messages.AttributesPart_ValueLabel ); tableLayout.addColumnData ( new ColumnWeightData ( 50 ) ); this.viewer.getTable ().setHeaderVisible ( true ); this.viewer.getTable ().setLayout ( tableLayout ); ViewerSupport.bind ( this.viewer, this.entries, new IValueProperty[] { PojoProperties.value ( "name" ), PojoProperties.value ( "type" ), PojoProperties.value ( "value" ) } ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ this.viewer.setComparator ( new ViewerComparator () ); }
@Override public void createPart ( final Composite parent ) { super.createPart ( parent ); this.viewer = new TableViewer ( parent, SWT.FULL_SELECTION ); final TableLayout tableLayout = new TableLayout (); final TableViewerColumn col1 = new TableViewerColumn ( this.viewer, SWT.NONE ); col1.getColumn ().setText ( Messages.AttributesPart_NameLabel ); tableLayout.addColumnData ( new ColumnWeightData ( 50 ) ); final TableViewerColumn col2 = new TableViewerColumn ( this.viewer, SWT.NONE ); col2.getColumn ().setText ( Messages.AttributesPart_TypeLabel ); tableLayout.addColumnData ( new ColumnWeightData ( 20 ) ); final TableViewerColumn col3 = new TableViewerColumn ( this.viewer, SWT.NONE ); col3.getColumn ().setText ( Messages.AttributesPart_ValueLabel ); tableLayout.addColumnData ( new ColumnWeightData ( 50 ) ); this.viewer.getTable ().setHeaderVisible ( true ); this.viewer.getTable ().setLayout ( tableLayout ); ViewerSupport.bind ( this.viewer, this.entries, new IValueProperty[] { PojoProperties.value ( "name" ), PojoProperties.value ( "type" ), PojoProperties.value ( "value" ) } ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ this.viewer.setComparator ( new ViewerComparator () ); }