org.eclipse.core.runtime.PlatformObject Java Examples

The following examples show how to use org.eclipse.core.runtime.PlatformObject. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NodeCompactor.java    From depan with Apache License 2.0 6 votes vote down vote up
/**
 * The argument for {@code remains} is updated on each call.
 */
private PlatformObject buildTreeRoot(
    GraphModel master,
    Collection<GraphNode> remains,
    GraphEdgeMatcherDescriptor matcher) {

  // Build the hierarchy for this set of nodes and matcher
  GraphModel treeGraph = GraphBuilders.buildFromNodes(master, remains);
  GraphData<GraphNode> data = GraphData.createGraphData(
      NodeTreeProviders.GRAPH_NODE_PROVIDER,
      treeGraph, matcher.getInfo());

  // Update remains with info from hierarchy tree
  TreeModel tree = data.getTreeModel();
  remains.removeAll(tree.computeTreeNodes());

  // provide the root viewing object
  String label = MessageFormat.format("Tree of {0}", matcher.getName());
  return new ActionTreeRoot(data, label, matcher);
}
 
Example #2
Source File: NodeCompactor.java    From depan with Apache License 2.0 6 votes vote down vote up
private PlatformObject[] buildHierarchyRoots(
    GraphModel master, Collection<GraphNode> nodes) {
  List<PlatformObject> staging = Lists.newArrayList();

  List<GraphNode> remains = Lists.newArrayList(nodes);

  Collection<GraphNode> collapseNodes = getCollapseTreeModel().computeNodes();
  if (!collapseNodes.isEmpty()) {
    staging.add(buildCollapseRoot());
    remains.removeAll(collapseNodes);
  }

  for (GraphEdgeMatcherDescriptor matcher : getTreeDescriptors()) {
    staging.add(buildTreeRoot(master, remains, matcher));
  }

  staging.add(buildRemainsRoot(remains));
  PlatformObject[] result = new PlatformObject[staging.size()];
  return staging.toArray(result);
}
 
Example #3
Source File: SCTSourceDisplay.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
protected IDebugTarget unwrapTarget(Object element) {
	if (element instanceof ILaunch) {
		return ((ILaunch) element).getDebugTarget();
	}
	if (element instanceof PlatformObject) {
		return ((PlatformObject) element).getAdapter(IDebugTarget.class);
	}
	return null;
}
 
Example #4
Source File: ViewEditor.java    From depan with Apache License 2.0 5 votes vote down vote up
/**
 * Provides the results for the 
 * {@link ViewEditorNodeViewerProvider#buildViewerRoots()}
 * this is returned by {@link #getNodeViewProvider()}.
 */
public ViewerRoot buildViewerRoot() {
  Collection<GraphNode> nodes = viewInfo.getViewNodes();
  PlatformObject[] roots = compactor.buildRoots(nodes);

  String label = buildNodeViewerLabel(roots.length, nodes.size());

  TreeViewerObject view = new TreeViewerObject(label, roots);
  return new ViewerRoot(new Object[] {view});
}
 
Example #5
Source File: NodeCompactor.java    From depan with Apache License 2.0 5 votes vote down vote up
private PlatformObject buildRemainsRoot(Collection<GraphNode> nodes) {
  TreeModel.Flat model = new TreeModel.Flat(nodes);
  GraphData<GraphNode> data = new GraphData<GraphNode>(
      NodeTreeProviders.GRAPH_NODE_PROVIDER, model);
  String label = MessageFormat.format("Solitaires [{0} nodes]", nodes.size());
  return new ActionRemainsRoot(data, label);
}
 
Example #6
Source File: NodeCompactor.java    From depan with Apache License 2.0 5 votes vote down vote up
private PlatformObject buildCollapseRoot() {

    CollapseTreeModel treeModel = getCollapseTreeModel();
    int rootCnt = treeModel.computeRoots().size();
    int nodeCnt = treeModel.computeNodes().size();

    String label = MessageFormat.format(
        "Collapse nodes [{0} roots, {1} nodes]", rootCnt, nodeCnt);
    return CollapseTreeRoot.build(
        label, treeModel, NodeTreeProviders.GRAPH_NODE_PROVIDER);
  }
 
Example #7
Source File: NodeListViewProvider.java    From depan with Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public PlatformObject buildViewerRoots() {
  List<PlatformObject> result = Lists.newArrayList();

  TreeModel.Flat model = new TreeModel.Flat(nodes);
  solo = new GraphData(provider, model);
  result.add(new SolitaryRoot(solo, listLabel));
  return new ViewerRoot(result.toArray());
}
 
Example #8
Source File: HighlightingSubmachineDecorationProvider.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
public void debugContextChanged(DebugContextEvent event) {
	if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
		PlatformObject object = (PlatformObject) ((IStructuredSelection) event.getContext()).getFirstElement();
		if (object == null)
			return;
		IDebugTarget newTarget = (IDebugTarget) object.getAdapter(IDebugTarget.class);
		if (newTarget != debugTarget && newTarget != null && !newTarget.isTerminated()) {
			debugTarget = newTarget;
		}
	}
}
 
Example #9
Source File: GraphNodeViewer.java    From depan with Apache License 2.0 4 votes vote down vote up
public void refresh() {
  PlatformObject treeRoots = provider.buildViewerRoots();
  treeViewer.setInput(treeRoots);
  provider.updateExpandState(treeViewer);
  treeViewer.refresh();
}
 
Example #10
Source File: TreeViewerObject.java    From depan with Apache License 2.0 4 votes vote down vote up
public PlatformObject[] getChildren() {
  return children;
}
 
Example #11
Source File: ActionableViewerObject.java    From depan with Apache License 2.0 4 votes vote down vote up
public ActionViewerObject(String name, PlatformObject[] children) {
  super(name, children);
}
 
Example #12
Source File: ActionableViewerObject.java    From depan with Apache License 2.0 4 votes vote down vote up
public ActionViewerObject(
    String name, PlatformObject parent, PlatformObject[] children) {
  super(name, parent, children);
}
 
Example #13
Source File: NodeCompactor.java    From depan with Apache License 2.0 4 votes vote down vote up
public PlatformObject[] buildRoots(Collection<GraphNode> nodes) {
  roots = buildHierarchyRoots(editor.getViewGraph(), nodes);
  return roots;
}
 
Example #14
Source File: TreeViewerObject.java    From depan with Apache License 2.0 4 votes vote down vote up
public PlatformObject getParent() {
  return parent;
}
 
Example #15
Source File: TreeViewerObject.java    From depan with Apache License 2.0 4 votes vote down vote up
public TreeViewerObject(
    String name, PlatformObject parent, PlatformObject[] children) {
  this.name = name;
  this.parent = parent;
  this.children = children;
}
 
Example #16
Source File: TreeViewerObject.java    From depan with Apache License 2.0 4 votes vote down vote up
public TreeViewerObject(String name, PlatformObject[] children) {
  this(name, null, children);
}
 
Example #17
Source File: TreeViewerObjectAdapter.java    From depan with Apache License 2.0 4 votes vote down vote up
private PlatformObject getParent(TreeViewerObject root) {
  return root.getParent();
}
 
Example #18
Source File: NodeViewerProvider.java    From depan with Apache License 2.0 votes vote down vote up
PlatformObject buildViewerRoots();