Java Code Examples for org.eclipse.jface.dialogs.PageChangingEvent#getCurrentPage()

The following examples show how to use org.eclipse.jface.dialogs.PageChangingEvent#getCurrentPage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ApplicationLayoutDropWizard.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
@Override
public void handlePageChanging(final PageChangingEvent event) {
    // Assume success
    event.doit = true;

    // Get the current and target pages
    WizardPage currPage = (WizardPage)event.getCurrentPage();
    WizardPage targetPage = (WizardPage)event.getTargetPage();
    
    if ((currPage instanceof AlwStartPage) && (targetPage instanceof AlwPropertiesPage)) {
        // Moving from first to second page
        LayoutConfig lc = getStartPage().getSelectedLayoutConfig();
        if (lc != null) {
            String errorMsg = "This configuration is in a library that is not yet enabled in this application.\nEnabling the library will add it as a dependency in Xsp Properties.\nXsp Properties is currently open in another editor and cannot be modified.\nClose Xsp Properties in order to proceed.";  // $NLX-ApplicationLayoutDropWizard.Thisconfigurationisinalibrarythat-1$
            String proceedMsg = "This configuration is in a library that is not yet enabled in this application.\nEnabling the library will add it as a dependency in Xsp Properties.\nClick Continue to update your Xsp Properties."; // $NLX-ApplicationLayoutDropWizard.Thisconfigurationisinalibrarythat.1-1$
            event.doit = WizardUtils.findStandardDefAndAddDependency(lc.facesDef.getNamespaceUri(), lc.tagName, _panelData.getDesignerProject(), errorMsg, proceedMsg); 
        }
    }        
}
 
Example 2
Source File: CalendarViewDropWizard.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
@Override
public void handlePageChanging(PageChangingEvent event) {
    event.doit = true;
    advancing = false;
    if (event.getCurrentPage() == _viewPage) {
        if (event.getTargetPage() == _restPage) {
            if (_viewPage.hasChanged()) {
                // We want the rest page to reload it's data
                _restPage.setFirstDisplay(true);
                _viewPage.setHasChanged(false);
            }
            advancing = true;
        }
    } else if (event.getCurrentPage() == _restPage) {
        if (event.getTargetPage() == _actionPage) {
            advancing = true;
        }
    } else if (event.getCurrentPage() == _actionPage) {
        if (event.getTargetPage() == _eventPage) {
            advancing = true;
        }
    }
}
 
Example 3
Source File: ImportBluemixWizard.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
@Override
public void handlePageChanging(PageChangingEvent event) {
    event.doit = true;
    advancing = false;
    if (event.getCurrentPage() == _zipFilePage) {
        if (event.getTargetPage() == _importCopyMethodPage) {
            advancing = true;
        }
    }
    else if (event.getCurrentPage() == _importCopyMethodPage) {
        if (event.getTargetPage() == _dirPage) {
            advancing = true;
        }
    }
    else if (event.getCurrentPage() == _dirPage) {
        if (event.getTargetPage() == _deployCopyMethodPage) {
            advancing = true;
        }
    }
    else if (event.getCurrentPage() == _deployCopyMethodPage) {
        if (event.getTargetPage() == _orgSpacePage) {
            advancing = true;
            if (_orgSpacePage.isFirstDisplay()) {
                if (!runJob(_orgSpacePage.getOrgsAndSpaces)) {
                    event.doit = false;
                }
            }
        }
    }
}
 
Example 4
Source File: SinglePageAppDropWizard.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
@Override
public void handlePageChanging(PageChangingEvent event) {
    // Get the current and target pages
    WizardBasePage currPage = (WizardBasePage)event.getCurrentPage();
    WizardBasePage targetPage = (WizardBasePage)event.getTargetPage();
    
    // Check that the Next button has been pressed
    if ((currPage.getStepNumber() < targetPage.getStepNumber()) || (targetPage.getStepNumber() < 0)) {
        event.doit = currPage.validatePage();
    } else {
        event.doit = true;
    }
}
 
Example 5
Source File: LangNewProjectWizard.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void handlePageChanging(PageChangingEvent event) {
	Object currentPage = event.getCurrentPage();
	Object nextPage = event.getTargetPage();
	
	if(currentPage == getFirstPage() && nextPage == getSecondPage()) {
		event.doit = changeToNewProject();
	} else if(currentPage == getSecondPage() && nextPage == getFirstPage()) {
		removeProject();
	}
}
 
Example 6
Source File: AbapGitWizard.java    From ADT_Frontend with MIT License 4 votes vote down vote up
@Override
public void handlePageChanging(final PageChangingEvent event) {

	//-> Credentials page -> Branch & Package page
	if (event.getCurrentPage() == AbapGitWizard.this.pageRepo && event.getTargetPage() == AbapGitWizard.this.pageBranchAndPackage
			&& !AbapGitWizard.this.pageRepo.validateAll()) {
		event.doit = false;
		return;
	}

	//-> Branch & Package page -> Credentials page
	if (event.getCurrentPage() == AbapGitWizard.this.pageBranchAndPackage && event.getTargetPage() == AbapGitWizard.this.pageRepo) {
		event.doit = true;
		return;
	}

	//-> Branch & Package page -> Transport page
	if (event.getCurrentPage() == AbapGitWizard.this.pageBranchAndPackage
			&& event.getTargetPage() == AbapGitWizard.this.transportPage) {
		if (!AbapGitWizard.this.pageBranchAndPackage.validateAll()) {
			event.doit = false;
			return;
		}
	}

	//-> Branch & Package page -> Any page
	if (event.getCurrentPage() == AbapGitWizard.this.pageBranchAndPackage
			&& !AbapGitWizard.this.pageBranchAndPackage.validateAll()) {
		event.doit = false;
		return;
	}

	//-> Prepare transport page
	if (event.getTargetPage() == AbapGitWizard.this.transportPage) {
		try {
			// The transport service requires URIs to objects we want to create in the
			// target package.
			// However, we do not know these URIs from the client.
			// Instead, give it the URI of the package in which we clone.
			IAdtObjectReference packageRef = AbapGitWizard.this.cloneData.packageRef;
			IAdtObjectReference checkRef = IAdtCoreFactory.eINSTANCE.createAdtObjectReference();
			checkRef.setUri(packageRef.getUri());
			IAdtTransportCheckData checkData = AbapGitWizard.this.transportService.check(checkRef, packageRef.getPackageName(),
					true);
			AbapGitWizard.this.transportPage.setCheckData(checkData);
		} catch (Exception e) {
			AbapGitWizard.this.pageBranchAndPackage.setMessage(e.getMessage(), DialogPage.ERROR);
		}
	}

	//-> APACK page -> Any page
	if (event.getCurrentPage() == AbapGitWizard.this.pageApack && !AbapGitWizard.this.pageApack.validateAll()) {
		event.doit = false;
		return;
	}
}
 
Example 7
Source File: AbapGitWizardPull.java    From ADT_Frontend with MIT License 4 votes vote down vote up
@Override
public void handlePageChanging(final PageChangingEvent event) {

	//-> Credentials page -> Branch & Package page
	if (event.getCurrentPage() == AbapGitWizardPull.this.pageCredentials
			&& event.getTargetPage() == AbapGitWizardPull.this.pageBranchAndPackage) {
		if (!AbapGitWizardPull.this.pageCredentials.validateAll()) {
			event.doit = false;
			return;
		}
	}

	//-> Branch & Package page -> Credentials page
	if (event.getCurrentPage() == AbapGitWizardPull.this.pageBranchAndPackage
			&& event.getTargetPage() == AbapGitWizardPull.this.pageCredentials) {
		if (!AbapGitWizardPull.this.pageBranchAndPackage.validateAll()) {
			event.doit = false;
			return;
		}
	}

	//-> Branch & Package page -> Transport page
	if (event.getCurrentPage() == AbapGitWizardPull.this.pageBranchAndPackage
			&& event.getTargetPage() == AbapGitWizardPull.this.transportPage) {
		if (!AbapGitWizardPull.this.pageBranchAndPackage.validateAll()) {
			event.doit = false;
			return;
		}
	}

	//-> Branch & Package page -> Any page
	if (event.getCurrentPage() == AbapGitWizardPull.this.pageBranchAndPackage
			&& !AbapGitWizardPull.this.pageBranchAndPackage.validateAll()) {
		event.doit = false;
		return;
	}

	//-> Prepare transport page
	if (event.getTargetPage() == AbapGitWizardPull.this.transportPage) {
		try {
			// The transport service requires URIs to objects we want to create in the
			// target package.
			// However, we do not know these URIs from the client.
			// Instead, give it the URI of the package in which we clone.
			IAdtObjectReference packageRef = AbapGitWizardPull.this.cloneData.packageRef;
			IAdtObjectReference checkRef = IAdtCoreFactory.eINSTANCE.createAdtObjectReference();
			checkRef.setUri(packageRef.getUri());
			IAdtTransportCheckData checkData = AbapGitWizardPull.this.transportService.check(checkRef, packageRef.getPackageName(),
					true);
			AbapGitWizardPull.this.transportPage.setCheckData(checkData);
		} catch (Exception e) {
			AbapGitWizardPull.this.pageBranchAndPackage.setMessage(e.getMessage(), DialogPage.ERROR);
		}
	}

	//-> APACK page -> Any page
	if (event.getCurrentPage() == AbapGitWizardPull.this.pageApack && !AbapGitWizardPull.this.pageApack.validateAll()) {
		event.doit = false;
		return;
	}

}
 
Example 8
Source File: ConfigBluemixWizard.java    From XPagesExtensionLibrary with Apache License 2.0 4 votes vote down vote up
@Override
public void handlePageChanging(PageChangingEvent event) {
    event.doit = true;
    advancing = false;
    if (event.getCurrentPage() == _dirPage) {
        if (_dirPage.hasChanged()) {
            _configPage.setFirstDisplay(true);
            _manifestPage.setFirstDisplay(true);
            _dirPage.setHasChanged(false);
        }
        if (event.getTargetPage() == _configPage) {
            advancing = true;
        } else if (event.getTargetPage() == _copyMethodPage) {
            advancing = true;
        }
    }
    else if (event.getCurrentPage() == _configPage) {
        if (event.getTargetPage() == _copyMethodPage) {
            advancing = true;
        }
    }
    else if (event.getCurrentPage() == _copyMethodPage) {
        if (event.getTargetPage() == _cloudSpacePage) {
            advancing = true;
            if(_cloudSpacePage.isFirstDisplay()) {
                if (!runJob(_cloudSpacePage.getOrgsAndSpaces)) {
                    event.doit = false;
                }
            }
        }
    }
    else if (event.getCurrentPage() == _cloudSpacePage) {
        if (_cloudSpacePage.hasChanged()) {
            _namePage.setFirstDisplay(true);
            _cloudSpacePage.setHasChanged(false);
        }            
        if (event.getTargetPage() == _namePage) {
            advancing = true;
            if (_namePage.isFirstDisplay()) {
                _namePage.setCloudSpace(_cloudSpacePage.getOrg(), _cloudSpacePage.getSpace());
                if (!runJob(_namePage.getApplications)) {
                    event.doit = false;
                }
            }
        } else if (event.getTargetPage() == _manifestPage) {
            advancing = true;
        }
    }
    else if (event.getCurrentPage() == _manifestPage) {
        if (event.getTargetPage() == _namePage) {
            advancing = true;
            if (_namePage.isFirstDisplay()) {
                _namePage.setCloudSpace(_cloudSpacePage.getOrg(), _cloudSpacePage.getSpace());
                if (!runJob(_namePage.getApplications)) {
                    event.doit = false;
                }
            }
        }             
    }
}