use of org.eclipse.ui.PartInitException in project tdi-studio-se by Talend.
the class AbstractMultiPageTalendEditor method createPage0.
protected void createPage0() {
try {
int index = addPage(designerEditor, getEditorInput());
//$NON-NLS-1$
setPageText(index, "Designer");
designerEditor.setParent(this);
} catch (PartInitException e) {
// e.printStackTrace();
ExceptionHandler.process(e);
}
setCSSStylingClass();
}
use of org.eclipse.ui.PartInitException in project tdi-studio-se by Talend.
the class EditPropertiesAction method getCorrespondingEditor.
/**
* Find the editor that is related to the node.
*
* @param node
* @return
*/
protected IEditorPart getCorrespondingEditor(final IRepositoryNode node) {
IEditorReference[] eidtors = getActivePage().getEditorReferences();
for (IEditorReference eidtor : eidtors) {
try {
IEditorInput input = eidtor.getEditorInput();
if (!(input instanceof RepositoryEditorInput)) {
continue;
}
RepositoryEditorInput repositoryInput = (RepositoryEditorInput) input;
if (node.getId() != null && node.getId().equals(repositoryInput.getId())) {
IPath path = repositoryInput.getFile().getLocation();
return eidtor.getEditor(false);
}
} catch (PartInitException e) {
continue;
}
}
return null;
}
use of org.eclipse.ui.PartInitException in project tdi-studio-se by Talend.
the class ShowJobSettingsViewAction method run.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
public void run() {
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
try {
page.showView(getViewId());
JobSettingsView view = (JobSettingsView) page.findView(getViewId());
IDiagramModelService service = CorePlugin.getDefault().getDiagramModelService();
ISelection selection = service.getBusinessEditorSelection(page.getActiveEditor());
if (selection instanceof IStructuredSelection) {
Object firstElement = ((IStructuredSelection) selection).getFirstElement();
if (firstElement != null) {
BusinessType type = service.getBusinessModelType(firstElement);
if (type == BusinessType.CONNECTION || type == BusinessType.NOTE || type == BusinessType.SHAP) {
view.refresh(false, firstElement);
} else if (type == BusinessType.PROCESS || service.isInstanceOfCompartmentEditPart(firstElement)) {
view.refresh(false, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor());
}
}
}
} catch (PartInitException e) {
// e.printStackTrace();
ExceptionHandler.process(e);
}
}
use of org.eclipse.ui.PartInitException in project tdi-studio-se by Talend.
the class CreateSqlpatternAction method doRun.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
protected void doRun() {
RepositoryNode sqlPatternNode = null;
if (!isFromSqlPatternComposite) {
sqlPatternNode = getCurrentRepositoryNode();
}
if (isToolbar()) {
if (sqlPatternNode != null && sqlPatternNode.getContentType() != ERepositoryObjectType.SQLPATTERNS) {
sqlPatternNode = null;
}
if (sqlPatternNode == null) {
sqlPatternNode = getRepositoryNodeForDefault(ERepositoryObjectType.SQLPATTERNS);
}
}
RepositoryNode node = null;
IPath path;
if (this.sqlPatternPath != null) {
path = new Path(this.sqlPatternPath);
} else if (isToolbar()) {
path = RepositoryNodeUtilities.getPath(sqlPatternNode);
} else {
ISelection selection = getSelection();
Object obj = ((IStructuredSelection) selection).getFirstElement();
node = (RepositoryNode) obj;
path = RepositoryNodeUtilities.getPath(node);
}
NewSqlpatternWizard routineWizard = new NewSqlpatternWizard(path);
WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), routineWizard);
if (dlg.open() == Window.OK) {
try {
openSQLPatternEditor(routineWizard.getSQLPattern(), false);
} catch (PartInitException e) {
MessageBoxExceptionHandler.process(e);
} catch (SystemException e) {
MessageBoxExceptionHandler.process(e);
}
}
}
use of org.eclipse.ui.PartInitException in project tdi-studio-se by Talend.
the class EditSqlpatternAction method doRun.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
protected void doRun() {
RepositoryNode node = (RepositoryNode) ((IStructuredSelection) getSelection()).getFirstElement();
Property property = node.getObject().getProperty();
Property updatedProperty = null;
try {
updatedProperty = ProxyRepositoryFactory.getInstance().getLastVersion(new Project(ProjectManager.getInstance().getProject(property.getItem())), property.getId()).getProperty();
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
// update the property of the node repository object
// node.getObject().setProperty(updatedProperty);
SQLPatternItem sqlPatternItem = (SQLPatternItem) node.getObject().getProperty().getItem();
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
boolean readonly = factory.getStatus(sqlPatternItem) == ERepositoryStatus.LOCK_BY_OTHER;
try {
openSQLPatternEditor(sqlPatternItem, readonly);
// TDI-21143 : Studio repository view : remove all refresh call to repo view
// IRepositoryView view = getViewPart();
// if (view != null) {
// view.refresh(node);
// }
} catch (PartInitException e) {
MessageBoxExceptionHandler.process(e);
} catch (SystemException e) {
MessageBoxExceptionHandler.process(e);
}
}
Aggregations