/*
  * @see org.eclipse.jface.action.Action#run()
  */
 @Override
 public void run() {
   ErlBrowserInformationControlInput input = null;
   if (fInfoControl != null) {
     input = (ErlBrowserInformationControlInput) fInfoControl.getInput();
     fInfoControl.notifyDelayedInputChange(null);
     fInfoControl.dispose();
   } else if (edocView != null) {
     input = edocView.getInput();
   }
   if (input != null) {
     // TODO: add hover location to editor navigation history?
     try {
       final Object element = input.getInputElement();
       if (element instanceof IErlElement) {
         EditorUtility.openElementInEditor(element, true);
       } else if (element instanceof OpenResult) {
         final OpenResult or = (OpenResult) element;
         try {
           final AbstractErlangEditor editor = input.getEditor();
           new OpenUtils().openOpenResult(editor, editor.getModule(), -1, null, or, null);
         } catch (final Exception e) {
           ErlLogger.error(e);
         }
       }
     } catch (final PartInitException e) {
       ErlLogger.error(e);
     }
   }
 }
示例#2
0
 @Override
 public void run() {
   final BrowserInformationControlInput next =
       (BrowserInformationControlInput) fInfoControl.getInput().getNext();
   if (next != null) {
     fInfoControl.setInput(next);
   }
 }
示例#3
0
 @Override
 public void run() {
   final BrowserInformationControlInput previous =
       (BrowserInformationControlInput) fInfoControl.getInput().getPrevious();
   if (previous != null) {
     fInfoControl.setInput(previous);
   }
 }
示例#4
0
 /*
  * @see org.eclipse.jface.action.Action#run()
  */
 @Override
 public void run() {
   final BrowserInformationControlInput input = fInfoControl.getInput();
   fInfoControl.notifyDelayedInputChange(null);
   fInfoControl.dispose();
   try {
     final EdocView view = (EdocView) ErlideUIPlugin.getActivePage().showView(EdocView.ID);
     // TODO view.setInput(infoInput);
     view.setText(input.getHtml());
   } catch (final PartInitException e) {
     ErlLogger.error(e);
   }
 }
示例#5
0
    public void update() {
      final BrowserInformationControlInput current = fInfoControl.getInput();

      if (current != null && current.getNext() != null) {
        setToolTipText(String.format("Go to next %s", current.getNext().getInputName()));
        setEnabled(true);
      } else {
        setToolTipText("");
        setEnabled(false);
      }
    }
示例#6
0
    public void update() {
      final BrowserInformationControlInput current = fInfoControl.getInput();

      if (current != null && current.getPrevious() != null) {
        final BrowserInput previous = current.getPrevious();
        setToolTipText(String.format("Go back to %s", previous.getInputName()));
        setEnabled(true);
      } else {
        setToolTipText("");
        setEnabled(false);
      }
    }
示例#7
0
  @Override
  protected IInformationControl doCreateInformationControl(final Shell parent) {
    if (BrowserInformationControl.isAvailable(parent)) {
      final ToolBarManager tbm = new ToolBarManager(SWT.FLAT);

      final String font = JFaceResources.DIALOG_FONT;
      final BrowserInformationControl control = new BrowserInformationControl(parent, font, tbm);

      final PresenterControlCreator.BackAction backAction =
          new PresenterControlCreator.BackAction(control);
      backAction.setEnabled(false);
      tbm.add(backAction);
      final PresenterControlCreator.ForwardAction forwardAction =
          new PresenterControlCreator.ForwardAction(control);
      tbm.add(forwardAction);
      forwardAction.setEnabled(false);

      final PresenterControlCreator.ShowInEdocViewAction showInEdocViewAction =
          new PresenterControlCreator.ShowInEdocViewAction(control);
      tbm.add(showInEdocViewAction);
      final OpenDeclarationAction openDeclarationAction =
          new OpenDeclarationAction(control, editor);
      tbm.add(openDeclarationAction);

      final SimpleSelectionProvider selectionProvider = new SimpleSelectionProvider();
      final OpenEdocInExternalBrowserAction openEdocInExternalBrowserAction =
          new OpenEdocInExternalBrowserAction(editor.getSite(), null);
      openEdocInExternalBrowserAction.setSpecialSelectionProvider(selectionProvider);
      selectionProvider.addSelectionChangedListener(openEdocInExternalBrowserAction);
      final ImageDescriptor descriptor = ErlideImage.OBJS_EXTERNALBROWSER.getDescriptor();
      openEdocInExternalBrowserAction.setImageDescriptor(descriptor);
      openEdocInExternalBrowserAction.setDisabledImageDescriptor(descriptor);
      selectionProvider.setSelection(new StructuredSelection());
      tbm.add(openEdocInExternalBrowserAction);

      // OpenExternalBrowserAction openExternalJavadocAction = new
      // OpenExternalBrowserAction(
      // parent.getDisplay(), selectionProvider);
      // selectionProvider
      // .addSelectionChangedListener(openExternalJavadocAction);
      // selectionProvider.setSelection(new
      // StructuredSelection());
      // tbm.add(openExternalJavadocAction);

      final IInputChangedListener inputChangeListener =
          new IInputChangedListener() {
            @Override
            public void inputChanged(final Object newInput) {
              backAction.update();
              forwardAction.update();
              if (newInput == null) {
                selectionProvider.setSelection(new StructuredSelection());
              } else if (newInput instanceof BrowserInformationControlInput) {
                final BrowserInformationControlInput input =
                    (BrowserInformationControlInput) newInput;
                final Object inputElement = input.getInputElement();
                selectionProvider.setSelection(new StructuredSelection(inputElement));
                final boolean hasInputElement = inputElement != null;
                showInEdocViewAction.setEnabled(hasInputElement);
                openDeclarationAction.setEnabled(hasInputElement);
                openEdocInExternalBrowserAction.setInput(newInput);
                openEdocInExternalBrowserAction.setEnabled(hasInputElement);
              }
            }
          };
      control.addInputChangeListener(inputChangeListener);

      tbm.update(true);

      control.addLocationListener(new HandleEdocLinksLocationListener(control));

      return control;
    }
    return new DefaultInformationControl(
        parent, EditorsUI.getTooltipAffordanceString(), new ErlInformationPresenter(true));
  }