Package org.eclipse.jface.action

Examples of org.eclipse.jface.action.ActionContributionItem


              if (noServer || noUsername || noPassword) {
                message.append("Please set up preferences first. Go to Eclipse -> Preferences -> Code Conjurer.");
              } else {
                Search search = CodeConjurer.getInstance()
                    .getActiveEditorSearch();
                ActionContributionItem showAdapterAction = (ActionContributionItem) getViewSite()
                    .getActionBars()
                    .getToolBarManager()
                    .find("de.uni_mannheim.swt.codeconjurer.showAdapterAction");

                if (search != null) {
                  Result result = null;
                  int results = 0;
                  switch (search.getKind()) {
                  case Search.STANDARD_SEARCH:
                    showAdapterAction.getAction()
                        .setEnabled(false);
                    result = search.getSearchResult();
                    results = result.getResultItems().length;
                    if (results > 0) {
                      message.append(results
                          + " results found. "
                          + result.getNumberOfSuccessfullyFetchedSources()
                          + " items successfully downloaded. :: Result created "
                          + result.getCreationDate());
                    }
                    break;

                  case Search.TEST_DRIVEN_SEARCH:
                    showAdapterAction.getAction()
                        .setEnabled(true);
                    result = search.getSearchResult();
                    int passes = result
                        .getNumberOfSuccessfulTests();
                    int retrieved = result
                        .getNumberOfSuccessfullyFetchedSources();
                    long time = search.getDuration();
                    String duration;
                    if (time / Math.pow(10, 9) < 120) {
                      duration = String.valueOf(time
                          / Math.pow(10, 9));
                      duration = duration.substring(0,
                          duration.indexOf("."));
                      duration += " s";
                    } else {
                      duration = String
                          .valueOf((time / Math.pow(
                              10, 9)) / 60);
                      duration = duration.substring(0,
                          duration.indexOf(".") + 2);
                      duration += " min";
                    }
                    results = result.getResultItems().length;
                    if (search.getState() == Job.RUNNING) {
                      message.append("Testing in progress");
                      message.append(" :: Time elapsed "
                          + duration);
                    }
                    if (retrieved > 0) {
                      message.append(" :: "
                          + passes
                          + " of "
                          + results
                          + " candidates passed test. "
                          + retrieved
                          + " items successfully downloaded.");
                      if (search.isFinished()) {
                        message.append(" :: Result created "
                            + result.getCreationDate());
                        message.append(" :: Result created in "
                            + duration);
                      }
                    }
                    break;

                  default:
                    message.append("No results.");
                    break;
                  }
                } else {
                  if (showAdapterAction != null) {
                    IAction action = showAdapterAction
                        .getAction();
                    if (action != null) {
                      action.setEnabled(false);
                      message.append("No search results available.");
                    }
View Full Code Here


              if (noServer || noUsername || noPassword) {
                message.append("Please set up preferences first. Go to Eclipse -> Preferences -> Code Conjurer.");
              } else {
                Search search = CodeConjurer.getInstance()
                    .getActiveEditorSearch();
                ActionContributionItem showAdapterAction = (ActionContributionItem) getViewSite()
                    .getActionBars()
                    .getToolBarManager()
                    .find("de.uni_mannheim.swt.codeconjurer.showAdapterAction");

                if (search != null) {
                  Result result = null;
                  int results = 0;
                  switch (search.getKind()) {
                  case Search.STANDARD_SEARCH:
                    showAdapterAction.getAction()
                        .setEnabled(false);
                    result = search.getSearchResult();
                    results = result.getResultItems().length;
                    if (results > 0) {
                      message.append(results
                          + " results found. "
                          + result.getNumberOfSuccessfullyFetchedSources()
                          + " items successfully downloaded. :: Result created "
                          + result.getCreationDate());
                    }
                    break;

                  case Search.TEST_DRIVEN_SEARCH:
                    showAdapterAction.getAction()
                        .setEnabled(true);
                    result = search.getSearchResult();
                    int passes = result
                        .getNumberOfSuccessfulTests();
                    int retrieved = result
                        .getNumberOfSuccessfullyFetchedSources();
                    long time = search.getDuration();
                    String duration;
                    if (time / Math.pow(10, 9) < 120) {
                      duration = String.valueOf(time
                          / Math.pow(10, 9));
                      duration = duration.substring(0,
                          duration.indexOf("."));
                      duration += " s";
                    } else {
                      duration = String
                          .valueOf((time / Math.pow(
                              10, 9)) / 60);
                      duration = duration.substring(0,
                          duration.indexOf(".") + 2);
                      duration += " min";
                    }
                    results = result.getResultItems().length;
                    if (search.getState() == Job.RUNNING) {
                      message.append("Testing in progress");
                      message.append(" :: Time elapsed "
                          + duration);
                    }
                    if (retrieved > 0) {
                      message.append(" :: "
                          + passes
                          + " of "
                          + results
                          + " candidates passed test. "
                          + retrieved
                          + " items successfully downloaded.");
                      if (search.isFinished()) {
                        message.append(" :: Result created "
                            + result.getCreationDate());
                        message.append(" :: Result created in "
                            + duration);
                      }
                    }
                    break;

                  default:
                    message.append("No results.");
                    break;
                  }
                } else {
                  if (showAdapterAction != null) {
                    IAction action = showAdapterAction
                        .getAction();
                    if (action != null) {
                      action.setEnabled(false);
                      message.append("No search results available.");
                    }
View Full Code Here

                            }
                        }
                    };
                    action.setText("Open " + extFile.getProjectRelativePath());
                    action.setImageDescriptor(extFileImg);
                    result.add(new ActionContributionItem(action));
                }
            }

            return result.toArray(new IContributionItem[result.size()]);
        } catch (Exception e) {
View Full Code Here

                share.stopShare();
            }
        };
        stopEditorShare.setText("Stop sharing with: " + share.getRemoteName());
        stopEditorShare.setImageDescriptor(getTopMenuImageDescriptor());
        return new IContributionItem[] {new Separator(), new ActionContributionItem(stopEditorShare)};
    }       
View Full Code Here

          MenuManager menuManager = (MenuManager) item;

          l.addAll(getMenuItemsInternal(menuManager.getItems(), matcher, recursive));
        } else if (item instanceof ActionContributionItem) {
          // Menus
          ActionContributionItem actionContribution = (ActionContributionItem) item;

          if (matcher.matches(actionContribution.getAction()))
            l.add(new SWTBotViewMenu(actionContribution));
        }
      } catch (WidgetNotFoundException e) {
        log.warn(e);
      }
View Full Code Here

        tbm.markDirty();
        tbm.update(true);
        getViewSite().getActionBars().updateActionBars();

        for( IContributionItem item : tbm.getItems() ) {
            ActionContributionItem action = (ActionContributionItem) item;
            action.getAction().setEnabled(action.getAction().isEnabled());
        }

        // focus the active editor if any exisits
        SLDEditorPart editor = (SLDEditorPart) editorBook.getData();
        List<Class> supported = SLD.getSupportedTypes( layer );
View Full Code Here

        public Menu getMenu( Menu parent ) {
            return null;
        }

        protected void addActionToMenu( Menu parent, Action action ) {
            ActionContributionItem item = new ActionContributionItem(action);
            item.fill(parent, -1);
        }
View Full Code Here

        menuService.addContributionFactory( new AbstractContributionFactory(locationURI,null){
            @Override
            public void createContributionItems( IServiceLocator serviceLocator,
            IContributionRoot additions ) {
                for( OpAction action : getActions() ){
                    IContributionItem item = new ActionContributionItem(action);               
                    Expression visibleWhen = Expression.TRUE;
                   
                    additions.addContributionItem(item, visibleWhen);
                }
            }           
View Full Code Here

        List<OpAction> actions = category.getActions();
        for( OpAction action : actions ){
            if( action == null ){
                continue; // TODO: why do we have a null action here?
            }
            IContributionItem item = new ActionContributionItem(action);
            item.setVisible(true);
            items.add( item );
        }
        return items;
    }
View Full Code Here

        fileMenu.add(new GroupMarker(IWorkbenchActionConstants.MRU));

        fileMenu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));

        IWorkbenchAction quit = ActionFactory.QUIT.create(window);
        IContributionItem item = new ActionContributionItem(quit);
        item.setVisible(!Platform.OS_MACOSX.equals(Platform.getOS()));
       
        fileMenu.add(item);
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.action.ActionContributionItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.