org.eclipse.swt.events.ShellEvent Java Examples

The following examples show how to use org.eclipse.swt.events.ShellEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BaseTransformDialog.java    From hop with Apache License 2.0 6 votes vote down vote up
private void addDeprecation() {

    if ( shell == null ) {

      return;
    }
    shell.addShellListener( new ShellAdapter() {

      private boolean deprecation = false;

      @Override public void shellActivated( ShellEvent shellEvent ) {
        super.shellActivated( shellEvent );
        if ( !transformMeta.isDeprecated() || deprecation ) {
          return;
        }
        String deprecated = BaseMessages.getString( PKG, "BaseTransform.Category.Deprecated" ).toLowerCase();
        shell.setText( shell.getText() + " (" + deprecated + ")" );
        deprecation = true;
      }
    } );
  }
 
Example #2
Source File: BaseDialog.java    From hop with Apache License 2.0 6 votes vote down vote up
/**
 * Returns a {@link org.eclipse.swt.events.SelectionAdapter} that is used to "submit" the dialog.
 */
private Display prepareLayout() {

  // Prep the parent shell and the dialog shell
  final Shell parent = getParent();
  final Display display = parent.getDisplay();

  shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.SHEET );
  shell.setImage( GuiResource.getInstance().getImageHopUi() );
  props.setLook( shell );
  // Detect X or ALT-F4 or something that kills this window...
  shell.addShellListener( new ShellAdapter() {
    @Override
    public void shellClosed( ShellEvent e ) {
      dispose();
    }
  } );

  final FormLayout formLayout = new FormLayout();
  formLayout.marginWidth = MARGIN_SIZE;
  formLayout.marginHeight = MARGIN_SIZE;

  shell.setLayout( formLayout );
  shell.setText( this.title );
  return display;
}
 
Example #3
Source File: BaseDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
/**
 * Returns a {@link org.eclipse.swt.events.SelectionAdapter} that is used to "submit" the dialog.
 */
private Display prepareLayout() {

  // Prep the parent shell and the dialog shell
  final Shell parent = getParent();
  final Display display = parent.getDisplay();

  shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.SHEET );
  shell.setImage( GUIResource.getInstance().getImageSpoon() );
  props.setLook( shell );
  // Detect X or ALT-F4 or something that kills this window...
  shell.addShellListener( new ShellAdapter() {
    @Override
    public void shellClosed( ShellEvent e ) {
      dispose();
    }
  } );

  final FormLayout formLayout = new FormLayout();
  formLayout.marginWidth = MARGIN_SIZE;
  formLayout.marginHeight = MARGIN_SIZE;

  shell.setLayout( formLayout );
  shell.setText( this.title );
  return display;
}
 
Example #4
Source File: WorkflowDialog.java    From hop with Apache License 2.0 6 votes vote down vote up
private static void addDeprecation( Shell shell ) {

    if ( shell == null ) {

      return;
    }
    shell.addShellListener( new ShellAdapter() {

      private boolean deprecation = false;

      @Override public void shellActivated( ShellEvent shellEvent ) {
        super.shellActivated( shellEvent );
        if ( deprecation ) {
          return;
        }
        String deprecated = BaseMessages.getString( PKGBASE, "ActionCategory.Category.Deprecated" ).toLowerCase();
        shell.setText( shell.getText() + " (" + deprecated + ")" );
        deprecation = true;
      }
    } );
  }
 
Example #5
Source File: LibFormulaEditor.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public String open() {
  shell.layout();
  shell.open();

  // Detect X or ALT-F4 or something that kills this window...
  shell.addShellListener( new ShellAdapter() {
    public void shellClosed( ShellEvent e ) {
      cancel();
    }
  } );

  while ( !shell.isDisposed() ) {
    if ( !shell.getDisplay().readAndDispatch() ) {
      shell.getDisplay().sleep();
    }
  }
  return formula;
}
 
Example #6
Source File: BaseStepDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void addDeprecation() {

    if ( shell == null ) {

      return;
    }
    shell.addShellListener( new ShellAdapter() {

      private boolean deprecation = false;

      @Override public void shellActivated( ShellEvent shellEvent ) {
        super.shellActivated( shellEvent );
        if ( !stepMeta.isDeprecated() || deprecation ) {
          return;
        }
        String deprecated = BaseMessages.getString( PKG, "BaseStep.Category.Deprecated" ).toLowerCase();
        shell.setText( shell.getText() + " (" + deprecated + ")" );
        deprecation = true;
      }
    } );
  }
 
Example #7
Source File: JobDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private static void addDeprecation( Shell shell ) {

    if ( shell == null ) {

      return;
    }
    shell.addShellListener( new ShellAdapter() {

      private boolean deprecation = false;

      @Override public void shellActivated( ShellEvent shellEvent ) {
        super.shellActivated( shellEvent );
        if ( deprecation ) {
          return;
        }
        String deprecated = BaseMessages.getString( PKGBASE, "JobCategory.Category.Deprecated" ).toLowerCase();
        shell.setText( shell.getText() + " (" + deprecated + ")" );
        deprecation = true;
      }
    } );
  }
 
Example #8
Source File: PopupCloser.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public void shellDeactivated(ShellEvent e)
{
	if (fContentAssistant != null && fDisplay != null)
	{
		fDisplay.asyncExec(new Runnable()
		{
			public void run()
			{
				/*
				 * The asyncExec is a workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=235556 :
				 * fContentAssistant.hasProposalPopupFocus() is still true during the shellDeactivated(..) event.
				 */
				if (fContentAssistant != null && !fContentAssistant.hasProposalPopupFocus()
						&& !isAdditionalInfoInFocus())
				{
					fContentAssistant.hide();
				}
			}
		});
	}
}
 
Example #9
Source File: SubtaskSheetImpl.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void shellClosed( ShellEvent e )
{
	Control focusControl = Display.getDefault( ).getFocusControl( );
	if ( focusControl instanceof Text )
	{
		// Focus saving the text by focus out
		focusControl.notifyListeners( SWT.FocusOut, null );
	}

	if ( e.widget.equals( popupShell ) )
	{
		if ( !POPUP_ATTACHING )
		{
			selectAllButtons( false );
		}

		if ( ChartWizard.POPUP_CLOSING_BY_USER )
		{
			// Clear selection if user closed the popup.
			setCurrentPopupSelection( null );
			getParentTask( ).setPopupSelection( null );
		}
	}
}
 
Example #10
Source File: DialogFindReplace.java    From arx with Apache License 2.0 5 votes vote down vote up
@Override
protected ShellListener getShellListener() {
    return new ShellAdapter() {
        @Override
        public void shellClosed(final ShellEvent event) {
            value = null;
            setReturnCode(Window.CANCEL);
        }
    };
}
 
Example #11
Source File: DialogProject.java    From arx with Apache License 2.0 5 votes vote down vote up
@Override
protected ShellListener getShellListener() {
    return new ShellAdapter() {
        @Override
        public void shellClosed(final ShellEvent event) {
            setReturnCode(Window.CANCEL);
        }
    };
}
 
Example #12
Source File: DialogComboSelection.java    From arx with Apache License 2.0 5 votes vote down vote up
@Override
protected ShellListener getShellListener() {
    return new ShellAdapter() {
        @Override
        public void shellClosed(final ShellEvent event) {
            setReturnCode(Window.CANCEL);
        }
    };
}
 
Example #13
Source File: JobEntryTransDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public JobEntryInterface open() {
  Shell parent = getParent();
  display = parent.getDisplay();

  shell = new Shell( parent, props.getJobsDialogStyle() );
  props.setLook( shell );
  JobDialog.setShellImage( shell, jobEntry );

  backupChanged = jobEntry.hasChanged();

  createElements();

  // Detect [X] or ALT-F4 or something that kills this window...
  shell.addShellListener( new ShellAdapter() {
    public void shellClosed( ShellEvent e ) {
      cancel();
    }
  } );

  getData();
  setActive();

  BaseStepDialog.setSize( shell );

  int width = 750;
  int height = Const.isWindows() ? 730 : 720;

  shell.setSize( width, height );
  shell.open();
  while ( !shell.isDisposed() ) {
    if ( !display.readAndDispatch() ) {
      display.sleep();
    }
  }
  return jobEntry;
}
 
Example #14
Source File: ExecSQLDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void checkCancel( ShellEvent e ) {
  if ( changedInDialog ) {
    int save = JobGraph.showChangedWarning( shell, wStepname.getText() );
    if ( save == SWT.CANCEL ) {
      e.doit = false;
    } else if ( save == SWT.YES ) {
      ok();
    } else {
      cancel();
    }
  } else {
    cancel();
  }
}
 
Example #15
Source File: TableInputDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void checkCancel( ShellEvent e ) {
  if ( changedInDialog ) {
    int save = JobGraph.showChangedWarning( shell, wStepname.getText() );
    if ( save == SWT.CANCEL ) {
      e.doit = false;
    } else if ( save == SWT.YES ) {
      ok();
    } else {
      cancel();
    }
  } else {
    cancel();
  }
}
 
Example #16
Source File: EnterTextDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void checkCancel( ShellEvent e ) {
  String newText = wDesc.getText();
  if ( !newText.equals( origText ) ) {
    int save = JobGraph.showChangedWarning( shell, title );
    if ( save == SWT.CANCEL ) {
      e.doit = false;
    } else if ( save == SWT.YES ) {
      ok();
    } else {
      cancel();
    }
  } else {
    cancel();
  }
}
 
Example #17
Source File: CommonStepDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private Display prepareLayout() {

    // Prep the parent shell and the dialog shell
    final Shell parent = getParent();
    final Display display = parent.getDisplay();

    shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN );
    props.setLook( shell );
    setShellImage( shell, meta );
    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener( new ShellAdapter() {
      @Override
      public void shellClosed( ShellEvent e ) {
        cancel();
      }
    } );

    changed = meta.hasChanged();

    final FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = BaseDialog.MARGIN_SIZE;
    formLayout.marginHeight = BaseDialog.MARGIN_SIZE;

    shell.setLayout( formLayout );
    shell.setText( getTitle() );
    return display;
  }
 
Example #18
Source File: JobEntryJobDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public JobEntryInterface open() {
  Shell parent = getParent();
  display = parent.getDisplay();

  shell = new Shell( parent, props.getJobsDialogStyle() );
  props.setLook( shell );
  JobDialog.setShellImage( shell, jobEntry );

  backupChanged = jobEntry.hasChanged();

  createElements();

  // Detect [X] or ALT-F4 or something that kills this window...
  shell.addShellListener( new ShellAdapter() {
    public void shellClosed( ShellEvent e ) {
      cancel();
    }
  } );

  getData();
  setActive();

  BaseStepDialog.setSize( shell );

  int width = 750;
  int height = Const.isWindows() ? 730 : 718;

  shell.setSize( width, height );
  shell.open();
  while ( !shell.isDisposed() ) {
    if ( !display.readAndDispatch() ) {
      display.sleep();
    }
  }
  return jobEntry;
}
 
Example #19
Source File: DialogCriterionUpdate.java    From arx with Apache License 2.0 5 votes vote down vote up
@Override
protected ShellListener getShellListener() {
    return new ShellAdapter() {
        @Override
        public void shellClosed(final ShellEvent event) {
            setReturnCode(Window.CANCEL);
        }
    };
}
 
Example #20
Source File: DialogOpenHierarchy.java    From arx with Apache License 2.0 5 votes vote down vote up
@Override
protected ShellListener getShellListener() {
    return new ShellAdapter() {
        @Override
        public void shellClosed(final ShellEvent event) {
            event.doit = false;
        }
    };
}
 
Example #21
Source File: ShowHelpDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void addShellListener() {
  // Detect [X] or ALT-F4 or something that kills this window...
  shell.addShellListener( new ShellAdapter() {
    public void shellClosed( ShellEvent e ) {
      ok();
    }
  } );
}
 
Example #22
Source File: DialogTopBottomCoding.java    From arx with Apache License 2.0 5 votes vote down vote up
@Override
protected ShellListener getShellListener() {
    return new ShellAdapter() {
        @Override
        public void shellClosed(final ShellEvent event) {
            value = null;
            setReturnCode(Window.CANCEL);
        }
    };
}
 
Example #23
Source File: DialogQuery.java    From arx with Apache License 2.0 5 votes vote down vote up
@Override
protected ShellListener getShellListener() {
    return new ShellAdapter() {
        @Override
        public void shellClosed(final ShellEvent event) {
            setReturnCode(Window.CANCEL);
        }
    };
}
 
Example #24
Source File: DialogAnonymization.java    From arx with Apache License 2.0 5 votes vote down vote up
@Override
protected ShellListener getShellListener() {
    return new ShellAdapter() {
        @Override
        public void shellClosed(final ShellEvent event) {
            configurationValid = false;
            setReturnCode(Window.CANCEL);
        }
    };
}
 
Example #25
Source File: DialogAuditTrail.java    From arx with Apache License 2.0 5 votes vote down vote up
@Override
protected ShellListener getShellListener() {
    return new ShellAdapter() {
        @Override
        public void shellClosed(final ShellEvent event) {
            setReturnCode(Window.CANCEL);
        }
    };
}
 
Example #26
Source File: GraphicalEditorWithFlyoutPalette.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public void shellActivated( ShellEvent e )
{
	if ( !shellActiveFlag )
	{
		shellActiveFlag = true;
		// Pre-fetch shell from site in case it could be disposed before async execution
		final Shell siteShell = getSite( ).getShell( );
		Display.getCurrent( ).asyncExec( new Runnable( ) {

			public void run( )
			{
				if ( lastActiveShell == siteShell )
				{
					// don't active the current active editor
					shellActiveFlag = false;
					return;
				}
				else
				{
					lastActiveShell = getSite( ).getShell( );
					IEditorPart editor = UIUtil.getActiveEditor( true );
					if ( editor instanceof IPartListener )
					{
						// update the SessionHandleAdapter's model.
						// If old selection is dataset or datasource,
						// the selection status will lost.
						( (IPartListener) editor ).partActivated( editor );
					}
					shellActiveFlag = false;
				}
			}
		} );
	}
}
 
Example #27
Source File: TmDbManagerDialog.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void configureShell(Shell newShell) {
	super.configureShell(newShell);
	newShell.setText(Messages.getString("dialog.TmDbManagerDialog.title"));
	newShell.addShellListener(new ShellAdapter() {
		public void shellActivated(ShellEvent e) {
			if (lastShellSize == null) {
				lastShellSize = getShell().getSize();
			}
		}
	});
}
 
Example #28
Source File: TermDbManagerDialog.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void configureShell(Shell newShell) {
	super.configureShell(newShell);
	newShell.setText(Messages.getString("dialog.TermDbManagerDialog.title"));
	newShell.addShellListener(new ShellAdapter() {
		public void shellActivated(ShellEvent e) {
			if (lastShellSize == null) {
				lastShellSize = getShell().getSize();
			}
		}
	});
}
 
Example #29
Source File: TmDbManagerDialog.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void configureShell(Shell newShell) {
	super.configureShell(newShell);
	newShell.setText(Messages.getString("dialog.TmDbManagerDialog.title"));
	newShell.addShellListener(new ShellAdapter() {
		public void shellActivated(ShellEvent e) {
			if (lastShellSize == null) {
				lastShellSize = getShell().getSize();
			}
		}
	});
}
 
Example #30
Source File: DialogMultiSelection.java    From arx with Apache License 2.0 5 votes vote down vote up
@Override
protected ShellListener getShellListener() {
    return new ShellAdapter() {
        @Override
        public void shellClosed(final ShellEvent event) {
            setReturnCode(Window.CANCEL);
        }
    };
}