コード例 #1
0
 public void update(final AnActionEvent e) {
   super.update(e);
   final PatternDialectProvider provider =
       PatternDialectProvider.getInstance(DependencyUISettings.getInstance().SCOPE_TYPE);
   e.getPresentation().setText(provider.getDisplayName());
   e.getPresentation().setIcon(provider.getIcon());
 }
コード例 #2
0
  private JComponent createTreeToolbar() {
    final DefaultActionGroup group = new DefaultActionGroup();
    final Runnable update =
        new Runnable() {
          public void run() {
            rebuild(true);
          }
        };
    if (ProjectViewDirectoryHelper.getInstance(myProject).supportsFlattenPackages()) {
      group.add(new FlattenPackagesAction(update));
    }
    final PatternDialectProvider[] dialectProviders =
        Extensions.getExtensions(PatternDialectProvider.EP_NAME);
    for (PatternDialectProvider provider : dialectProviders) {
      for (AnAction action : provider.createActions(myProject, update)) {
        group.add(action);
      }
    }
    group.add(new ShowFilesAction(update));
    final Module[] modules = ModuleManager.getInstance(myProject).getModules();
    if (modules.length > 1) {
      group.add(new ShowModulesAction(update));
      group.add(new ShowModuleGroupsAction(update));
    }
    group.add(new FilterLegalsAction(update));

    if (dialectProviders.length > 1) {
      group.add(new ChooseScopeTypeAction(update));
    }

    ActionToolbar toolbar =
        ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true);
    return toolbar.getComponent();
  }
コード例 #3
0
 @NotNull
 protected DefaultActionGroup createPopupActionGroup(final JComponent button) {
   final DefaultActionGroup group = new DefaultActionGroup();
   for (final PatternDialectProvider provider :
       Extensions.getExtensions(PatternDialectProvider.EP_NAME)) {
     group.add(
         new AnAction(provider.getDisplayName()) {
           public void actionPerformed(final AnActionEvent e) {
             DependencyUISettings.getInstance().SCOPE_TYPE = provider.getShortName();
             myUpdate.run();
           }
         });
   }
   return group;
 }
コード例 #4
0
 boolean isButtonEnabled(boolean rec) {
   final TreePath[] paths = myPackageTree.getSelectionPaths();
   if (paths != null) {
     for (TreePath path : paths) {
       final PackageDependenciesNode node = (PackageDependenciesNode) path.getLastPathComponent();
       if (PatternDialectProvider.getInstance(DependencyUISettings.getInstance().SCOPE_TYPE)
               .createPackageSet(node, rec)
           != null) {
         return true;
       }
     }
   }
   return false;
 }
コード例 #5
0
 static boolean isButtonEnabled(boolean rec, TreePath[] paths, TreeSelectionEvent e) {
   if (paths != null) {
     for (TreePath path : paths) {
       if (!e.isAddedPath(path)) continue;
       final PackageDependenciesNode node = (PackageDependenciesNode) path.getLastPathComponent();
       if (PatternDialectProvider.getInstance(DependencyUISettings.getInstance().SCOPE_TYPE)
               .createPackageSet(node, rec)
           != null) {
         return true;
       }
     }
   }
   return false;
 }
コード例 #6
0
 @Nullable
 private ArrayList<PackageSet> getSelectedSets(boolean recursively) {
   int[] rows = myPackageTree.getSelectionRows();
   if (rows == null) return null;
   final ArrayList<PackageSet> result = new ArrayList<PackageSet>();
   for (int row : rows) {
     final PackageDependenciesNode node =
         (PackageDependenciesNode) myPackageTree.getPathForRow(row).getLastPathComponent();
     final PackageSet set =
         PatternDialectProvider.getInstance(DependencyUISettings.getInstance().SCOPE_TYPE)
             .createPackageSet(node, recursively);
     if (set != null) {
       result.add(set);
     }
   }
   return result;
 }