当前位置: 首页>>代码示例>>Java>>正文


Java TreePath类代码示例

本文整理汇总了Java中org.eclipse.jface.viewers.TreePath的典型用法代码示例。如果您正苦于以下问题:Java TreePath类的具体用法?Java TreePath怎么用?Java TreePath使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TreePath类属于org.eclipse.jface.viewers包,在下文中一共展示了TreePath类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: selectTreePath

import org.eclipse.jface.viewers.TreePath; //导入依赖的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

示例2: getJavaProjects

import org.eclipse.jface.viewers.TreePath; //导入依赖的package包/类
public static IJavaProject[] getJavaProjects(final ITreeSelection treeSelection) {
  if (treeSelection == null) {
    return new IJavaProject[0];
  }
  final List<IJavaProject> projects = new ArrayList<>();
  final TreePath[] paths = treeSelection.getPaths();
  for (final TreePath treePath : paths) {
    if (treePath.equals(TreePath.EMPTY)) {
      continue;
    }
    for (int i = 0; i < treePath.getSegmentCount(); i++) {
      final Object segment = treePath.getSegment(i);
      if ((segment instanceof IJavaProject)) {
        projects.add((IJavaProject) segment);
        break;
      }
    }
  }
  return projects.toArray(new IJavaProject[projects.size()]);
}
 
开发者ID:AndreasWBartels,项目名称:libraries,代码行数:21,代码来源:JavaProjectUtilities.java

示例3: getJavaElements

import org.eclipse.jface.viewers.TreePath; //导入依赖的package包/类
public static IJavaElement[] getJavaElements(final ITreeSelection selection) {
  if (selection == null) {
    return new IJavaProject[0];
  }
  final List<IJavaElement> projects = new ArrayList<>();
  for (final TreePath treePath : selection.getPaths()) {
    if (treePath.equals(TreePath.EMPTY)) {
      continue;
    }
    final Object lastSegment = treePath.getLastSegment();
    if (!(lastSegment instanceof IJavaElement)) {
      continue;
    }
    projects.add((IJavaElement) lastSegment);
  }
  return projects.toArray(new IJavaElement[projects.size()]);
}
 
开发者ID:AndreasWBartels,项目名称:libraries,代码行数:18,代码来源:JavaProjectUtilities.java

示例4: computeEnablement

import org.eclipse.jface.viewers.TreePath; //导入依赖的package包/类
@Override
protected boolean computeEnablement(final IStructuredSelection selection) {
    if (selection.size() != 1) {
        return false;
    }

    // For VS 2010 the content provider is a TreeContentProvider. Only
    // enable this action for history items at the root level. For
    // versions prior to 2010 the condition for enablement conditions
    // are unchanged.
    boolean isRootItemSelected = true;
    if (selection instanceof ITreeSelection) {
        final ITreeSelection treeSelection = (ITreeSelection) selection;
        final TreePath[] treePaths = treeSelection.getPaths();
        if (treePaths.length == 1) {
            isRootItemSelected = treePaths[0].getSegmentCount() == 1;
        }
    }

    final String item = historyInput.getHistoryItem();
    return !ServerPath.isServerPath(item) && isRootItemSelected;
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:23,代码来源:HistoryEditor.java

示例5: setInput

import org.eclipse.jface.viewers.TreePath; //导入依赖的package包/类
public void setInput(PageRoot inputElement) {
	input = inputElement;
	if (viewer != null) {
		Object[] expandedElements = viewer.getExpandedElements();
		TreePath[] expandedTreePaths = viewer.getExpandedTreePaths();

		viewer.setInput(input);

		viewer.setExpandedElements(expandedElements);
		viewer.setExpandedTreePaths(expandedTreePaths);

		actions.get(ACTION_COPY).setEnabled(true);
		actions.get(ACTION_CUT).setEnabled(true);
		actions.get(ACTION_PASTE).setEnabled(true);
		actions.get(ACTION_DELETE).setEnabled(true);
	}
}
 
开发者ID:grosenberg,项目名称:fluentmark,代码行数:18,代码来源:MkOutlinePage.java

示例6: getExpandTreePaths

import org.eclipse.jface.viewers.TreePath; //导入依赖的package包/类
/**
 * getExpandTreePaths
 *  
 * @param tree
 * @param selectedItem
 * @return TreePath[]
 */
public static TreePath[] getExpandTreePaths(Tree tree, TreeItem selectedItem) {
    ArrayList<Object> items = new ArrayList<Object>();
    internalCollectTreeItems(items, tree);
    ArrayList<Object> result = new ArrayList<Object>();

    for (Iterator<Object> it = items.iterator(); it.hasNext();) {
        Item item = (Item) it.next();
        // if (item == selectedItem) {
        TreePath treePath = getTreePathFromItem(item);
        if (treePath != null) {
            result.add(treePath);
        }
        // }
    }

    return (TreePath[]) result.toArray(new TreePath[items.size()]);
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:25,代码来源:TreeItemUtil.java

示例7: hierarchyCheck

import org.eclipse.jface.viewers.TreePath; //导入依赖的package包/类
/**
 * hierarchyCheck
 *  
 * @return boolean
 */
protected boolean hierarchyCheck() {
    CommonViewer commonViewer = ViewerRegistry.getViewer();
    TreeSelection sel = (TreeSelection) commonViewer.getSelection();

    List<TreePath> pathList = Arrays.asList(sel.getPaths());

    for (TreePath path : pathList) {
        if (isContains(pathList, path.getParentPath())) {
            MessageDialog.openError(ProjectExplorerPlugin.getShell(),
                UMLMessage.LABEL_FILE_FRAGMENTATION,
                UMLMessage.MESSAGE_FRAGMENT_DEFRAGMENT_ERROR_MESSAGE/*"패키지 간 상하 관계가 포함된 경우 일괄 단편화/병합을 실행할 수 없습니다."*/);
            return false;
        }
    }

    return true;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:23,代码来源:BaseMultiFragmentAction.java

示例8: doRunSimulationExperiment

import org.eclipse.jface.viewers.TreePath; //导入依赖的package包/类
protected void doRunSimulationExperiment() {
	TreePath[] paths = suiteViewer.getStructuredSelection().getPaths();
	if ((paths != null)&&(paths.length>0)) {
		TreePath selected = paths[0];			
		if (selected.getSegmentCount()>=2) {
			SimulationSuiteElement simulationSuiteElement = (SimulationSuiteElement) selected.getSegment(1);
			RunSimulationExperimentJob experiment = new RunSimulationExperimentJob(this, simulationSuiteElement);
			
			//update the Lab View
			//updateView();
			
			experiment.setUser(true);
			experiment.schedule();
		}
	}

}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:18,代码来源:SimulationView.java

示例9: refreshTreeViewer

import org.eclipse.jface.viewers.TreePath; //导入依赖的package包/类
private void refreshTreeViewer(final BTSCorpusObject btsCorpusObject) {
		sync.asyncExec(new Runnable() {
			public void run() {
				if (!mainTreeViewer.getTree().isDisposed())
				{
					
//					mainTreeViewer
//							.removeSelectionChangedListener(selectionListener);
					for (TreePath path : mainTreeViewer.getExpandedTreePaths())
						System.out.println(path.getLastSegment());
					mainTreeViewer.refresh();
//					mainTreeViewer.addSelectionChangedListener(selectionListener);
				}
			}
		});

	}
 
开发者ID:cplutte,项目名称:bts,代码行数:18,代码来源:LemmaNavigator.java

示例10: handleEvent

import org.eclipse.jface.viewers.TreePath; //导入依赖的package包/类
@Override
public void handleEvent(final Event event) {
	// FIXME hack, should be solved be resetting the selection in viewer
	// instead
	btnToEdit.setEnabled(false);
	btnUngroup.setEnabled(false);
	final TreePath[] paths = xViewer.getSelection().getPaths();
	if (paths.length > 0) {
		final Copy copy = (Copy) paths[0].getLastSegment();
		setInput(copy);
		copies.remove(copy);
		bindingContext.updateTargets();
		checkGroups();
		updateToListButton();
		updateSaveButton();
		xViewer.setInput(copies);
	}
}
 
开发者ID:FI13,项目名称:afbb-bibo,代码行数:19,代码来源:RegisterCopyView.java

示例11: doubleClick

import org.eclipse.jface.viewers.TreePath; //导入依赖的package包/类
@Override
public void doubleClick(final DoubleClickEvent event) {
	// safety check first
	if (event == null || event.getSelection() == null || !(event.getSelection() instanceof TreeSelection)) {
		return;
	}
	final TreeSelection selection = (TreeSelection) event.getSelection();
	final TreePath[] paths = selection.getPaths();
	final TreePath treePath = paths[paths.length - 1];
	final Object segment = treePath.getLastSegment();

	final TreeItem[] items = viewer.getTree().getItems();
	final TreeItem item = getItem(items, segment);
	if (item != null) {
		item.setExpanded(!item.getExpanded());
		viewer.refresh();
	}
}
 
开发者ID:FI13,项目名称:afbb-bibo,代码行数:19,代码来源:TreeCollapseExpandListener.java

示例12: copyTreeSelectionToClipboard

import org.eclipse.jface.viewers.TreePath; //导入依赖的package包/类
private void copyTreeSelectionToClipboard() {
  ITreeSelection selection = (ITreeSelection) treeViewer.getSelection();
  TreePath[] paths = selection.getPaths();

  StringBuffer buf = new StringBuffer();

  for (TreePath path : paths) {
    LogEntry<?> entry = (LogEntry<?>) path.getLastSegment();
    buf.append(createTabString(path.getSegmentCount() - 1));
    buf.append(entry.toString());
    buf.append("\n");
  }

  if (buf.length() > 0) {
    buf.deleteCharAt(buf.length() - 1); // take off last \n
  }

  copyToClipboard(buf.toString());
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:20,代码来源:LogContent.java

示例13: init

import org.eclipse.jface.viewers.TreePath; //导入依赖的package包/类
/**
 * We will accept the selection in the workbench to see if we can initialize
 * from it.
 * 
 * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection)
 */
public void init(IWorkbench workbench, IStructuredSelection selection) {
	if (selection instanceof StructuredSelection) {
		if (selection.getFirstElement() instanceof IProject || selection.getFirstElement() instanceof IFile || selection.getFirstElement() instanceof IFolder) {
			this.selection = selection;
			return;
		}
		for (Object obj : selection.toList()) {
			if (obj instanceof EditPart) {
				IEditorInput ein = SelectionHelper.getActiveJRXMLEditor().getEditorInput();
				if (ein instanceof FileEditorInput) {
					this.selection = new TreeSelection(new TreePath(new Object[] { ((FileEditorInput) ein).getFile() }));
					return;
				}
			}
		}
	}
	this.selection = selection;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:25,代码来源:Publish2ServerWizard.java

示例14: init

import org.eclipse.jface.viewers.TreePath; //导入依赖的package包/类
@Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
	if (selection instanceof StructuredSelection) {
		if (selection.getFirstElement() instanceof IProject || selection.getFirstElement() instanceof IFile || selection.getFirstElement() instanceof IFolder) {
			this.selection = selection;
			return;
		}
		for (Object obj : selection.toList()) {
			if (obj instanceof EditPart) {
				IEditorInput ein = SelectionHelper.getActiveJRXMLEditor().getEditorInput();
				if (ein instanceof FileEditorInput) {
					this.selection = new TreeSelection(new TreePath(new Object[] { ((FileEditorInput) ein).getFile() }));
					return;
				}
			}
		}
	}
	this.selection = selection;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:20,代码来源:PublishFile2ServerWizard.java

示例15: run

import org.eclipse.jface.viewers.TreePath; //导入依赖的package包/类
@Override
public void run() {
	TreeSelection s = (TreeSelection) treeViewer.getSelection();
	TreePath[] p = s.getPaths();
	for (int i = 0; i < p.length;) {
		final Object obj = p[i].getLastSegment();
		if (obj instanceof ANode) {
			ANode parent = (ANode) obj;
			AddResourceWizard wizard = new AddResourceWizard(parent);
			WizardDialog dialog = new WizardDialog(UIUtils.getShell(), wizard);
			dialog.create();
			dialog.open();
		}
		break;
	}

}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:18,代码来源:AddResourceAction.java


注:本文中的org.eclipse.jface.viewers.TreePath类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。