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


Java TreePath.getLastSegment方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: getExpandedOpenedItems

import org.eclipse.jface.viewers.TreePath; //导入方法依赖的package包/类
/**
 * @param allVisibleItems
 * @param allExpandedItems
 * @return Returns {@link TreePath}'s which are expanded and open (not hidden).
 */
public static TreePath[] getExpandedOpenedItems(final Object[] allVisibleItems, final TreePath[] allExpandedItems) {

	final ArrayList<TreePath> expandedOpened = new ArrayList<TreePath>();

	for (final TreePath expandedPath : allExpandedItems) {

		/*
		 * The last expanded segment must be in the visible list otherwise it is hidden.
		 */
		final Object lastExpandedItem = expandedPath.getLastSegment();

		for (final Object visibleItem : allVisibleItems) {

			if (lastExpandedItem == visibleItem) {

				expandedOpened.add(expandedPath);
				break;
			}
		}
	}

	return expandedOpened.toArray(new TreePath[expandedOpened.size()]);
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:29,代码来源:UI.java

示例5: updateLabel

import org.eclipse.jface.viewers.TreePath; //导入方法依赖的package包/类
public void updateLabel(ViewerLabel label, TreePath elementPath) {
	Object firstSegment = elementPath.getFirstSegment();
	if (firstSegment instanceof IProject && elementPath.getSegmentCount() == 2) {
		IProject project = (IProject) firstSegment;
		Object lastSegment = elementPath.getLastSegment();
		if (lastSegment instanceof IFolder) {
			IFolder folder = (IFolder) lastSegment;
			if (!folder.getParent().equals(project)) {
				// This means that a folder that is not a direct child of the project
				// is a child in the tree. Therefore, the resource content provider
				// must be active and in compress folder mode so we will leave
				// it to the resource provider to provide the proper label.
				// We need to do this because of bug 153912
				return;
			}
		}
	}
	label.setImage(getImage(elementPath.getLastSegment()));
	label.setText(getText(elementPath.getLastSegment()));
	Font f = getFont(elementPath.getLastSegment());
	if (f != null)
		label.setFont(f);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:JavaSynchronizationLabelProvider.java

示例6: save

import org.eclipse.jface.viewers.TreePath; //导入方法依赖的package包/类
/**
 * Saves some selection in the memento object.
 */
private void save(TreePath treePath, String type) {
    if (treePath != null) {
        Object object = treePath.getLastSegment();
        if (object instanceof IAdaptable) {
            IAdaptable adaptable = (IAdaptable) object;
            IResource resource = (IResource) adaptable.getAdapter(IResource.class);
            if (resource != null) {
                IPath path = resource.getLocation();
                if (path != null) {
                    memento.createChild(type, path.toPortableString());
                }
            }
        }
    }
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:19,代码来源:PyPackageStateSaver.java

示例7: traverseBreadthFirst

import org.eclipse.jface.viewers.TreePath; //导入方法依赖的package包/类
private void traverseBreadthFirst(final TreePath root, final IProgressMonitor monitor) {
    final Queue<TreePath> q = new LinkedList<>();
    q.add(root);
    while (!q.isEmpty()) {
        final TreePath treePath = q.remove();
        if (treePath.getSegmentCount() > MAX_BREADTH_FIRST_TRAVERSAL_DEPTH) {
            traverseDepthFirst(treePath, monitor);
            while (!q.isEmpty()) {
                traverseDepthFirst(q.remove(), monitor);
            }
        } else {
            final Object o = treePath.getLastSegment();
            if (itIsAMatch(o)) {
                reveal(treePath);
            }
            final Object[] children = getChildren(o);
            checkCanceled(monitor);
            for (final Object child : children) {
                q.add(treePath.createChildPath(child));
            }
        }
    }
}
 
开发者ID:info-sharing-environment,项目名称:NIEM-Modeling-Tool,代码行数:24,代码来源:NiemCheckedTreeSelectionDialog.java

示例8: hasParentTypeScriptFile

import org.eclipse.jface.viewers.TreePath; //导入方法依赖的package包/类
private boolean hasParentTypeScriptFile(Object parent) {
	if (parent instanceof TreePath) {
		TreePath treePath = (TreePath) parent;
		Object segment = treePath.getLastSegment();
		if (segment == null) {
			return false;
		}
		return TypeScriptResourceUtil.isTsOrTsxFile(segment);
	}
	return false;
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:12,代码来源:TypeScriptFilter.java

示例9: updateLabel

import org.eclipse.jface.viewers.TreePath; //导入方法依赖的package包/类
/**
 * @generated
 */
public void updateLabel(ViewerLabel label, TreePath elementPath) {
	Object element = elementPath.getLastSegment();
	if (element instanceof StatemachineNavigatorItem
			&& !isOwnView(((StatemachineNavigatorItem) element).getView())) {
		return;
	}
	label.setText(getText(element));
	label.setImage(getImage(element));
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:13,代码来源:StatemachineNavigatorLabelProvider.java

示例10: updateLabel

import org.eclipse.jface.viewers.TreePath; //导入方法依赖的package包/类
public void updateLabel(ViewerLabel label, TreePath elementPath) {
	Diagram lastSegment = (Diagram) elementPath.getLastSegment();
	NamedElement element = (NamedElement) lastSegment.getElement();
	AdapterFactoryLabelProvider provider = new AdapterFactoryLabelProvider(
			new SGraphItemProviderAdapterFactory());
	label.setText(provider.getText(element));
	if (element instanceof Statechart)
		label.setImage(StatechartImages.LOGO.image());
	else
		label.setImage(provider.getImage(element));

}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:13,代码来源:DiagramPartitioningEditor.java

示例11: select

import org.eclipse.jface.viewers.TreePath; //导入方法依赖的package包/类
@Override
public boolean select(final Viewer viewer, final Object parentElement, final Object element) {
	if (parentElement instanceof TreePath && ResourceManager.isFile(element)) {
		final TreePath p = (TreePath) parentElement;
		if (p.getLastSegment() instanceof WrappedFolder) {
			final IResource r = FileMetaDataProvider.shapeFileSupportedBy(ResourceManager.getFile(element));
			if (r != null) { return false; }
		}
	}
	return true;
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:12,代码来源:NavigatorFilter.java

示例12: getWorkbenchWindowSelection

import org.eclipse.jface.viewers.TreePath; //导入方法依赖的package包/类
private IPath getWorkbenchWindowSelection() {
	IWorkbenchWindow window= fWorkbench.getActiveWorkbenchWindow();
	if (window != null) {
		ISelection selection= window.getSelectionService().getSelection();
		if (selection instanceof IStructuredSelection) {
			IStructuredSelection structuredSelection= (IStructuredSelection) selection;
			Object element= structuredSelection.getFirstElement();
			if (element != null) {
				Object resource= Platform.getAdapterManager().getAdapter(element, IResource.class);
				if (resource != null) {
					return ((IResource) resource).getFullPath();
				}
				if (structuredSelection instanceof ITreeSelection) {
					TreePath treePath= ((ITreeSelection) structuredSelection).getPaths()[0];
					while ((treePath = treePath.getParentPath()) != null) {
						element= treePath.getLastSegment();
						resource= Platform.getAdapterManager().getAdapter(element, IResource.class);
						if (resource != null) {
							return ((IResource) resource).getFullPath();
						}
					}
				}
			}
			
		}
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:29,代码来源:UserLibraryPreferencePage.java

示例13: updateLabel

import org.eclipse.jface.viewers.TreePath; //导入方法依赖的package包/类
/**
 * @generated
 */
public void updateLabel(ViewerLabel label, TreePath elementPath) {
	Object element = elementPath.getLastSegment();
	if (element instanceof SmcNavigatorItem
			&& !isOwnView(((SmcNavigatorItem) element).getView())) {
		return;
	}
	label.setText(getText(element));
	label.setImage(getImage(element));
}
 
开发者ID:road-framework,项目名称:ROADDesigner,代码行数:13,代码来源:SmcNavigatorLabelProvider.java

示例14: updateLabel

import org.eclipse.jface.viewers.TreePath; //导入方法依赖的package包/类
/**
 * @generated
 */
public void updateLabel(ViewerLabel label, TreePath elementPath) {
	Object element = elementPath.getLastSegment();
	if (element instanceof Wc2014NavigatorItem
			&& !isOwnView(((Wc2014NavigatorItem) element).getView())) {
		return;
	}
	label.setText(getText(element));
	label.setImage(getImage(element));
}
 
开发者ID:ggxx,项目名称:HelloBrazil,代码行数:13,代码来源:Wc2014NavigatorLabelProvider.java

示例15: updateLabel

import org.eclipse.jface.viewers.TreePath; //导入方法依赖的package包/类
/**
 * @generated
 */
public void updateLabel(ViewerLabel label, TreePath elementPath) {
	Object element = elementPath.getLastSegment();
	if (element instanceof SimpleBPMN.diagram.navigator.SimpleBPMNNavigatorItem
			&& !isOwnView(((SimpleBPMN.diagram.navigator.SimpleBPMNNavigatorItem) element)
					.getView())) {
		return;
	}
	label.setText(getText(element));
	label.setImage(getImage(element));
}
 
开发者ID:bluezio,项目名称:simplified-bpmn-example,代码行数:14,代码来源:SimpleBPMNNavigatorLabelProvider.java


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