Beispiel #1
0
 public void linkActivated(HyperlinkEvent e) {
   String href = (String) e.getHref();
   if ("resolve".equals(href)) {
     handleResolve();
   } else if ("prune".equals(href)) {
     handlePrune();
   }
 }
Beispiel #2
0
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.ui.forms.events.HyperlinkListener#linkActivated(org.eclipse.ui.forms.events.HyperlinkEvent)
  */
 public void linkActivated(HyperlinkEvent e) {
   String href = (String) e.getHref();
   // try page references
   if (href.equals("dependencies")) // $NON-NLS-1$
   getEditor().setActivePage(DependenciesPage.PAGE_ID);
   else if (href.equals("runtime")) // $NON-NLS-1$
   getEditor().setActivePage(RuntimePage.PAGE_ID);
   else if (href.equals("extensions")) { // $NON-NLS-1$
     if (getEditor().setActivePage(ExtensionsPage.PAGE_ID) == null)
       activateExtensionPages(ExtensionsPage.PAGE_ID);
   } else if (href.equals("ex-points")) { // $NON-NLS-1$
     if (getEditor().setActivePage(ExtensionPointsPage.PAGE_ID) == null)
       activateExtensionPages(ExtensionPointsPage.PAGE_ID);
   } else if (href.equals("build")) { // $NON-NLS-1$
     if (!getPDEEditor().hasInputContext(BuildInputContext.CONTEXT_ID)) {
       if (!MessageDialog.openQuestion(
           PDEPlugin.getActiveWorkbenchShell(),
           PDEUIMessages.OverviewPage_buildTitle,
           PDEUIMessages.OverviewPage_buildQuestion)) return;
       IFile file = PDEProject.getBuildProperties(getPDEEditor().getCommonProject());
       WorkspaceBuildModel model = new WorkspaceBuildModel(file);
       model.save();
       IEditorInput in = new FileEditorInput(file);
       getPDEEditor()
           .getContextManager()
           .putContext(in, new BuildInputContext(getPDEEditor(), in, false));
     }
     getEditor().setActivePage(BuildPage.PAGE_ID);
   } else if (href.equals("export")) { // $NON-NLS-1$
     getExportAction().run();
   } else if (href.equals("action.convert")) { // $NON-NLS-1$
     handleConvert();
   } else if (href.equals("organize")) { // $NON-NLS-1$
     getEditor().doSave(null);
     OrganizeManifestsAction organizeAction = new OrganizeManifestsAction();
     organizeAction.selectionChanged(
         null, new StructuredSelection(getPDEEditor().getCommonProject()));
     organizeAction.run(null);
   } else if (href.equals("externalize")) { // $NON-NLS-1$
     getEditor().doSave(null);
     GetNonExternalizedStringsAction externalizeAction = new GetNonExternalizedStringsAction();
     externalizeAction.selectionChanged(
         null, new StructuredSelection(getPDEEditor().getCommonProject()));
     externalizeAction.run(null);
   } else super.linkActivated(e);
 }
Beispiel #3
0
  @Override
  public void linkActivated(HyperlinkEvent event) {
    try {
      String target = (String) event.getHref();

      if ("action:open".equals(target)) // $NON-NLS-1$
      {
        IHandlerService handlerService =
            (IHandlerService) getIntroSite().getService(IHandlerService.class);
        Object result =
            handlerService.executeCommand(
                "name.abuchen.portfolio.ui.commands.openFileCommand", null); // $NON-NLS-1$
        if (result != null) PlatformUI.getWorkbench().getIntroManager().closeIntro(this);
      } else if ("action:new".equals(target)) // $NON-NLS-1$
      {
        IHandlerService handlerService =
            (IHandlerService) getIntroSite().getService(IHandlerService.class);
        handlerService.executeCommand(
            "name.abuchen.portfolio.ui.commands.newFileCommand", null); // $NON-NLS-1$
        PlatformUI.getWorkbench().getIntroManager().closeIntro(this);
      } else if ("action:sample".equals(target)) // $NON-NLS-1$
      {
        openSample("kommer.xml"); // $NON-NLS-1$
      } else if ("action:daxsample".equals(target)) // $NON-NLS-1$
      {
        openSample("dax.xml"); // $NON-NLS-1$
      } else if (target.startsWith("http://")) // $NON-NLS-1$
      {
        IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
        IWebBrowser browser = support.getExternalBrowser();
        browser.openURL(new URL(target));
      }

    } catch (CommandException e) {
      PortfolioPlugin.log(e);
      MessageDialog.openError(getIntroSite().getShell(), Messages.LabelError, e.getMessage());
    } catch (PartInitException e) {
      PortfolioPlugin.log(e);
      MessageDialog.openError(getIntroSite().getShell(), Messages.LabelError, e.getMessage());
    } catch (MalformedURLException e) {
      PortfolioPlugin.log(e);
      MessageDialog.openError(getIntroSite().getShell(), Messages.LabelError, e.getMessage());
    }
  }
Beispiel #4
0
 public void linkActivated(final HyperlinkEvent linkEvent) {
   String href = (String) linkEvent.getHref();
   if (href.equals("action.export")) { // $NON-NLS-1$
     if (getPDEEditor().isDirty()) {
       getPDEEditor().doSave(null);
     }
     new WARProductExportAction(getPDEEditor()).run();
   } else if (href.equals("action.configuration")) { // $NON-NLS-1$
     String pageId = ConfigurationPage.PLUGIN_ID;
     getEditor().setActivePage(pageId);
   } else if (href.equals("action.validate")) { // $NON-NLS-1$
     IProductModel model = (IProductModel) getPDEEditor().getAggregateModel();
     WARProductValidateAction validationAction =
         new WARProductValidateAction((IWARProduct) model.getProduct());
     IValidationListener listener = (IValidationListener) getPDEEditor();
     validationAction.addValidationListener(listener);
     validationAction.run();
   } else {
     super.linkActivated(linkEvent);
   }
 }
Beispiel #5
0
    public void linkActivated(HyperlinkEvent e) {
      String ref = (String) e.getHref();
      int number = Integer.parseInt(ref);
      if (number == 0) {
        // Clear the selection if root is selected
        if (viewer.getInput() == input.getRoot())
          viewer.setSelection(new StructuredSelection(new Object[0]), true);

        return;
      }
      // get the parent numbered "number"
      TagTreeItem current = (TagTreeItem) viewer.getInput();
      while (current != null && number > 0) {
        current = current.getParent();
        number--;
      }
      if (current == null) {
        viewer.setInput(input.getRoot());
      } else {
        viewer.setInput(current);
      }
      refresh();
    }