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