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 Project: hop   Author: project-hop   File: BaseTransformDialog.java    License: 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 Project: hop   Author: project-hop   File: WorkflowDialog.java    License: 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 #3
Source Project: hop   Author: project-hop   File: BaseDialog.java    License: 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 #4
Source Project: APICloud-Studio   Author: apicloudcom   File: PopupCloser.java    License: 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 #5
Source Project: birt   Author: eclipse   File: SubtaskSheetImpl.java    License: 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 #6
Source Project: pentaho-kettle   Author: pentaho   File: JobDialog.java    License: 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 #7
Source Project: pentaho-kettle   Author: pentaho   File: BaseStepDialog.java    License: 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 #8
Source Project: pentaho-kettle   Author: pentaho   File: BaseDialog.java    License: 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 #9
Source Project: pentaho-kettle   Author: pentaho   File: LibFormulaEditor.java    License: 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 #10
Source Project: hop   Author: project-hop   File: CommonTransformDialog.java    License: 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 #11
Source Project: hop   Author: project-hop   File: ActionPipelineDialog.java    License: Apache License 2.0 5 votes vote down vote up
public IAction open() {
    Shell parent = getParent();
    display = parent.getDisplay();

    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.MAX | SWT.RESIZE);
    props.setLook(shell);
    WorkflowDialog.setShellImage(shell, action);

    backupChanged = action.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();

    BaseTransformDialog.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 action;
}
 
Example #12
Source Project: hop   Author: project-hop   File: ActionWorkflowDialog.java    License: Apache License 2.0 5 votes vote down vote up
public IAction open() {
  Shell parent = getParent();
  display = parent.getDisplay();

  shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.MAX | SWT.RESIZE );
  props.setLook( shell );
  WorkflowDialog.setShellImage( shell, action );

  backupChanged = action.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();

  BaseTransformDialog.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 action;
}
 
Example #13
Source Project: hop   Author: project-hop   File: EnterTextDialog.java    License: 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 = HopGuiWorkflowGraph.showChangedWarning( shell, title );
    if ( save == SWT.CANCEL ) {
      e.doit = false;
    } else if ( save == SWT.YES ) {
      ok();
    } else {
      cancel();
    }
  } else {
    cancel();
  }
}
 
Example #14
Source Project: hop   Author: project-hop   File: ShowHelpDialog.java    License: 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 #15
Source Project: logbook   Author: sanaehirotaka   File: SelectVisibleColumnDialog.java    License: MIT License 5 votes vote down vote up
@Override
public void shellClosed(ShellEvent e) {
    TreeItem[] items = this.tree.getItems();
    for (int i = 0; i < items.length; i++) {
        this.visibles[i + 1] = items[i].getChecked();
    }
}
 
Example #16
Source Project: logbook   Author: sanaehirotaka   File: SaveWindowLocationAdapter.java    License: MIT License 5 votes vote down vote up
@Override
public void shellClosed(ShellEvent e) {
    if (e.widget instanceof Shell) {
        Shell shell = (Shell) e.widget;
        // 最大化の状態では保存しない
        if (!shell.getMaximized()) {
            LayoutLogic.saveWindowLocation(this.dialogClass, shell);
        }
    }
}
 
Example #17
Source Project: tuxguitar   Author: phiresky   File: SWTCloseListenerManager.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
public void shellClosed(ShellEvent e) {
	if(!this.control.isIgnoreEvents()) {
		// cancel default operation
		e.doit = false;
		
		this.onClose(new UICloseEvent(this.control));
	}
}
 
Example #18
Source Project: tracecompass   Author: tracecompass   File: TimeGraphFindDialog.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void shellActivated(ShellEvent e) {
    fActiveShell = (Shell) e.widget;
    updateButtonState();

    if (fGiveFocusToFindField && getShell() == fActiveShell && okToUse(fFindField)) {
        fFindField.setFocus();
    }

}
 
Example #19
Source Project: tracecompass   Author: tracecompass   File: TimeGraphFindDialog.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void shellDeactivated(ShellEvent e) {
    fGiveFocusToFindField = false;

    storeSettings();

    fActiveShell = null;
    updateButtonState();
}
 
Example #20
Source Project: APICloud-Studio   Author: apicloudcom   File: PopupCloser.java    License: GNU General Public License v3.0 5 votes vote down vote up
public void shellClosed(ShellEvent e)
{
	if (fContentAssistant != null)
	{
		fContentAssistant.hide();
	}
}
 
Example #21
Source Project: Eclipse-Postfix-Code-Completion   Author: trylimits   File: JavaReconciler.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void shellActivated(ShellEvent e) {
	if (!fControl.isDisposed() && fControl.isVisible()) {
		if (hasJavaModelChanged())
			JavaReconciler.this.forceReconciling();
		setEditorActive(true);
	}
}
 
Example #22
Source Project: Eclipse-Postfix-Code-Completion   Author: trylimits   File: JavaReconciler.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void shellDeactivated(ShellEvent e) {
	if (!fControl.isDisposed() && fControl.getShell() == e.getSource()) {
		setJavaModelChanged(false);
		setEditorActive(false);
	}
}
 
Example #23
Source Project: translationstudio8   Author: heartsome   File: TermDbManagerDialog.java    License: 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 #24
Source Project: translationstudio8   Author: heartsome   File: TmDbManagerDialog.java    License: 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 #25
Source Project: learning-hadoop   Author: javachen   File: EnterCQLDialog.java    License: Apache License 2.0 5 votes vote down vote up
public void checkCancel(ShellEvent e) {
  String newText = m_cqlText.getText();
  if (!newText.equals(m_originalCQL)) {
    int save = JobGraph.showChangedWarning(m_shell, m_title);
    if (save == SWT.CANCEL) {
      e.doit = false;
    } else if (save == SWT.YES) {
      ok();
    } else {
      cancel();
    }
  } else {
    cancel();
  }
}
 
Example #26
Source Project: tmxeditor8   Author: heartsome   File: TmDbManagerDialog.java    License: 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 #27
Source Project: tmxeditor8   Author: heartsome   File: TermDbManagerDialog.java    License: 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 #28
Source Project: tmxeditor8   Author: heartsome   File: TmDbManagerDialog.java    License: 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 #29
Source Project: birt   Author: eclipse   File: GraphicalEditorWithFlyoutPalette.java    License: 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 #30
Source Project: arx   Author: arx-deidentifier   File: DialogAuditTrail.java    License: 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);
        }
    };
}