use of org.eclipse.jface.wizard.IWizardContainer 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.wizard.IWizardContainer 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.wizard.IWizardContainer in project eclipse-integration-commons by spring-projects.
the class GenericCommandWizard method resizeWizard.
protected void resizeWizard(Control control) {
Point size = control.computeSize(SWT.DEFAULT, SWT.DEFAULT);
IWizardContainer container = getContainer();
if (container != null) {
container.getShell().setSize(size);
}
}
use of org.eclipse.jface.wizard.IWizardContainer in project epp.mpc by eclipse.
the class MarketplacePage method showNextPage.
protected void showNextPage() {
IWizardContainer container = getContainer();
if (container == null) {
return;
}
IWizardPage currentPage = container.getCurrentPage();
if (currentPage == MarketplacePage.this && currentPage.isPageComplete()) {
IWizardPage nextPage = getNextPage();
if (nextPage != null && nextPage instanceof WizardPage) {
((WizardPage) nextPage).setPageComplete(true);
container.showPage(nextPage);
}
}
}
use of org.eclipse.jface.wizard.IWizardContainer in project epp.mpc by eclipse.
the class MarketplaceWizard method updateProfileChangeOperation.
public void updateProfileChangeOperation() {
removeAddedRepositoryLocations();
addedRepositoryLocations = null;
profileChangeOperation = null;
operationIUs = null;
IWizardContainer wizardContainer = getContainer();
if (getSelectionModel().computeProvisioningOperationViable()) {
ProfileChangeOperationComputer provisioningOperation = null;
try {
final Map<CatalogItem, Operation> itemToOperation = getSelectionModel().getItemToSelectedOperation();
final Set<CatalogItem> selectedItems = getSelectionModel().getSelectedCatalogItems();
OperationType operationType = null;
for (Map.Entry<CatalogItem, Operation> entry : itemToOperation.entrySet()) {
if (!selectedItems.contains(entry.getKey())) {
continue;
}
OperationType entryOperationType = OperationType.map(entry.getValue());
if (entryOperationType != null) {
if (operationType == null || operationType == OperationType.UPDATE || entryOperationType == OperationType.CHANGE) {
operationType = entryOperationType;
}
}
}
Map<FeatureEntry, Operation> featureEntries = getSelectionModel().getFeatureEntryToOperation(false, false);
if (operationType == OperationType.CHANGE || operationType == OperationType.UPDATE) {
Set<OperationType> featureOperations = EnumSet.noneOf(OperationType.class);
for (Entry<FeatureEntry, Operation> entry : featureEntries.entrySet()) {
OperationType operation = OperationType.map(entry.getValue());
if (operation != null) {
featureOperations.add(operation);
}
}
if (featureOperations.contains(OperationType.INSTALL) && featureOperations.contains(OperationType.UPDATE)) {
// just perform install instead, which covers update
featureOperations.remove(OperationType.UPDATE);
}
if (featureOperations.size() == 1) {
operationType = featureOperations.iterator().next();
}
}
URI dependenciesRepository = null;
if (getConfiguration().getCatalogDescriptor().getDependenciesRepository() != null) {
try {
dependenciesRepository = getConfiguration().getCatalogDescriptor().getDependenciesRepository().toURI();
} catch (URISyntaxException e) {
throw new InvocationTargetException(e);
}
}
provisioningOperation = new ProfileChangeOperationComputer(operationType, selectedItems, featureEntries.keySet(), dependenciesRepository, getConfiguration().getCatalogDescriptor().isInstallFromAllRepositories() ? ProfileChangeOperationComputer.ResolutionStrategy.FALLBACK_STRATEGY : ProfileChangeOperationComputer.ResolutionStrategy.SELECTED_REPOSITORIES, withRemediation);
wizardContainer.run(true, true, provisioningOperation);
profileChangeOperation = provisioningOperation.getOperation();
operationIUs = provisioningOperation.getIus();
addedRepositoryLocations = provisioningOperation.getAddedRepositoryLocations();
operationNewInstallItems = computeNewInstallCatalogItems();
errorMessage = provisioningOperation.getErrorMessage();
final IStatus result = profileChangeOperation.getResolutionResult();
if (result != null && operationIUs != null && operationIUs.length > 0 && operationType == OperationType.INSTALL) {
switch(result.getSeverity()) {
case IStatus.ERROR:
Job job = new Job(Messages.MarketplaceWizard_errorNotificationJob) {
IStatus r = result;
Set<CatalogItem> items = new HashSet<CatalogItem>(itemToOperation.keySet());
IInstallableUnit[] ius = operationIUs;
String details = profileChangeOperation.getResolutionDetails();
{
setSystem(false);
setUser(false);
setPriority(LONG);
}
@Override
protected IStatus run(IProgressMonitor monitor) {
getCatalog().installErrorReport(monitor, r, items, ius, details);
return monitor.isCanceled() ? Status.CANCEL_STATUS : Status.OK_STATUS;
}
};
job.schedule();
}
}
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
IStatus status;
if (cause instanceof CoreException) {
status = ((CoreException) cause).getStatus();
} else {
status = new Status(IStatus.ERROR, MarketplaceClientUi.BUNDLE_ID, NLS.bind(Messages.MarketplaceWizard_problemsPerformingProvisioningOperation, new Object[] { cause.getMessage() }), cause);
}
MarketplaceClientUi.handle(status, StatusManager.SHOW | StatusManager.BLOCK | StatusManager.LOG);
} catch (InterruptedException e) {
// canceled
MarketplaceClientUi.log(IStatus.CANCEL, MarketplaceClientUi.BUNDLE_ID, Messages.MarketplaceWizard_ProvisioningOperationCancelled, e);
} finally {
if (provisioningOperation != null) {
addedRepositoryLocations = provisioningOperation.getAddedRepositoryLocations();
}
}
}
// re-get the container - in case the wizard was closed in the meantime, this will be null...
wizardContainer = getContainer();
if (wizardContainer != null && wizardContainer.getCurrentPage() == featureSelectionWizardPage) {
featureSelectionWizardPage.updateMessage();
}
}
Aggregations