Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 93610 Details for
Bug 224116
Zest Graph throws IndexOutOfBoundsException when clearing selection after highlighting nodes and edges
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
Snippet to reproduce the prolem
GraphJFaceSnippet3.java (text/plain), 4.36 KB, created by
GianMaria Romanato
on 2008-03-26 10:52:00 EDT
(
hide
)
Description:
Snippet to reproduce the prolem
Filename:
MIME Type:
Creator:
GianMaria Romanato
Created:
2008-03-26 10:52:00 EDT
Size:
4.36 KB
patch
obsolete
>/******************************************************************************* > * Copyright 2005-2007, CHISEL Group, University of Victoria, Victoria, BC, Canada. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * > * Contributors: > * The Chisel Group, University of Victoria > *******************************************************************************/ >package org.eclipse.mylar.zest.examples.jface; > >import java.io.IOException; >import java.util.ArrayList; >import java.util.Iterator; >import java.util.StringTokenizer; > >import org.eclipse.jface.viewers.LabelProvider; >import org.eclipse.jface.viewers.Viewer; >import org.eclipse.swt.SWT; >import org.eclipse.swt.layout.FillLayout; >import org.eclipse.swt.widgets.Display; >import org.eclipse.swt.widgets.FileDialog; >import org.eclipse.swt.widgets.Shell; >import org.eclipse.zest.core.viewers.GraphViewer; >import org.eclipse.zest.core.viewers.IGraphContentProvider; >import org.eclipse.zest.core.widgets.GraphConnection; >import org.eclipse.zest.core.widgets.GraphNode; >import org.eclipse.zest.core.widgets.ZestStyles; >import org.eclipse.zest.layouts.LayoutStyles; >import org.eclipse.zest.layouts.algorithms.RadialLayoutAlgorithm; > >/** > * This snippet uses a very simple file format to read a graph. Edges are listed > * on a new line in a file as such: > * a calls b > * b calls c > * c calld d > * > * The content provider creates an edge for each line in the file and names the > * sources and destination from the line. > * > * > * @author Ian Bull > * > */ >public class GraphJFaceSnippet3 { > > public static final String graph = "a calls b\n" + "a calls c\n" + "b calld d\n" + "b calls e\n" + "c calls f\n" + "c calls g\n" + "d calls h\n" + "d calls i\n" + "e calls j\n" + "e calls k\n" + "f calls l\n" + "f calls m\n"; > > static class SimpleGraphContentProvider implements IGraphContentProvider { > > private StringTokenizer graph; > > public Object getDestination(Object rel) { > String string = (String) rel; > String[] parts = string.split(" "); > return parts[2]; > } > > public Object[] getElements(Object input) { > ArrayList listOfEdges = new ArrayList(); > while (graph.hasMoreTokens()) { > listOfEdges.add(graph.nextToken()); > } > return listOfEdges.toArray(); > } > > public Object getSource(Object rel) { > String string = (String) rel; > String[] parts = string.split(" "); > return parts[0]; > } > > public double getWeight(Object connection) { > return 0; > } > > public void dispose() { > > } > > public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { > if (newInput != null) { > graph = new StringTokenizer((String) newInput, "\n"); > } > } > > } > > public static void main(String[] args) throws IOException { > Display display = new Display(); > Shell shell = new Shell(display); > shell.setText("Simple Graph File Format"); > > FileDialog dialog = new FileDialog(shell, SWT.OPEN); > dialog.setFilterNames(new String[] { "Simple Graph Files (*.sgf)", "All Files (*.*)" }); > dialog.setFilterExtensions(new String[] { "*.sgf", "*.*" }); //Windows wild cards > > String directory = System.getProperty("user.dir"); > dialog.setFilterPath(directory); > > shell.setLayout(new FillLayout(SWT.VERTICAL)); > shell.setSize(400, 400); > GraphViewer viewer = null; > > viewer = new GraphViewer(shell, SWT.NONE); > viewer.setNodeStyle(ZestStyles.NODES_NO_LAYOUT_RESIZE); > viewer.setContentProvider(new SimpleGraphContentProvider()); > viewer.setLabelProvider(new LabelProvider()); > viewer.setLayoutAlgorithm(new RadialLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING)); > > shell.open(); > > // use the sample graph > viewer.setInput(graph); > for (Iterator iterator = viewer.getGraphControl().getNodes().iterator(); iterator.hasNext();) { > GraphNode node = (GraphNode) iterator.next(); > node.highlight(); > } > for (Iterator it = viewer.getGraphControl().getConnections().iterator(); it.hasNext();) { > GraphConnection conn = (GraphConnection) it.next(); > conn.highlight(); > } > > viewer.removeNode("a"); > > > > while (!shell.isDisposed()) { > if (!display.readAndDispatch()) { > display.sleep(); > } > } > display.dispose(); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 224116
: 93610 |
105132
|
105133