Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 65889 - Paste Java Source into the editor break down the Eclipse
Summary: Paste Java Source into the editor break down the Eclipse
Status: RESOLVED DUPLICATE of bug 44915
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.0   Edit
Hardware: PC Linux-GTK
: P3 blocker (vote)
Target Milestone: ---   Edit
Assignee: Veronika Irvine CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-05 22:32 EDT by Zhou Renjian CLA
Modified: 2004-06-14 14:02 EDT (History)
1 user (show)

See Also:


Attachments
thread dump (7.72 KB, text/plain)
2004-06-08 10:39 EDT, David Audel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zhou Renjian CLA 2004-06-05 22:32:33 EDT
I use the following steps to repeat the bug on 3.0RC1:
Create a java project with package swt.test, and make new class TableExample10.
And now go to   
http://www.uni-koblenz.de/~toaster/stuff/lego/swt_Examples.txt
and copy the "TableExample10" part of the java source code. 
And now switch to "TableExample10" editor, and select all of the codes. NOW,
pressing "Ctrl+V" or selecting "Paste" from the contextmenu will break down the
Eclipse.
Mind that copy other part of the java source code (e.g. TableExample1) can not
repeat the bug.

This bug is found in 3.0M9 and 3.0RC1. Not only pasting TableExample10 from
browser(Mozzila1.6) but also pasting some certain source from 3.0M7 into 3.0M9
will break down the Eclipse. 

Not all of the pasting source actions will break down the Eclipse, but some
certain Java source does. (I met with this problem 3-4 times.)

I am using Mandrake, and Mozilla 1.6.
Comment 1 Zhou Renjian CLA 2004-06-05 22:36:34 EDT
I try to kill the java process in order to terminate the Eclipse. The eclipse
give the Exit error message:

JVM terminated. Exit code=143
/home/zhourj/bin/java/bin/java
-cp /home/zhourj/eclipse-test/eclipse/./startup.jar org.eclipse.core.launcher.Main
-os linux
-ws gtk
-arch x86
-showsplash /home/zhourj/eclipse-test/eclipse/./eclipse -showsplash 600
-exitdata /home/zhourj/eclipse-test/eclipse/./eclipse -exitdata 25801b
-vm /home/zhourj/bin/java/bin/java
-vmargs
-cp /home/zhourj/eclipse-test/eclipse/./startup.jar org.eclipse.core.launcher.Main 

and I can not find any error in the log (I use a new workspace to test this bug
and no log file is created)


And the TableExample10 class' source is :

package swt.test;
import java.io.File;
import java.text.DateFormat;
import java.util.Date;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TableLayout;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
/** Show files, render checkbox */
public class TableExample10 {
public static void main(String[] args) {
new TableExample10().run();
}
void run() {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
shell.setSize(600, 500);
TabFolder tabFolder = new TabFolder(shell, SWT.NONE);
TabItem tabItem1 = new TabItem(tabFolder, SWT.NONE);
tabItem1.setText("Tab 1");
TabItem tabItem2 = new TabItem(tabFolder, SWT.NONE);
tabItem2.setText("Tab 2");
TabItem tabItem3 = new TabItem(tabFolder, SWT.NONE);
tabItem3.setText("Tab 3");
Table table =
new Table(
tabFolder,
SWT.CHECK | SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
table.setHeaderVisible(true);
table.setLinesVisible(true);
tabItem1.setControl(table);
TableColumn col1 = new TableColumn(table, SWT.NONE);
col1.setText("Name");
TableColumn col2 = new TableColumn(table, SWT.NONE);
col2.setText("Size");
TableColumn col3 = new TableColumn(table, SWT.NONE);
col3.setText("Date");
TableLayout layout = new TableLayout();
layout.addColumnData(new ColumnWeightData(33));
layout.addColumnData(new ColumnWeightData(33));
layout.addColumnData(new ColumnWeightData(33));
table.setLayout(layout);
final CheckboxTableViewer viewer = new CheckboxTableViewer(table);
viewer.setContentProvider(new TestContentProvider());
viewer.setLabelProvider(new TestLabelProvider());
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection sel =
(IStructuredSelection) event.getSelection();
System.out.println(
sel.size()
+ " items selected, "
+ viewer.getCheckedElements().length
+ " items checked");
}
});
viewer.setInput(new File("/"));
Label dummy1 = new Label(tabFolder, SWT.NONE);
dummy1.setText("Nothing here.");
tabItem2.setControl(dummy1);
Label dummy2 = new Label(tabFolder, SWT.NONE);
dummy2.setText("Nothing here either.");
tabItem3.setControl(dummy2);
shell.setVisible(true);
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
class TestContentProvider implements IStructuredContentProvider {
public Object[] getElements(Object input) {
if (input instanceof File) {
File dir = (File) input;
String[] names = dir.list();
if (names != null) {
File[] files = new File[names.length];
for (int i = 0; i < names.length; i++)
files[i] = new File(dir, names[i]);
return files;
}
}
return new File[0];
}
public void inputChanged(
Viewer viewer,
Object oldInput,
Object newInput) {
// don't need to hang onto input for this example, so do nothing
}
public void dispose() {
}
}
class TestLabelProvider
extends LabelProvider
implements ITableLabelProvider {
DateFormat dateFormat = DateFormat.getInstance();
public String getColumnText(Object element, int columnIndex) {
File file = (File) element;
switch (columnIndex) {
case 0 :
return file.getName();
case 1 :
return file.isDirectory()
? ""
: ((file.length() + 1023) / 1024) + " KB ";
case 2 :
Date date = new Date(file.lastModified());
return dateFormat.format(date);
default :
return "";
}
}
public Image getColumnImage(Object element, int columnIndex) {
return null;
}
}
}
Comment 2 David Audel CLA 2004-06-08 10:37:46 EDT
I cannot reproduce the problem with Windows
I can reproduce the problem with Linux-GTK
Comment 3 David Audel CLA 2004-06-08 10:39:19 EDT
Created attachment 11729 [details]
thread dump
Comment 4 David Audel CLA 2004-06-08 11:17:48 EDT
The problem seems to be inside 
org.eclipse.swt.internal.gtk.OS.gtk_clipboard_wait_for_contents(Native 
Method). A very long time is spend inside this method.

If i wait a long time (>15 min) then eclipse stop to freeze but the editor 
does not contain the pasted source (only the original source).

My linux computer is a PIII with ram 128mo 

Move to SWT
Comment 5 Steve Northover CLA 2004-06-08 14:09:29 EDT
Vikki, is this a dup of the dreaded GTK event eating?
Comment 6 Veronika Irvine CLA 2004-06-08 15:16:55 EDT
I think this is a duplicate of bug 63991.  This was fixed in I20040604.  I 
will confirm that this problem does not occur in the latest build and close 
this bug report as a duplicate.
Comment 7 Steve Northover CLA 2004-06-14 14:02:30 EDT
This looks like the hang that we are investigating in bug 44915.

*** This bug has been marked as a duplicate of 44915 ***