@Override
 public void doubleClick(final DoubleClickEvent event) {
   final Playlist playlist = player.getPlaylist();
   if (!playlist.isEmpty()) {
     final StructuredSelection selection = (StructuredSelection) event.getSelection();
     playlist.setCurrentTrack((PlaylistItem) selection.getFirstElement());
     player.play();
     event.getViewer().refresh();
   }
 }
Exemplo n.º 2
0
    @Override
    public void doubleClick(DoubleClickEvent event) {

      TableViewer viewer = (TableViewer) event.getViewer();
      IStructuredSelection thisSelection = (IStructuredSelection) event.getSelection();

      Object selectedNode = thisSelection.getFirstElement();

      Extra extra = (Extra) selectedNode;

      if (extra != null) {
        if (extra.isSelected()) extra.setSelected(false);
        else extra.setSelected(true);
      }
      viewer.refresh();
    }
Exemplo n.º 3
0
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
  */
 public void doubleClick(DoubleClickEvent event) {
   IStructuredSelection s = (IStructuredSelection) event.getSelection();
   Object element = s.getFirstElement();
   if (tree.isExpandable(element)) {
     tree.setExpandedState(element, !tree.getExpandedState(element));
   } else if (opActions.length > 0) {
     saveWidgetValues();
     setReturnCode(OK);
     close();
   }
 }
Exemplo n.º 4
0
  /**
   * This method listens for a double click event on a resource. If the selected resource is valid,
   * then it will be displayed on the view's associated {@link ICEResourceView#resourcePage}.
   */
  @Override
  public void doubleClick(DoubleClickEvent event) {

    // Get the associated resource
    ISelection selection = event.getSelection();
    ICEResource selectedResource = getResourceFromSelection(selection);

    // If it's valid, try to display it on the ResourcePage
    if (selectedResource != null) {
      try {
        resourcePage.showResource(selectedResource);
      } catch (PartInitException e) {
        logger.error(getClass().getName() + " Exception!", e);
      }
    }

    return;
  }
Exemplo n.º 5
0
 public void doubleClick(DoubleClickEvent event) {
   if (dlListeners != null) {
     Iterator<DoubleClickListener> it = dlListeners.iterator();
     while (it.hasNext()) {
       DoubleClickListener dl = it.next();
       IStructuredSelection sel = (IStructuredSelection) event.getSelection();
       if ((sel != null) && (!sel.isEmpty())) {
         Object element = sel.getFirstElement();
         if (element instanceof Tree<?>) {
           element = ((Tree<?>) element).contents;
         }
         if (element instanceof PersistentObject) {
           dl.doubleClicked((PersistentObject) element, this);
         }
       }
     }
   }
 }
Exemplo n.º 6
0
  @Override
  @SuppressWarnings("unchecked")
  public void doubleClick(final DoubleClickEvent event) {
    TreeSelection selection = (TreeSelection) event.getSelection();
    Object o = selection.getFirstElement();
    if (o == null || o instanceof NoDatabaseRoot) {
      return;
    }

    // Try to find element to show
    HoogleResult result = null;
    if (o instanceof HoogleResult) {
      result = (HoogleResult) o;
    } else {
      Map.Entry<String, Object> entry = (Map.Entry<String, Object>) o;
      if (entry.getValue() instanceof HoogleResult) {
        result = (HoogleResult) entry.getValue();
      } else {
        // Show the first one (better than nothing)
        result = ((ArrayList<HoogleResult>) entry.getValue()).get(0);
      }
    }
    IWorkbenchPage page = getSite().getPage();

    switch (result.getType()) {
      case KEYWORD:
        OpenDefinitionHandler.openExternalDefinition(
            page, null, null, null, result.getName(), null);
        break;
      case PACKAGE:
        HoogleResultPackage pkg = (HoogleResultPackage) result;
        OpenDefinitionHandler.openExternalDefinition(
            page, null, pkg.getPackage().getIdentifier().toString(), null, null, null);
        break;
      case MODULE:
        HoogleResultModule mod = (HoogleResultModule) result;
        OpenDefinitionHandler.openExternalDefinition(
            page, null, mod.getPackageIdentifiers().get(0).toString(), mod.getName(), null, null);
        break;
      case CONSTRUCTOR:
        HoogleResultConstructor con = (HoogleResultConstructor) result;
        OpenDefinitionHandler.openExternalDefinition(
            page,
            null,
            con.getPackageIdentifiers().get(0).toString(),
            con.getModule(),
            con.getName(),
            "v");
        break;
      case DECLARATION:
        HoogleResultDeclaration decl = (HoogleResultDeclaration) result;
        OpenDefinitionHandler.openExternalDefinition(
            page,
            null,
            decl.getPackageIdentifiers().get(0).toString(),
            decl.getModule(),
            decl.getName(),
            decl.getDeclaration().getType() == DeclarationType.FUNCTION ? "v" : "t");
        break;
      case WARNING: // not in tree
        break;
    }
  }
Exemplo n.º 7
0
  @SuppressWarnings("unchecked")
  public void doubleClick(final DoubleClickEvent event) {
    TreeSelection selection = (TreeSelection) event.getSelection();
    Object o = selection.getFirstElement();
    if (o == null || o instanceof NoDatabaseRoot) {
      return;
    }

    // Try to find element to show
    HoogleResult result = null;
    if (o instanceof HoogleResult) {
      result = (HoogleResult) o;
    } else {
      Map.Entry<String, Object> entry = (Map.Entry<String, Object>) o;
      if (entry.getValue() instanceof HoogleResult) {
        result = (HoogleResult) entry.getValue();
      } else {
        // Show the first one (better than nothing)
        result = ((ArrayList<HoogleResult>) entry.getValue()).get(0);
      }
    }

    String url = null;
    switch (result.getType()) {
      case PACKAGE:
        HoogleResultPackage pkg = (HoogleResultPackage) result;
        url = HtmlUtil.generatePackageUrl(pkg.getPackage().getIdentifier());
        break;
      case MODULE:
        HoogleResultModule mod = (HoogleResultModule) result;
        url = HtmlUtil.generateModuleUrl(mod.getPackageIdentifiers().get(0), mod.getName());
        break;
      case CONSTRUCTOR:
        HoogleResultConstructor con = (HoogleResultConstructor) result;
        url =
            HtmlUtil.generateElementUrl(
                con.getPackageIdentifiers().get(0), con.getModule(), true, con.getName());
        break;
      case DECLARATION:
        HoogleResultDeclaration decl = (HoogleResultDeclaration) result;
        url =
            HtmlUtil.generateElementUrl(
                decl.getPackageIdentifiers().get(0),
                decl.getModule(),
                decl.getDeclaration().getType() == DeclarationType.FUNCTION,
                decl.getName());
        break;
    }

    // Open browser
    if (url != null) {
      try {
        IWorkbenchBrowserSupport browserSupport =
            this.getSite().getWorkbenchWindow().getWorkbench().getBrowserSupport();
        URL webUrl = new URL(url);
        IWebBrowser browser =
            browserSupport.createBrowser(
                IWorkbenchBrowserSupport.AS_EDITOR | IWorkbenchBrowserSupport.LOCATION_BAR,
                null,
                "Haskell Browser",
                "Haskell Browser");
        browser.openURL(webUrl);
      } catch (Throwable ex) {
        // Do nothing
      }
    }
  }
    /**
     * @see
     *     org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
     */
    public void doubleClick(DoubleClickEvent event) {

      openFilterEditor(event.getSelection());
    }
Exemplo n.º 9
0
 public void doubleClick(DoubleClickEvent event) {
   IStructuredSelection selection = (IStructuredSelection) event.getSelection();
   Node node = (Node) selection.getFirstElement();
   OntResource subject = node.getSubject();
   if (outline != null) outline.drillTo(subject);
 }