Java Code Examples for org.eclipse.swt.widgets.Shell#getChildren()

The following examples show how to use org.eclipse.swt.widgets.Shell#getChildren() . 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: DeployPropertyPageTest.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Test
public void testCorrectPanelIsShownForFacetedProject() {
  DeployPropertyPage page = new DeployPropertyPage(loginService, googleApiFactory);
  Shell parent = shellTestResource.getShell();
  page.setElement(getProject());
  page.createControl(parent);
  page.setVisible(true);
  Composite preferencePageComposite = (Composite) parent.getChildren()[0];
  for (Control control : preferencePageComposite.getChildren()) {
    if (control instanceof SharedScrolledComposite) {
      assertThat(getDeployPreferencesPanel((Composite) control), instanceOf(getPanelClass()));
      return;
    }
  }
  fail("Did not find the deploy preferences panel");
}
 
Example 2
Source File: XtextDirectEditManager.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * @see org.eclipse.gef.tools.DirectEditManager#commit()
 */
protected void commit() {
	Shell activeShell = Display.getCurrent().getActiveShell();
	if (activeShell != null && getCellEditor().getControl().getShell().equals(activeShell.getParent())) {
		Control[] children = activeShell.getChildren();
		if (children.length == 1 && children[0] instanceof Table) {
			/*
			 * CONTENT ASSIST: focus is lost to the content assist pop up -
			 * stay in focus
			 */
			getCellEditor().getControl().setVisible(true);
			((XtextStyledTextCellEditorEx) getCellEditor()).setDeactivationLock(true);
			return;
		}
	}

	// content assist hacks
	if (committed) {
		bringDown();
		return;
	}
	committed = true;
	super.commit();
}