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;
}
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;
}
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();
}
}
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;
}
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());
}
Aggregations