private void makeActions()

in org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/ResolveVisualizerView.java [228:359]


    private void makeActions() {
        refreshAction = new Action() {
            public void run() {
                final IvyClasspathContainer container = currentContainer;

                if (container == null) {
                    // nothing as been actually selected
                    return;
                }

                ResolveReport report = container.getResolveReport();
                if (report == null) {
                    // TODO we might want to launch some resolve here
                    // or at least open a popup inviting the end user to launch one
                    return;
                }

                // a resolve report is already saved on the container's state, we will use it
                focusOnContainer(container);

                // When a new container is selected, disable the forward action
                // The forward action only stores history when the back button was used (much like a browser)
                forwardStack.clear();
                forwardAction.setEnabled(false);
            }
        };
        refreshAction.setText("Resolve");
        refreshAction.setEnabled(true);
        refreshAction.setImageDescriptor(Plugin.getImageDescriptor("icons/refresh.gif"));

        focusDialogAction = new Action() {
            public void run() {
                ClasspathContainerSelectionDialog dialog = new ClasspathContainerSelectionDialog(viewer.getControl()
                        .getShell());
                dialog.create();
                int dialogStatus = dialog.open();
                if (dialogStatus == Window.OK) {
                    currentContainer = (IvyClasspathContainer) dialog.getFirstResult();
                    refreshAction.run();
                }
            }
        };
        focusDialogAction.setText("Focus on ivy file...");

        focusDialogActionToolbar = new Action() {
            public void run() {
                focusDialogAction.run();
            }
        };
        focusDialogActionToolbar.setToolTipText("Focus on ivy file...");
        focusDialogActionToolbar.setImageDescriptor(ResolveVisualizerPlugin.getImageDescriptor("icons/focus.gif"));

        focusOnSelectionAction = new Action() {
            public void run() {
                if (currentSelection != null) {
                    if (currentRoot != currentSelection) {
                        if (currentRoot != null) {
                            historyStack.push(currentRoot);
                            historyAction.setEnabled(true);
                        }
                        focusOn(currentSelection);
                    }
                }
            }
        };
        focusOnSelectionAction.setText("Focus on selection");
        focusOnSelectionAction.setEnabled(false);

        historyAction = new Action() {
            public void run() {
                if (historyStack.size() > 0) {
                    IvyNodeElement element = historyStack.pop();
                    forwardStack.push(currentRoot);
                    forwardAction.setEnabled(true);
                    focusOn(element);
                    if (historyStack.size() <= 0) {
                        historyAction.setEnabled(false);
                    }
                }
            }
        };
        historyAction.setText("Back");
        historyAction.setToolTipText("Back");
        historyAction.setEnabled(false);
        historyAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages()
                .getImageDescriptor(ISharedImages.IMG_TOOL_BACK));

        forwardAction = new Action() {
            public void run() {
                if (forwardStack.size() > 0) {
                    IvyNodeElement element = forwardStack.pop();

                    historyStack.push(currentRoot);
                    historyAction.setEnabled(true);

                    focusOn(element);
                    if (forwardStack.size() <= 0) {
                        forwardAction.setEnabled(false);
                    }
                }
            }
        };

        forwardAction.setText("Forward");
        forwardAction.setToolTipText("Forward");
        forwardAction.setEnabled(false);
        forwardAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages()
                .getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD));

        hideSelectionAction = new Action() {
            public void run() {
                forceHiddenFilter.addHidden(currentSelection);
                refresh();
            }
        };
        hideSelectionAction.setText("Hide");

        showHiddenAction = new Action() {
            public void run() {
                forceHiddenFilter.clearHidden();
                refresh();
            }
        };
        showHiddenAction.setText("Show hidden");

        applyDefaultLayoutAction = new Action() {
            public void run() {
                viewer.applyLayout();
            }
        };
        applyDefaultLayoutAction.setText("Apply default layout");
    }