本文整理汇总了Java中org.eclipse.jface.viewers.TreeViewer类的典型用法代码示例。如果您正苦于以下问题:Java TreeViewer类的具体用法?Java TreeViewer怎么用?Java TreeViewer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TreeViewer类属于org.eclipse.jface.viewers包,在下文中一共展示了TreeViewer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPartControl
import org.eclipse.jface.viewers.TreeViewer; //导入依赖的package包/类
@Override
public void createPartControl ( final Composite parent )
{
this.container = parent;
createEditingDomain ();
parent.setLayout ( new FillLayout () );
this.viewer = new TreeViewer ( parent );
this.viewer.setAutoExpandLevel ( 2 );
this.viewer.setContentProvider ( new AdapterFactoryContentProvider ( this.factory ) );
this.viewer.setLabelProvider ( new AdapterFactoryLabelProvider ( this.factory ) );
createContextMenuFor ( this.viewer );
new AdapterFactoryTreeEditor ( this.viewer.getTree (), this.factory );
getViewSite ().setSelectionProvider ( this.viewer );
attachSelectionService ();
getViewSite ().getActionBars ().getMenuManager ().add ( new Separator ( "additions" ) );
this.actionBarContributor.init ( getViewSite ().getActionBars () );
this.actionBarContributor.setViewPart ( this );
}
示例2: removeSelectedPackage
import org.eclipse.jface.viewers.TreeViewer; //导入依赖的package包/类
private void removeSelectedPackage(SelectionEvent e, TreeViewer treeViewer) {
Tree tree = getTree(e);
if (tree == null) {
return;
}
TreeItem[] selection = tree.getSelection();
if (selection != null && selection.length > 0) {
for (TreeItem item : selection) {
TreeItem parent = item.getParentItem();
if (parent == null) {
removePackage(item);
updatePageComplete(tree);
} else {
alert("请选择要删除的包!");
}
}
} else {
alert("请选择要删除的包!");
}
}
示例3: CustomElementSelectionForm
import org.eclipse.jface.viewers.TreeViewer; //导入依赖的package包/类
/**
* Create the composite.
*/
public CustomElementSelectionForm(Composite parent, int style) {
super(parent, style);
setLayout(new GridLayout(2, false));
treeViewer = new TreeViewer(this, SWT.BORDER);
Tree tree = getTreeViewer().getTree();
// Set a minimum height to prevent weird dialog dimensions
tree.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(2, 1).minSize(0, 200).create());
elementLabel = new Label(this, SWT.NONE);
elementLabel.setLayoutData(GridDataFactory.swtDefaults().create());
elementLabel.setText("New Label");
elementInput = new SuffixText(this, SWT.BORDER);// new Text(this, SWT.BORDER);
elementInput.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
}
示例4: createViewer
import org.eclipse.jface.viewers.TreeViewer; //导入依赖的package包/类
@Override
protected TreeViewer createViewer(final Composite parent, final AbstractColumnLayout columnLayout,
final int style) {
final TreeViewer viewer = new TreeViewer(parent, virual ? (style | VIRTUAL) : style);
final Tree tree = viewer.getTree();
tree.setLinesVisible(linesVisible);
tree.setHeaderVisible(headerVisible);
int columnIndex = 0;
for (final String columnLabel : columnLabels) {
final TreeViewerColumn viewerColumn = new TreeViewerColumn(viewer, NONE);
final TreeColumn column = viewerColumn.getColumn();
columnLayout.setColumnData(column, createColumnLayoutData(columnIndex));
column.setText(columnLabel);
column.setMoveable(moveable);
columnIndex++;
}
return viewer;
}
示例5: createPartControl
import org.eclipse.jface.viewers.TreeViewer; //导入依赖的package包/类
/**
* Create contents of the editor part.
* @param parent
*/
@Override
@PostConstruct
public void createPartControl(Composite parent) {
this.sashForm = new SashForm(parent, SWT.NONE);
this.treeViewer = new TreeViewer(this.sashForm, SWT.BORDER);
this.tree = this.treeViewer.getTree();
this.tabFolder = new CTabFolder(this.sashForm, SWT.BORDER);
this.tabFolder.setTabPosition(SWT.BOTTOM);
this.tabFolder.setSelectionBackground(Display.getCurrent().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT));
this.tabItem = new CTabItem(this.tabFolder, SWT.NONE);
this.tabItem.setText("New Item");
this.tabItem_1 = new CTabItem(this.tabFolder, SWT.NONE);
this.tabItem_1.setText("New Item");
this.sashForm.setWeights(new int[] { 3, 10 });
}
示例6: selectTreePath
import org.eclipse.jface.viewers.TreeViewer; //导入依赖的package包/类
private boolean selectTreePath(Viewer viewer, TreePath parentPath, Object element) {
// Cut off children of elements that are shown repeatedly.
for (int i = 0; i < parentPath.getSegmentCount() - 1; i++) {
if (element.equals(parentPath.getSegment(i))) {
return false;
}
}
if (!(viewer instanceof TreeViewer)) {
return true;
}
if (matcher == null) {
return true;
}
TreeViewer treeViewer = (TreeViewer) viewer;
Boolean matchingResult = isMatchingOrNull(element);
if (matchingResult != null) {
return matchingResult;
}
return hasUnfilteredChild(treeViewer, parentPath, element);
}
示例7: performAdded
import org.eclipse.jface.viewers.TreeViewer; //导入依赖的package包/类
protected void performAdded ( final ListEntry[] entries )
{
if ( this.viewer.getControl ().isDisposed () )
{
return;
}
if ( this.viewer instanceof TreeViewer )
{
( (TreeViewer)this.viewer ).add ( this.data, entries );
}
else if ( this.viewer != null )
{
this.viewer.refresh ();
}
}
示例8: performRemoved
import org.eclipse.jface.viewers.TreeViewer; //导入依赖的package包/类
public void performRemoved ( final ListEntry[] entries )
{
if ( this.viewer.getControl ().isDisposed () )
{
return;
}
if ( this.viewer instanceof TreeViewer )
{
( (TreeViewer)this.viewer ).remove ( entries );
}
else if ( this.viewer != null )
{
this.viewer.refresh ();
}
}
示例9: performUpdated
import org.eclipse.jface.viewers.TreeViewer; //导入依赖的package包/类
public void performUpdated ( final ListEntry[] entries )
{
if ( this.viewer.getControl ().isDisposed () )
{
return;
}
if ( this.viewer instanceof TreeViewer )
{
for ( final ListEntry entry : entries )
{
( (TreeViewer)this.viewer ).refresh ( entry );
}
( (TreeViewer)this.viewer ).update ( entries, null );
}
else if ( this.viewer != null )
{
this.viewer.refresh ();
}
}
示例10: ServersViewer
import org.eclipse.jface.viewers.TreeViewer; //导入依赖的package包/类
public ServersViewer ( final Composite parent )
{
parent.setLayout ( new FillLayout () );
this.viewer = new TreeViewer ( parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL );
this.contentProvider = new ObservableSetTreeContentProvider ( new ObservableFactoryImpl (), null );
this.viewer.setContentProvider ( this.contentProvider );
this.labelProvider = new ServerLabelProvider ( this.contentProvider.getKnownElements () );
this.viewer.setLabelProvider ( this.labelProvider );
this.viewer.setInput ( HivesPlugin.getDefault ().getServerManager () );
this.viewer.getControl ().addDisposeListener ( new DisposeListener () {
@Override
public void widgetDisposed ( final DisposeEvent e )
{
handleDispose ();
}
} );
ColumnViewerToolTipSupport.enableFor ( this.viewer );
}
示例11: hasBeenModified
import org.eclipse.jface.viewers.TreeViewer; //导入依赖的package包/类
protected synchronized void hasBeenModified() {
if (isInherited()) return;
XMLVector<XMLVector<Object>> xmlv = new XMLVector<XMLVector<Object>>();
for(PropertyTableRowTreeObject rowTreeObject : getChildren()){
XMLVector<Object> row = new XMLVector<Object>(rowTreeObject.getObject());
xmlv.add(row);
}
data = xmlv;
try {
DatabaseObject databaseObject = databaseObjectTreeObject.getObject();
java.beans.PropertyDescriptor databaseObjectPropertyDescriptor = databaseObjectTreeObject.getPropertyDescriptor(getObject());
Method setter = databaseObjectPropertyDescriptor.getWriteMethod();
Object args[] = { data };
setter.invoke(databaseObject, args);
databaseObject.hasChanged = true;
databaseObjectTreeObject.hasBeenModified(true);
}
catch (Exception e) {}
TreeViewer viewer = (TreeViewer) getAdapter(TreeViewer.class);
viewer.update(databaseObjectTreeObject, null);
}
示例12: rename
import org.eclipse.jface.viewers.TreeViewer; //导入依赖的package包/类
@Override
public boolean rename(String newName, Boolean bDialog) {
if (getName().equals(newName))
return true;
IDesignTreeObject dto = getParentDesignTreeObject();
if (((DesignDocumentTreeObject)dto).hasUpdate(newName)) {
ConvertigoPlugin.logException(new ConvertigoException("The function named \"" + newName + "\" already exists."), "Unable to change the object name.", bDialog);
return false;
}
getObject().setName(newName);
hasBeenModified();
TreeViewer viewer = (TreeViewer) getAdapter(TreeViewer.class);
viewer.update(this, null);
return true;
}
示例13: rename
import org.eclipse.jface.viewers.TreeViewer; //导入依赖的package包/类
public boolean rename(String newName, Boolean bDialog) {
if (getName().equals(newName))
return true;
if (getParentDesignTreeObject().hasView(newName)) {
ConvertigoPlugin.logException(new ConvertigoException("The view named \"" + newName + "\" already exists."), "Unable to change the object name.", bDialog);
return false;
}
getObject().setName(newName);
hasBeenModified();
TreeViewer viewer = (TreeViewer) getAdapter(TreeViewer.class);
viewer.update(this, null);
return true;
}
示例14: rename
import org.eclipse.jface.viewers.TreeViewer; //导入依赖的package包/类
@Override
public boolean rename(String newName, Boolean bDialog) {
if (getName().equals(newName))
return true;
IDesignTreeObject dto = getParentDesignTreeObject();
if (((DesignDocumentTreeObject)dto).hasFilter(newName)) {
ConvertigoPlugin.logException(new ConvertigoException("The function named \"" + newName + "\" already exists."), "Unable to change the object name.", bDialog);
return false;
}
getObject().setName(newName);
hasBeenModified();
TreeViewer viewer = (TreeViewer) getAdapter(TreeViewer.class);
viewer.update(this, null);
return true;
}
示例15: updateLoadedProjects
import org.eclipse.jface.viewers.TreeViewer; //导入依赖的package包/类
private void updateLoadedProjects() {
TreeParent invisibleRoot = ((ViewContentProvider)((TreeViewer)viewer).getContentProvider()).getTreeRoot();
Sequence sequence = getObject();
Set<String> loadedProject = sequence.getLoadedProjectNames();
for (TreeObject treeObject : invisibleRoot.getChildren()) {
if (treeObject instanceof ProjectTreeObject) {
Project project = ((ProjectTreeObject)treeObject).getObject();
sequence.setLoadedProject(project);
}
else if (treeObject instanceof UnloadedProjectTreeObject) {
sequence.removeLoaded(((UnloadedProjectTreeObject)treeObject).getName());
}
if (loadedProject.contains(treeObject.getName())) {
loadedProject.remove(treeObject.getName());
}
}
for (String projectName: loadedProject) {
sequence.removeLoaded(projectName);
}
}