use of org.eclipse.jface.dialogs.IPageChangedListener in project n4js by eclipse.
the class NpmExportWizard method init.
@Override
public void init(IWorkbench targetWorkbench, IStructuredSelection currentSelection) {
// this.selection = currentSelection;
List<?> selectedResources = IDE.computeSelectedResources(currentSelection);
List<IProject> workspaceProjects = Arrays.asList(ResourcesPlugin.getWorkspace().getRoot().getProjects());
// Find all selected projects
Set<IProject> projects = selectedResources.stream().filter(m -> m instanceof IResource).map(m -> ((IResource) m).getProject()).filter(// only open projects
p -> p.isOpen()).collect(Collectors.toSet());
// make the behavior predictable by ordering:
TreeSet<IProject> sortedProjects = Sets.<IProject>newTreeSet((a, b) -> a.getName().compareToIgnoreCase(b.getName()));
sortedProjects.addAll(projects);
// 0) turn into IN4JSProject and give and process further.
// a) find out which projects fulfill the npm-"exportable"-contract
// b) give back a list to the user what to export,
// c) disable things not fullfilling the contract.
// d) take choosing from the list and pass to exporter in non-ui package.
// 0)
List<IN4JSEclipseProject> rawN4jsProjects = Lists.newArrayList();
iP2in4jsP = HashBiMap.create();
for (IProject iProject : workspaceProjects) {
IN4JSEclipseProject mappedIn4jsProject = map2In4js(iProject);
if (mappedIn4jsProject != null) {
rawN4jsProjects.add(mappedIn4jsProject);
iP2in4jsP.put(iProject, mappedIn4jsProject);
}
}
// filter out Non-N4JS-projects from initial selection.
sortedProjects.retainAll(iP2in4jsP.keySet());
// filter out all non-N4JS-projects from the workspace projects.
ArrayList<IProject> filteredWorkspaceProjects = new ArrayList<>(workspaceProjects);
filteredWorkspaceProjects.retainAll(iP2in4jsP.keySet());
setWindowTitle("N4JS to npm Export");
setNeedsProgressMonitor(true);
Map<IProject, Boolean> selectedProjects = new HashMap<>();
// Add all workspace projects to list, default selection value is false
filteredWorkspaceProjects.forEach(project -> selectedProjects.put(project, false));
// Override selection value for all initially selected projects
sortedProjects.forEach(project -> selectedProjects.put(project, true));
// exportPage = new ExportSelectionPage("Export Page", rawN4jsProjects, labelProvider);
exportPage = new ExportSelectionPage("Export Page", selectedProjects);
if (runTools())
toolRunnerPage = new NpmToolRunnerPage("npm Execution Page");
comparePage = new PackageJsonComparePage("Compare package.json Page");
pageListener = new IPageChangedListener() {
@Override
public void pageChanged(PageChangedEvent event) {
if (event.getSelectedPage() == comparePage) {
udpatePackagJasonComparison();
}
}
};
}
use of org.eclipse.jface.dialogs.IPageChangedListener in project hale by halestudio.
the class HaleWizardPage method createControl.
/**
* @see WizardPage#createControl(Composite)
*/
@Override
public void createControl(Composite parent) {
IWizardContainer container = getContainer();
if (container instanceof IPageChangeProvider) {
((IPageChangeProvider) container).addPageChangedListener(changeListener = new IPageChangedListener() {
@Override
public void pageChanged(PageChangedEvent event) {
if (event.getSelectedPage() == HaleWizardPage.this) {
if (wasShown) {
onShowPage(false);
} else {
wasShown = true;
onShowPage(true);
}
}
}
});
}
Composite page = new Composite(parent, SWT.NONE);
page.setLayout(new FillLayout());
createContent(page);
setControl(page);
}
use of org.eclipse.jface.dialogs.IPageChangedListener in project hale by halestudio.
the class ConfigurationWizardPage method createControl.
/**
* @see IDialogPage#createControl(Composite)
*/
@Override
public void createControl(Composite parent) {
IWizardContainer container = getContainer();
if (container instanceof IPageChangeProvider) {
((IPageChangeProvider) container).addPageChangedListener(new IPageChangedListener() {
@Override
public void pageChanged(PageChangedEvent event) {
if (currentPage == ConfigurationWizardPage.this) {
// try to apply current configuration
updateConfiguration(getWizard().getConfiguration());
onHidePage();
}
currentPage = event.getSelectedPage();
if (event.getSelectedPage() == ConfigurationWizardPage.this) {
onShowPage();
}
}
});
}
createContent(parent);
}
use of org.eclipse.jface.dialogs.IPageChangedListener in project hale by halestudio.
the class WMSWizardPage method createControl.
/**
* @see IDialogPage#createControl(Composite)
*/
@Override
public void createControl(Composite parent) {
IWizardContainer container = getContainer();
if (container instanceof IPageChangeProvider) {
((IPageChangeProvider) container).addPageChangedListener(new IPageChangedListener() {
@Override
public void pageChanged(PageChangedEvent event) {
if (event.getSelectedPage() == WMSWizardPage.this) {
onShowPage();
}
}
});
}
createContent(parent);
}
use of org.eclipse.jface.dialogs.IPageChangedListener in project cubrid-manager by CUBRID.
the class ImportDataWizardDialog method createContents.
/**
* Overwrite the method. Auto add IPageChangingListener(s);
*
* @param parent of the control.
* @return Control
*/
protected Control createContents(Composite parent) {
Control result = super.createContents(parent);
IWizardPage[] pages = this.getWizard().getPages();
for (IWizardPage page : pages) {
if (page instanceof IPageChangingListener) {
this.addPageChangingListener((IPageChangingListener) page);
}
if (page instanceof IPageChangedListener) {
this.addPageChangedListener((IPageChangedListener) page);
}
}
return result;
}
Aggregations