org.eclipse.core.databinding.property.value.IValueProperty Java Examples
The following examples show how to use
org.eclipse.core.databinding.property.value.IValueProperty.
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: ProjectSelector.java From google-cloud-eclipse with Apache License 2.0 | 6 votes |
/** * @return true if the element's properties are matched by the given search terms. */ @VisibleForTesting static boolean matches(String[] searchTerms, Object element, IValueProperty[] properties) { for (String searchTerm : searchTerms) { boolean seen = false; for (IValueProperty property : properties) { Object value = property.getValue(element); if (value instanceof String && ((String) value).contains(searchTerm)) { seen = true; break; } } if (!seen) { return false; } } return true; }
Example #2
Source File: DefaultEditingSupport.java From neoscada with Eclipse Public License 1.0 | 5 votes |
public DefaultEditingSupport ( final ColumnViewer viewer, final DataBindingContext dbc, final IValueProperty cellEditorProperty, final CellEditor cellEditor, final IValueProperty elementProperty ) { super ( viewer, dbc ); this.cellEditorProperty = cellEditorProperty; this.cellEditor = cellEditor; this.elementProperty = elementProperty; this.dbc = dbc; }
Example #3
Source File: AttributesPart.java From neoscada with Eclipse Public License 1.0 | 5 votes |
@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 () ); }
Example #4
Source File: ProjectSelectorTest.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
@Test public void testMatches() { IValueProperty property = mock(IValueProperty.class); when(property.getValue(any())).thenReturn("a"); assertTrue(ProjectSelector.matches(new String[] { "a" }, new Object(), new IValueProperty[] { property })); assertFalse( ProjectSelector.matches(new String[] {"b"}, new Object(), new IValueProperty[] {property})); }
Example #5
Source File: JSONValuePropertyDecorator.java From typescript.java with MIT License | 4 votes |
public JSONValuePropertyDecorator(IValueProperty delegate, IJSONPath path) { this.delegate = delegate; this.path = path; }
Example #6
Source File: ReverseConversionWizardPage.java From translationstudio8 with GNU General Public License v2.0 | 4 votes |
/** * 创建文件列表区域 * @param contents * ; */ private Composite createFilesGroup(Composite contents) { Composite filesComposite = new Composite(contents, SWT.NONE); filesComposite.setLayout(new GridLayout(1, false)); filesComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); filesTable = new Table(filesComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION); GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH); tableData.heightHint = 100; filesTable.setLayoutData(tableData); filesTable.setLinesVisible(true); filesTable.setHeaderVisible(true); filesTable.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { TableItem[] selected = filesTable.getSelection(); if (selected.length == 0) { return; } String strTgtEnc = ""; //$NON-NLS-1$ for (int i = 0; i < selected.length; i++) { String curTgtEnc = selected[i].getText(2); if (i == 0) { strTgtEnc = curTgtEnc; } else { if (!strTgtEnc.equals(curTgtEnc)) { strTgtEnc = ""; //$NON-NLS-1$ break; } } } if (!"".equals(strTgtEnc)) { //$NON-NLS-1$ tgtEncCombo.setText(strTgtEnc); } else { tgtEncCombo.deselectAll(); } } }); tableViewer = new TableViewer(filesTable); lineNumberColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); lineNumberColumn.setText(Messages.getString("wizard.ReverseConversionWizardPage.lineNumberColumn")); xliffColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); xliffColumn.setText(Messages.getString("wizard.ReverseConversionWizardPage.xliffColumn")); //$NON-NLS-1$ tgtEncColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); tgtEncColumn.setText(Messages.getString("wizard.ReverseConversionWizardPage.tgtEncColumn")); //$NON-NLS-1$ targetColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); targetColumn.setText(Messages.getString("wizard.ReverseConversionWizardPage.targetColumn")); //$NON-NLS-1$ IValueProperty[] valueProperties = BeanProperties.values(ConversionConfigBean.class, new String[] { "index","source", "targetEncoding", "target" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ ViewerSupport.bind(tableViewer, new WritableList(conversionConfigBeans, ConversionConfigBean.class), valueProperties); filesComposite.addPaintListener(new PaintListener() { public void paintControl(PaintEvent arg0) { int width = filesTable.getClientArea().width; lineNumberColumn.setWidth(width * 1 / 10); targetColumn.setWidth(width * 4 / 10); tgtEncColumn.setWidth(width * 1 / 10); xliffColumn.setWidth(width * 4 / 10); } }); return filesComposite; }
Example #7
Source File: ReverseConversionWizardPage.java From translationstudio8 with GNU General Public License v2.0 | 4 votes |
/** * 创建文件列表区域 * @param contents * ; */ private Composite createFilesGroup(Composite contents) { Composite filesComposite = new Composite(contents, SWT.NONE); filesComposite.setLayout(new GridLayout(1, false)); filesComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); filesTable = new Table(filesComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION); GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH); tableData.heightHint = 100; filesTable.setLayoutData(tableData); filesTable.setLinesVisible(true); filesTable.setHeaderVisible(true); filesTable.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { TableItem[] selected = filesTable.getSelection(); if (selected.length == 0) { return; } String strTgtEnc = ""; //$NON-NLS-1$ for (int i = 0; i < selected.length; i++) { String curTgtEnc = selected[i].getText(1); if (i == 0) { strTgtEnc = curTgtEnc; } else { if (!strTgtEnc.equals(curTgtEnc)) { strTgtEnc = ""; //$NON-NLS-1$ break; } } } if (!"".equals(strTgtEnc)) { //$NON-NLS-1$ tgtEncCombo.setText(strTgtEnc); } else { tgtEncCombo.deselectAll(); } } }); tableViewer = new TableViewer(filesTable); xliffColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); xliffColumn.setText("XLIFF 文件"); //$NON-NLS-1$ tgtEncColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); tgtEncColumn.setText("目标编码"); //$NON-NLS-1$ targetColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); targetColumn.setText("目标文件"); //$NON-NLS-1$ IValueProperty[] valueProperties = BeanProperties.values(ConversionConfigBean.class, new String[] { "source", "targetEncoding", "target" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ ViewerSupport.bind(tableViewer, new WritableList(conversionConfigBeans, ConversionConfigBean.class), valueProperties); filesComposite.addPaintListener(new PaintListener() { public void paintControl(PaintEvent arg0) { int width = filesTable.getClientArea().width; targetColumn.setWidth(width * 4 / 10); tgtEncColumn.setWidth(width * 2 / 10); xliffColumn.setWidth(width * 4 / 10); } }); return filesComposite; }
Example #8
Source File: ReverseConversionWizardPage.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
/** * 创建文件列表区域 * @param contents * ; */ private Composite createFilesGroup(Composite contents) { Composite filesComposite = new Composite(contents, SWT.NONE); filesComposite.setLayout(new GridLayout(1, false)); filesComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); filesTable = new Table(filesComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION); GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH); tableData.heightHint = 100; filesTable.setLayoutData(tableData); filesTable.setLinesVisible(true); filesTable.setHeaderVisible(true); filesTable.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { TableItem[] selected = filesTable.getSelection(); if (selected.length == 0) { return; } String strTgtEnc = ""; //$NON-NLS-1$ for (int i = 0; i < selected.length; i++) { String curTgtEnc = selected[i].getText(2); if (i == 0) { strTgtEnc = curTgtEnc; } else { if (!strTgtEnc.equals(curTgtEnc)) { strTgtEnc = ""; //$NON-NLS-1$ break; } } } if (!"".equals(strTgtEnc)) { //$NON-NLS-1$ tgtEncCombo.setText(strTgtEnc); } else { tgtEncCombo.deselectAll(); } } }); tableViewer = new TableViewer(filesTable); lineNumberColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); lineNumberColumn.setText(Messages.getString("wizard.ReverseConversionWizardPage.lineNumberColumn")); xliffColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); xliffColumn.setText(Messages.getString("wizard.ReverseConversionWizardPage.xliffColumn")); //$NON-NLS-1$ tgtEncColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); tgtEncColumn.setText(Messages.getString("wizard.ReverseConversionWizardPage.tgtEncColumn")); //$NON-NLS-1$ targetColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); targetColumn.setText(Messages.getString("wizard.ReverseConversionWizardPage.targetColumn")); //$NON-NLS-1$ IValueProperty[] valueProperties = BeanProperties.values(ConversionConfigBean.class, new String[] { "index","source", "targetEncoding", "target" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ ViewerSupport.bind(tableViewer, new WritableList(conversionConfigBeans, ConversionConfigBean.class), valueProperties); filesComposite.addPaintListener(new PaintListener() { public void paintControl(PaintEvent arg0) { int width = filesTable.getClientArea().width; lineNumberColumn.setWidth(width * 1 / 10); targetColumn.setWidth(width * 4 / 10); tgtEncColumn.setWidth(width * 1 / 10); xliffColumn.setWidth(width * 4 / 10); } }); return filesComposite; }
Example #9
Source File: ReverseConversionWizardPage.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
/** * 创建文件列表区域 * @param contents * ; */ private Composite createFilesGroup(Composite contents) { Composite filesComposite = new Composite(contents, SWT.NONE); filesComposite.setLayout(new GridLayout(1, false)); filesComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); filesTable = new Table(filesComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION); GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH); tableData.heightHint = 100; filesTable.setLayoutData(tableData); filesTable.setLinesVisible(true); filesTable.setHeaderVisible(true); filesTable.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { TableItem[] selected = filesTable.getSelection(); if (selected.length == 0) { return; } String strTgtEnc = ""; //$NON-NLS-1$ for (int i = 0; i < selected.length; i++) { String curTgtEnc = selected[i].getText(1); if (i == 0) { strTgtEnc = curTgtEnc; } else { if (!strTgtEnc.equals(curTgtEnc)) { strTgtEnc = ""; //$NON-NLS-1$ break; } } } if (!"".equals(strTgtEnc)) { //$NON-NLS-1$ tgtEncCombo.setText(strTgtEnc); } else { tgtEncCombo.deselectAll(); } } }); tableViewer = new TableViewer(filesTable); xliffColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); xliffColumn.setText("XLIFF 文件"); //$NON-NLS-1$ tgtEncColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); tgtEncColumn.setText("目标编码"); //$NON-NLS-1$ targetColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); targetColumn.setText("目标文件"); //$NON-NLS-1$ IValueProperty[] valueProperties = BeanProperties.values(ConversionConfigBean.class, new String[] { "source", "targetEncoding", "target" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ ViewerSupport.bind(tableViewer, new WritableList(conversionConfigBeans, ConversionConfigBean.class), valueProperties); filesComposite.addPaintListener(new PaintListener() { public void paintControl(PaintEvent arg0) { int width = filesTable.getClientArea().width; targetColumn.setWidth(width * 4 / 10); tgtEncColumn.setWidth(width * 2 / 10); xliffColumn.setWidth(width * 4 / 10); } }); return filesComposite; }
Example #10
Source File: ListeningStyledCellLabelProvider.java From neoscada with Eclipse Public License 1.0 | 3 votes |
/** * Listen to changed of the value property of an element * <p> * This will start listening to value change events and trigger a refresh of * the label provider. It will not actually take the value for displaying. * </p> * <p> * Elements that are listened to will automatically removed * </p> * * @since 1.2 * @param element * the element to listen to * @param property * the property to listen to */ protected void listenTo ( final Object element, final IValueProperty property ) { final IObservableValue obs = property.observe ( element ); this.observables.put ( element, obs ); obs.addValueChangeListener ( new IValueChangeListener () { @Override public void handleValueChange ( final ValueChangeEvent event ) { fireLabelProviderChanged ( new LabelProviderChangedEvent ( ListeningStyledCellLabelProvider.this, element ) ); } } ); }