Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[pde-dev] Re: pde-dev digest, Vol 1 #148 - 1 msg

Hi Steven,

 Create the plug-in by using org.eclipse.ui.actionSet.
 There is a exaple in Eclipse Help, PDE Guide.

 Then Edit the plugin.xml file as follows:

 - Change "action" element property called "toolbarPath"
 Sample code:
         <action
               label="&amp;Web Servise"
               icon="icon/sample.jpg"
               class="org.apache.axis.wsdl.wsdl2ws.WSDL2WsGUI"
               toolbarPath="asa"  //Give any name as value
               id="com.example.wsdl2ws.action1">
         </action>

Chatura Gunawardana
(Sri Lanka)


> Send pde-dev mailing list submissions to
> 	pde-dev@xxxxxxxxxxx
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://dev.eclipse.org/mailman/listinfo/pde-dev
> or, via email, send a message with subject or body 'help' to
> 	pde-dev-request@xxxxxxxxxxx
>
> You can reach the person managing the list at
> 	pde-dev-admin@xxxxxxxxxxx
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of pde-dev digest..."
>
>
> Today's Topics:
>
>    1. To make login window as a plugin,pls reply (Steven Sequeira)
>
> --__--__--
>
> Message: 1
> From: "Steven Sequeira" <ssequeira@xxxxxxxxx>
> To: "swt list" <platform-swt-dev@xxxxxxxxxxx>,
> 	"eclipse plugin" <pde-dev@xxxxxxxxxxx>,
> 	<platform-swt-dev-request@xxxxxxxxxxx>
> Date: Tue, 25 May 2004 20:06:08 +0530
> Subject: [pde-dev] To make login window as a plugin,pls reply
> Reply-To: pde-dev@xxxxxxxxxxx
>
> This is a multi-part message in MIME format.
>
> ------=_NextPart_000_002D_01C44293.B807EF50
> Content-Type: text/plain;
> 	charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
>
> Hi all, I have a login window that has simple user id and password field =
> with corresponding text boxes implementesd in pure swt.Now i want to put =
> it as a plugin(toolbar button) so that on pressing it i will get the =
> login window.I just want to explore these things ,as iam new to eclipse =
> plugin progrraming
>
>     My code has 3 classes
> 1.Login class,that has get,set methods for fields userid,password,button =
> pressed
> 2.Logindialog class that will display a window.
> 3.Main class.
>
> 1. public class Login {
>    String id;
>  String password;
>  boolean buttonResponse;
>
> public Login(){}
>
> public boolean getButtonResponse() {
>
> return buttonResponse;}
>
> public void setButtonResponse(boolean b){
>
> buttonResponse =3D b;}
>
> public String getID()
>
> {return id;}
>
> public void setID(String id){
>
> this.id =3D id;}
>
> public String getPassword(){
>
> return password;}
>
> public void setPassword(String password){
>
> this.password =3D password;}}
>
> 2.
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.widgets.*;i
> import org.eclipse.swt.graphics.*;
>
> public class Logindialog extends Dialog {
> private Text idText;
>
> private Text passwordText;
>
> private Button btnOK;
>
> private Button btnCancel;
>
> private Login login;
>
>
> Logindialog(Shell arg0) {super(arg0);}
>
> public Login open(){
>
> login =3D new Login();
>
> final Shell shell =3D new Shell(getParent(),SWT.DIALOG_TRIM | =
> SWT.APPLICATION_MODAL);
>
> shell.setText(getText());shell.setSize(400,200);Label label1 =3D new =
> Label(shell,SWT.NONE);
>
> label1.setSize(400,50);label1.setLocation(0,0);
>
> label1.setAlignment(SWT.CENTER);label1.setText("\nWelcome to my program. =
> \n please login");
>
> label1.setBackground(new Color(shell.getDisplay(),255,255,255));
>
>
> Label label2 =3D new Label(shell,SWT.NONE);label2.setSize(70,10);
>
> label2.setLocation(20,63);label2.setAlignment(SWT.RIGHT);=20
>
> label2.setText("ID :");idText =3D new Text(shell,SWT.BORDER);
>
> idText.setTextLimit(30);idText.setBounds(100,60,200,20);
>
>
> Label label3 =3D new Label(shell,SWT.NONE);label3.setSize(70,10);
>
> label3.setLocation(20,93);label3.setAlignment(SWT.RIGHT);=20
>
> label3.setText("Password :");passwordText =3D new =
> Text(shell,SWT.BORDER);
>
> passwordText.setTextLimit(30);passwordText.setBounds(100,90,200,20);
>
> passwordText.setEchoChar('*');btnOK =3D new Button(shell,SWT.PUSH);
>
> btnOK.setText("Login");btnOK.setLocation(110,130);
>
> btnOK.setSize(80,20);btnCancel =3D new Button(shell,SWT.PUSH);
>
> btnCancel.setText("Cancel");btnCancel.setLocation(210,130);
>
> btnCancel.setSize(80,20);=20
>
>
> Listener listener =3D new Listener(){
>
> public void handleEvent(Event event){
>
> login.setButtonResponse(event.widget=3D=3DbtnOK);
>
> login.setID(idText.getText());
>
> login.setPassword(passwordText.getText());shell.close();}};
>
> btnOK.addListener(SWT.Selection,listener);
>
> btnCancel.addListener(SWT.Selection,listener);
>
> Display display =3D getParent().getDisplay();
>
> Rectangle rect =3D display.getBounds();
>
> int mx =3D rect.width/2;
>
> int my =3D rect.height/2;
>
> shell.setLocation(mx-200,my-100);
>
> shell.open();
>
>
> while(!shell.isDisposed()){
>
> if(!display.readAndDispatch()) display.sleep();
>
> }
>
> return login;
>
> }
>
> }
>
> 3.Main class
> import org.eclipse.swt.SWT;import org.eclipse.swt.widgets.*;import =
> org.eclipse.swt.graphics.*;
>
> public class Main {
>
> public static void main(String args[]){
>
> Display display=3D new Display();
>
> final Shell sh =3D new Shell(display);
>
> Logindialog dialog =3D new Logindialog(sh);Login login =3D =
> dialog.open();
>
> MessageBox msg =3D new MessageBox(sh,SWT.OK);
>
> if(login.getButtonResponse()) {
>
> msg.setMessage("Your id is:"+login.getID()+"\nYour Password is =
> :"+login.getPassword());
>
> msg.open();
>
>
> while(!sh.isDisposed()) {
>
> if(!display.readAndDispatch()) display.sleep();
>
> }}
>
> display.dispose(); }}
>
>
> Regards,
> Steven Sequeira
>
> ------=_NextPart_000_002D_01C44293.B807EF50
> Content-Type: text/html;
> 	charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META http-equiv=3DContent-Type content=3D"text/html; =
> charset=3Diso-8859-1">
> <META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
> <STYLE></STYLE>
> </HEAD>
> <BODY bgColor=3D#ffffff>
> <DIV><FONT face=3DArial size=3D2>Hi all, I have a login window that has =
> simple user=20
> id and password field with corresponding text boxes implementesd in pure =
> swt.Now=20
> i want to put it as a plugin(toolbar button) so that on pressing it i =
> will get=20
> the login window.I just want to explore these things ,as iam new to =
> eclipse=20
> plugin progrraming</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; My code has 3=20
> classes</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>1.Login class,that has get,set methods =
> for fields=20
> userid,password,button pressed</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>2.Logindialog class that will display a =
>
> window.</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>3.Main class.</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3DArial size=3D2>1. <B><FONT color=3D#7f0055=20
> size=3D2>public</B></FONT><FONT size=3D2> </FONT><B><FONT =
> color=3D#7f0055=20
> size=3D2>class</B></FONT><FONT size=3D2> Login {</FONT></FONT></DIV>
> <DIV><FONT face=3DArial size=3D2><FONT size=3D2>&nbsp;&nbsp; String=20
> id;</FONT></FONT></DIV>
> <DIV><FONT face=3DArial size=3D2><FONT size=3D2>&nbsp;String=20
> password;</FONT></FONT></DIV>
> <DIV><FONT face=3DArial><FONT size=3D2>&nbsp;<B><FONT=20
> color=3D#7f0055>boolean</B></FONT></FONT><FONT size=3D2>=20
> buttonResponse;</FONT></DIV>
> <P><FONT size=3D2></FONT></P>
> <P><B><FONT color=3D#7f0055><FONT size=3D2>public</FONT></B></FONT><FONT =
> size=3D2>=20
> Login(){}</FONT></P>
> <P><B><FONT color=3D#7f0055><FONT size=3D2>public</FONT></B></FONT><FONT =
> size=3D2>=20
> <B><FONT color=3D#7f0055>boolean</B></FONT></FONT><FONT size=3D2>=20
> getButtonResponse() {</FONT></P>
> <P><B><FONT color=3D#7f0055><FONT size=3D2>return</FONT></B></FONT><FONT =
> size=3D2>=20
> buttonResponse;}</FONT></P>
> <P><B><FONT color=3D#7f0055><FONT size=3D2>public</FONT></B></FONT><FONT =
> size=3D2>=20
> <B><FONT color=3D#7f0055>void</B></FONT></FONT><FONT size=3D2>=20
> setButtonResponse(<B><FONT =
> color=3D#7f0055>boolean</B></FONT></FONT><FONT size=3D2>=20
> b){</FONT></P>
> <P><FONT size=3D2>buttonResponse =3D b;</FONT><FONT =
> size=3D2>}</FONT></P>
> <P><B><FONT color=3D#7f0055><FONT size=3D2>public</FONT></B></FONT><FONT =
> size=3D2>=20
> String getID()</FONT></P>
> <P><FONT size=3D2>{<B><FONT =
> color=3D#7f0055>return</B></FONT></FONT><FONT size=3D2>=20
> id;</FONT><FONT size=3D2>}</FONT></P>
> <P><B><FONT color=3D#7f0055><FONT size=3D2>public</FONT></B></FONT><FONT =
> size=3D2>=20
> <B><FONT color=3D#7f0055>void</B></FONT></FONT><FONT size=3D2> =
> setID(String=20
> id){</FONT></P>
> <P><B><FONT color=3D#7f0055><FONT size=3D2>this</FONT></B></FONT><FONT =
> size=3D2>.id =3D=20
> id;</FONT><FONT size=3D2>}</FONT></P>
> <P><B><FONT color=3D#7f0055><FONT size=3D2>public</FONT></B></FONT><FONT =
> size=3D2>=20
> String getPassword(){</FONT></P>
> <P><B><FONT color=3D#7f0055><FONT size=3D2>return</FONT></B></FONT><FONT =
> size=3D2>=20
> password;</FONT><FONT size=3D2>}</FONT></P>
> <P><B><FONT color=3D#7f0055><FONT size=3D2>public</FONT></B></FONT><FONT =
> size=3D2>=20
> <B><FONT color=3D#7f0055>void</B></FONT></FONT><FONT size=3D2> =
> setPassword(String=20
> password){</FONT></P>
> <P><B><FONT color=3D#7f0055><FONT size=3D2>this</FONT></B></FONT><FONT=20
> size=3D2>.password =3D password;}}</FONT></P></FONT>
> <DIV><FONT face=3DArial size=3D2>2.</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2><B><FONT color=3D#7f0055=20
> size=3D2>import</B></FONT><FONT size=3D2> =
> org.eclipse.swt.SWT;</FONT></FONT></DIV>
> <DIV><FONT face=3DArial size=3D2><B><FONT color=3D#7f0055=20
> size=3D2>import</B></FONT><FONT size=3D2>=20
> org.eclipse.swt.widgets.*;i</FONT></FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>i<B><FONT color=3D#7f0055=20
> size=3D2>mport</B></FONT><FONT size=3D2>=20
> org.eclipse.swt.graphics.*;</FONT></FONT></DIV>
> <DIV><FONT face=3DArial size=3D2><B><FONT color=3D#7f0055=20
> size=3D2></FONT></B></FONT>&nbsp;</DIV>
> <DIV><FONT face=3DArial size=3D2><B><FONT color=3D#7f0055=20
> size=3D2>public</B></FONT><FONT size=3D2> </FONT><B><FONT =
> color=3D#7f0055=20
> size=3D2>class</B></FONT><FONT size=3D2> Logindialog </FONT><B><FONT =
> color=3D#7f0055=20
> size=3D2>extends</B></FONT><FONT size=3D2> Dialog {</DIV>
> <P></FONT><B><FONT color=3D#7f0055 size=3D2>private</B></FONT><FONT =
> size=3D2> Text=20
> idText;</P>
> <P></FONT><B><FONT color=3D#7f0055 size=3D2>private</B></FONT><FONT =
> size=3D2> Text=20
> passwordText;</P>
> <P></FONT><B><FONT color=3D#7f0055 size=3D2>private</B></FONT><FONT =
> size=3D2> Button=20
> btnOK;</P>
> <P></FONT><B><FONT color=3D#7f0055 size=3D2>private</B></FONT><FONT =
> size=3D2> Button=20
> btnCancel;</P>
> <P></FONT><B><FONT color=3D#7f0055 size=3D2>private</B></FONT><FONT =
> size=3D2> Login=20
> login;</P>
> <P></P>
> <P>Logindialog(Shell arg0) {</FONT><B><FONT color=3D#7f0055=20
> size=3D2>super</B></FONT><FONT size=3D2>(arg0);}</P>
> <P></FONT><B><FONT color=3D#7f0055 size=3D2>public</B></FONT><FONT =
> size=3D2> Login=20
> open(){</FONT></P>
> <P><FONT size=3D2>login =3D </FONT><B><FONT color=3D#7f0055 =
> size=3D2>new</B></FONT><FONT=20
> size=3D2> Login();</P>
> <P></FONT><B><FONT color=3D#7f0055 size=3D2>final</B></FONT><FONT =
> size=3D2> Shell=20
> shell =3D </FONT><B><FONT color=3D#7f0055 size=3D2>new</B></FONT><FONT =
> size=3D2>=20
> Shell(getParent(),SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);</P>
> <P>shell.setText(getText());shell.setSize(400,200);Label label1 =3D=20
> </FONT><B><FONT color=3D#7f0055 size=3D2>new</B></FONT><FONT size=3D2>=20
> Label(shell,SWT.NONE);</P>
> <P>label1.setSize(400,50);label1.setLocation(0,0);</P>
> <P>label1.setAlignment(SWT.CENTER);label1.setText(</FONT><FONT =
> color=3D#2a00ff=20
> size=3D2>"\nWelcome to my program. \n please login"</FONT><FONT =
> size=3D2>);</P>
> <P>label1.setBackground(</FONT><B><FONT color=3D#7f0055 =
> size=3D2>new</B></FONT><FONT=20
> size=3D2> Color(shell.getDisplay(),255,255,255));</P>
> <P></P>
> <P>Label label2 =3D </FONT><B><FONT color=3D#7f0055 =
> size=3D2>new</B></FONT><FONT=20
> size=3D2> Label(shell,SWT.NONE);label2.setSize(70,10);</P>
> <P>label2.setLocation(20,63);label2.setAlignment(SWT.RIGHT); </P>
> <P>label2.setText(</FONT><FONT color=3D#2a00ff size=3D2>"ID =
> :"</FONT><FONT=20
> size=3D2>);idText =3D </FONT><B><FONT color=3D#7f0055 =
> size=3D2>new</B></FONT><FONT=20
> size=3D2> Text(shell,SWT.BORDER);</P>
> <P>idText.setTextLimit(30);</FONT><FONT=20
> size=3D2>idText.setBounds(100,60,200,20);</P>
> <P></P>
> <P>Label label3 =3D </FONT><B><FONT color=3D#7f0055 =
> size=3D2>new</B></FONT><FONT=20
> size=3D2> Label(shell,SWT.NONE);label3.setSize(70,10);</P>
> <P>label3.setLocation(20,93);label3.setAlignment(SWT.RIGHT); </P>
> <P>label3.setText(</FONT><FONT color=3D#2a00ff size=3D2>"Password =
> :"</FONT><FONT=20
> size=3D2>);passwordText =3D </FONT><B><FONT color=3D#7f0055 =
> size=3D2>new</B></FONT><FONT=20
> size=3D2> Text(shell,SWT.BORDER);</P>
> <P>passwordText.setTextLimit(30);</FONT><FONT=20
> size=3D2>passwordText.setBounds(100,90,200,20);</P>
> <P>passwordText.setEchoChar(</FONT><FONT color=3D#2a00ff =
> size=3D2>'*'</FONT><FONT=20
> size=3D2>);btnOK =3D </FONT><B><FONT color=3D#7f0055 =
> size=3D2>new</B></FONT><FONT=20
> size=3D2> Button(shell,SWT.PUSH);</P>
> <P>btnOK.setText(</FONT><FONT color=3D#2a00ff =
> size=3D2>"Login"</FONT><FONT=20
> size=3D2>);btnOK.setLocation(110,130);</P>
> <P>btnOK.setSize(80,20);btnCancel =3D </FONT><B><FONT color=3D#7f0055=20
> size=3D2>new</B></FONT><FONT size=3D2> =
> Button(shell,SWT.PUSH);</FONT></P>
> <P><FONT size=3D2>btnCancel.setText(</FONT><FONT color=3D#2a00ff=20
> size=3D2>"Cancel"</FONT><FONT =
> size=3D2>);btnCancel.setLocation(210,130);</P>
> <P>btnCancel.setSize(80,20); </P>
> <P></P>
> <P>Listener listener =3D </FONT><B><FONT color=3D#7f0055 =
> size=3D2>new</B></FONT><FONT=20
> size=3D2> Listener(){</P>
> <P></FONT><B><FONT color=3D#7f0055 size=3D2>public</B></FONT><FONT =
> size=3D2>=20
> </FONT><B><FONT color=3D#7f0055 size=3D2>void</B></FONT><FONT size=3D2>=20
> handleEvent(Event event){</P>
> <P>login.setButtonResponse(event.widget=3D=3DbtnOK);</P>
> <P>login.setID(idText.getText());</P>
> <P>login.setPassword(passwordText.getText());shell.close();}};</P>
> <P>btnOK.addListener(SWT.Selection,listener);</P>
> <P>btnCancel.addListener(SWT.Selection,listener);</P>
> <P>Display display =3D getParent().getDisplay();</P>
> <P>Rectangle rect =3D display.getBounds();</P>
> <P></FONT><B><FONT color=3D#7f0055 size=3D2>int</B></FONT><FONT =
> size=3D2> mx =3D=20
> rect.width/2;</P>
> <P></FONT><B><FONT color=3D#7f0055 size=3D2>int</B></FONT><FONT =
> size=3D2> my =3D=20
> rect.height/2;</P>
> <P>shell.setLocation(mx-200,my-100);</P>
> <P>shell.open();</P>
> <P></P>
> <P></FONT><B><FONT color=3D#7f0055 size=3D2>while</B></FONT><FONT=20
> size=3D2>(!shell.isDisposed()){</P>
> <P></FONT><B><FONT color=3D#7f0055 size=3D2>if</B></FONT><FONT=20
> size=3D2>(!display.readAndDispatch()) display.sleep();</P>
> <P>}</P>
> <P></FONT><B><FONT color=3D#7f0055 size=3D2>return</B></FONT><FONT =
> size=3D2>=20
> login;</P>
> <P>}</P>
> <P>}</P></FONT></FONT>
> <DIV><FONT face=3DArial size=3D2>3.Main class</FONT></DIV>
> <DIV><B><FONT color=3D#7f0055 size=3D2>
> <P>import</B></FONT><FONT size=3D2> org.eclipse.swt.SWT;</FONT><B><FONT=20
> color=3D#7f0055 size=3D2>import</B></FONT><FONT size=3D2>=20
> org.eclipse.swt.widgets.*;</FONT><B><FONT color=3D#7f0055=20
> size=3D2>import</B></FONT><FONT size=3D2>=20
> org.eclipse.swt.graphics.*;</P></FONT><B><FONT color=3D#7f0055 size=3D2>
> <P>public</B></FONT><FONT size=3D2> </FONT><B><FONT color=3D#7f0055=20
> size=3D2>class</B></FONT><FONT size=3D2> Main {</P>
> <P></FONT><B><FONT color=3D#7f0055 size=3D2>public</B></FONT><FONT =
> size=3D2>=20
> </FONT><B><FONT color=3D#7f0055 size=3D2>static</B></FONT><FONT =
> size=3D2>=20
> </FONT><B><FONT color=3D#7f0055 size=3D2>void</B></FONT><FONT size=3D2> =
> main(String=20
> args[]){</P>
> <P>Display display=3D </FONT><B><FONT color=3D#7f0055 =
> size=3D2>new</B></FONT><FONT=20
> size=3D2> Display();</P>
> <P></FONT><B><FONT color=3D#7f0055 size=3D2>final</B></FONT><FONT =
> size=3D2> Shell sh =3D=20
> </FONT><B><FONT color=3D#7f0055 size=3D2>new</B></FONT><FONT size=3D2>=20
> Shell(display);</P>
> <P>Logindialog dialog =3D </FONT><B><FONT color=3D#7f0055 =
> size=3D2>new</B></FONT><FONT=20
> size=3D2> Logindialog(sh);Login login =3D dialog.open();</P>
> <P>MessageBox msg =3D </FONT><B><FONT color=3D#7f0055 =
> size=3D2>new</B></FONT><FONT=20
> size=3D2> MessageBox(sh,SWT.OK);</FONT></P>
> <P><B><FONT color=3D#7f0055 size=3D2>if</B></FONT><FONT=20
> size=3D2>(login.getButtonResponse()) {</P>
> <P>msg.setMessage(</FONT><FONT color=3D#2a00ff size=3D2>"Your id =
> is:"</FONT><FONT=20
> size=3D2>+login.getID()+</FONT><FONT color=3D#2a00ff size=3D2>"\nYour =
> Password is=20
> :"</FONT><FONT size=3D2>+login.getPassword());</P>
> <P>msg.open();</P>
> <P></P>
> <P></FONT><B><FONT color=3D#7f0055 size=3D2>while</B></FONT><FONT=20
> size=3D2>(!sh.isDisposed()) {</P>
> <P></FONT><B><FONT color=3D#7f0055 size=3D2>if</B></FONT><FONT=20
> size=3D2>(!display.readAndDispatch()) display.sleep();</P>
> <P>}}</P>
> <P>display.dispose(); }}</P></FONT></DIV>
> <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3DArial size=3D2>Regards,<BR>Steven=20
> Sequeira<BR></DIV></FONT></BODY></HTML>
>
> ------=_NextPart_000_002D_01C44293.B807EF50--
>
>
>
> --__--__--
>
> _______________________________________________
> pde-dev mailing list
> pde-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/pde-dev
>
>
> End of pde-dev Digest
>
>



Back to the top