use of org.eclipse.jface.wizard.WizardDialog in project tdi-studio-se by Talend.
the class OpenExistVersionProcessAction method doRun.
@Override
protected void doRun() {
ISelection selection = getSelection();
Object obj = ((IStructuredSelection) selection).getFirstElement();
RepositoryNode node = (RepositoryNode) obj;
IPath path = RepositoryNodeUtilities.getPath(node);
String originalName = node.getObject().getLabel();
RepositoryObject repositoryObj = new RepositoryObject(node.getObject().getProperty());
repositoryObj.setRepositoryNode(node.getObject().getRepositoryNode());
OpenExistVersionProcessWizard wizard = new OpenExistVersionProcessWizard(repositoryObj);
WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
dialog.setPageSize(300, 250);
//$NON-NLS-1$
dialog.setTitle(Messages.getString("OpenExistVersionProcess.open.dialog"));
if (dialog.open() == Dialog.OK) {
refresh(node);
// refresh the corresponding editor's name
IEditorPart part = getCorrespondingEditor(node);
if (part != null && part instanceof IUIRefresher) {
((IUIRefresher) part).refreshName();
} else {
processRoutineRenameOperation(originalName, node, path);
}
}
}
use of org.eclipse.jface.wizard.WizardDialog in project tdi-studio-se by Talend.
the class SaveAsSQLPatternAction method run.
@Override
public void run() {
SaveAsSQLPatternWizard processWizard = new SaveAsSQLPatternWizard(editorPart);
WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), processWizard);
if (dlg.open() == Window.OK) {
try {
SQLPatternItem sqlpatternItem = processWizard.getSQLPatternItem();
// get the IFile
ICodeGeneratorService service = (ICodeGeneratorService) GlobalServiceRegister.getDefault().getService(ICodeGeneratorService.class);
// only for talend java version
ISQLPatternSynchronizer sqlPatternSynchronizer = service.getSQLPatternSynchronizer();
IFile file = sqlPatternSynchronizer.getSQLPatternFile(sqlpatternItem);
if (file == null) {
return;
}
// Set readonly to false since created job will always be editable.
RepositoryEditorInput repositoryEditorInput = new RepositoryEditorInput(file, sqlpatternItem);
IWorkbenchPage page = getActivePage();
IRepositoryNode repositoryNode = RepositoryNodeUtilities.getRepositoryNode(repositoryEditorInput.getItem().getProperty().getId(), false);
repositoryEditorInput.setRepositoryNode(repositoryNode);
// here really do the normal save as function
IDocumentProvider provider = ((StandAloneTalendJavaEditor) this.editorPart).getDocumentProvider();
provider.aboutToChange(repositoryEditorInput);
provider.saveDocument(null, repositoryEditorInput, provider.getDocument(this.editorPart.getEditorInput()), true);
provider.changed(repositoryEditorInput);
// copy back from the *.java file to *.item file.
// @see:StandAloneTalendJavaEditor.doSave(IProgressMonitor monitor)
ByteArray byteArray = sqlpatternItem.getContent();
byteArray.setInnerContentFromFile(repositoryEditorInput.getFile());
IProxyRepositoryFactory repFactory = DesignerPlugin.getDefault().getRepositoryService().getProxyRepositoryFactory();
repFactory.save(sqlpatternItem);
// close the old editor
page.closeEditor(this.editorPart, false);
// open the new editor, because at the same time, there will update the jobSetting/componentSetting view
page.openEditor(repositoryEditorInput, StandAloneTalendJavaEditor.ID, true);
} catch (Exception e) {
MessageDialog.openError(Display.getCurrent().getActiveShell(), "Error", "SQLTemplate could not be saved" + " : " + e.getMessage());
ExceptionHandler.process(e);
}
}
}
use of org.eclipse.jface.wizard.WizardDialog in project tdi-studio-se by Talend.
the class SaveAsRoutineAction method run.
@Override
public void run() {
SaveAsRoutineWizard processWizard = new SaveAsRoutineWizard(editorPart);
WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), processWizard);
if (dlg.open() == Window.OK) {
try {
RoutineItem routineItem = processWizard.getRoutineItem();
// get the IFile
ICodeGeneratorService service = (ICodeGeneratorService) GlobalServiceRegister.getDefault().getService(ICodeGeneratorService.class);
ITalendSynchronizer routineSynchronizer = null;
switch(LanguageManager.getCurrentLanguage()) {
case JAVA:
routineSynchronizer = service.createJavaRoutineSynchronizer();
break;
case PERL:
routineSynchronizer = service.createPerlRoutineSynchronizer();
break;
default:
}
IFile file = routineSynchronizer.getFile(routineItem);
if (file == null) {
return;
}
// Set readonly to false since created job will always be editable.
RoutineEditorInput routineEditorInput = new RoutineEditorInput(file, routineItem);
IWorkbenchPage page = getActivePage();
IRepositoryNode repositoryNode = RepositoryNodeUtilities.getRepositoryNode(routineEditorInput.getItem().getProperty().getId(), false);
routineEditorInput.setRepositoryNode(repositoryNode);
// here really do the normal save as function
IDocumentProvider provider = ((AbstractTextEditor) this.editorPart).getDocumentProvider();
provider.aboutToChange(routineEditorInput);
provider.saveDocument(null, routineEditorInput, provider.getDocument(this.editorPart.getEditorInput()), true);
provider.changed(routineEditorInput);
// copy back from the *.java file to *.item file.
// @see:StandAloneTalendJavaEditor.doSave(IProgressMonitor monitor)
ByteArray byteArray = routineItem.getContent();
byteArray.setInnerContentFromFile(routineEditorInput.getFile());
IProxyRepositoryFactory repFactory = DesignerPlugin.getDefault().getRepositoryService().getProxyRepositoryFactory();
repFactory.save(routineItem);
// close the old editor
page.closeEditor(this.editorPart, false);
// open the new editor, because at the same time, there will update the jobSetting/componentSetting view
switch(LanguageManager.getCurrentLanguage()) {
case JAVA:
page.openEditor(routineEditorInput, StandAloneTalendJavaEditor.ID, true);
break;
default:
}
} catch (Exception e) {
MessageDialog.openError(Display.getCurrent().getActiveShell(), "Error", "Routine could not be saved" + " : " + e.getMessage());
ExceptionHandler.process(e);
}
}
}
use of org.eclipse.jface.wizard.WizardDialog in project tdi-studio-se by Talend.
the class UpdateDocumentationAction method doRun.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
protected void doRun() {
RepositoryNode node = (RepositoryNode) ((IStructuredSelection) getSelection()).getFirstElement();
DocumentationUpdateWizard docWizard = new DocumentationUpdateWizard(PlatformUI.getWorkbench(), node.getObject(), getPath());
WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), docWizard);
dlg.open();
}
use of org.eclipse.jface.wizard.WizardDialog in project tdi-studio-se by Talend.
the class CreateFTPConnectionAction method doRun.
/*
* (non-Javadoc)
*
* @see org.talend.repository.ui.actions.AContextualAction#doRun()
*/
@Override
protected void doRun() {
RepositoryNode dbConnectionNode = getCurrentRepositoryNode();
if (isToolbar()) {
if (dbConnectionNode != null && dbConnectionNode.getContentType() != ERepositoryObjectType.METADATA_FILE_FTP) {
dbConnectionNode = null;
}
if (dbConnectionNode == null) {
dbConnectionNode = getRepositoryNodeForDefault(ERepositoryObjectType.METADATA_FILE_FTP);
}
}
RepositoryNode metadataNode = dbConnectionNode.getParent();
if (metadataNode != null) {
// Force focus to the repositoryView and open Metadata and DbConnection nodes
IRepositoryView viewPart = getViewPart();
if (viewPart != null) {
viewPart.setFocus();
viewPart.expand(metadataNode, true);
viewPart.expand(dbConnectionNode, true);
}
}
FTPConnection connection = null;
IPath pathToSave = null;
// Define the RepositoryNode, by default Metadata/DbConnection
RepositoryNode node = dbConnectionNode;
ISelection selection = null;
// When the userSelection is an element of metadataNode, use it !
if (!isToolbar()) {
Object userSelection = ((IStructuredSelection) getSelection()).getFirstElement();
if (userSelection instanceof RepositoryNode) {
switch(((RepositoryNode) userSelection).getType()) {
case REPOSITORY_ELEMENT:
case SIMPLE_FOLDER:
case SYSTEM_FOLDER:
node = (RepositoryNode) userSelection;
break;
}
}
selection = getSelection();
}
boolean creation = false;
// Define the repositoryObject DatabaseConnection and his pathToSave
switch(node.getType()) {
case REPOSITORY_ELEMENT:
// pathToSave = null;
connection = (FTPConnection) ((ConnectionItem) node.getObject().getProperty().getItem()).getConnection();
creation = false;
break;
case SIMPLE_FOLDER:
pathToSave = RepositoryNodeUtilities.getPath(node);
connection = ConnectionFactory.eINSTANCE.createFTPConnection();
creation = true;
break;
case SYSTEM_FOLDER:
//$NON-NLS-1$
pathToSave = new Path("");
connection = ConnectionFactory.eINSTANCE.createFTPConnection();
creation = true;
break;
}
// Init the content of the Wizard
init(node);
FTPWizard ftpWizard;
if (isToolbar()) {
ftpWizard = new FTPWizard(PlatformUI.getWorkbench(), creation, node, getExistingNames());
ftpWizard.setToolBar(true);
} else {
ftpWizard = new FTPWizard(PlatformUI.getWorkbench(), creation, selection, getExistingNames());
}
// Open the Wizard
WizardDialog wizardDialog = new WizardDialog(Display.getCurrent().getActiveShell(), ftpWizard);
wizardDialog.setPageSize(700, 550);
wizardDialog.create();
wizardDialog.open();
IRepositoryView view = getViewPart();
if (view != null) {
view.expand(dbConnectionNode, true);
}
}
Aggregations