Search in sources :

Example 6 with IFormPage

use of org.eclipse.ui.forms.editor.IFormPage in project bndtools by bndtools.

the class BuildOperationsPart method findEditorResource.

private IResource findEditorResource() {
    IFormPage formPage = (IFormPage) getManagedForm().getContainer();
    IResource resource = ResourceUtil.getResource(formPage.getEditorInput());
    return resource;
}
Also used : IFormPage(org.eclipse.ui.forms.editor.IFormPage) IResource(org.eclipse.core.resources.IResource)

Example 7 with IFormPage

use of org.eclipse.ui.forms.editor.IFormPage in project bndtools by bndtools.

the class ExportPatternsListPart method selectPackagesToAdd.

protected List<ExportedPackage> selectPackagesToAdd() {
    List<ExportedPackage> added = null;
    final IPackageFilter filter = new IPackageFilter() {

        @Override
        public boolean select(String packageName) {
            if (packageName.equals("java") || packageName.startsWith("java."))
                return false;
            return true;
        }
    };
    IFormPage page = (IFormPage) getManagedForm().getContainer();
    IWorkbenchWindow window = page.getEditorSite().getWorkbenchWindow();
    // Prepare the package lister from the Java project
    IProject project = ResourceUtil.getResource(page.getEditorInput()).getProject();
    IJavaProject javaProject = JavaCore.create(project);
    IJavaSearchScope searchScope = SearchEngine.createJavaSearchScope(new IJavaElement[] { javaProject });
    JavaSearchScopePackageLister packageLister = new JavaSearchScopePackageLister(searchScope, window);
    // Create and open the dialog
    PackageSelectionDialog dialog = new PackageSelectionDialog(window.getShell(), packageLister, filter, "Select new packages to export from the bundle.");
    dialog.setSourceOnly(true);
    dialog.setMultipleSelection(true);
    if (dialog.open() == Window.OK) {
        Object[] results = dialog.getResult();
        added = new LinkedList<ExportedPackage>();
        // Select the results
        for (Object result : results) {
            String newPackageName = (String) result;
            ExportedPackage newPackage = new ExportedPackage(newPackageName, new Attrs());
            added.add(newPackage);
        }
    }
    return added;
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) Attrs(aQute.bnd.header.Attrs) IFormPage(org.eclipse.ui.forms.editor.IFormPage) IProject(org.eclipse.core.resources.IProject) IJavaProject(org.eclipse.jdt.core.IJavaProject) ExportedPackage(aQute.bnd.build.model.clauses.ExportedPackage) IJavaSearchScope(org.eclipse.jdt.core.search.IJavaSearchScope) JavaSearchScopePackageLister(bndtools.internal.pkgselection.JavaSearchScopePackageLister) IPackageFilter(bndtools.internal.pkgselection.IPackageFilter) PackageSelectionDialog(bndtools.internal.pkgselection.PackageSelectionDialog)

Example 8 with IFormPage

use of org.eclipse.ui.forms.editor.IFormPage in project bndtools by bndtools.

the class PluginsPart method doReload.

void doReload() {
    IFormPage page = (IFormPage) getManagedForm().getContainer();
    final IFile file = ResourceUtil.getFile(page.getEditorInput());
    if (file != null && file.exists()) {
        WorkspaceJob job = new WorkspaceJob("Reload Plugins") {

            @Override
            public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
                file.touch(monitor);
                return Status.OK_STATUS;
            }
        };
        job.setUser(true);
        job.schedule();
    }
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IFile(org.eclipse.core.resources.IFile) WorkspaceJob(org.eclipse.core.resources.WorkspaceJob) IFormPage(org.eclipse.ui.forms.editor.IFormPage)

Example 9 with IFormPage

use of org.eclipse.ui.forms.editor.IFormPage in project bndtools by bndtools.

the class PluginPathPart method getEditorFile.

IFile getEditorFile() {
    IFormPage page = (IFormPage) getManagedForm().getContainer();
    IFile file = ResourceUtil.getFile(page.getEditorInput());
    return file;
}
Also used : IFile(org.eclipse.core.resources.IFile) IFormPage(org.eclipse.ui.forms.editor.IFormPage)

Example 10 with IFormPage

use of org.eclipse.ui.forms.editor.IFormPage in project bndtools by bndtools.

the class FormPartJavaSearchContext method getJavaProject.

public IJavaProject getJavaProject() {
    IFormPage page = getFormPage();
    if (page == null)
        return null;
    IResource resource = ResourceUtil.getResource(page.getEditorInput());
    if (resource == null)
        return null;
    return JavaCore.create(resource.getProject());
}
Also used : IFormPage(org.eclipse.ui.forms.editor.IFormPage) IResource(org.eclipse.core.resources.IResource)

Aggregations

IFormPage (org.eclipse.ui.forms.editor.IFormPage)22 IFile (org.eclipse.core.resources.IFile)12 LinkedList (java.util.LinkedList)3 IJavaProject (org.eclipse.jdt.core.IJavaProject)3 IJavaSearchScope (org.eclipse.jdt.core.search.IJavaSearchScope)3 IEditorInput (org.eclipse.ui.IEditorInput)3 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)3 IPackageFilter (bndtools.internal.pkgselection.IPackageFilter)2 JavaSearchScopePackageLister (bndtools.internal.pkgselection.JavaSearchScopePackageLister)2 PackageSelectionDialog (bndtools.internal.pkgselection.PackageSelectionDialog)2 HashSet (java.util.HashSet)2 IProject (org.eclipse.core.resources.IProject)2 IResource (org.eclipse.core.resources.IResource)2 ExportedPackage (aQute.bnd.build.model.clauses.ExportedPackage)1 Attrs (aQute.bnd.header.Attrs)1 IPriority (bndtools.editor.common.IPriority)1 ITestCaseFilter (bndtools.internal.testcaseselection.ITestCaseFilter)1 JavaSearchScopeTestCaseLister (bndtools.internal.testcaseselection.JavaSearchScopeTestCaseLister)1 TestCaseSelectionDialog (bndtools.internal.testcaseselection.TestCaseSelectionDialog)1 BndPreferences (bndtools.preferences.BndPreferences)1