public void apply() throws ConfigurationException { final List<TreePath> treePaths = TreeUtil.collectExpandedPaths(myActionsTree); if (mySelectedSchema != null) { CustomizationUtil.optimizeSchema(myActionsTree, mySelectedSchema); } restorePathsAfterTreeOptimization(treePaths); CustomActionsSchema.getInstance().copyFrom(mySelectedSchema); setCustomizationSchemaForCurrentProjects(); }
private List<ActionUrl> findActionsUnderSelection() { final ArrayList<ActionUrl> actions = new ArrayList<ActionUrl>(); final TreePath[] selectionPaths = myActionsTree.getSelectionPaths(); if (selectionPaths != null) { for (TreePath path : selectionPaths) { final ActionUrl selectedUrl = CustomizationUtil.getActionUrl(path, ActionUrl.MOVE); final ArrayList<String> selectedGroupPath = new ArrayList<String>(selectedUrl.getGroupPath()); final Object component = selectedUrl.getComponent(); if (component instanceof Group) { selectedGroupPath.add(((Group) component).getName()); for (ActionUrl action : mySelectedSchema.getActions()) { final ArrayList<String> groupPath = action.getGroupPath(); final int idx = Collections.indexOfSubList(groupPath, selectedGroupPath); if (idx > -1) { actions.add(action); } } } } } return actions; }
public boolean isModified() { CustomizationUtil.optimizeSchema(myActionsTree, mySelectedSchema); return CustomActionsSchema.getInstance().isModified(mySelectedSchema); }
private void restorePathsAfterTreeOptimization(final List<TreePath> treePaths) { for (final TreePath treePath : treePaths) { myActionsTree.expandPath(CustomizationUtil.getPathByUserObjects(myActionsTree, treePath)); } }