当前位置: 首页>>代码示例>>Java>>正文


Java ExternalActionManager类代码示例

本文整理汇总了Java中org.eclipse.jface.action.ExternalActionManager的典型用法代码示例。如果您正苦于以下问题:Java ExternalActionManager类的具体用法?Java ExternalActionManager怎么用?Java ExternalActionManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ExternalActionManager类属于org.eclipse.jface.action包,在下文中一共展示了ExternalActionManager类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMenuText

import org.eclipse.jface.action.ExternalActionManager; //导入依赖的package包/类
/**
 * Returns the text shown in the menu, potentially with a shortcut appended.
 *
 * @return the menu text
 */
public String getMenuText() {
  if (definitionId == null) {
    return menuText;
  }
  final ExternalActionManager.ICallback callback =
      ExternalActionManager.getInstance().getCallback();
  if (callback != null) {
    final String shortCut = callback.getAcceleratorText(definitionId);
    if (shortCut == null) {
      return menuText;
    }
    return menuText + "\t" + shortCut; //$NON-NLS-1$
  }
  return menuText;
}
 
开发者ID:Haixing-Hu,项目名称:swt-widgets,代码行数:21,代码来源:MenuManagerEx.java

示例2: fill

import org.eclipse.jface.action.ExternalActionManager; //导入依赖的package包/类
/**
 * The <code>ActionContributionItemEx</code> implementation of this
 * <code>IContributionItem</code> method creates an SWT <code>Button</code>
 * for the action using the action's style. If the action's checked property
 * has been set, the button is created and primed to the value of the checked
 * property.
 */
@Override
public void fill(Composite parent) {
  if ((widget == null) && (parent != null)) {
    int flags = SWT.PUSH;
    if (action != null) {
      if (action.getStyle() == IAction.AS_CHECK_BOX) {
        flags = SWT.TOGGLE;
      }
      if (action.getStyle() == IAction.AS_RADIO_BUTTON) {
        flags = SWT.RADIO;
      }
    }

    final Button b = new Button(parent, flags);
    b.setData(this);
    b.addListener(SWT.Dispose, getButtonListener());
    // Don't hook a dispose listener on the parent
    b.addListener(SWT.Selection, getButtonListener());
    if (action.getHelpListener() != null) {
      b.addHelpListener(action.getHelpListener());
    }
    widget = b;

    update(null);

    // Attach some extra listeners.
    action.addPropertyChangeListener(propertyListener);
    if (action != null) {
      final String commandId = action.getActionDefinitionId();
      final ExternalActionManager.ICallback callback = ExternalActionManager
          .getInstance().getCallback();

      if ((callback != null) && (commandId != null)) {
        callback.addPropertyChangeListener(commandId, actionTextListener);
      }
    }
  }
}
 
开发者ID:Haixing-Hu,项目名称:swt-widgets,代码行数:46,代码来源:ActionContributionItemEx.java

示例3: handleWidgetDispose

import org.eclipse.jface.action.ExternalActionManager; //导入依赖的package包/类
/**
 * Handles a widget dispose event for the widget corresponding to this item.
 */
private void handleWidgetDispose(Event e) {
  // Check if our widget is the one being disposed.
  if (e.widget == widget) {
    // Dispose of the menu creator.
    if ((action.getStyle() == IAction.AS_DROP_DOWN_MENU) && menuCreatorCalled) {
      final IMenuCreator mc = action.getMenuCreator();
      if (mc != null) {
        mc.dispose();
      }
    }

    // Unhook all of the listeners.
    action.removePropertyChangeListener(propertyListener);
    if (action != null) {
      final String commandId = action.getActionDefinitionId();
      final ExternalActionManager.ICallback callback = ExternalActionManager
          .getInstance().getCallback();

      if ((callback != null) && (commandId != null)) {
        callback.removePropertyChangeListener(commandId, actionTextListener);
      }
    }

    // Clear the widget field.
    widget = null;

    disposeOldImages();
  }
}
 
开发者ID:Haixing-Hu,项目名称:swt-widgets,代码行数:33,代码来源:ActionContributionItemEx.java

示例4: isCommandActive

import org.eclipse.jface.action.ExternalActionManager; //导入依赖的package包/类
/**
 * Returns whether the command corresponding to this action is active.
 */
private boolean isCommandActive() {
  final IAction actionToCheck = getAction();

  if (actionToCheck != null) {
    final String commandId = actionToCheck.getActionDefinitionId();
    final ExternalActionManager.ICallback callback = ExternalActionManager
        .getInstance().getCallback();

    if (callback != null) {
      return callback.isActive(commandId);
    }
  }
  return true;
}
 
开发者ID:Haixing-Hu,项目名称:swt-widgets,代码行数:18,代码来源:ActionContributionItemEx.java

示例5: getMenuText

import org.eclipse.jface.action.ExternalActionManager; //导入依赖的package包/类
/**
 * Returns the text shown in the menu, potentially with a shortcut
 * appended.
 *
 * @return the menu text
 */
public String getMenuText() {
    if (definitionId == null) {
        return menuText;
    }
    ExternalActionManager.ICallback callback = ExternalActionManager.getInstance().getCallback();
    if (callback != null) {
        String shortCut = callback.getAcceleratorText(definitionId);
        if (shortCut == null) {
            return menuText;
        }
        return menuText + "\t" + shortCut; //$NON-NLS-1$
    }
    return menuText;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:21,代码来源:MenuManagerCopiedToAddCreateMenuWithMenuParent.java

示例6: fill

import org.eclipse.jface.action.ExternalActionManager; //导入依赖的package包/类
/**
 * The <code>ActionContributionItem</code> implementation of this
 * <code>IContributionItem</code> method creates an SWT
 * <code>Button</code> for the action using the action's style. If the
 * action's checked property has been set, the button is created and primed
 * to the value of the checked property.
 */
@Override
public void fill(Composite parent) {
	if (widget == null && parent != null) {
		int flags = SWT.PUSH;
		if (action != null) {
			if (action.getStyle() == IAction.AS_CHECK_BOX) {
				flags = SWT.TOGGLE;
			}
			if (action.getStyle() == IAction.AS_RADIO_BUTTON) {
				flags = SWT.RADIO;
			}
		}

		Button b = new Button(parent, flags);
		b.setData(this);
		b.addListener(SWT.Dispose, getButtonListener());
		// Don't hook a dispose listener on the parent
		b.addListener(SWT.Selection, getButtonListener());
		if (action.getHelpListener() != null) {
			b.addHelpListener(action.getHelpListener());
		}
		widget = b;

		update(null);

		// Attach some extra listeners.
		action.addPropertyChangeListener(propertyListener);
		if (action != null) {
			String commandId = action.getActionDefinitionId();
			ExternalActionManager.ICallback callback = ExternalActionManager
					.getInstance().getCallback();

			if ((callback != null) && (commandId != null)) {
				callback.addPropertyChangeListener(commandId,
						actionTextListener);
			}
		}
	}
}
 
开发者ID:TheWhiteShadow3,项目名称:cuina,代码行数:47,代码来源:SaveActionContributionItem.java

示例7: handleWidgetDispose

import org.eclipse.jface.action.ExternalActionManager; //导入依赖的package包/类
/**
 * Handles a widget dispose event for the widget corresponding to this item.
 */
private void handleWidgetDispose(Event e) {
	// Check if our widget is the one being disposed.
	if (e.widget == widget) {
		// Dispose of the menu creator.
		if (action.getStyle() == IAction.AS_DROP_DOWN_MENU
				&& menuCreatorCalled) {
			IMenuCreator mc = action.getMenuCreator();
			if (mc != null) {
				mc.dispose();
			}
		}

		// Unhook all of the listeners.
		action.removePropertyChangeListener(propertyListener);
		if (action != null) {
			String commandId = action.getActionDefinitionId();
			ExternalActionManager.ICallback callback = ExternalActionManager
					.getInstance().getCallback();

			if ((callback != null) && (commandId != null)) {
				callback.removePropertyChangeListener(commandId,
						actionTextListener);
			}
		}

		// Clear the widget field.
		widget = null;

		disposeOldImages();
	}
}
 
开发者ID:TheWhiteShadow3,项目名称:cuina,代码行数:35,代码来源:SaveActionContributionItem.java

示例8: isCommandActive

import org.eclipse.jface.action.ExternalActionManager; //导入依赖的package包/类
/**
 * Returns whether the command corresponding to this action is active.
 */
private boolean isCommandActive() {
	IAction actionToCheck = getAction();

	if (actionToCheck != null) {
		String commandId = actionToCheck.getActionDefinitionId();
		ExternalActionManager.ICallback callback = ExternalActionManager
				.getInstance().getCallback();

		if (callback != null) {
			return callback.isActive(commandId);
		}
	}
	return true;
}
 
开发者ID:TheWhiteShadow3,项目名称:cuina,代码行数:18,代码来源:SaveActionContributionItem.java

示例9: update

import org.eclipse.jface.action.ExternalActionManager; //导入依赖的package包/类
@Override
public void update(String property) {
  final IContributionItem items[] = getItems();

  for (final IContributionItem item : items) {
    item.update(property);
  }

  if ((menu != null) && ! menu.isDisposed() && (menu.getParentItem() != null)) {
    if (IAction.TEXT.equals(property)) {
      String text = getOverrides().getText(this);

      if (text == null) {
        text = getMenuText();
      }

      if (text != null) {
        final ExternalActionManager.ICallback callback = ExternalActionManager
            .getInstance().getCallback();

        if (callback != null) {
          final int index = text.indexOf('&');

          if ((index >= 0) && (index < (text.length() - 1))) {
            final char character = Character.toUpperCase(text
                .charAt(index + 1));

            if (callback.isAcceleratorInUse(SWT.ALT | character)
                && isTopLevelMenu()) {
              if (index == 0) {
                text = text.substring(1);
              } else {
                text = text.substring(0, index) + text.substring(index + 1);
              }
            }
          }
        }

        menu.getParentItem().setText(text);
      }
    } else if (IAction.IMAGE.equals(property) && (image != null)) {
      final LocalResourceManager localManager = new LocalResourceManager(
          JFaceResources.getResources());
      menu.getParentItem().setImage(localManager.createImage(image));
      disposeOldImages();
      imageManager = localManager;
    }
  }
}
 
开发者ID:Haixing-Hu,项目名称:swt-widgets,代码行数:50,代码来源:MenuManagerEx.java

示例10: update

import org.eclipse.jface.action.ExternalActionManager; //导入依赖的package包/类
@Override
public void update(String property) {
    IContributionItem items[] = getItems();

    for (int i = 0; i < items.length; i++) {
        items[i].update(property);
    }

    if (menu != null && !menu.isDisposed() && menu.getParentItem() != null) {
        if (IAction.TEXT.equals(property)) {
            String text = getOverrides().getText(this);

            if (text == null) {
                text = getMenuText();
            }

            if (text != null) {
                ExternalActionManager.ICallback callback = ExternalActionManager.getInstance().getCallback();

                if (callback != null) {
                    int index = text.indexOf('&');

                    if (index >= 0 && index < text.length() - 1) {
                        char character = Character.toUpperCase(text.charAt(index + 1));

                        if (callback.isAcceleratorInUse(SWT.ALT | character)) {
                            if (index == 0) {
                                text = text.substring(1);
                            } else {
                                text = text.substring(0, index) + text.substring(index + 1);
                            }
                        }
                    }
                }

                menu.getParentItem().setText(text);
            }
        } else if (IAction.IMAGE.equals(property) && image != null) {
            LocalResourceManager localManager = new LocalResourceManager(JFaceResources.getResources());
            menu.getParentItem().setImage(localManager.createImage(image));
            disposeOldImages();
            imageManager = localManager;
        }
    }
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:46,代码来源:MenuManagerCopiedToAddCreateMenuWithMenuParent.java


注:本文中的org.eclipse.jface.action.ExternalActionManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。