use of org.eclipse.jface.wizard.IWizardPage in project translationstudio8 by heartsome.
the class NewProjectWizardLanguagePage method getNextPage.
/**
* 处理扩展页面中需要获取项目源语言问题 (non-Javadoc)
* @see org.eclipse.jface.wizard.WizardPage#getNextPage()
*/
public IWizardPage getNextPage() {
if (getWizard() == null) {
return null;
}
IWizardPage[] pages = getWizard().getPages();
for (int i = 0; i < pages.length; i++) {
if (pages[i] instanceof AbstractNewProjectWizardPage) {
AbstractNewProjectWizardPage extensoinPage = (AbstractNewProjectWizardPage) pages[i];
extensoinPage.setProjSourceLang(getSrcLanguage());
}
}
return getWizard().getNextPage(this);
}
use of org.eclipse.jface.wizard.IWizardPage in project tdi-studio-se by Talend.
the class JSONWizard method performFinish.
/**
* This method determine if the 'Finish' button is enable This method is called when 'Finish' button is pressed in
* the wizard. We will create an operation and run it using wizard as execution context.
*/
@Override
public boolean performFinish() {
boolean formIsPerformed = false;
IWizardPage finalPage = getCurrentPage();
if (finalPage == null) {
finalPage = propertiesWizardPage;
}
// deleteTemFile();
if (connection.isInputModel()) {
if (finalPage instanceof JSONFileWizardPage) {
int step = ((JSONFileWizardPage) finalPage).step;
if (step == 2) {
formIsPerformed = finalPage.isPageComplete();
if (formIsPerformed) {
List schemas = connection.getSchema();
Set tables = ConnectionHelper.getTables(connection);
if (!schemas.isEmpty() && !tables.isEmpty()) {
JSONXPathLoopDescriptor currentSchema = (JSONXPathLoopDescriptor) schemas.get(0);
MetadataTable currentTable = (MetadataTable) tables.toArray(new MetadataTable[0])[0];
if (!currentSchema.getAbsoluteXPathQuery().equals(oldAbstractQueryPath)) {
resetMetadata(currentSchema.getSchemaTargets(), true);
} else {
resetMetadata(currentSchema.getSchemaTargets(), false);
}
}
}
} else {
formIsPerformed = finalPage.isPageComplete();
}
} else {
formIsPerformed = finalPage.isPageComplete();
}
} else {
formIsPerformed = finalPage.isPageComplete();
}
if (formIsPerformed) {
final IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
final IWorkspaceRunnable op = new IWorkspaceRunnable() {
@Override
public void run(IProgressMonitor monitor) throws CoreException {
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
if (creation) {
String nextId = factory.getNextId();
connectionProperty.setId(nextId);
// changed by hqzhang for TDI-19527, label=displayName
connectionProperty.setLabel(connectionProperty.getDisplayName());
final RepositoryWorkUnit<Object> workUnit = new RepositoryWorkUnit<Object>("", this) {
@Override
protected void run() throws LoginException, PersistenceException {
factory.create(connectionItem, propertiesWizardPage.getDestinationPath());
}
};
workUnit.setAvoidUnloadResources(true);
factory.executeRepositoryWorkUnit(workUnit);
} else {
// changed by hqzhang for TDI-19527, label=displayName
connectionProperty.setLabel(connectionProperty.getDisplayName());
// update schemas
Map<String, SchemaTarget> schemaTargetMap = new HashMap<String, SchemaTarget>();
EList<JSONXPathLoopDescriptor> schema = connection.getSchema();
if (schema != null && schema.size() > 0) {
JSONXPathLoopDescriptor jsonXPathLoopDescriptor = schema.get(0);
if (jsonXPathLoopDescriptor != null) {
EList<SchemaTarget> schemaTargets = jsonXPathLoopDescriptor.getSchemaTargets();
if (schemaTargets != null && schemaTargets.size() > 0) {
for (SchemaTarget schemaTarget : schemaTargets) {
schemaTargetMap.put(schemaTarget.getTagName(), schemaTarget);
}
}
}
}
Map<String, MetadataColumn> columnsMap = new HashMap<String, MetadataColumn>();
MetadataTable[] tables = ConnectionHelper.getTables(connectionItem.getConnection()).toArray(new MetadataTable[0]);
for (MetadataTable table : tables) {
EList<MetadataColumn> columns = table.getColumns();
Iterator<MetadataColumn> columnsIter = columns.iterator();
while (columnsIter.hasNext()) {
MetadataColumn column = columnsIter.next();
if (connection.isInputModel()) {
if (schemaTargetMap.get(column.getLabel()) == null) {
columnsIter.remove();
} else {
columnsMap.put(column.getLabel(), column);
}
} else {
columnsMap.put(column.getLabel(), column);
}
}
}
boolean hasAddedColumns = false;
Iterator<Entry<String, SchemaTarget>> schemaTargetIter = schemaTargetMap.entrySet().iterator();
while (schemaTargetIter.hasNext()) {
Map.Entry<String, SchemaTarget> entry = schemaTargetIter.next();
String key = entry.getKey();
if (columnsMap.get(key) == null) {
hasAddedColumns = true;
break;
}
}
if (hasAddedColumns) {
MessageDialog.openInformation(getShell(), "Detect new columns", "There are some new fields to extract, guess your schema manually if you want to apply the update.");
}
// update
RepositoryUpdateManager.updateFileConnection(connectionItem);
refreshInFinish(propertiesWizardPage.isNameModifiedByUser());
final RepositoryWorkUnit<Object> workUnit = new RepositoryWorkUnit<Object>("", this) {
@Override
protected void run() throws LoginException, PersistenceException {
factory.save(connectionItem);
}
};
workUnit.setAvoidUnloadResources(true);
factory.executeRepositoryWorkUnit(workUnit);
closeLockStrategy();
}
final RepositoryWorkUnit<Object> workUnit = new RepositoryWorkUnit<Object>("", this) {
@Override
protected void run() throws LoginException, PersistenceException {
ProxyRepositoryFactory.getInstance().saveProject(ProjectManager.getInstance().getCurrentProject());
}
};
workUnit.setAvoidUnloadResources(true);
factory.executeRepositoryWorkUnit(workUnit);
}
});
}
};
IRunnableWithProgress iRunnableWithProgress = new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
try {
ISchedulingRule schedulingRule = workspace.getRoot();
// the update the project files need to be done in the workspace runnable to avoid all
// notification
// of changes before the end of the modifications.
workspace.run(op, schedulingRule, IWorkspace.AVOID_UPDATE, monitor);
} catch (CoreException e) {
throw new InvocationTargetException(e);
}
}
};
try {
new ProgressMonitorDialog(null).run(true, true, iRunnableWithProgress);
} catch (InvocationTargetException e) {
ExceptionHandler.process(e);
} catch (InterruptedException e) {
//
}
return true;
} else {
return false;
}
}
use of org.eclipse.jface.wizard.IWizardPage in project azure-tools-for-java by Microsoft.
the class AzureWizardDialog method backPressed.
@Override
protected void backPressed() {
IWizardPage page = getCurrentPage().getPreviousPage();
if (page == null) {
// should never happen since we have already visited the page
return;
}
sendTelemetryOnAction("Previos");
super.backPressed();
}
use of org.eclipse.jface.wizard.IWizardPage in project azure-tools-for-java by Microsoft.
the class AzureWizardDialog method nextPressed.
@Override
protected void nextPressed() {
IWizardPage page = getCurrentPage().getNextPage();
if (page == null) {
// something must have happened getting the next page
return;
}
sendTelemetryOnAction("Next");
super.nextPressed();
}
use of org.eclipse.jface.wizard.IWizardPage in project cubrid-manager by CUBRID.
the class VolumeSizeValidator method pageChanged.
public void pageChanged(PageChangedEvent event) {
IWizardPage page = (IWizardPage) event.getSelectedPage();
if (page.getName().equals(PAGENAME)) {
GeneralInfoPage generalInfoPage = (GeneralInfoPage) getWizard().getPage(GeneralInfoPage.PAGENAME);
pageSize = generalInfoPage.getPageSize();
String volumeSize = volumeSizeText.getText();
if (volumeSize.trim().equals("")) {
volumeSizeText.setText(generalInfoPage.getDefaultDatVolumeSize());
}
if (!isAddedDefaultVolume) {
addDefaultVolume(generalInfoPage);
isAddedDefaultVolume = true;
}
changeVolumeName();
/*Update Page number*/
for (Map<String, String> map : volumeTableList) {
String totalSize = map.get("2");
long pageNum = CreateDatabaseWizard.calcVolumePageNum(totalSize, pageSize);
map.put("3", String.valueOf(pageNum));
}
}
}
Aggregations