Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 160282 Details for
Bug 303923
[Table] Wrong position of cell's text if no image is in cell
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
Snippet View
DemoTableViewPart.java (text/x-java), 3.95 KB, created by
Markus Krüger
on 2010-02-26 05:52:57 EST
(
hide
)
Description:
Snippet View
Filename:
MIME Type:
Creator:
Markus Krüger
Created:
2010-02-26 05:52:57 EST
Size:
3.95 KB
patch
obsolete
>/******************************************************************************* > * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * > * Contributors: > * Innoopract Informationssysteme GmbH - initial API and implementation > ******************************************************************************/ >package ag.dummy.view.views; > >import org.eclipse.jface.viewers.ColumnLabelProvider; >import org.eclipse.jface.viewers.ColumnViewerToolTipSupport; >import org.eclipse.jface.viewers.IStructuredContentProvider; >import org.eclipse.jface.viewers.TableViewer; >import org.eclipse.jface.viewers.TableViewerColumn; >import org.eclipse.jface.viewers.Viewer; >import org.eclipse.swt.SWT; >import org.eclipse.swt.graphics.Image; >import org.eclipse.swt.layout.GridData; >import org.eclipse.swt.layout.GridLayout; >import org.eclipse.swt.widgets.Composite; >import org.eclipse.swt.widgets.Table; >import org.eclipse.ui.ISharedImages; >import org.eclipse.ui.PlatformUI; >import org.eclipse.ui.part.ViewPart; > >public class DemoTableViewPart extends ViewPart { > > private TableViewer tableViewer; > > @Override > public void createPartControl(final Composite parent) { > parent.setLayout(new GridLayout()); > String[] baseColNames = new String[] { "A", "B", "C" }; > int[] colWidths = new int[] { 100, 100, 100 }; > tableViewer = new TableViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL > | SWT.BORDER > | SWT.SINGLE > | SWT.FULL_SELECTION); > ColumnViewerToolTipSupport.enableFor(tableViewer); > tableViewer.setContentProvider(new MyContentProvider()); > Table table = tableViewer.getTable(); > table.setLinesVisible(true); > table.setHeaderVisible(true); > GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); > gd.heightHint = 100; > table.setLayoutData(gd); > for (int i = 0; i < baseColNames.length; i++) { > TableViewerColumn tblvCol = new TableViewerColumn(tableViewer, SWT.NONE); > tblvCol.getColumn().setWidth(colWidths[i]); > tblvCol.getColumn().setResizable(true); > tblvCol.getColumn().setText(baseColNames[i]); > tblvCol.getColumn().setAlignment(SWT.LEFT); > tblvCol.setLabelProvider(new MyColumnLabelProvider()); > } > tableViewer.setColumnProperties(baseColNames); > String[] input = new String[] { "image", "no image", "image", "no image", "image", "no image", > "image", "no image", "image", "no image", "image", "no image", "image", "no image", > "image", "no image" }; > tableViewer.setInput(input); > } > > @Override > public void setFocus() { > tableViewer.getTable().setFocus(); > } > > private class MyColumnLabelProvider extends ColumnLabelProvider { > > @Override > public String getText(Object element) { > if (element instanceof String) { > String text = (String) element; > return text; > } > return element.getClass().getName(); > } > > @Override > public Image getImage(Object element) { > if (element instanceof String) { > String text = (String) element; > if (!text.startsWith("no")) { > ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages(); > return sharedImages.getImage(ISharedImages.IMG_DEF_VIEW); > } > } > return null; > } > } > > private class MyContentProvider implements IStructuredContentProvider { > > public Object[] getElements(Object inputElement) { > if (inputElement instanceof String[]) { > return (String[]) inputElement; > } > return new Object[0]; > } > > public void dispose() { > // nothing to do > } > > public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { > // nothing to do > } > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 303923
:
160196
|
160230
|
160280
| 160282