本文整理了Java中org.eclipse.jface.viewers.TreePath.getParentPath()
方法的一些代码示例,展示了TreePath.getParentPath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TreePath.getParentPath()
方法的具体详情如下:
包路径:org.eclipse.jface.viewers.TreePath
类名称:TreePath
方法名:getParentPath
[英]Returns a copy of this tree path with one segment removed from the end, or null
if this tree path has no segments.
[中]返回此树路径的副本,其中一个段已从末尾删除,如果此树路径没有段,则返回null
。
代码示例来源:origin: org.eclipse.platform/org.eclipse.debug.ui
/**
* Returns true if there are running requests for any parent element of
* the given tree path.
* @param requestPath Path of element to check.
* @return Returns true if requests are running.
*/
private boolean isRequestBlocked(TreePath requestPath) {
TreePath parentPath = requestPath;
List<ViewerUpdateMonitor> parentRequests = fRequestsInProgress.get(parentPath);
while (parentRequests == null || parentRequests.isEmpty()) {
parentPath = parentPath.getParentPath();
if (parentPath == null) {
// no running requests: start request
return false;
}
parentRequests = fRequestsInProgress.get(parentPath);
}
return true;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.debug.ui
@Override
TreePath getSchedulingPath() {
TreePath path = getElementPath();
if (path.getSegmentCount() > 0) {
return path.getParentPath();
}
return path;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.debug.ui
@Override
TreePath getSchedulingPath() {
TreePath path = getElementPath();
if (path.getSegmentCount() > 0) {
return path.getParentPath();
}
return path;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.debug.ui
/**
* Finds the model proxy that an element with a given path is associated with.
* @param path Path of the element.
* @return Element's model proxy.
*/
private IModelProxy getElementProxy(TreePath path) {
while (path != null) {
IModelProxy proxy = fTreeModelProxies.get(path);
if (proxy != null) {
return proxy;
}
Object element = path.getSegmentCount() == 0 ? getViewer().getInput() : path.getLastSegment();
proxy = fModelProxies.get(element);
if (proxy != null) {
return proxy;
}
path = path.getParentPath();
}
return null;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.debug.ui
Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
TreePath parentPath = path.getParentPath();
List<ViewerUpdateMonitor> requests = fWaitingRequests.get(path);
if (requests != null) {
代码示例来源:origin: org.eclipse.platform/org.eclipse.debug.ui
/**
* If an attempt is made to select an invalid element, it usually indicates that the
* currently selected element was removed from the model. Instead of leaving the
* selection empty, attempt to select the parent element instead.
*
* @param selection the selection to replace
* @param newSelection the selection to use if the given selection is not an {@link ITreeSelection}
* @return the replaced selection or <code>newSelection</code> if the given selection is not an {@link ITreeSelection}
*
* @see org.eclipse.debug.internal.ui.viewers.model.provisional.IModelSelectionPolicy#replaceInvalidSelection(ISelection, ISelection)
*/
@Override
public ISelection replaceInvalidSelection(ISelection selection, ISelection newSelection) {
if (selection instanceof ITreeSelection) {
TreePath[] paths = ((ITreeSelection)selection).getPaths();
if (paths.length > 0 && paths[0].getSegmentCount() > 1) {
return new TreeSelection(paths[0].getParentPath());
}
}
return newSelection;
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.debug.ui
TreePath parents = path.getParentPath();
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
if (elementOrTreePath instanceof TreePath) {
TreePath treePath = (TreePath) elementOrTreePath;
return (treePath).getParentPath();
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
if (elementOrTreePath instanceof TreePath) {
TreePath treePath = (TreePath) elementOrTreePath;
return (treePath).getParentPath();
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
if (elementOrTreePath instanceof TreePath) {
TreePath treePath = (TreePath) elementOrTreePath;
return (treePath).getParentPath();
代码示例来源:origin: org.eclipse.platform/org.eclipse.debug.ui
@Override
public void viewerUpdatesComplete() {
Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
IInternalTreeModelViewer viewer = fContentProvider.getViewer();
if (viewer == null || fPendingSetTopItem != this) {
return;
}
TreePath topPath = viewer.getTopElementPath();
if (!fPathToReveal.equals(topPath)) {
TreePath parentPath = fPathToReveal.getParentPath();
int index = viewer.findElementIndex(parentPath, fPathToReveal.getLastSegment());
if (index >= 0) {
if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
DebugUIPlugin.trace("\tRESTORE REVEAL: " + fPathToReveal.getLastSegment()); //$NON-NLS-1$
}
viewer.reveal(parentPath, index);
}
}
fCounter++;
// in case the pending state was already set to null, we assume that
// all others elements are restored, so we don't expect that REVEAL will
// trigger other updates
if (fCounter > 1 || fPendingState == null) {
dispose();
}
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
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;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
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;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.debug.ui
fDropDownViewer.setInput(launchViewInput, path.getParentPath());
代码示例来源:origin: org.eclipse.platform/org.eclipse.debug.ui
TreePath elementPath = getViewerTreePath(delta);
if (modelIndex >= 0) {
TreePath parentPath = elementPath.getParentPath();
if (parentPath == null) {
parentPath = TreePath.EMPTY;
代码示例来源:origin: org.eclipse.platform/org.eclipse.debug.ui
TreePath elementPath = getViewerTreePath(delta);
if (modelIndex >= 0) {
TreePath parentPath = elementPath.getParentPath();
if (parentPath == null) {
parentPath = TreePath.EMPTY;
内容来源于网络,如有侵权,请联系作者删除!