home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 May / PCO_5_97.ISO / FilesBBS / OS2 / CSIME.ARJ / CSIME.ZIP / csime / BookmarkCommand.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-02-09  |  1.6 KB  |  42 lines

  1. import java.awt.Window;
  2. import mug.app.Command;
  3. import mug.ui.Callback;
  4. import mug.ui.QuestionDialog;
  5.  
  6. public class BookmarkCommand extends Command implements Callback {
  7.    private MainShell _app;
  8.    private String _link;
  9.  
  10.    public BookmarkCommand(MainShell var1, String var2) {
  11.       this._app = var1;
  12.       this._link = var2;
  13.    }
  14.  
  15.    public void execute() {
  16.       if (this._link != null) {
  17.          if (!this._link.endsWith(".gif") && !this._link.endsWith(".jpg") && !this._link.endsWith(".jpeg") && !this._link.endsWith(".GIF") && !this._link.endsWith(".JPG") && !this._link.endsWith(".JPEG")) {
  18.             this._app.setLink(this._link);
  19.             ((Command)this).executeNext();
  20.          } else {
  21.             String var1 = "The bookmark you selected\n \n" + this._link + "\n \nis probably an image.";
  22.             String[] var2 = new String[]{"Load as Image", "Use as Link", "Cancel"};
  23.             QuestionDialog var3 = new QuestionDialog(this._app, "Image _link", false, var1, var2, this);
  24.             ((Window)var3).show();
  25.          }
  26.       }
  27.    }
  28.  
  29.    public void execute(Object var1, Object var2) {
  30.       if (((String)var2).equals("Load as Image")) {
  31.          (new LoadImageURLCommand(this._app)).execute(this, this._link);
  32.          ((Command)this).executeNext();
  33.       } else {
  34.          if (((String)var2).equals("Use as Link")) {
  35.             this._app.setLink(this._link);
  36.             ((Command)this).executeNext();
  37.          }
  38.  
  39.       }
  40.    }
  41. }
  42.