Search in sources :

Example 11 with IFormPage

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

the class FormPartJavaSearchContext method getFormPage.

private IFormPage getFormPage() {
    IManagedForm managedForm = formPart.getManagedForm();
    if (managedForm == null)
        return null;
    Object container = managedForm.getContainer();
    if (!(container instanceof IFormPage))
        return null;
    return (IFormPage) container;
}
Also used : IManagedForm(org.eclipse.ui.forms.IManagedForm) IFormPage(org.eclipse.ui.forms.editor.IFormPage)

Example 12 with IFormPage

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

the class BndEditor method showHighestPriorityPage.

void showHighestPriorityPage() {
    int selectedPrio = Integer.MIN_VALUE;
    String selected = null;
    BndPreferences prefs = new BndPreferences();
    if (prefs.getEditorOpenSourceTab()) {
        selected = SOURCE_PAGE;
        selectedPrio = 0;
    } else {
        for (Object pageObj : pages) {
            IFormPage page = (IFormPage) pageObj;
            int priority = 0;
            if (page instanceof IPriority)
                priority = ((IPriority) page).getPriority();
            if (priority > selectedPrio) {
                selected = page.getId();
                selectedPrio = priority;
            }
        }
    }
    if (selected != null)
        setActivePage(selected);
}
Also used : BndPreferences(bndtools.preferences.BndPreferences) IFormPage(org.eclipse.ui.forms.editor.IFormPage) IPriority(bndtools.editor.common.IPriority)

Example 13 with IFormPage

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

the class BndEditor method addPages.

@Override
protected void addPages() {
    updateIncludedPages();
    showHighestPriorityPage();
    if (!Central.isWorkspaceInited()) {
        IFormPage activePage = getActivePageInstance();
        if (activePage != null && activePage.getManagedForm() != null) {
            ScrolledForm form = activePage.getManagedForm().getForm();
            if (form.getMessage() == null) {
                form.setMessage(SYNC_MESSAGE, IMessageProvider.WARNING);
            }
        }
    }
}
Also used : ScrolledForm(org.eclipse.ui.forms.widgets.ScrolledForm) IFormPage(org.eclipse.ui.forms.editor.IFormPage)

Example 14 with IFormPage

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

the class BundleCalculatedImportsPart method resourceChanged.

@Override
public void resourceChanged(IResourceChangeEvent event) {
    IFile file = getEditorFile();
    if (file != null) {
        IResourceDelta delta = event.getDelta();
        delta = delta.findMember(file.getFullPath());
        if (delta != null) {
            IFormPage page = (IFormPage) getManagedForm().getContainer();
            if (page.isActive())
                refresh();
            else
                markStale();
        }
    }
}
Also used : IFile(org.eclipse.core.resources.IFile) IFormPage(org.eclipse.ui.forms.editor.IFormPage) IResourceDelta(org.eclipse.core.resources.IResourceDelta)

Example 15 with IFormPage

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

the class PrivatePackagesPart method doAddPackages.

private void doAddPackages() {
    // Prepare the exclusion list based on existing private packages
    final Set<String> packageNameSet = new HashSet<String>(packages);
    // Create a filter from the exclusion list and packages matching
    // "java.*", which must not be included in a bundle
    IPackageFilter filter = new IPackageFilter() {

        @Override
        public boolean select(String packageName) {
            return !packageName.equals("java") && !packageName.startsWith("java.") && !packageNameSet.contains(packageName);
        }
    };
    IFormPage page = (IFormPage) getManagedForm().getContainer();
    IWorkbenchWindow window = page.getEditorSite().getWorkbenchWindow();
    // Prepare the package lister from the Java project
    IJavaProject javaProject = getJavaProject();
    if (javaProject == null) {
        MessageDialog.openError(getSection().getShell(), "Error", "Cannot add packages: unable to find a Java project associated with the editor input.");
        return;
    }
    IJavaSearchScope searchScope = SearchEngine.createJavaSearchScope(new IJavaElement[] { javaProject });
    JavaSearchScopePackageLister packageLister = new JavaSearchScopePackageLister(searchScope, window);
    // Create and open the dialog
    PackageSelectionDialog dialog = new PackageSelectionDialog(getSection().getShell(), packageLister, filter, "Select new packages to include in the bundle.");
    dialog.setSourceOnly(true);
    dialog.setMultipleSelection(true);
    if (dialog.open() == Window.OK) {
        Object[] results = dialog.getResult();
        List<String> added = new LinkedList<String>();
        // Select the results
        for (Object result : results) {
            String newPackageName = (String) result;
            if (packages.add(newPackageName)) {
                added.add(newPackageName);
            }
        }
        // Update the model and view
        if (!added.isEmpty()) {
            viewer.add(added.toArray());
            markDirty();
        }
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IFormPage(org.eclipse.ui.forms.editor.IFormPage) LinkedList(java.util.LinkedList) IJavaProject(org.eclipse.jdt.core.IJavaProject) IJavaSearchScope(org.eclipse.jdt.core.search.IJavaSearchScope) JavaSearchScopePackageLister(bndtools.internal.pkgselection.JavaSearchScopePackageLister) IPackageFilter(bndtools.internal.pkgselection.IPackageFilter) HashSet(java.util.HashSet) PackageSelectionDialog(bndtools.internal.pkgselection.PackageSelectionDialog)

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