Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[pde-dev] Is this correct sanjaya(reply soon)

Hi,steven here.
  In order to create a button in toolbar,is it needed a java file which has
resource bundle's desription like in that of helloworld ex(which extends
from AbstractUIPlugin).Bcos i tried without this file,its giving an error
that says action delegate could not b found.I havent understood why that
file is needed.
      shall i send u all my clases,can u test it



----- Original Message ----- 
From: <sanjaya@xxxxxxxxxxxxx>
To: <pde-dev@xxxxxxxxxxx>
Sent: Monday, May 31, 2004 8:15 AM
Subject: Re: [pde-dev] One problem not able to solve chatura,ravikanth


> Hi steven,
>            I think your problem is with your plug-in XML.In plug-in XML U
> have to set the class property to ur org.eclipse.login.Testlog.In
> plugin-xml click the button at the end of the text and search for the
> Testlog class and select the Testlog class with the correct
> package.Remember to check the use existing class Radio button.
>
> regards
> sanjaya
>
> > Hi, i did as u told but iam gettin foll error in console:where Testlog
is
> > the  class where iam implementing run,init ,selectionchanged methods.
> >   Pls check this out,iam getting psyched by this
> > Could not create action delegate for id: org.eclipse.login.Testlog
> > Reason:
> > Plug-in "org.eclipse.login" was unable to instantiate class
> > "org.eclipse.login.Testlog".
> > Could not create action delegate for id: org.eclipse.login.Testlog
> > Reason:
> > Plug-in "org.eclipse.login" was unable to instantiate class
> > "org.eclipse.login.Testlog".
> >    when i run,i get the sample.gif icon with the tool tip and also the
> > menu
> > item in the workbench Runtime instance.But when i press the icon i get
> > message as:
> >     " The choosen operation is currently not available"
> >
> >
> > My Testlog class is like this:
> >
> > import org.eclipse.swt.SWT;
> > import org.eclipse.swt.widgets.*;
> > import org.eclipse.ui.IWorkbenchWindowActionDelegate;
> > import org.eclipse.ui.IWorkbenchWindow;
> > import org.eclipse.jface.action.IAction;
> > import org.eclipse.jface.viewers.ISelection;
> >
> > public class Testlog implements IWorkbenchWindowActionDelegate {
> > private IWorkbenchWindow window;
> > Display display= new Display();
> > final Shell sh = new Shell(display);
> > public void run(IAction action)
> > {
> >   Logindialog dialog = new Logindialog(sh);
> >   Login login = dialog.open();
> >  MessageBox msg = 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();
> >  }//end of run method
> > public void selectionChanged(IAction action, ISelection selection)
> >
> > {
> >
> > }
> >
> > public void dispose()
> >
> > {
> >
> > }
> >
> > public void init(IWorkbenchWindow window)
> >
> > {
> >
> > this.window = window;
> >
> > }
> >
> >
> >
> > }
> >
> >
> >
> > ----- Original Message -----
> > From: "Chatura Gunawardana" <chatura@xxxxxxxxxxxxx>
> > To: "Steven Sequeira" <ssequeira@xxxxxxxxx>
> > Cc: <chatura_kl@xxxxxxxxx>
> > Sent: Friday, May 28, 2004 1:55 PM
> > Subject: Re: Thanks for info,but.....
> >
> >
> >> Hi Steven,
> >>
> >>  It's very simple thing to do.
> >>
> >>  The things u have done in your Main class should be done in the run()
> >> in
> >> the SampleAction class.
> >>
> >> Your plug-in will be worked.
> >> If you have yahoo id, pls send me. then we can chat.
> >> Bye
> >> Regards,
> >> Chatura(Sri Lanka)
> >>
> >> > Hi chatura,i dont want it to extend from .views,rather i want it to
> > extend
> >> > from actionset,so that on pressing a button on toolbar,my window will
> >> > display.I have changed plugin.xml by looking into helloworld(autocode
> >> > generator)where u have 2 files,one among them is SampleAction which
> >> has
> >> > run,init,selectionchange methods.....But there is no main class in
> >> their
> >> > eg.But i have main class.I have also changed my main class file by
> > adding
> >> > run methods.Can u tell wat chnges exactly i have to do in my main
> >> class.
> >> >
> >> > Again i can give my code:
> >> > 1. public class Login {
> >> >    String id;
> >> >    String password;
> >> >    boolean buttonResponse;
> >> >    public Login(){}
> >> >   public boolean getButtonResponse() {
> >> >    return buttonResponse;}
> >> > public void setButtonResponse(boolean b){
> >> > buttonResponse = b;}
> >> > public String getID()
> >> > {return id;}
> >> > public void setID(String id){
> >> > this.id = id;}
> >> > public String getPassword(){
> >> > return password;}
> >> > public void setPassword(String password){
> >> > this.password = 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 = new Login();
> >> > final Shell shell = new Shell(getParent(),SWT.DIALOG_TRIM |
> >> > SWT.APPLICATION_MODAL);
> >> >
> >> > shell.setText(getText());
> >> > shell.setSize(400,200);
> >> > Label label1 = 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 = new Label(shell,SWT.NONE);
> >> > label2.setSize(70,10);
> >> > label2.setLocation(20,63);
> >> > label2.setAlignment(SWT.RIGHT);
> >> > label2.setText("ID :");
> >> > idText = new Text(shell,SWT.BORDER);
> >> > idText.setTextLimit(30);
> >> > idText.setBounds(100,60,200,20);
> >> > Label label3 = new Label(shell,SWT.NONE);
> >> > label3.setSize(70,10);
> >> > label3.setLocation(20,93);
> >> > label3.setAlignment(SWT.RIGHT);
> >> > label3.setText("Password :");
> >> > passwordText = new Text(shell,SWT.BORDER);
> >> > passwordText.setTextLimit(30);
> >> > passwordText.setBounds(100,90,200,20);
> >> > passwordText.setEchoChar('*');
> >> > btnOK = new Button(shell,SWT.PUSH);
> >> > btnOK.setText("Login");
> >> > btnOK.setLocation(110,130);
> >> > btnOK.setSize(80,20);
> >> > btnCancel = new Button(shell,SWT.PUSH);
> >> > btnCancel.setText("Cancel");
> >> > btnCancel.setLocation(210,130);
> >> > btnCancel.setSize(80,20);
> >> >
> >> > Listener listener = new Listener(){
> >> >
> >> > public void handleEvent(Event event){
> >> >
> >> > login.setButtonResponse(event.widget==btnOK);
> >> >
> >> > login.setID(idText.getText());
> >> >
> >> > login.setPassword(passwordText.getText());shell.close();}};
> >> >
> >> > btnOK.addListener(SWT.Selection,listener);
> >> >
> >> > btnCancel.addListener(SWT.Selection,listener);
> >> >
> >> > Display display = getParent().getDisplay();
> >> >
> >> > Rectangle rect = display.getBounds();
> >> >
> >> > int mx = rect.width/2;
> >> >
> >> > int my = rect.height/2;
> >> >
> >> > shell.setLocation(mx-200,my-100);
> >> >
> >> > shell.open();
> >> >
> >> >
> >> > while(!shell.isDisposed()){
> >> >
> >> > if(!display.readAndDispatch()) display.sleep();
> >> >
> >> > }
> >> >
> >> > return login;
> >> >
> >> > }
> >> >
> >> > }
> >> >
> >> > 3.Testlog 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= new Display();
> >> >
> >> >  final Shell sh = new Shell(display);
> >> > Logindialog dialog = new Logindialog(sh);Login login = dialog.open();
> >> >
> >> > MessageBox msg = 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(); }}
> >> >
> >> >
> >> > My plugin.xml is:
> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> > <plugin
> >> > id="org.eclipse.login"
> >> > name="org.eclipse.login"
> >> > provider-name="steven s"
> >> > class="org.eclipse.login.Main"
> >> > version="1.0.0">
> >> >
> >> > <requires>
> >> > <import plugin="org.eclipse.core.resources"/>
> >> > <import plugin="org.eclipse.ui"/>
> >> > </requires>
> >> >
> >> > <runtime>
> >> > <library name="login.jar"/>
> >> > </runtime>
> >> >
> >> > <extension
> >> >  point="org.eclipse.ui.actionSets">
> >> >  <actionSet
> >> >  label="Login sample"
> >> >  visible="true"
> >> >  id="org.eclipse.login.sampleSet">
> >> >
> >> > <menu
> >> > label="Sample &amp;Menu"
> >> > id="loginMenu">
> >> >
> >> > <separator
> >> > name="loginGroup">
> >> > </separator>
> >> > </menu>
> >> >
> >> > <action
> >> >  label="&amp;Sample Action"
> >> >  icon="icons/sample.gif"
> >> >  tooltip="hi"
> >> >  class="org.eclipse.login.Main"
> >> >  menubarPath="loginMenu/loginGroup"
> >> >  toolbarPath="sampleGroup"
> >> >  id="org.eclipse.login.">
> >> > </action>
> >> > </actionSet>
> >> > </extension>
> >> > <extension
> >> > point="org.eclipse.ui.perspectiveExtensions">
> >> > <perspectiveExtension
> >> > targetID="org.eclipse.ui.resourcePerspective">
> >> > <actionSet
> >> > id="org.eclipse.login.actionSet">
> >> > </actionSet>
> >> > </perspectiveExtension>
> >> > </extension>
> >> > </plugin>
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >>
> >
> > _______________________________________________
> > pde-dev mailing list
> > pde-dev@xxxxxxxxxxx
> > http://dev.eclipse.org/mailman/listinfo/pde-dev
> >
> >
>
> _______________________________________________
> pde-dev mailing list
> pde-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/pde-dev



Back to the top