當前位置: 首頁>>代碼示例>>Java>>正文


Java TreeViewer類代碼示例

本文整理匯總了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 );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:26,代碼來源:ChartConfiguratorView.java

示例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("請選擇要刪除的包!");
	}
}
 
開發者ID:bsteker,項目名稱:bdf2,代碼行數:21,代碼來源:SelectClassPage.java

示例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());
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:21,代碼來源:CustomElementSelectionForm.java

示例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;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:23,代碼來源:TreeViewerBuilder.java

示例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 });
	
}
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:27,代碼來源:ProjectEditor.java

示例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);
}
 
開發者ID:de-jcup,項目名稱:eclipse-batch-editor,代碼行數:22,代碼來源:AbstractTreeViewerFilter.java

示例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 ();
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:17,代碼來源:ItemListContentProvider.java

示例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 ();
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:17,代碼來源:ItemListContentProvider.java

示例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 ();
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:21,代碼來源:ItemListContentProvider.java

示例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 );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:23,代碼來源:ServersViewer.java

示例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);
	
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:26,代碼來源:PropertyTableTreeObject.java

示例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;
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:20,代碼來源:DesignDocumentUpdateTreeObject.java

示例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;
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:17,代碼來源:DesignDocumentViewTreeObject.java

示例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;
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:20,代碼來源:DesignDocumentFilterTreeObject.java

示例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);
	}
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:25,代碼來源:SequenceTreeObject.java


注:本文中的org.eclipse.jface.viewers.TreeViewer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。