本文整理了Java中org.eclipse.swt.accessibility.Accessible.addAccessibleListener()
方法的一些代码示例,展示了Accessible.addAccessibleListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Accessible.addAccessibleListener()
方法的具体详情如下:
包路径:org.eclipse.swt.accessibility.Accessible
类名称:Accessible
方法名:addAccessibleListener
[英]Adds the listener to the collection of listeners who will be notified when an accessible client asks for certain strings, such as name, description, help, or keyboard shortcut. The listener is notified by sending it one of the messages defined in the AccessibleListener
interface.
[中]将侦听器添加到侦听器集合中,当可访问的客户端请求某些字符串(例如名称、说明、帮助或键盘快捷键)时,将通知这些侦听器。通过向侦听器发送AccessibleListener
接口中定义的消息之一来通知侦听器。
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
void initAccessibleChevronTb() {
chevronTb.getAccessible().addAccessibleListener(new AccessibleAdapter() {
@Override
public void getName(AccessibleEvent e) {
if (e.childID != ACC.CHILDID_SELF) {
if (chevronItem != null && e.childID == chevronTb.indexOf(chevronItem)) {
e.result = chevronItem.getToolTipText();
}
}
}
});
}
void onKeyDown (Event event) {
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
void initAccessibleChevronTb() {
chevronTb.getAccessible().addAccessibleListener(new AccessibleAdapter() {
@Override
public void getName(AccessibleEvent e) {
if (e.childID != ACC.CHILDID_SELF) {
if (chevronItem != null && e.childID == chevronTb.indexOf(chevronItem)) {
e.result = chevronItem.getToolTipText();
}
}
}
});
}
void onKeyDown (Event event) {
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
void initAccessibleChevronTb() {
chevronTb.getAccessible().addAccessibleListener(new AccessibleAdapter() {
public void getName(AccessibleEvent e) {
if (e.childID != ACC.CHILDID_SELF) {
if (chevronItem != null && e.childID == chevronTb.indexOf(chevronItem)) {
e.result = chevronItem.getToolTipText();
}
}
}
});
}
void onKeyDown (Event event) {
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
void initAccessibleMinMaxTb() {
minMaxTb.getAccessible().addAccessibleListener(new AccessibleAdapter() {
public void getName(AccessibleEvent e) {
if (e.childID != ACC.CHILDID_SELF) {
if (minItem != null && e.childID == minMaxTb.indexOf(minItem)) {
e.result = minItem.getToolTipText();
} else if (maxItem != null && e.childID == minMaxTb.indexOf(maxItem)) {
e.result = maxItem.getToolTipText();
}
}
}
});
}
void initAccessibleChevronTb() {
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
void initAccessibleChevronTb() {
chevronTb.getAccessible().addAccessibleListener(new AccessibleAdapter() {
@Override
public void getName(AccessibleEvent e) {
if (e.childID != ACC.CHILDID_SELF) {
if (chevronItem != null && e.childID == chevronTb.indexOf(chevronItem)) {
e.result = chevronItem.getToolTipText();
}
}
}
});
}
void onKeyDown (Event event) {
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
void initAccessibleChevronTb() {
chevronTb.getAccessible().addAccessibleListener(new AccessibleAdapter() {
@Override
public void getName(AccessibleEvent e) {
if (e.childID != ACC.CHILDID_SELF) {
if (chevronItem != null && e.childID == chevronTb.indexOf(chevronItem)) {
e.result = chevronItem.getToolTipText();
}
}
}
});
}
void onKeyDown (Event event) {
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
/**
* Adds an accessibility listener returning the given fixed name.
*
* @param control the control to add the accessibility support to
* @param text the name
*/
public static void setAccessibilityText(Control control, final String text) {
control.getAccessible().addAccessibleListener(new AccessibleAdapter() {
@Override
public void getName(AccessibleEvent e) {
if (e.childID == ACC.CHILDID_SELF) {
e.result= text;
}
}
});
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.debug.ui
public static void addListener(Control comp, String name) {
//strip mnemonic
String[] strs = name.split("&"); //$NON-NLS-1$
StringBuffer stripped = new StringBuffer();
for (int i = 0; i < strs.length; i++) {
stripped.append(strs[i]);
}
comp.getAccessible().addAccessibleListener(new ControlAccessibleListener(stripped.toString()));
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
void initAccessibleMinMaxTb() {
minMaxTb.getAccessible().addAccessibleListener(new AccessibleAdapter() {
@Override
public void getName(AccessibleEvent e) {
if (e.childID != ACC.CHILDID_SELF) {
if (minItem != null && e.childID == minMaxTb.indexOf(minItem)) {
e.result = minItem.getToolTipText();
} else if (maxItem != null && e.childID == minMaxTb.indexOf(maxItem)) {
e.result = maxItem.getToolTipText();
}
}
}
});
}
void initAccessibleChevronTb() {
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
void initAccessibleMinMaxTb() {
minMaxTb.getAccessible().addAccessibleListener(new AccessibleAdapter() {
@Override
public void getName(AccessibleEvent e) {
if (e.childID != ACC.CHILDID_SELF) {
if (minItem != null && e.childID == minMaxTb.indexOf(minItem)) {
e.result = minItem.getToolTipText();
} else if (maxItem != null && e.childID == minMaxTb.indexOf(maxItem)) {
e.result = maxItem.getToolTipText();
}
}
}
});
}
void initAccessibleChevronTb() {
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
void initAccessibleMinMaxTb() {
minMaxTb.getAccessible().addAccessibleListener(new AccessibleAdapter() {
@Override
public void getName(AccessibleEvent e) {
if (e.childID != ACC.CHILDID_SELF) {
if (minItem != null && e.childID == minMaxTb.indexOf(minItem)) {
e.result = minItem.getToolTipText();
} else if (maxItem != null && e.childID == minMaxTb.indexOf(maxItem)) {
e.result = maxItem.getToolTipText();
}
}
}
});
}
void initAccessibleChevronTb() {
代码示例来源:origin: org.eclipse/org.eclipse.wst.xml.ui
/**
* Specifically set the reporting name of a control for accessibility
*/
private void setAccessible(Control control, String name) {
if (control == null)
return;
final String n = name;
control.getAccessible().addAccessibleListener(new AccessibleAdapter() {
public void getName(AccessibleEvent e) {
if (e.childID == ACC.CHILDID_SELF)
e.result = n;
}
});
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
void initAccessibleMinMaxTb() {
minMaxTb.getAccessible().addAccessibleListener(new AccessibleAdapter() {
@Override
public void getName(AccessibleEvent e) {
if (e.childID != ACC.CHILDID_SELF) {
if (minItem != null && e.childID == minMaxTb.indexOf(minItem)) {
e.result = minItem.getToolTipText();
} else if (maxItem != null && e.childID == minMaxTb.indexOf(maxItem)) {
e.result = maxItem.getToolTipText();
}
}
}
});
}
void initAccessibleChevronTb() {
代码示例来源:origin: org.eclipse.xtext/ui
/**
* Adds an accessibility listener returning the given fixed name.
*
* @param control
* the control to add the accessibility support to
* @param text
* the name
*/
public static void setAccessibilityText(Control control, final String text) {
control.getAccessible().addAccessibleListener(new AccessibleAdapter() {
@Override
public void getName(AccessibleEvent e) {
e.result = text;
}
});
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
/**
* Adds an accessibility listener returning the given fixed name.
*
* @param control the control to add the accessibility support to
* @param text the name
*/
public static void setAccessibilityText(Control control, final String text) {
control.getAccessible().addAccessibleListener(new AccessibleAdapter() {
@Override
public void getName(AccessibleEvent e) {
if (e.childID == ACC.CHILDID_SELF) {
e.result= text;
}
}
});
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
/**
* Add an accessible listener to the label if it can be inferred from the
* image.
*
* @param label
* @param image
*/
private void addAccessibleListeners(Label label, final Image image) {
label.getAccessible().addAccessibleListener(new AccessibleAdapter() {
public void getName(AccessibleEvent event) {
final String accessibleMessage = getAccessibleMessageFor(image);
if (accessibleMessage == null) {
return;
}
event.result = accessibleMessage;
}
});
}
代码示例来源:origin: org.eclipse.e4.ui.workbench.renderers/swt
public void hookControllerLogic(final MUIElement me) {
Object widget = me.getWidget();
// add an accessibility listener (not sure if this is in the wrong place
// (factory?)
if (widget instanceof Control && me instanceof MUILabel) {
((Control) widget).getAccessible().addAccessibleListener(
new AccessibleAdapter() {
public void getName(AccessibleEvent e) {
e.result = ((MUILabel) me).getLocalizedLabel();
}
});
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.renderers.swt
@Override
public void hookControllerLogic(final MUIElement me) {
Object widget = me.getWidget();
// add an accessibility listener (not sure if this is in the wrong place
// (factory?)
if (widget instanceof Control && me instanceof MUILabel) {
((Control) widget).getAccessible().addAccessibleListener(
AccessibleListener.getNameAdapter(e -> e.result = ((MUILabel) me).getLocalizedLabel()));
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
/**
* Creates and returns this manager's tool bar control. Does not create
* a new control if one already exists and is not disposed.
* Also create an {@link AccessibleListener} for the {@link ToolBar}.
*
* @param parent
* the parent control
* @return the tool bar control
*/
public ToolBar createControl(Composite parent) {
if (!toolBarExist() && parent != null) {
toolBar = new ToolBar(parent, itemStyle);
toolBar.setMenu(getContextMenuControl());
update(true);
toolBar.getAccessible().addAccessibleListener(getAccessibleListener());
}
return toolBar;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
private void initButton(Image im, final String tt) {
toolButton.setImage(im);
toolButton.setToolTipText(tt);
toolbar.setVisible(true);
toolbar.getParent().requestLayout(); // must layout
if (currentAccessibleListener != null)
toolbar.getAccessible().removeAccessibleListener(currentAccessibleListener);
currentAccessibleListener = new AccessibleAdapter() {
@Override
public void getName(AccessibleEvent e) {
e.result = tt;
}
};
toolbar.getAccessible().addAccessibleListener(currentAccessibleListener);
}
内容来源于网络,如有侵权,请联系作者删除!