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 114855 Details for
Bug 244387
Memory leak when adding/removing filters
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.
test case
clipboard.txt (text/plain), 4.28 KB, created by
Ian Bull
on 2008-10-10 18:54:18 EDT
(
hide
)
Description:
test case
Filename:
MIME Type:
Creator:
Ian Bull
Created:
2008-10-10 18:54:18 EDT
Size:
4.28 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.zest.tests.jface; > >import org.eclipse.jface.viewers.ISelection; >import org.eclipse.jface.viewers.ISelectionChangedListener; >import org.eclipse.jface.viewers.LabelProvider; >import org.eclipse.jface.viewers.SelectionChangedEvent; >import org.eclipse.jface.viewers.Viewer; >import org.eclipse.jface.viewers.ViewerFilter; >import org.eclipse.zest.layouts.LayoutStyles; >import org.eclipse.zest.layouts.algorithms.GridLayoutAlgorithm; >import org.eclipse.zest.layouts.algorithms.SpringLayoutAlgorithm; >import org.eclipse.zest.core.viewers.GraphViewer; >import org.eclipse.zest.core.viewers.IGraphEntityContentProvider; >import org.eclipse.swt.SWT; >import org.eclipse.swt.events.SelectionAdapter; >import org.eclipse.swt.events.SelectionEvent; >import org.eclipse.swt.graphics.Image; >import org.eclipse.swt.layout.FillLayout; >import org.eclipse.swt.widgets.Button; >import org.eclipse.swt.widgets.Display; >import org.eclipse.swt.widgets.Shell; > >/** > * This snippet shows how to use the IGraphEntityContentProvider to build a graph. > * @author Ian Bull > * > */ >public class GraphJFaceSnippet1 { > > /** > * The Content Provider > * @author irbull > * > */ > static class MyContentProvider implements IGraphEntityContentProvider { > > public Object[] getConnectedTo(Object entity) { > if (entity.equals("First")) { > return new Object[] { "Second" }; > } > if (entity.equals("Second")) { > return new Object[] { "Third" }; > } > if (entity.equals("Third")) { > return new Object[] { "First" }; > } > return null; > } > > public Object[] getElements(Object inputElement) { > String[] nodes = new String[2000]; > for ( int i = 0; i< 2000; i++) { > nodes[i] = "" + i; > } > //return new String[] { "First", "Second", "Third" }; > return nodes; > } > > public double getWeight(Object entity1, Object entity2) { > return 0; > } > > public void dispose() { > > } > > public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { > > } > } > > static class MyLabelProvider extends LabelProvider { > final Image image = Display.getDefault().getSystemImage(SWT.ICON_WARNING); > > public Image getImage(Object element) { > if (element instanceof String) { > return image; > } > return null; > } > > public String getText(Object element) { > if (element instanceof String) { > return element.toString(); > } > return null; > } > > } > > static GraphViewer viewer = null; > > /** > * @param args > */ > public static void main(String[] args) { > Display d = new Display(); > Shell shell = new Shell(d); > shell.setLayout(new FillLayout(SWT.VERTICAL)); > shell.setSize(400, 400); > Button button = new Button(shell, SWT.PUSH); > button.setText("Reload"); > button.addSelectionListener(new SelectionAdapter() { > > public void widgetSelected(SelectionEvent e) { > viewer.setInput(new Object()); > } > > }); > viewer = new GraphViewer(shell, SWT.NONE); > > viewer.setContentProvider(new MyContentProvider()); > viewer.setLabelProvider(new MyLabelProvider()); > viewer.setLayoutAlgorithm(new GridLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING)); > viewer.addSelectionChangedListener(new ISelectionChangedListener() { > public void selectionChanged(SelectionChangedEvent event) { > System.out.println("Selection changed: " + (event.getSelection())); > } > > }); > viewer.setInput(new Object()); > > for ( int i = 0; i < 100; i++ ) { > ViewerFilter fv = new ViewerFilter() { > public boolean select(Viewer viewer, Object parentElement, Object element) { > return true; > } > }; > viewer.addFilter(fv); > viewer.removeFilter(fv); > } > > shell.open(); > while (!shell.isDisposed()) { > while (!d.readAndDispatch()) { > d.sleep(); > } > } > > } >}
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 244387
:
110185
| 114855