本文整理匯總了Java中org.eclipse.swt.widgets.TreeColumn.setResizable方法的典型用法代碼示例。如果您正苦於以下問題:Java TreeColumn.setResizable方法的具體用法?Java TreeColumn.setResizable怎麽用?Java TreeColumn.setResizable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.TreeColumn
的用法示例。
在下文中一共展示了TreeColumn.setResizable方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createColumns
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
protected void createColumns ( final Tree tree )
{
final TreeColumn typeFilterColumn = new TreeColumn ( tree, SWT.NONE );
typeFilterColumn.setText ( getString ( "_UI_TypeFilterColumn_label" ) ); //$NON-NLS-1$
typeFilterColumn.setResizable ( true );
typeFilterColumn.setWidth ( 200 );
final TreeColumn idFilterColumn = new TreeColumn ( tree, SWT.NONE );
idFilterColumn.setText ( getString ( "_UI_IdFilterColumn_label" ) ); //$NON-NLS-1$
idFilterColumn.setResizable ( true );
idFilterColumn.setWidth ( 200 );
final TreeColumn actionFilterColumn = new TreeColumn ( tree, SWT.NONE );
actionFilterColumn.setText ( getString ( "_UI_ActionFilterColumn_label" ) ); //$NON-NLS-1$
actionFilterColumn.setResizable ( true );
actionFilterColumn.setWidth ( 200 );
}
示例2: installDesigns
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
protected void installDesigns()
{
TreeColumn designColumn = new TreeColumn(tree, SWT.LEFT);
designColumn.setToolTipText(selectAllHelp);
// TODO: Bonnie wants some indicator for which columns are designs
// Such as changing "Tasks" here to "Tasks \\ Designs"
designColumn.setText(L10N.get("PM.Tasks", "Tasks"));
designColumn.setResizable(true);
designColumn.setWidth(400);
if (columnHook != null) {
columnHook.onColumnCreation(designColumn);
}
Iterator<Design> designs = project.getDesigns().iterator();
while (designs.hasNext()) {
Design nextDesign = designs.next();
addTreeColumn(nextDesign);
}
}
示例3: expandColumnsAtIndexes
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
private void expandColumnsAtIndexes(Set<Integer> indexes) {
if (indexes != null && !indexes.isEmpty()) {
TreeColumn[] columns = getTree().getColumns();
for (int i = 0; i < columns.length; i++) {
if (!indexes.contains(i)) {
continue;
}
TreeColumn column = columns[i];
column.setWidth(dataSource.columnWidthForColumnIndex(i));
column.setResizable(true);
}
}
}
示例4: collapseColumnsAtIndexes
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
private void collapseColumnsAtIndexes(Set<Integer> indexes) {
if (indexes == null || indexes.isEmpty()) {
return;
}
TreeColumn[] columns = getTree().getColumns();
for (int i = 0; i < columns.length; i++) {
if (!indexes.contains(i)) {
continue;
}
TreeColumn column = columns[i];
column.setWidth(0);
column.setResizable(false);
}
}
示例5: createComposite
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
/**
* 뷰어가 담길 컴포지트 생성
*
* @param parent
* @return Composite
*/
public Composite createComposite(final Composite parent) {
Tree tree = new Tree(parent, SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
tree.setLinesVisible(true);
tree.setHeaderVisible(true);
String[] strHeadings = { UMLMessage.LABEL_PROPERTY, UMLMessage.LABEL_VALUE };
TreeColumn propertyTreeColumn = new TreeColumn(tree, SWT.NONE);
propertyTreeColumn.setWidth(240);
propertyTreeColumn.setText(strHeadings[0]);
propertyTreeColumn.setAlignment(SWT.LEFT);
propertyTreeColumn.setResizable(true);
TreeColumn valueTreeColumn = new TreeColumn(tree, SWT.NONE);
valueTreeColumn.setWidth(300);
valueTreeColumn.setText(strHeadings[1]);
valueTreeColumn.setAlignment(SWT.LEFT);
valueTreeColumn.setResizable(true);
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.heightHint = 150;
gridData.horizontalSpan = 2;
tree.setLayoutData(gridData);
viewer = new TreeViewer(tree);
tree.setItemCount(20);
viewer.setContentProvider(new StereotypePropertyTreeContentProvider());
viewer.setLabelProvider(new StereotypePropertyTableColumnLabelProvider(this));
// viewer.setInput(input);
viewer.addSelectionChangedListener(new StereotypePropertySelectionChangedListener(parent, this));
return parent;
}
示例6: createColumns
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
protected void createColumns(final Tree tree) {
TableLayout layout = new TableLayout();
tree.setLayout(layout);
tree.setHeaderVisible(true);
for (int i = 0; i < 4; i++) {
if (i == 1) {
layout.addColumnData(new ColumnPixelData(100, true));
} else {
layout.addColumnData(new ColumnPixelData(300, true));
}
TreeColumn column = new TreeColumn(tree, SWT.NONE, i);
if (i == 0) {
column.setText("Resource");
}
if (i == 1) {
column.setText("Project");
}
if (i == 2) {
column.setText("Possible Targets");
}
if (i == 3) {
column.setText("Targets");
}
column.setResizable(true);
TreeViewerColumn viewerColumn = new TreeViewerColumn(viewer, column);
viewerColumn
.setLabelProvider(new ResourceChangesColumnLabelProvider(i));
}
}
示例7: TreeColumnResizer
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
public TreeColumnResizer(Composite control, TreeColumn column1, TreeColumn column2) {
this.mControl = control;
this.mColumn1 = column1;
this.mColumn2 = column2;
control.addListener(SWT.Resize, resizeListener);
column1.addListener(SWT.Resize, column1ResizeListener);
column2.setResizable(false);
}
示例8: createTableViewerColumn
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
private TreeViewerColumn createTableViewerColumn(String title, int width, final int colNumber) {
final TreeViewerColumn viewerColumn = new TreeViewerColumn(viewer, SWT.NONE);
TreeColumn column = viewerColumn.getColumn();
column.setText(title);
column.setWidth(width);
column.setResizable(true);
column.setMoveable(false);
return viewerColumn;
}
示例9: createOwnerDrawnTreeWithColumn
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
static Tree createOwnerDrawnTreeWithColumn( Composite parent ) {
Tree result = createTree( parent, 2, 6, SWT.FULL_SELECTION );
result.setHeaderVisible( true );
result.setLinesVisible( true );
result.addListener( SWT.MeasureItem, evt -> {} );
result.addListener( SWT.PaintItem, evt -> {} );
result.addListener( SWT.MouseDown, evt -> {} );
result.setFocus();
TreeColumn labelColumn = new TreeColumn( result, SWT.NONE );
labelColumn.setText( "Column" );
labelColumn.setWidth( 200 );
labelColumn.setResizable( true );
return result;
}
示例10: createColumns
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
/**
* Creates the columns for the history table.
*/
private void createColumns(Tree tree, TableLayout layout) {
SelectionListener headerListener = new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
int column = viewer.getTree().indexOf((TreeColumn) e.widget);
HistoryComparator oldSorter = (HistoryComparator) viewer.getComparator();
TreeColumn treeColumn = ((TreeColumn)e.widget);
if (oldSorter != null && column == oldSorter.getColumnNumber()) {
oldSorter.setReversed(!oldSorter.isReversed());
viewer.getTree().setSortColumn(treeColumn);
viewer.getTree().setSortDirection(oldSorter.isReversed() ? SWT.DOWN : SWT.UP);
viewer.refresh();
} else {
viewer.getTree().setSortColumn(treeColumn);
viewer.getTree().setSortDirection(SWT.UP);
viewer.setComparator(new HistoryComparator(column));
}
}
};
// file name
TreeColumn nameCol = new TreeColumn(tree, SWT.NONE);
nameCol.setResizable(true);
nameCol.setText(HistoryMessages.GenericHistoryTableProvider_FileName);
nameCol.addSelectionListener(headerListener);
// creation date
TreeColumn dateCol = new TreeColumn(tree, SWT.NONE);
dateCol.setResizable(true);
dateCol.setText(TeamUIMessages.GenericHistoryTableProvider_RevisionTime);
dateCol.addSelectionListener(headerListener);
layout.addColumnData(new ColumnWeightData(15, true));
layout.addColumnData(new ColumnWeightData(10, true));
}
示例11: build
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的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;
}
示例12: createPartControl
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
public void createPartControl(Composite parent) {
GridLayout layout = new GridLayout();
layout.marginWidth = 0;
layout.marginHeight = 0;
layout.numColumns = 1;
parent.setLayout(layout);
treeViewer = new TreeViewer(parent, SWT.FULL_SELECTION);
treeViewer.setLabelProvider(new ConflictsLabelProvider());
treeViewer.setContentProvider(new ConflictsContentProvider());
treeViewer.setUseHashlookup(true);
GridData layoutData = new GridData();
layoutData.grabExcessHorizontalSpace = true;
layoutData.grabExcessVerticalSpace = true;
layoutData.horizontalAlignment = GridData.FILL;
layoutData.verticalAlignment = GridData.FILL;
treeViewer.getControl().setLayoutData(layoutData);
TableLayout tableLayout = new TableLayout();
treeViewer.getTree().setLayout(tableLayout);
DisposeListener disposeListener = new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
TreeColumn col = (TreeColumn)e.getSource();
if (col.getWidth() > 0) settings.put("TreeConflictsView.col." + col.getText(), col.getWidth()); //$NON-NLS-1$
}
};
for (int i = 0; i < columnHeaders.length; i++) {
TreeColumn tc = new TreeColumn(treeViewer.getTree(), SWT.NONE,i);
tc.setResizable(columnLayouts[i].resizable);
tc.setText(columnHeaders[i]);
setColumnWidth(tableLayout, disposeListener, tc, i);
}
treeViewer.getTree().setHeaderVisible(true);
treeViewer.getTree().setLinesVisible(false);
treeViewer.setInput(this);
treeViewer.addOpenListener(new IOpenListener() {
public void open(OpenEvent evt) {
openAction.run();
}
});
createMenus();
createToolbar();
String path = settings.get("TreeConflictsView.resource"); //$NON-NLS-1$
if (path != null) {
boolean container = settings.getBoolean("TreeConflictsView.container"); //$NON-NLS-1$
if (container) resource = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(new Path(path));
else resource = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(path));
}
if (resource == null)
setContentDescription(Policy.bind("TreeConflictsView.noResource")); //$NON-NLS-1$
else
setContentDescription(resource.getFullPath().toString());
}
示例13: createPage1
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
void createPage1() {
Composite composite = new Composite(getContainer(), SWT.NONE);
FillLayout layout = new FillLayout();
composite.setLayout(layout);
Tree tree = new Tree(composite, SWT.BORDER | SWT.H_SCROLL
| SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
tree.setHeaderVisible(true);
tree.setLinesVisible(true);
TreeColumn column1 = new TreeColumn(tree, SWT.LEFT);
column1.setWidth(250);
column1.setResizable(true);
TreeColumn column2 = new TreeColumn(tree, SWT.LEFT);
column2.setWidth(40);
column2.setResizable(true);
TreeColumn column3 = new TreeColumn(tree, SWT.LEFT);
column3.setWidth(250);
column3.setResizable(true);
TreeColumn column4 = new TreeColumn(tree, SWT.LEFT);
column4.setWidth(600);
column4.setResizable(true);
TreeViewer resultsViewer = new TreeViewer(tree);
resultsViewer.setLabelProvider(new TSVResultsLabelProvider());
resultsViewer.setContentProvider(new TSVResultsContentProvider(resultMap));
resultsViewer.setInput(createModel());
resultsViewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
IStructuredSelection structuredSelection = (IStructuredSelection) event.getSelection();
if (structuredSelection.isEmpty()) return;
Object selection = structuredSelection.getFirstElement();
if (selection instanceof TSVResult) {
String fileName = ((TSVResult) selection).getFilename();
int lineNumber = ((TSVResult) selection).getLineNumber();
String extensionName = fileName.replaceAll("-items.xml", "");
IProject extension = ResourcesPlugin.getWorkspace().getRoot().getProject(extensionName);
IFile itemsxml = extension.getFile("resources/" + fileName);
if (itemsxml.exists()) {
IMarker marker;
try {
marker = itemsxml.createMarker(IMarker.TEXT);
HashMap<String, Object> map = new HashMap<String, Object>();
map.put(IMarker.LINE_NUMBER, lineNumber);
marker.setAttributes(map);
IDE.openEditor(getSite().getPage(), marker);
marker.delete();
}
catch (CoreException e) {
e.printStackTrace();
}
}
else {
MessageBox dialog = new MessageBox(getContainer().getShell(), SWT.ICON_WARNING | SWT.OK);
dialog.setText("Extension not found");
dialog.setMessage("The extension " + extensionName + " was not found in the workspace. Please import it and try again.");
dialog.open();
}
}
}
});
int index = addPage(composite);
setPageText(index, "Results");
}
示例14: createPartControl
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
/**
* Creates the columns for the view
*/
@Override
public void createPartControl(Composite parent) {
Tree main =
new Tree(parent, SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL
| SWT.V_SCROLL);
main.setHeaderVisible(true);
main.setLinesVisible(false);
main.setLayoutData(new GridData(GridData.FILL_BOTH));
TreeColumn serverCol = new TreeColumn(main, SWT.SINGLE);
serverCol.setText("Location");
serverCol.setWidth(300);
serverCol.setResizable(true);
TreeColumn locationCol = new TreeColumn(main, SWT.SINGLE);
locationCol.setText("Master node");
locationCol.setWidth(185);
locationCol.setResizable(true);
TreeColumn stateCol = new TreeColumn(main, SWT.SINGLE);
stateCol.setText("State");
stateCol.setWidth(95);
stateCol.setResizable(true);
TreeColumn statusCol = new TreeColumn(main, SWT.SINGLE);
statusCol.setText("Status");
statusCol.setWidth(300);
statusCol.setResizable(true);
viewer = new TreeViewer(main);
viewer.setContentProvider(this);
viewer.setLabelProvider(this);
viewer.setInput(CONTENT_ROOT); // don't care
getViewSite().setSelectionProvider(viewer);
getViewSite().getActionBars().setGlobalActionHandler(
ActionFactory.DELETE.getId(), deleteAction);
getViewSite().getActionBars().getToolBarManager().add(editServerAction);
getViewSite().getActionBars().getToolBarManager().add(newLocationAction);
createActions();
createContextMenu();
}
示例15: createControl
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
public void createControl(final Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayout gridLayout = new GridLayout();
gridLayout.marginWidth = 0;
gridLayout.marginHeight = 0;
composite.setLayout(gridLayout);
treeViewer = new TreeViewer(composite, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
GridData data = new GridData(GridData.FILL_BOTH);
Tree tree = treeViewer.getTree();
tree.setLayoutData(data);
tree.setHeaderVisible(true);
IUColumnConfig[] columns = getColumnConfig();
for (int i = 0; i < columns.length; i++) {
TreeColumn tc = new TreeColumn(tree, SWT.LEFT, i);
tc.setResizable(true);
tc.setText(columns[i].getColumnTitle());
tc.setWidth(columns[i].getWidthInPixels(tree));
}
contentProvider = new ProvElementContentProvider();
treeViewer.setContentProvider(contentProvider);
labelProvider = new IUDetailsLabelProvider(null, getColumnConfig(), getShell());
treeViewer.setLabelProvider(labelProvider);
setControl(composite);
final Runnable runnable = new Runnable() {
public void run() {
// updateStatus(input, operation);
setDrilldownElements(input, operation);
treeViewer.setInput(input);
}
};
if (operation != null && !operation.hasResolved()) {
try {
getContainer().run(true, false, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) {
operation.resolveModal(monitor);
parent.getDisplay().asyncExec(runnable);
}
});
} catch (Exception e) {
StatusManager.getManager().handle(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, e.getMessage(), e));
}
} else {
runnable.run();
}
}