protected void createBuildLifecyclePart()

in org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/page/BuildLifecycleBlock.java [129:177]


    protected void createBuildLifecyclePart(final IManagedForm managedForm, final Composite parent) {
        FormToolkit toolkit = managedForm.getToolkit();
        Section section = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
        section.setText("Build Lifecycle");
        section.setDescription("The build lifecycle has the following build phases:");
        section.marginWidth = 10;
        section.marginHeight = 5;
        Composite client = toolkit.createComposite(section, SWT.WRAP);
        GridLayout layout = new GridLayout();
        layout.numColumns = 2;
        layout.marginWidth = 2;
        layout.marginHeight = 2;
        client.setLayout(layout);
        toolkit.paintBordersFor(client);

        section.setClient(client);
        final SectionPart spart = new SectionPart(section);
        managedForm.addPart(spart);
        TreeViewer viewer = new TreeViewer(client);
        GridData gd = new GridData(GridData.FILL_BOTH);
        gd.heightHint = 20;
        gd.widthHint = 100;
        viewer.getTree().setLayoutData(gd);
        viewer.addSelectionChangedListener(new ISelectionChangedListener() {
            public void selectionChanged(SelectionChangedEvent event) {
                managedForm.fireSelectionChanged(spart, event.getSelection());
            }
        });
        viewer.addDoubleClickListener(new IDoubleClickListener(){
            public void doubleClick(DoubleClickEvent event) {
                ISelection selection = event.getSelection();
                if(selection instanceof StructuredSelection){
                    StructuredSelection structuredSelection = (StructuredSelection)selection;
                    if(!structuredSelection.isEmpty()){
                        Object o = structuredSelection.getFirstElement();                       
                        if(o instanceof PhaseReport){
                            runPhase((PhaseReport)o);
                        }else if(o instanceof TargetReport){                            
                            runTarget((TargetReport)o);
                        }
                    }
                }               
            }           
        });
        viewer.setContentProvider(buildLifeCycleContentProvider);
        viewer.setLabelProvider(buildLifecycleLabelProvider);
        viewer.setInput(page.getEditor().getEditorInput());
        // viewer.expandAll();
    }