Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » Parsing Stopped working for simple visual class
Parsing Stopped working for simple visual class [message #613401] Fri, 23 June 2006 14:02
Harel Ben Attia is currently offline Harel Ben AttiaFriend
Messages: 10
Registered: July 2009
Junior Member
Hi,

I'm trying to create a visual class for a connect dialog. Everything was
fine until a few days ago. At some point, the visual representation of the
window stopped being displayed correctly. It sometimes only shows a "this"
icon. On other occasions it shows the shell window itself, but it's empty,
and the buttons are to the side of the window (not on the window itself)
etc. I've tried cleaning the caches and stuff, but it doesn't seem to work.
At runtime, everything runs correctly.

Does anyone have any idea how to fix this ?

Thanks
RL


here is the source code for the class (a very simple one):



import java.net.InetAddress;

import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Button;

import sun.net.util.IPAddressUtil;

public class ConnectDialogForm {

private Display display;

private Results results;

private Shell sShell = null; //
@jve:decl-index=0:visual-constraint="14,10"
private Label label = null;
private Label label1 = null;
private Text txtIPAddress = null;
private Text txtPort = null;
private Button btnOK = null;
private Button btnCancel = null;

private Label txtMessage = null;

/**
* This method initializes sShell
*/
private void createSShell() {
sShell = new Shell(SWT.APPLICATION_MODAL | SWT.SHELL_TRIM);
sShell.setText("Shell");
sShell.setSize(new org.eclipse.swt.graphics.Point(336,133));
sShell.addShellListener(new org.eclipse.swt.events.ShellAdapter() {
public void shellClosed(org.eclipse.swt.events.ShellEvent e) {
onCancel();
}
});
label = new Label(sShell, SWT.NONE);
label.setBounds(new org.eclipse.swt.graphics.Rectangle(11,14,69,17));
label.setText("IP Address");
label1 = new Label(sShell, SWT.NONE);
label1.setBounds(new org.eclipse.swt.graphics.Rectangle(11,42,71,19));
label1.setText("Port");
txtIPAddress = new Text(sShell, SWT.BORDER);
txtIPAddress.setBounds(new
org.eclipse.swt.graphics.Rectangle(101,14,123,17));
txtPort = new Text(sShell, SWT.BORDER);
txtPort.setBounds(new org.eclipse.swt.graphics.Rectangle(100,45,126,17));
txtMessage = new Label(sShell, SWT.CENTER);
txtMessage.setBounds(new
org.eclipse.swt.graphics.Rectangle(11,74,302,18));
txtMessage.setText("Enter the IP address and port of the UniLoader
server");
btnOK = new Button(sShell, SWT.NONE | SWT.DEFAULT);
btnOK.setBounds(new org.eclipse.swt.graphics.Rectangle(238,7,81,25));
btnOK.setText("&OK");
btnOK.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
onOK();
}
});
btnCancel = new Button(sShell, SWT.NONE);
btnCancel.setBounds(new org.eclipse.swt.graphics.Rectangle(236,38,85,27));
btnCancel.setText("&Cancel");
btnCancel.addSelectionListener(new
org.eclipse.swt.events.SelectionAdapter() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
onCancel();
}
});
}

public void init() {
display = Display.getDefault();
createSShell();
}

public void display() {
sShell.open();

while (!sShell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}

public Results getResults() {
return this.results;
}

public void onOK() {
// verify ip address
byte[] bytes =
IPAddressUtil.textToNumericFormatV4(txtIPAddress.getText());
// get port number
int port = Integer.parseInt(txtPort.getText());

// if values are legal,
if ((bytes != null) && (port > 0) && (port < 65535)) {
// save them and dispose of the window
results = new Results(txtIPAddress.getText(),txtPort.getText());
sShell.dispose();
}
else {
txtMessage.setText("IP address is illegal or port is not in the range
1-65535.");
}
}

public void onCancel() {
results = null;
sShell.dispose();
}

public class Results {
String ipAddress;
String port;

public Results(String ipAddress,String port) {
this.ipAddress = ipAddress;
this.port = port;
}
}

}
Previous Topic:Create a new Java Visual Class - SWT Shell
Next Topic:adding a new "tool" to the palette
Goto Forum:
  


Current Time: Fri Apr 19 00:01:39 GMT 2024

Powered by FUDForum. Page generated in 0.13031 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top