private IContributionItem getFindItem() {
   return getItem(
       ActionFactory.FIND.getId(),
       ActionFactory.FIND.getCommandId(),
       null,
       null,
       Messages.Workbench_findReplace,
       Messages.Workbench_findReplaceToolTip,
       null);
 }
 public void setActiveEditor(IEditorPart part) {
   IActionBars bars = getActionBars();
   if (bars == null) return;
   if (part instanceof LargeFileEditor) {
     LargeFileEditor editor = (LargeFileEditor) part;
     IAction findAction = editor.getAction(ActionFactory.FIND.getId());
     bars.setGlobalActionHandler(ActionFactory.FIND.getId(), findAction);
     bars.updateActionBars();
   }
 }
  public void setActivePage(IEditorPart part) {
    if (activeEditorPart == part) return;

    activeEditorPart = part;

    IActionBars actionBars = getActionBars();
    if (actionBars != null) {

      ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null;

      actionBars.setGlobalActionHandler(
          ActionFactory.DELETE.getId(), getAction(editor, ITextEditorActionConstants.DELETE));
      actionBars.setGlobalActionHandler(
          ActionFactory.UNDO.getId(), getAction(editor, ITextEditorActionConstants.UNDO));
      actionBars.setGlobalActionHandler(
          ActionFactory.REDO.getId(), getAction(editor, ITextEditorActionConstants.REDO));
      actionBars.setGlobalActionHandler(
          ActionFactory.CUT.getId(), getAction(editor, ITextEditorActionConstants.CUT));
      actionBars.setGlobalActionHandler(
          ActionFactory.COPY.getId(), getAction(editor, ITextEditorActionConstants.COPY));
      actionBars.setGlobalActionHandler(
          ActionFactory.PASTE.getId(), getAction(editor, ITextEditorActionConstants.PASTE));
      actionBars.setGlobalActionHandler(
          ActionFactory.SELECT_ALL.getId(),
          getAction(editor, ITextEditorActionConstants.SELECT_ALL));
      actionBars.setGlobalActionHandler(
          ActionFactory.FIND.getId(), getAction(editor, ITextEditorActionConstants.FIND));
      actionBars.setGlobalActionHandler(
          IDEActionFactory.BOOKMARK.getId(), getAction(editor, IDEActionFactory.BOOKMARK.getId()));
      actionBars.updateActionBars();
    }
  }
 private void restoreSavedActions(IActionBars _actionBars) {
   _actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), copy);
   _actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), paste);
   _actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), delete);
   _actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), selectAll);
   _actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), cut);
   _actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(), find);
   _actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undo);
   _actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redo);
 }
 private void saveCurrentActions(IActionBars _actionBars) {
   copy = _actionBars.getGlobalActionHandler(ActionFactory.COPY.getId());
   paste = _actionBars.getGlobalActionHandler(ActionFactory.PASTE.getId());
   delete = _actionBars.getGlobalActionHandler(ActionFactory.DELETE.getId());
   selectAll = _actionBars.getGlobalActionHandler(ActionFactory.SELECT_ALL.getId());
   cut = _actionBars.getGlobalActionHandler(ActionFactory.CUT.getId());
   find = _actionBars.getGlobalActionHandler(ActionFactory.FIND.getId());
   undo = _actionBars.getGlobalActionHandler(ActionFactory.UNDO.getId());
   redo = _actionBars.getGlobalActionHandler(ActionFactory.REDO.getId());
 }
Esempio n. 6
0
  @Override
  public void createPartControl(Composite parent) {
    parent.setLayout(new FillLayout());

    IPreferenceStore prefStore = DdmsPlugin.getDefault().getPreferenceStore();
    mLogCatPanel = new LogCatPanel(prefStore);
    mLogCatPanel.createPanel(parent);
    setSelectionDependentPanel(mLogCatPanel);

    mLogCatPanel.addLogCatMessageSelectionListener(
        new ILogCatMessageSelectionListener() {
          @Override
          public void messageDoubleClicked(LogCatMessage m) {
            onDoubleClick(m);
          }
        });

    mClipboard = new Clipboard(parent.getDisplay());
    IActionBars actionBars = getViewSite().getActionBars();
    actionBars.setGlobalActionHandler(
        ActionFactory.COPY.getId(),
        new Action(Messages.LogCatView_Copy) {
          @Override
          public void run() {
            mLogCatPanel.copySelectionToClipboard(mClipboard);
          }
        });

    actionBars.setGlobalActionHandler(
        ActionFactory.SELECT_ALL.getId(),
        new Action(Messages.LogCatView_Select_All) {
          @Override
          public void run() {
            mLogCatPanel.selectAll();
          }
        });

    actionBars.setGlobalActionHandler(
        ActionFactory.FIND.getId(),
        new Action("Find") {
          @Override
          public void run() {
            mLogCatPanel.showFindDialog();
          }
        });
  }