當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。