org.eclipse.swt.widgets.Shell.getDefaultButton()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(84)

本文整理了Java中org.eclipse.swt.widgets.Shell.getDefaultButton()方法的一些代码示例,展示了Shell.getDefaultButton()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Shell.getDefaultButton()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Shell
类名称:Shell
方法名:getDefaultButton

Shell.getDefaultButton介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07

static boolean isDefaultButton( final Button button ) {
  return button.getShell().getDefaultButton() == button;
 }
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
  public void keyTraversed(TraverseEvent e) {
    if (e.detail == SWT.TRAVERSE_RETURN && (e.stateMask & SWT.MODIFIER_MASK) != 0) {
      buttonPressed(((Integer)getShell().getDefaultButton().getData()).intValue());
    }
  }
});

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

@Override
  public void keyTraversed(TraverseEvent e) {
    if (e.detail == SWT.TRAVERSE_RETURN && (e.stateMask & SWT.MODIFIER_MASK) != 0) {
      buttonPressed(((Integer)getShell().getDefaultButton().getData()).intValue());
    }
  }
});

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07

private static void writeDefaultButton( final Shell shell ) throws IOException
{
 Button defaultButton = shell.getDefaultButton();
 if( defaultButton != null && defaultButton.isDisposed() ) {
  JSWriter writer = JSWriter.getWriterFor( shell );
  writer.call( "setDefaultButton", NULL_PARAMETER );
 }
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07

private static boolean hasSelectionListener( final Text text ) {
 // Emulate SWT (on Windows) where a default button takes precedence over
 // a SelectionListener on a text field when both are on the same shell.
 Button defButton = text.getShell().getDefaultButton();
 // TODO [rst] On GTK, the SelectionListener is also off when the default
 //      button is invisible or disabled. Check with Windows and repair.
 boolean hasDefaultButton = defButton != null && defButton.isVisible();
 return !hasDefaultButton && SelectionEvent.hasListener( text );
}

代码示例来源:origin: org.eclipse.xtext/ui

public void assistSessionStarted(ContentAssistEvent event) {
  defaultButton = parent.getShell().getDefaultButton();
  parent.getShell().setDefaultButton(null);
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

private static void renderDefaultButton( Shell shell ) {
 Button defaultButton = shell.getDefaultButton();
 if( hasChanged( shell, PROP_DEFAULT_BUTTON, defaultButton, null ) ) {
  String defaultButtonId = null;
  if( defaultButton != null ) {
   defaultButtonId = WidgetUtil.getId( defaultButton );
  }
  getRemoteObject( shell ).set( "defaultButton", defaultButtonId );
 }
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface

protected void initializeBounds() {
  Shell shell = getShell();
  if (shell != null) {
    if (shell.getDisplay().getDismissalAlignment() == SWT.RIGHT) {
      // make the default button the right-most button
      Button defaultButton = shell.getDefaultButton();
      if (defaultButton != null
          && isContained(buttonBar, defaultButton)) {
        defaultButton.moveBelow(null);
        ((Composite) buttonBar).layout();
      }
    }
  }
  
  super.initializeBounds();
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface

/**
 * {@inheritDoc}
 * <p>
 * The implementation in {@link #Dialog} also moves the
 * {@link Shell#getDefaultButton() default button} in the
 * {@link #createButtonBar(Composite) button bar} to the right
 * if that's required by the
 * {@link Display#getDismissalAlignment() platform convention}.
 * </p>
 */
@Override
protected void initializeBounds() {
  Shell shell = getShell();
  if (shell != null) {
    if (shell.getDisplay().getDismissalAlignment() == SWT.RIGHT) {
      // make the default button the right-most button
      Button defaultButton = shell.getDefaultButton();
      if (defaultButton != null
          && isContained(buttonBar, defaultButton)) {
        defaultButton.moveBelow(null);
        defaultButton.getParent().layout();
      }
    }
  }
  super.initializeBounds();
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

@Override
public void preserveValues( Shell shell ) {
 preserveProperty( shell, PROP_ACTIVE_CONTROL, getActiveControl( shell ) );
 preserveProperty( shell, PROP_ACTIVE_SHELL, shell.getDisplay().getActiveShell() );
 preserveProperty( shell, PROP_TEXT, shell.getText() );
 preserveProperty( shell, PROP_IMAGE, shell.getImage() );
 preserveProperty( shell, PROP_ALPHA, Integer.valueOf( shell.getAlpha() ) );
 preserveProperty( shell, PROP_MODE, getMode( shell ) );
 preserveProperty( shell, PROP_FULLSCREEN, Boolean.valueOf( shell.getFullScreen() ) );
 preserveProperty( shell, PROP_MINIMUM_SIZE, shell.getMinimumSize() );
 preserveProperty( shell, PROP_DEFAULT_BUTTON, shell.getDefaultButton() );
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface

/**
 * {@inheritDoc}
 * <p>
 * The implementation in {@link #Dialog} also moves the
 * {@link Shell#getDefaultButton() default button} in the
 * {@link #createButtonBar(Composite) button bar} to the right
 * if that's required by the
 * {@link Display#getDismissalAlignment() platform convention}.
 * </p>
 */
@Override
protected void initializeBounds() {
  // UI guidelines:
  // https://developer.gnome.org/hig/stable/dialogs.html.en#primary-buttons
  // https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/OSXHIGuidelines/WindowDialogs.html#//apple_ref/doc/uid/20000957-CH43-SW5
  // https://msdn.microsoft.com/en-us/library/windows/desktop/dn742499(v=vs.85).aspx#win_dialog_box_image25
  Shell shell = getShell();
  if (shell != null) {
    if (shell.getDisplay().getDismissalAlignment() == SWT.RIGHT) {
      // make the default button the right-most button
      Button defaultButton = shell.getDefaultButton();
      if (defaultButton != null
          && isContained(buttonBar, defaultButton)) {
        defaultButton.moveBelow(null);
        defaultButton.getParent().layout();
      }
    }
  }
  super.initializeBounds();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.compare

@Override
public void setVisible(boolean visible) {
  super.setVisible(visible);
  //Need to handle input and rebuild tree only when becoming visible
  if (visible){
    fillSegmentCombo();
    if (getPatcher().isGitPatch()) {
      int ignore = getPatcher().calculateStripGitPrefixSegments();
      fStripPrefixSegments.select(ignore);
      getPatcher().setStripPrefixSegments(ignore);
    }
    // TODO: We should only do this if the tree needs to be rebuilt
    rebuildTree();
    updateEnablements();
    addedRemovedLines.setText(countLines());
    // expand the first tree item i.e. change
    getCompareConfiguration().getContainer().getNavigator().selectChange(true);
    getContainer().updateButtons();
    getShell().getDefaultButton().setFocus();
  }
}

相关文章

微信公众号

最新文章

更多

Shell类方法