Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » In RAP Platform , how to create a login dialog?
In RAP Platform , how to create a login dialog? [message #758434] Wed, 23 November 2011 09:44 Go to next message
terry  is currently offline terry Friend
Messages: 6
Registered: November 2011
Junior Member
hellow dear,

The follow is my code,
Application class:

public Object start(IApplicationContext context) throws Exception {
Display display = PlatformUI.createDisplay();
// Entry Point Login
LoginDialog loginDialog = new LoginDialog(null);
int result = loginDialog.open();
if (result != Window.OK) {
return IApplication.EXIT_OK;
} else {
WorkbenchAdvisor advisor = new ApplicationWorkbenchAdvisor();
return PlatformUI.createAndRunWorkbench(display, advisor);
}
}
by using eclipse wtp3.3 create WAR product configuration,Export the file(.WAR)and logs.zip
logs.zip content:
1. ERROR in D:\work\eoffice\src\com\yidatec\eoffice\startup\Application.java (at line 22)
int result = loginDialog.open();
^^^^^^^^^^^
loginDialog cannot be resolved

I am waiting for you good news. I am Chinese,and just learning RAP for just a while.
Thank you first!!!

[Updated on: Wed, 23 November 2011 09:50]

Report message to a moderator

Re: In RAP Platform , how to create a login dialog? [message #758438 is a reply to message #758434] Wed, 23 November 2011 09:55 Go to previous messageGo to next message
marie Missing name is currently offline marie Missing nameFriend
Messages: 63
Registered: March 2011
Member
Hi terry,
You have to write your own login dialog class which extends dialog class.
Here is the example:

public class LoginDialog extends Dialog{

private Text m_userName_Text = null;
private Text m_userPassword_Text = null;
private String m_Title=null;
private String m_loginName=null;
private String m_password=null;

public LoginDialog(Shell parentShell, String title){
super(parentShell);
m_Title=title;
}
protected void configureShell(Shell shell) {
super.configureShell(shell);
if (m_Title != null){
shell.setText(m_Title);
}
}
protected Control createDialogArea(Composite parent){
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
composite.setLayout(layout);
createDialogAreaHelper(composite);
composite.pack();
return composite;
}
private void createDialogAreaHelper(Composite composite){
Label m_userName_Text_Label = new Label(composite, SWT.NONE );
m_userName_Text_Label.setText("User Name"+" : " );
GridData userNamedata = new GridData();
userNamedata.widthHint = 100;
m_userName_Text_Label.setLayoutData(userNamedata);
m_userName_Text = new Text(composite, SWT.SINGLE | SWT.BORDER);
userNamedata = new GridData();
userNamedata.widthHint = 243;
m_userName_Text.setLayoutData(userNamedata);
m_userName_Text.setText("username");

Label m_userPassword_Text_Label = new Label(composite, SWT.NONE );
m_userPassword_Text_Label.setText("Password"+" : " );
GridData passwordData = new GridData();
passwordData.widthHint = 100;
m_userPassword_Text_Label.setLayoutData(passwordData);
m_userPassword_Text = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD);
passwordData = new GridData();
passwordData.widthHint = 243;
m_userPassword_Text.setLayoutData(passwordData);
m_userPassword_Text.setEchoChar('*');
m_userPassword_Text.setText("password");

}catch(Exception e) {

return;
}
}

protected void okPressed(){
String userName = m_userName_Text.getText().trim();
String userPassword=m_userPassword_Text.getText().trim();


super.okPressed();
}
protected void enableDisableButtons(boolean enable) {
getButton(IDialogConstants.OK_ID).setEnabled(enable);
}


private boolean checkFileds(){

m_loginName = m_userName_Text.getText().trim();
m_password = m_userPassword_Text.getText().trim();

if(m_loginName.length() <= 0){

return false;
}

if(m_password.length() <= 0){

return false;
}

}
return true;
}
}


I hope this will help you
Smile

[Updated on: Wed, 23 November 2011 09:55]

Report message to a moderator

Re: In RAP Platform , how to create a login dialog? [message #758442 is a reply to message #758438] Wed, 23 November 2011 10:24 Go to previous message
terry  is currently offline terry Friend
Messages: 6
Registered: November 2011
Junior Member
By using eclipse wtp3.3 create WAR product configuration,Export the file(XXX.WAR) and one error come out
this is the @dit.log

# 11-11-23 18:09:30
# Eclipse Compiler for Java(TM) 0.B76_R37x, 3.7.1, Copyright IBM Corp 2000, 2011. All rights reserved.
----------
1. ERROR in D:\work\eoffice\src\com\yidatec\eoffice\startup\Application.java (at line 22)
}
^
Syntax error on token "}", { expected after this token
----------
2. ERROR in D:\work\eoffice\src\com\yidatec\eoffice\startup\Application.java (at line 24)
return PlatformUI.createAndRunWorkbench(display,
new ApplicationWorkbenchAdvisor());
}

public void stop() {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Syntax error on token(s), misplaced construct(s)
----------
3. ERROR in D:\work\eoffice\src\com\yidatec\eoffice\startup\Application.java (at line 26)
}
^
Syntax error on token "}", delete this token
----------
4. ERROR in D:\work\eoffice\src\com\yidatec\eoffice\startup\Application.java (at line 28)
public void stop() {
^^^^
Syntax error on token "void", @ expected
Previous Topic:Remote Debugging in RAP
Next Topic:by using eclipse wtp3.3 create WAR product configuration,export war file,one error occurs
Goto Forum:
  


Current Time: Mon Oct 25 11:58:51 GMT 2021

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

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

Back to the top