本文整理汇总了Java中org.eclipse.jface.viewers.TreeViewerColumn.setEditingSupport方法的典型用法代码示例。如果您正苦于以下问题:Java TreeViewerColumn.setEditingSupport方法的具体用法?Java TreeViewerColumn.setEditingSupport怎么用?Java TreeViewerColumn.setEditingSupport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.viewers.TreeViewerColumn
的用法示例。
在下文中一共展示了TreeViewerColumn.setEditingSupport方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createColumns
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
private void createColumns(TreeViewer viewer) {
viewer.setColumnProperties(new String[] { "Name", "Value"});
ColumnViewerToolTipSupport.enableFor(viewer);
TreeViewerColumn nameColumn = new TreeViewerColumn(viewer, SWT.LEFT, 0);
nameColumn.getColumn().setText("Name");
nameColumn.getColumn().setWidth(200);
nameColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
INamedNode node = (INamedNode)element;
return node.getDisplayName();
}
});
nameColumn.setEditingSupport(new NameEditingSupport(this));
TreeViewerColumn valueColumn = new TreeViewerColumn(viewer, SWT.LEFT, 1);
valueColumn.getColumn().setText("Value");
valueColumn.getColumn().setWidth(300);
valueColumn.setLabelProvider(new DelegatingStyledCellLabelProvider(new ControlValueLabelProvider(cservice, this)));
valueColumn.setEditingSupport(new ControlEditingSupport(viewer, cservice, controlViewerMode));
}
示例2: enableValueTreeEditing
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
private void enableValueTreeEditing() {
final TreeViewerColumn col = columns.get(
ValueTreeLP.Column.VALEX.label);
TreeViewerEditor.create(viewer,
new EditorActivationStrategy(viewer),
ColumnViewerEditor.DEFAULT);
col.setEditingSupport(new EntryEditorEditingSupport(this));
}
示例3: createProductEditorTableColumns
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
/**
* Method creates the columns for the product table.
*/
private void createProductEditorTableColumns() {
String[] titles = getColumnTitles();
int[] bounds = getColumnWidths();
for (int i = 0; i < titles.length; i++) {
TreeViewerColumn column = new TreeViewerColumn(this, SWT.NONE);
column.setLabelProvider(createColumnLabelProvider());
column.getColumn().setText(titles[i]);
column.getColumn().setWidth(bounds[i]);
column.getColumn().setResizable(true);
column.getColumn().setMoveable(true);
if (1 == i) {
column.setEditingSupport(new ConfigurationCellEditor(this, ColumnType.VALUE));
}
if (2 == i) {
column.setEditingSupport(new ConfigurationCellEditor(this, ColumnType.EXTEND));
}
if (3 == i) {
column.setEditingSupport(new ConfigurationCellEditor(this, ColumnType.REMOVE));
}
if (4 == i) {
column.setEditingSupport(new ConfigurationCellEditor(this, ColumnType.FREEZE));
}
}
Tree table = this.getTree();
table.setHeaderVisible(true);
table.setLinesVisible(true);
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
/*
* Show scroll bars of parent composite only if less then approx. 3 rows are shown in the table
* Otherwise the scroll bars of the table are used.
*/
data.heightHint = 60;
table.setLayoutData(data);
}
示例4: createTimeColumn
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
/**
* Creates a table column for the given weekday and installs editing support
*
* @param weekday
* the day of the week, starting from 0
*/
private void createTimeColumn(int weekday) {
TreeViewerColumn column = createTableViewerColumn("-", TIME_COLUMN_WIDTH, 1 + weekday);
column.getColumn().setAlignment(SWT.RIGHT);
column.setEditingSupport(new TimeEditingSupport((TreeViewer) column.getViewer(), contentProvider, weekday));
column.setLabelProvider(new TimeColumnLabelProvider(contentProvider) {
@Override
public String getText(Object element) {
// Use modern formatting
long seconds = 0;
LocalDate date = contentProvider.getFirstDayOfWeek().plusDays(weekday);
if (element instanceof String) {
seconds = getSum(contentProvider.getFiltered(), date, (String) element);
} else if (element instanceof ITask) {
AbstractTask task = (AbstractTask) element;
TrackedTask trackedTask = TimekeeperPlugin.getDefault().getTask(task);
if (trackedTask != null) {
seconds = trackedTask.getDuration(contentProvider.getDate(weekday)).getSeconds();
}
} else if (element instanceof WeeklySummary) {
seconds = getSum(contentProvider.getFiltered(), date);
} else if (element instanceof Activity) {
seconds = ((Activity) element).getDuration(date).getSeconds();
}
if (seconds > 0) {
return DurationFormatUtils.formatDuration(seconds * 1000, "H:mm", true);
}
return "";
}
});
}
示例5: createColumns
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
/**
* Configure the table
*/
private void createColumns() {
TreeViewerColumn column = createTableViewerColumn(V1_COLUMN_TITLE_ID, 120, SWT.LEFT, -1);
column.setLabelProvider(new SimpleProvider(Workitem.ID_PROPERTY, true));
column.setEditingSupport(new TextSupport(Workitem.ID_PROPERTY, viewer, selectionProvider));
column = createTableViewerColumn(V1_COLUMN_TITLE_TITLE, 150, SWT.LEFT, -1);
column.setLabelProvider(new SimpleProvider(Workitem.NAME_PROPERTY, false));
column.setEditingSupport(new TextSupport(Workitem.NAME_PROPERTY, viewer, selectionProvider));
column = createTableViewerColumn(V1_COLUMN_TITLE_OWNER, 150, SWT.LEFT, -1);
column.setLabelProvider(new SimpleProvider(Workitem.OWNERS_PROPERTY, false));
column.setEditingSupport(new MultiValueSupport(Workitem.OWNERS_PROPERTY, viewer, selectionProvider));
column = createTableViewerColumn(V1_COLUMN_TITLE_STATUS, 100, SWT.LEFT, -1);
column.setLabelProvider(new SimpleProvider(Workitem.STATUS_PROPERTY, false));
column.setEditingSupport(new SingleValueSupport(Workitem.STATUS_PROPERTY, viewer, selectionProvider));
column = createTableViewerColumn(V1_COLUMN_TITLE_DETAIL_ESTIMATE, 100, SWT.CENTER, -1);
column.setLabelProvider(new SimpleProvider(Workitem.DETAIL_ESTIMATE_PROPERTY, false));
column.setEditingSupport(new TextSupport(Workitem.DETAIL_ESTIMATE_PROPERTY, viewer, selectionProvider));
column = createTableViewerColumn(V1_COLUMN_TITLE_TO_DO, 50, SWT.CENTER, -1);
column.setLabelProvider(new SimpleProvider(Workitem.TODO_PROPERTY, false));
column.setEditingSupport(new TextSupport(Workitem.TODO_PROPERTY, viewer, selectionProvider));
if (ApiDataLayer.getInstance().isTrackEffortEnabled()) {
addEffortColumns();
}
}
示例6: addEffortColumns
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
/**
* Adds the columns needed to track effort
*/
private void addEffortColumns() {
TreeViewerColumn column = createTableViewerColumn(V1_COLUMN_TITLE_DONE, 50, SWT.CENTER, 5);
column.setLabelProvider(new SimpleProvider(Workitem.DONE_PROPERTY, false));
column.setEditingSupport(new TextSupport(Workitem.DONE_PROPERTY, viewer, selectionProvider));
column = createTableViewerColumn(V1_COLUMN_TITLE_EFFORT, 50, SWT.CENTER, 6);
column.setLabelProvider(new SimpleProvider(Workitem.EFFORT_PROPERTY, false));
column.setEditingSupport(new TextSupport(Workitem.EFFORT_PROPERTY, viewer, selectionProvider));
isEffortColumsShown = true;
}
示例7: build
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
/**
* Builds the column and returns the TreeViewerColumn
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public TreeViewerColumn build() {
// create column
TreeViewerColumn viewerColumn = new TreeViewerColumn(builder.getViewer(), style);
TreeColumn column = viewerColumn.getColumn();
if (headerText != null) {
column.setText(headerText);
}
column.setMoveable(moveable);
column.setResizable(resizable);
// set label provider
if (cellLabelProvider != null) {
viewerColumn.setLabelProvider(cellLabelProvider);
}
else {
if (propertyName == null) {
viewerColumn.setLabelProvider(new ColumnLabelProvider());
}
else {
PropertyDescriptor descriptor = builder.getPropertyDescriptor(propertyName);
viewerColumn.setLabelProvider(new PropertyCellLabelProvider(descriptor, valueFormatter));
}
}
// set editing support
if (editingSupport != null) {
viewerColumn.setEditingSupport(editingSupport);
}
return viewerColumn;
}
示例8: createProjectsTreeControl
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
private void createProjectsTreeControl(final Composite container) {
treeViewer = new CheckboxTreeViewer(container, TREE_STYLES);
treeControl = treeViewer.getTree();
GridDataBuilder.newInstance().fill().grab().hHint(150).applyTo(treeControl);
treeControl.setHeaderVisible(false);
projectColumn = new TreeColumn(treeControl, SWT.NONE);
projectColumn.setText(Messages.getString("GitImportWizardSelectProjectsPage.ProjectColumnName")); //$NON-NLS-1$
projectColumn.setWidth(300);
final TreeViewerColumn nameColumnViewer = new TreeViewerColumn(treeViewer, projectColumn);
nameColumnViewer.setLabelProvider(new ProjectNameLabelProvider());
nameColumnViewer.setEditingSupport(new ProjectNameEditingSupport(treeViewer));
pathColumn = new TreeColumn(treeControl, SWT.NONE);
pathColumn.setText(Messages.getString("GitImportWizardSelectProjectsPage.PathColumnName")); //$NON-NLS-1$
pathColumn.setWidth(500);
final TreeViewerColumn pathColumnViewer = new TreeViewerColumn(treeViewer, pathColumn);
pathColumnViewer.setLabelProvider(new ImportProjectPathLabelProvider());
treeControl.setHeaderVisible(true);
treeControl.setSortColumn(projectColumn);
treeControl.setLinesVisible(true);
treeViewer.setUseHashlookup(true);
treeViewer.setContentProvider(new ProjectTreeContentProvider());
treeViewer.setAutoExpandLevel(2);
treeViewer.addCheckStateListener(new ProjectCheckStateListener());
searchForNestedProjectsButton = new Button(container, SWT.CHECK);
searchForNestedProjectsButton.setText(
Messages.getString("GitImportWizardSelectProjectsPage.SearchForNestedButtonText")); //$NON-NLS-1$
GridDataBuilder.newInstance().hGrab().hFill().applyTo(searchForNestedProjectsButton);
searchForNestedProjectsButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
refresh();
}
});
}
示例9: defineColumn_Opacity
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
/**
* column: marker
*/
private void defineColumn_Opacity(final TreeColumnLayout treeLayout) {
final TreeViewerColumn tvc = new TreeViewerColumn(_layerViewer, SWT.CENTER);
final TreeColumn tc = tvc.getColumn();
tc.setText(Messages.Map3Layer_Viewer_Column_Opacity);
tc.setToolTipText(Messages.Map3Layer_Viewer_Column_Opacity_Tooltip);
_opacityEditingSupport = new OpacityEditingSupport(_layerViewer);
tvc.setEditingSupport(_opacityEditingSupport);
tvc.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
final Object element = cell.getElement();
if (element instanceof TVIMap3Layer) {
final TVIMap3Layer layerItem = (TVIMap3Layer) element;
final float opacity = layerItem.getOpacity();
final String opacityText;
if (layerItem.canSetOpacity()) {
if (layerItem.isLayerVisible) {
if (opacity == 1.0) {
opacityText = UI.SYMBOL_FULL_BLOCK;
} else {
opacityText = _nf2.format(opacity);
}
} else {
// layer is hidden
opacityText = UI.EMPTY_STRING;
}
} else {
// opacity cannot be set
opacityText = OPACITY_CAN_NOT_BE_SET;
}
cell.setText(opacityText);
}
}
});
treeLayout.setColumnData(tc, new ColumnPixelData(_pc.convertWidthInCharsToPixels(8), false));
}
示例10: createColumns
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
private void createColumns() {
GC gc = new GC(getTree().getParent());
List<Integer> widths = new ArrayList<Integer>();
for (final IGenericTableColumn c : table.getColumns()) {
TreeViewerColumn viewerColumn = new TreeViewerColumn(this, SWT.NONE);
viewerColumn.setLabelProvider(new GenericLabelProvider(c
.getDataProvider()));
if (c.getEditable()) {
viewerColumn.setEditingSupport(c.getEditingSupport(this));
}
TreeColumn column = viewerColumn.getColumn();
if (c.getSortable() && comparator != null) {
column.addSelectionListener(getSelectionAdapter(column, c));
}
column.setText(c.getLabel());
column.setAlignment(c.getAlignMent());
int width;
if (c.getWidth() != -1) {
width = c.getWidth();
}
else if (c.getTextExtent() != null
&& c.getLabel().length() < c.getTextExtent().length()) {
width = gc.textExtent(c.getTextExtent()).x + 2;
}
else {
width = gc.textExtent(c.getLabel()).x + 2;
}
widths.add(width);
column.setWidth(width);
column.setResizable(c.getResizable());
}
gc.dispose();
// /* All columns have their prefered width set now calculate percentages */
// TreeColumnLayout layout = new TreeColumnLayout();
// for (int i = 0; i < widths.size(); i++) {
// layout.setColumnData(getTree().getColumns()[i], new ColumnWeightData(
// widths.get(i), widths.get(i), true));
// }
// getTree().getParent().setLayout(layout);
}
示例11: createDialogArea
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
container.setLayout(new GridLayout(1, true));
IDecisionVariable nestedVar = variable.getVariable();
if (null != nestedVar) {
// String[] titles = {"Annotation", "Value"};
TreeViewer viewer = new TreeViewer(container, SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL
| SWT.H_SCROLL);
viewer.setUseHashlookup(true);
final Tree table = viewer.getTree();
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
table.setHeaderVisible(true);
table.setLinesVisible(true);
// viewer.setColumnProperties(titles);
viewer.setContentProvider(new AnnotationViewContentProvider());
viewer.setInput(variable);
TreeViewerColumn column1 = new TreeViewerColumn(viewer, SWT.NONE);
column1.getColumn().setText("Annotation");
column1.getColumn().setWidth(150);
column1.setLabelProvider(new ConfigurationLabelProvider(variable.getConfiguration()));
TreeViewerColumn column2 = new TreeViewerColumn(viewer, SWT.NONE);
column2.getColumn().setText("Value");
column2.getColumn().setWidth(125);
column2.setEditingSupport(new ConfigurationCellEditor(viewer, ColumnType.VALUE));
column2.setLabelProvider(new ConfigurationLabelProvider(variable.getConfiguration()));
System.out.println(viewer.getTree().getColumnCount());
// table.update();
// table.redraw();
viewer.refresh();
// Table table = new Table(container, SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
// table.setHeaderVisible(true);
// table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
// String[] titles = {"Annotation", "Value"};
// for (int i = 0; i < titles.length; i++) {
// TableColumn column = new TableColumn(table, SWT.NULL);
// column.setText(titles[i]);
// }
//
// for (int i = 0; i < nestedVar.getAttributesCount(); i++) {
// IDecisionVariable annotation = nestedVar.getAttribute(i);
// Value value = annotation.getValue();
// TableItem item = new TableItem(table, SWT.NULL);
// item.setText(annotation.getDeclaration().getName());
// item.setText(0, annotation.getDeclaration().getName());
// String valueTxt = (null != value && NullValue.INSTANCE != value) ? value.getValue().toString()
// : "<null>";
// item.setText(1, valueTxt);
// }
//
// for (int i = 0; i < titles.length; i++) {
// table.getColumn(i).pack();
// }
}
return container;
}
示例12: createTitleColumn
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
private void createTitleColumn() {
TreeViewerColumn column = createTableViewerColumn("Activity", 400, 1);
column.setLabelProvider(new TreeColumnViewerLabelProvider(new TitleColumnLabelProvider(contentProvider)));
column.setEditingSupport(new ActivitySummaryEditingSupport(viewer));
}
示例13: createTableViewer
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
private void createTableViewer() {
tableViewer = new CheckboxTreeViewer(table);
tableViewer.setUseHashlookup(true);
TreeViewerColumn cNames = new TreeViewerColumn(tableViewer, SWT.CENTER);
cNames.getColumn().setText(Messages.getString("PreviewRowsDialog.LayerTreeViewer.GeometryFields"));
TreeViewerColumn cLegend = new TreeViewerColumn(tableViewer, SWT.CENTER);
cLegend.getColumn().setText(Messages.getString("PreviewRowsDialog.LayerTreeViewer.Legend"));
cLegend.setEditingSupport(new StyleEditingSupport(tableViewer));
for (int i = 0, n = table.getColumnCount(); i < n; i++) {
table.getColumn(i).setWidth(200);
}
tableViewer.addCheckStateListener(new ICheckStateListener(){
public void checkStateChanged(CheckStateChangedEvent event) {
if (event.getElement() instanceof LayerCollection)
((LayerCollection)event.getElement()).setVisible(event.getChecked(),true);
else if (event.getElement() instanceof Layer){
((Layer)event.getElement()).setVisible(event.getChecked());
if(event.getChecked()){
LayerCollection lc = ((Layer)event.getElement()).getLayerCollectionParent();
if(!lc.isVisible()){
lc.setVisible(event.getChecked(), false);
tableViewer.setChecked(lc, event.getChecked());
}
}
}else {
Symbolisation sym = (Symbolisation)event.getElement();
sym.setIsCustom(event.getChecked());
if(event.getChecked()){
sym.setFeatureStyle(sym.getLastFeatureStyle());
}else{
int usage = sym.getStyleUsage();
if(usage==Symbolisation.LineStrokeColor||usage==Symbolisation.PointColor||usage==Symbolisation.PolygonFillColor||usage==Symbolisation.PolygonStrokeColor)
sym.setFeatureStyle((Object)LayerFactory.getDefaultColor());
else if(usage==Symbolisation.LineStrokeWidth||usage==Symbolisation.PolygonStrokeWidth)
sym.setFeatureStyle(LayerFactory.DEFAULT_STROKE_WIDTH);
else if(usage==Symbolisation.Radius)
sym.setFeatureStyle(LayerFactory.DEFAULT_RADIUS);
else if(usage==Symbolisation.LineOpacity||usage==Symbolisation.PolygonOpacity||usage==Symbolisation.PointOpacity)
sym.setFeatureStyle(LayerFactory.DEFAULT_OPACITY);
}
sym.updateParent();
tableViewer.refresh();
}
}
});
tableViewer.setContentProvider(new LayerTreeContentProvider(layerList, tableViewer));
tableViewer.setLabelProvider(new LayerLabelProvider(tableViewer));
tableViewer.setInput(layerList);
tableViewer.setAllChecked(true);
}
示例14: createParameterGroup
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
private void createParameterGroup( Composite composite )
{
final Group group2 = new Group( composite, SWT.NONE );
group2.setLayout( new GridLayout( ) );
group2.setLayoutData( new GridData( SWT.FILL,
SWT.FILL,
true,
true,
1,
8 ) );// GridData.FILL_BOTH));
group2.setText( Messages.getString( "PromptParameterDialog.parameterGroup.title" ) );
Label label1 = new Label( group2, SWT.NONE );
label1.setText( Messages.getString( "PromptParameterDialog.parameterGroup.label" ) );
TreeViewer viewer2 = new TreeViewer( group2, SWT.FULL_SELECTION );
Tree tableTree2 = viewer2.getTree( );
GridData gd = new GridData( GridData.FILL_BOTH );
tableTree2.setLayoutData( gd );
tableTree2.setHeaderVisible( true );
tableTree2.setLinesVisible( true );
TreeViewerColumn tvc21 = new TreeViewerColumn( viewer2, SWT.NONE );
tvc21.getColumn( )
.setText( Messages.getString( "PromptParameterDialog.parameterGroup.nameColumn" ) ); //$NON-NLS-1$
tvc21.getColumn( ).setWidth( 200 );
tvc21.setLabelProvider( new NameLabelProvider( selectedStatusMap ) );
tvc21.setEditingSupport( new ParameterEditingSupport( viewer2,
selectedStatusMap ) );
TreeViewerColumn tvc22 = new TreeViewerColumn( viewer2, SWT.NONE );
tvc22.getColumn( )
.setText( Messages.getString( "PromptParameterDialog.parameterGroup.previousValue" ) ); //$NON-NLS-1$
tvc22.getColumn( ).setWidth( 200 );
tvc22.setLabelProvider( new PreviousValueLabelProvider( ) );
TreeViewerColumn tvc23 = new TreeViewerColumn( viewer2, SWT.NONE );
tvc23.getColumn( )
.setText( Messages.getString( "PromptParameterDialog.parameterGroup.revisedValue" ) ); //$NON-NLS-1$
tvc23.getColumn( ).setWidth( 200 );
tvc23.setLabelProvider( new RevisedValueLabelProvider( ) );
viewer2.setContentProvider( new ParameterContentProvider( ) );
viewer2.setInput( ( (IAmbiguousOption) input ).getAmbiguousParameters( ) );
viewer2.expandAll( );
}