Example usage for org.springframework.ide.eclipse.core SpringCoreUtils removeProjectBuilder

List of usage examples for org.springframework.ide.eclipse.core SpringCoreUtils removeProjectBuilder

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.core SpringCoreUtils removeProjectBuilder.

Prototype

public static void removeProjectBuilder(IProject project, String builderID, IProgressMonitor monitor)
        throws CoreException 

Source Link

Document

Removes given builder from specified project.

Usage

From source file:org.eclipse.virgo.ide.bundlor.ui.internal.actions.AutomaticRunBundlorActionDelegate.java

public void run(IAction action) {
    final Set<IJavaProject> projects = new LinkedHashSet<IJavaProject>();
    Iterator<IProject> iter = selected.iterator();
    while (iter.hasNext()) {
        IProject project = iter.next();/*from w  w w  .j a v a  2s.c  om*/
        if (FacetUtils.isBundleProject(project)) {
            projects.add(JdtUtils.getJavaProject(project));
        }
    }
    IRunnableWithProgress op = new WorkspaceModifyOperation() {
        protected void execute(IProgressMonitor monitor) throws CoreException, InterruptedException {
            for (final IJavaProject javaProject : projects) {
                try {
                    if (BundlorUiPlugin.isBundlorBuilderEnabled(javaProject.getProject())) {
                        SpringCoreUtils.removeProjectBuilder(javaProject.getProject(),
                                BundlorCorePlugin.BUILDER_ID, new NullProgressMonitor());
                    } else {
                        SpringCoreUtils.addProjectBuilder(javaProject.getProject(),
                                BundlorCorePlugin.BUILDER_ID, new NullProgressMonitor());
                    }
                } catch (CoreException e) {
                    SpringCore.log(e);
                }
            }
        }
    };

    try {
        PlatformUI.getWorkbench().getProgressService().runInUI(
                PlatformUI.getWorkbench().getActiveWorkbenchWindow(), op,
                ResourcesPlugin.getWorkspace().getRoot());
    } catch (InvocationTargetException e) {
        SpringCore.log(e);
    } catch (InterruptedException e) {
    }

}

From source file:org.eclipse.virgo.ide.ui.editors.BundleOverviewPage.java

private void createBundleActionSection(IManagedForm managedForm, Composite parent, FormToolkit toolkit) {
    String sectionTitle;/*from w  w w . jav a  2  s .c om*/
    sectionTitle = "Bundle Actions";
    Section section = createStaticSection(toolkit, parent, sectionTitle);

    Composite container = createStaticSectionClient(toolkit, section);

    FormText noteText = createClient(container,
            "<form><p>OSGi dependency meta data in the MANIFEST.MF file can automatically be updated based on dependencies expressed in source code artifacts.</p><p>Java source files, Spring XML configuration, JPA persistence.xml and Hibernate .hbm mapping files will be analysed. The process will create Import-Package and Export-Package headers.</p><li style=\"image\" value=\"manifest\" bindent=\"5\"><a href=\"generate\">Update MANIFEST.MF</a>: automatically generate MANIFEST.MF file based on dependencies in source code artifacts.</li></form>",
            true, toolkit);
    noteText.setImage("manifest", ServerIdeUiPlugin.getImage("full/obj16/osgi_obj.gif")); //$NON-NLS-1$
    noteText.addHyperlinkListener(this);

    Button button = toolkit.createButton(container, "Automatically update MANIFEST.MF file in background.",
            SWT.CHECK);
    button.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            IRunnableWithProgress op = new WorkspaceModifyOperation() {
                protected void execute(IProgressMonitor monitor) throws CoreException, InterruptedException {
                    try {
                        if (isBundlorBuilderEnabled()) {
                            SpringCoreUtils.removeProjectBuilder(resource.getProject(),
                                    BundlorCorePlugin.BUILDER_ID, new NullProgressMonitor());
                        } else {
                            SpringCoreUtils.addProjectBuilder(resource.getProject(),
                                    BundlorCorePlugin.BUILDER_ID, new NullProgressMonitor());
                        }
                    } catch (CoreException e1) {
                    }
                }
            };
            try {
                PlatformUI.getWorkbench().getProgressService().runInUI(PDEPlugin.getActiveWorkbenchWindow(), op,
                        PDEPlugin.getWorkspace().getRoot());
            } catch (InvocationTargetException e1) {
            } catch (InterruptedException e1) {
            }

        }
    });
    TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
    data.indent = 5;
    button.setLayoutData(data);
    button.setSelection(isBundlorBuilderEnabled());

    toolkit.createLabel(container, "");

    FormText text = createClient(container, BUNDLE_ACTION_SECTION_TEXT, true, toolkit);
    PDELabelProvider lp = PDEPlugin.getDefault().getLabelProvider();
    text.setImage("page", lp.get(PDEPluginImages.DESC_PAGE_OBJ, SharedLabelProvider.F_EDIT)); //$NON-NLS-1$
    text.setImage("dependencies", //$NON-NLS-1$
            JavaUI.getSharedImages().getImage(ISharedImages.IMG_OBJS_EXTERNAL_ARCHIVE_WITH_SOURCE));
    text.setImage("export", BeansGraphImages.getImage(BeansGraphImages.IMG_OBJS_EXPORT_ENABLED));
    text.addHyperlinkListener(this);

    section.setClient(container);
}