Exemplo n.º 1
0
  private ControlPanelWindow(Shell parentShell, ITestCase testCase) throws ModelException {
    super((Shell) null);

    this.parentShell = parentShell;
    setShellStyle(SWT.RESIZE /* | SWT.TOOL */ | SWT.CLOSE /* | SWT.ON_TOP */);
    if (testCase != null) {
      setModel(testCase);
      copyContent((Scenario) testCase.getNamedElement(), this.scenario);
    }
    recordingSupport =
        new RecordingSupport(
            this, this.scenario, testCase != null ? (Scenario) testCase.getNamedElement() : null);
    recordingSupport.observeMode().addChangeListener(new RecordingModeListener());
    recordingSupport.addRecordingListener(new AssertAddedListener());
  }
Exemplo n.º 2
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;
 }
Exemplo n.º 3
0
 @Override
 protected Object calculate() {
   RecordingMode mode = recordingSupport.getMode();
   return mode != RecordingMode.Stopped
       && mode != RecordingMode.Replaying
       && mode != RecordingMode.Connecting;
 }
Exemplo n.º 4
0
 @Override
 public int open() {
   final int result = super.open();
   parentShell.setMinimized(true);
   getShell().setVisible(true);
   recordingSupport.setMode(RecordingMode.Connecting);
   return result;
 }
Exemplo n.º 5
0
 private void handleStopRecordShortcutPressed(KeySequence sequence) {
   TriggerSequence[] shortcuts = RecordingContextManager.Instance.getStopRecordShortcuts();
   if (shortcuts != null) {
     for (TriggerSequence s : shortcuts) {
       if (sequence.equals(s)) {
         recordingSupport.setMode(RecordingMode.Stopped);
       }
     }
   }
 }