Exemplo n.º 1
0
 @Override
 public boolean close() {
   recordingSupport.setMode(RecordingMode.Stopped);
   if (isDirty()) {
     if (!openSaveDialog()) {
       return false;
     }
   }
   final boolean result = super.close();
   if (result && !parentShell.isDisposed()) {
     dbc.dispose();
     parentShell.removeShellListener(closeListener);
     parentShell.setMinimized(false);
     try {
       ShellUtilsProvider.getShellUtils().forceActive(parentShell);
     } catch (CoreException e) {
       throw new RuntimeException(e);
     }
     parentShell.setFocus();
     ITestCase model = getModel();
     if (model != null && model.exists()) {
       IFile location = (IFile) model.getResource();
       if (location != null) {
         try {
           IDE.openEditor(Q7UIPlugin.getActiveWindow().getActivePage(), location);
         } catch (PartInitException e) {
           Q7UIPlugin.log(e);
         }
       }
     }
   }
   RecordingContextManager.Instance.deactivateContext();
   return result;
 }
 public void open() {
   createShell();
   shell.open();
   shell.setFocus();
   while (!shell.isDisposed()) {
     if (!shell.getDisplay().readAndDispatch()) {
       shell.getDisplay().sleep();
     }
   }
 }
  public void build() {
    shell = new Shell(parentShell, SWT.TOOL | SWT.CLOSE);

    final Rectangle bounds = this.display.getBounds();
    shell.setLocation(bounds.width - 220, bounds.height - iY);
    shell.setSize(200, iheight);
    final Timer upDownWindowTimer = new Timer(true);
    upDownWindowTimer.schedule(
        new TimerTask() {
          public void run() {
            display.syncExec(
                new Runnable() {
                  public void run() {
                    if (step < 0 && delayTime > 0) {
                      delayTime = delayTime - 30;
                      return;
                    }
                    shell.setLocation(bounds.width - 220, bounds.height - iY);
                    shell.setSize(200, iheight);
                    iheight = iheight + step;
                    iY = iY + step;
                    if (iheight == 150 && step > 0) {
                      step = -step;
                      delayTime = POPUP_WINDOW_DELAY_TIME;
                    }
                    if (iheight == 0 && step < 0) {
                      step = -step;
                      delayTime = 0;
                      upDownWindowTimer.cancel();
                      shell.close();
                    }
                  }
                });
          }
        },
        0,
        30);

    shell.addShellListener(
        new ShellAdapter() {
          public void shellClosed(ShellEvent e) {
            upDownWindowTimer.cancel();
          }
        });

    // For the jmobile invoke.
    shell.setText(Messages.getString(MessagesConstant.NEW_SMS_TITLE));
    // For the main() invoke.
    // shell.setText("NEW SMS");

    setBackGroundWhite(shell);

    FormLayout layout = new FormLayout();
    layout.marginTop = 5;
    layout.marginLeft = 5;
    shell.setLayout(layout);

    // The first row: product name label
    FormData formData = new FormData();
    formData.left = new FormAttachment(0, 0);
    formData.right = new FormAttachment(0, 200);
    formData.top = new FormAttachment(0, 0);
    Label lbSender = new Label(shell, SWT.LEFT);
    lbSender.setLayoutData(formData);
    // For the jmobile invoke.
    lbSender.setText(Messages.getString(MessagesConstant.NEW_SMS_FROM, message.getTeleNum()));
    // For the main() invoke.
    // lbSender.setText(message.getTeleNum());
    setBackGroundWhite(lbSender);

    // The first row: product name label
    formData = new FormData();
    formData.left = new FormAttachment(0, 0);
    formData.right = new FormAttachment(0, 200);
    formData.top = new FormAttachment(lbSender, 10);
    Link lkContent = new Link(shell, SWT.NONE);
    lkContent.setLayoutData(formData);
    lkContent.setText(MessageFormat.format(smsContentFormat, new Object[] {message.getContent()}));
    lkContent.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            shell.close();
            NewSMSDialog dialog =
                new NewSMSDialog(NewMessageArrivalPopupWindowShell.this.parentShell);
            dialog.create();
            // set value to control in dialog
            dialog.getTxtReceiver().setText(message.getTeleNum());
            dialog.getTxtContent().setText(message.getContent());
            dialog.getTxtContent().setFocus();
            dialog.open();
          }
        });
    setBackGroundWhite(lkContent);

    shell.setFocus();

    shell.open();

    shell.forceActive();

    PlaySound.execute(WAV_FILE);
  }
Exemplo n.º 4
0
 public void raiseToTop() {
   shell.forceFocus();
   shell.forceActive();
   shell.setFocus();
   shell.setActive();
 }