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


Java TreePath.getSegmentCount方法代码示例

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


在下文中一共展示了TreePath.getSegmentCount方法的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: 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

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

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

示例6: getQualifiedName

import org.eclipse.jface.viewers.TreePath; //导入方法依赖的package包/类
/**
 * @param selections
 * @return
 */
public static String getQualifiedName(final ITreeSelection selections) {
  final TreePath[] paths = selections.getPaths();

  // Consider only not empty and single selection
  if (selections.isEmpty() || selections.size() > 1) {
    return null;
  }

  final TreePath path = paths[0];
  IElementComparer comparer = null;
  if (selections instanceof TreeSelection) {
    comparer = ((TreeSelection) selections).getElementComparer();
  }
  System.out.println(path.hashCode(comparer));
  for (int i = 1; i < path.getSegmentCount(); i++) {
    if (path.getSegment(i) instanceof ResourceFactoryImpl) {
      final EcoreResourceFactoryImpl eResourceFactory =
          (EcoreResourceFactoryImpl) path.getSegment(i);
      System.out
          .println(eResourceFactory.getClass().getName() + ": " + eResourceFactory.toString());
    } else if (path.getSegment(i) instanceof ENamedElement) {
      final ENamedElement namedElement = (ENamedElement) path.getSegment(i);
      System.out.println(namedElement.getClass().getName() + ": " + namedElement.getName());
    } else {
      System.out.println("?");
    }
  }
  return null;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:34,代码来源:MarkerFactory.java

示例7: computeEnablement

import org.eclipse.jface.viewers.TreePath; //导入方法依赖的package包/类
@Override
protected boolean computeEnablement(final IStructuredSelection selection) {
    if (selection.size() > 1) {
        setText(Messages.getString("HistoryEditor.RollbackMultipleName")); //$NON-NLS-1$
        setToolTipText(Messages.getString("HistoryEditor.RollbackMultipleTooltip")); //$NON-NLS-1$
    } else {
        setText(Messages.getString("HistoryEditor.RollbackSingleName")); //$NON-NLS-1$
        setToolTipText(Messages.getString("HistoryEditor.RollbackSingleTooltip")); //$NON-NLS-1$
    }

    if (selection instanceof ITreeSelection) {
        final ITreeSelection treeSelection = (ITreeSelection) selection;
        final TreePath[] treePaths = treeSelection.getPaths();
        for (final TreePath path : treePaths) {
            if (path.getSegmentCount() > 1) {
                return false;
            }
        }
    }

    final TFSRepository repository = historyInput.getRepository();
    if (repository == null) {
        return false;
    }

    if (repository.getVersionControlClient().getServiceLevel().getValue() < WebServiceLevel.TFS_2010.getValue()) {
        return false;
    }

    final String itemPath = historyInput.getHistoryItem();
    if (itemPath == null) {
        return false;
    }

    if (ServerPath.isServerPath(itemPath)) {
        return repository.getWorkspace().isServerPathMapped(itemPath);
    } else {
        return repository.getWorkspace().isLocalPathMapped(itemPath);
    }
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:41,代码来源:HistoryEditor.java

示例8: createTreePath

import org.eclipse.jface.viewers.TreePath; //导入方法依赖的package包/类
private TreePath createTreePath(TreePath old, Object newElement) {
	int count = old.getSegmentCount();
	Object[] newObjects = new Object[count];
	for (int i = 0; i < count - 1; i++) {
		newObjects[i] = old.getSegment(i);
	}
	newObjects[count - 1] = newElement;
	return new TreePath(newObjects);
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:10,代码来源:RenameSelectionState.java

示例9: showSimulationResults

import org.eclipse.jface.viewers.TreePath; //导入方法依赖的package包/类
protected void showSimulationResults() {
	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);
			resultViewer.setInput(simulationSuiteElement.getExperimentTags());
		} else {
			resultViewer.setInput(new LinkedList<>());
		}
	} else {
		resultViewer.setInput(new LinkedList<>());
	}
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:15,代码来源:SimulationView.java

示例10: doEditExperiment

import org.eclipse.jface.viewers.TreePath; //导入方法依赖的package包/类
protected void doEditExperiment() {
	TreePath[] paths = suiteViewer.getStructuredSelection().getPaths();
	if ((paths != null)&&(paths.length>0)) {
		TreePath selected = paths[0];			
		if (selected.getSegmentCount()>=2) {
			ProjectSimulationSuite projectSuite = (ProjectSimulationSuite) selected.getSegment(0);
			SimulationSuiteElement simulationSuiteElement = (SimulationSuiteElement) selected.getSegment(1);
			NewExperimentDialog dialog = new NewExperimentDialog(util.getProjectModels(projectSuite.getProject()), suiteViewer.getControl().getShell(),true,simulationSuiteElement.getSimulationExperiment() );
			if (dialog.open()==Window.OK) {
				simulationSuiteElement.setExperiment( dialog.getSimulationExperiment() );
				suiteViewer.refresh();
			}
		}
	}
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:16,代码来源:SimulationView.java

示例11: doCopyExperiment

import org.eclipse.jface.viewers.TreePath; //导入方法依赖的package包/类
protected void doCopyExperiment() {
	TreePath[] paths = suiteViewer.getStructuredSelection().getPaths();
	if ((paths != null)&&(paths.length>0)) {
		TreePath selected = paths[0];			
		if (selected.getSegmentCount()>=2) {
			ProjectSimulationSuite projectSuite = (ProjectSimulationSuite) selected.getSegment(0);
			SimulationSuiteElement simulationSuiteElement = (SimulationSuiteElement) selected.getSegment(1);
			projectSuite.add( simulationSuiteElement.getSimulationExperiment().copy() );
			suiteViewer.refresh();
		}
	}
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:13,代码来源:SimulationView.java

示例12: doRemoveLaboratory

import org.eclipse.jface.viewers.TreePath; //导入方法依赖的package包/类
protected void doRemoveLaboratory() {
	TreePath[] paths = suiteViewer.getStructuredSelection().getPaths();
	if ((paths != null)&&(paths.length>0)) {
		TreePath selected = paths[0];			
		if (selected.getSegmentCount()>=2) {
			ProjectSimulationSuite projectSuite = (ProjectSimulationSuite) selected.getSegment(0);
			SimulationSuiteElement simulationSuiteElement = (SimulationSuiteElement) selected.getSegment(1);
			if (showConfirmMessage("Deleting simulation experiment...", "Selected simulation experiment will be deleted. Do you want to proceed?")) {
				projectSuite.remove( simulationSuiteElement );	
				suiteViewer.refresh();
			}
		}
	}
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:15,代码来源:SimulationView.java

示例13: openTwin

import org.eclipse.jface.viewers.TreePath; //导入方法依赖的package包/类
/** Expands the element with the same name in the given treeviewer.
 * @param selection TreeSelection
 * @param tv 
 */
private void openTwin(TreeSelection selection,
		TreeViewer tv) {
	TreePath[] path = selection.getPaths();
	BTSObjectTypeTreeNode nodeRight = (BTSObjectTypeTreeNode) tv.getInput();
	TreePath tp = path[0];
	List<BTSObjectTypeTreeNode> elements = new Vector<BTSObjectTypeTreeNode>(tp.getSegmentCount());
	for (int i = 0 ; i < tp.getSegmentCount(); i++)
	{
		BTSObjectTypeTreeNode leftNode = (BTSObjectTypeTreeNode) tp.getSegment(i);
		BTSObjectTypeTreeNode childRight = null;
		if (nodeRight != null)
		{
			for (BTSObjectTypeTreeNode c : nodeRight.getChildren())
			{
				if (c.getValue() != null && c.getValue().equals(leftNode.getValue()))
				{
					childRight = c;
					elements.add(childRight);
					break;
				}
			}
			nodeRight = childRight;
		}
	}
	tv.setExpandedElements(elements.toArray(new BTSObjectTypeTreeNode[elements.size()]));

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

示例14: close

import org.eclipse.jface.viewers.TreePath; //导入方法依赖的package包/类
@Override
public boolean close() {
	if (root != null && root.getRoot() != null)
		root.getRoot().getPropertyChangeSupport()
				.removePropertyChangeListener(metaDataListener);
	if (getReturnCode() == OK) {
		TreeSelection ts = (TreeSelection) treeViewer.getSelection();
		for (TreePath tp : ts.getPaths())
			if (tp.getSegmentCount() == 2)
				cols.put((MSQLColumn) tp.getLastSegment(),
						(MFromTable) tp.getFirstSegment());
	}
	return super.close();
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:15,代码来源:FromTableColumnsDialog.java

示例15: getChildren

import org.eclipse.jface.viewers.TreePath; //导入方法依赖的package包/类
@Override
public synchronized Object[] getChildren(TreePath parentPath) {
	if (flatten) {
		if (parentPath == null) {
			return planAdvisorMember.getViolationTrackers().toArray();
		}
		return new Object[0];
	}
	int count = ((parentPath == null) ? 0 : parentPath.getSegmentCount());
	List<ViolationTracker> trackers = planAdvisorMember.getViolationTrackers();
	if (parentPath != null) {
		List<PlanAdvisorGroup> groups = getGroupsFromPath(parentPath);
		ListIterator<ViolationTracker> trackerIterator = trackers.listIterator(); 
		while (trackerIterator.hasNext()) {
			Violation violation = trackerIterator.next().getViolation();
			for (int i = 0 ; i < groups.size() ; i++) {
				PlanAdvisorGroup group = groups.get(i);
				ViolationKey key = group.getKey();
				String value = violation.getPrintString(key);
				if (!CommonUtils.equals(group.getValue(), value)) {
					trackerIterator.remove();
					break;
				}
			}
		}
	}
	if (count >= groupingOrder.length) {
		return trackers.toArray();
	}
	return groupsFor(groupingOrder[count], trackers);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:32,代码来源:ViolationContentProvider.java


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