use of org.talend.core.ui.properties.tab.IDynamicProperty in project tdi-studio-se by Talend.
the class JobSettingsView method getSelection.
/*
* (non-Javadoc)
*
* @see org.talend.designer.core.ui.views.properties.IJobSettingsView#getSelection()
*/
@Override
public ISelection getSelection() {
ISVNUiProviderService service = null;
if (PluginChecker.isSVNProviderPluginLoaded()) {
service = (ISVNUiProviderService) GlobalServiceRegister.getDefault().getService(ISVNUiProviderService.class);
}
if (currentSelectedTab == null) {
return null;
}
IDynamicProperty dc = currentSelectedTab.getPropertyComposite();
if (dc instanceof ProcessVersionComposite) {
return ((ProcessVersionComposite) dc).getSelection();
} else if (service != null && service.isSVNHistoryComposite(dc)) {
return service.getSVNHistorySelection(dc);
} else if (CorePlugin.getDefault().getDiagramModelService().isInstanceOfBusinessAssignmentComposite(dc)) {
IRepositoryView repositoryView = RepositoryManagerHelper.findRepositoryView();
if (repositoryView != null) {
return repositoryView.getViewer().getSelection();
}
}
return null;
}
use of org.talend.core.ui.properties.tab.IDynamicProperty in project tdi-studio-se by Talend.
the class JobSettingsView method createPartControl.
@Override
public void createPartControl(Composite parent) {
// tabFactory = new HorizontalTabFactory();
this.parent = parent;
tabFactory.initComposite(parent, false);
tabFactory.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
TalendPropertyTabDescriptor descriptor = (TalendPropertyTabDescriptor) selection.getFirstElement();
if (descriptor == null) {
return;
}
if (currentSelectedTab != null) {
if ((!currentSelectedTab.getData().equals(descriptor.getData()) || currentSelectedTab.getData() != descriptor.getData() || currentSelectedTab.getCategory() != descriptor.getCategory())) {
for (Control curControl : tabFactory.getTabComposite().getChildren()) {
curControl.dispose();
}
}
}
if (element == null || !element.equals(descriptor.getData()) || currentSelectedTab == null || currentSelectedTab.getCategory() != descriptor.getCategory() || selectedPrimary) {
Object data = descriptor.getData();
if (data instanceof Element) {
element = (Element) data;
currentSelectedTab = descriptor;
IDynamicProperty propertyComposite = createTabComposite(tabFactory.getTabComposite(), element, descriptor.getCategory());
} else if (data instanceof IRepositoryViewObject) {
IRepositoryViewObject viewObject = (IRepositoryViewObject) data;
IProcess process = getProcess(viewObject);
if (process != null && process instanceof Element && process.getId().equals(viewObject.getId()) && process.getVersion().equals(viewObject.getVersion())) {
data = process;
}
currentSelectedTab = descriptor;
IDynamicProperty propertyComposite = createTabComposite(tabFactory.getTabComposite(), data, descriptor.getCategory());
} else if (data instanceof IEditorPart) {
currentSelectedTab = descriptor;
IRepositoryViewObject repObj = retrieveBusiness((IEditorPart) data);
if (repObj != null) {
IDynamicProperty propertyComposite = createTabComposite(tabFactory.getTabComposite(), repObj, descriptor.getCategory());
}
} else {
currentSelectedTab = descriptor;
IDynamicProperty propertyComposite = createTabComposite(tabFactory.getTabComposite(), null, descriptor.getCategory());
}
selectedPrimary = false;
}
}
});
}
use of org.talend.core.ui.properties.tab.IDynamicProperty in project tdi-studio-se by Talend.
the class JobSettingsView method createTabComposite.
private IDynamicProperty createTabComposite(Composite parent, Object data, EComponentCategory category) {
final int style = SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS;
IDynamicProperty dynamicComposite = null;
if (EComponentCategory.EXTRA.equals(category)) {
// achen modify to fix bug 0006241
Process process = getElement();
boolean isJoblet = AbstractProcessProvider.isExtensionProcessForJoblet(process);
if (isJoblet) {
dynamicComposite = new MultipleThreadDynamicComposite(parent, style, category, (Element) data, true);
} else {
dynamicComposite = new ExtraComposite(parent, style, category, (Element) data, true);
CoreUIPlugin.setCSSId(dynamicComposite.getComposite(), //$NON-NLS-1$
"org-talend-designer-core-ui-views-jobsettings-JobSettingsView-ExtraComposite");
}
} else if (EComponentCategory.STATSANDLOGS.equals(category)) {
dynamicComposite = new StatsAndLogsComposite(parent, style, category, (Element) data);
CoreUIPlugin.setCSSId(dynamicComposite.getComposite(), //$NON-NLS-1$
"org-talend-designer-core-ui-views-jobsettings-JobSettingsView-StatsAndLogsComposite");
} else if (EComponentCategory.CONTEXT.equals(category)) {
// TODO
// dynamicComposite = new ContextDynamicComposite(parent, style, category, element);
} else if (EComponentCategory.MAIN.equals(category)) {
dynamicComposite = new MainComposite(parent, SWT.NONE, tabFactory, (IRepositoryViewObject) data);
} else if (EComponentCategory.VERSIONS.equals(category)) {
if (allowVerchange) {
dynamicComposite = new ProcessVersionComposite(parent, SWT.NONE, tabFactory.getWidgetFactory(), (IRepositoryViewObject) data);
}
} else if (EComponentCategory.HEADERFOOTER.equals(category)) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHeaderFooterProviderService.class)) {
IHeaderFooterProviderService headerFooterService = (IHeaderFooterProviderService) GlobalServiceRegister.getDefault().getService(IHeaderFooterProviderService.class);
if (headerFooterService.isVisible()) {
dynamicComposite = new HeaderFooterComposite(parent, SWT.NONE, tabFactory.getWidgetFactory(), (IRepositoryViewObject) data);
}
}
} else if (EComponentCategory.SVNHISTORY.equals(category) && svnUIService != null) {
dynamicComposite = svnUIService.createProcessSVNHistoryComposite(parent, tabFactory.getWidgetFactory(), (IRepositoryViewObject) data);
} else if (EComponentCategory.GITHISTORY.equals(category) && gitUIService != null) {
dynamicComposite = gitUIService.createProcessGitHistoryComposite(parent, this, tabFactory.getWidgetFactory(), (IRepositoryViewObject) data);
} else if (EComponentCategory.APPEARANCE.equals(category)) {
dynamicComposite = (IDynamicProperty) CorePlugin.getDefault().getDiagramModelService().getBusinessAppearanceComposite(parent, SWT.NONE, tabFactory.getWidgetFactory(), selectedModel);
} else if (EComponentCategory.RULERS_AND_GRID.equals(category)) {
dynamicComposite = (IDynamicProperty) CorePlugin.getDefault().getDiagramModelService().getBusinessRulersAndGridComposite(parent, SWT.NONE, tabFactory.getWidgetFactory(), null);
} else if (EComponentCategory.ASSIGNMENT.equals(category)) {
dynamicComposite = (IDynamicProperty) CorePlugin.getDefault().getDiagramModelService().getBusinessAssignmentComposite(parent, SWT.NONE, tabFactory.getWidgetFactory(), selectedModel);
} else if (EComponentCategory.DEPLOYMENT.equals(category)) {
dynamicComposite = new DeploymentComposite(parent, SWT.NONE, tabFactory.getWidgetFactory(), (IRepositoryViewObject) data);
}
if (dynamicComposite != null) {
dynamicComposite.refresh();
}
currentSelectedTab.setPropertyComposite(dynamicComposite);
return dynamicComposite;
}
use of org.talend.core.ui.properties.tab.IDynamicProperty in project tdi-studio-se by Talend.
the class AbstractMultiPageTalendEditor method refreshJobSettingsView.
/**
* Added by Marvin Wang on July 30, 2012 for refreshing the tab of Job view.
*/
protected void refreshJobSettingsView() {
IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(IJobSettingsView.ID);
if (viewPart != null && viewPart instanceof JobSettingsView) {
JobSettingsView jobView = (JobSettingsView) viewPart;
TalendPropertyTabDescriptor currentSelectedTab = jobView.getCurrentSelectedTab();
if (currentSelectedTab != null) {
IDynamicProperty dc = currentSelectedTab.getPropertyComposite();
if (dc != null) {
dc.refresh();
}
}
}
}
use of org.talend.core.ui.properties.tab.IDynamicProperty in project tdi-studio-se by Talend.
the class StatsAndLogsViewHelper method applySettings.
/**
* yzhang Comment method "applySettings".
*
* @param element
* @param dynamicProperty
*/
public static void applySettings(IElement element, IElement applyTo, IDynamicProperty dynamicProperty) {
List<? extends IElementParameter> elementParameters = applyTo.getElementParameters();
for (IElementParameter elementParameterType : elementParameters) {
String parameterName = elementParameterType.getName();
if (parameterName.equals(EParameterName.ON_STATCATCHER_FLAG.getName())) {
elementParameterType.setValue(element.getElementParameter(EParameterName.ON_STATCATCHER_FLAG.getName()).getValue());
continue;
}
if (parameterName.equals(EParameterName.ON_LOGCATCHER_FLAG.getName())) {
elementParameterType.setValue(element.getElementParameter(EParameterName.ON_LOGCATCHER_FLAG.getName()).getValue());
continue;
}
if (parameterName.equals(EParameterName.ON_METERCATCHER_FLAG.getName())) {
elementParameterType.setValue(element.getElementParameter(EParameterName.ON_METERCATCHER_FLAG.getName()).getValue());
continue;
}
if (parameterName.equals(EParameterName.ON_FILES_FLAG.getName())) {
elementParameterType.setValue(element.getElementParameter(EParameterName.ON_FILES_FLAG.getName()).getValue());
continue;
}
if (parameterName.equals(EParameterName.FILE_PATH.getName())) {
elementParameterType.setValue(element.getElementParameter(EParameterName.FILE_PATH.getName()).getValue());
continue;
}
if (parameterName.equals(EParameterName.FILENAME_STATS.getName())) {
elementParameterType.setValue(element.getElementParameter(EParameterName.FILENAME_STATS.getName()).getValue());
continue;
}
if (parameterName.equals(EParameterName.FILENAME_LOGS.getName())) {
elementParameterType.setValue(element.getElementParameter(EParameterName.FILENAME_LOGS.getName()).getValue());
continue;
}
if (parameterName.equals(EParameterName.FILENAME_METTER.getName())) {
elementParameterType.setValue(element.getElementParameter(EParameterName.FILENAME_METTER.getName()).getValue());
continue;
}
if (parameterName.equals(EParameterName.ON_DATABASE_FLAG.getName())) {
elementParameterType.setValue(element.getElementParameter(EParameterName.ON_DATABASE_FLAG.getName()).getValue());
continue;
}
if (parameterName.equals(EParameterName.PROPERTY_TYPE.getName())) {
String id = (String) element.getElementParameter(//$NON-NLS-1$
EParameterName.PROPERTY_TYPE.getName() + ":" + EParameterName.REPOSITORY_PROPERTY_TYPE.getName()).getValue();
String propertyType = (String) element.getElementParameter(EParameterName.PROPERTY_TYPE.getName() + ":" + EParameterName.PROPERTY_TYPE.getName()).getValue();
/* 16969 */
Connection repositoryConnection = null;
// Map<String, ConnectionItem> repositoryConnectionItemMap =
// dynamicProperty.getRepositoryConnectionItemMap();
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
Item item = null;
try {
IRepositoryViewObject repobj = factory.getLastVersion(id);
if (repobj != null) {
Property tmpproperty = repobj.getProperty();
if (tmpproperty != null) {
item = tmpproperty.getItem();
}
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
if (item != null && item instanceof ConnectionItem) {
repositoryConnection = ((ConnectionItem) item).getConnection();
} else {
repositoryConnection = null;
}
// if (repositoryConnectionItemMap.containsKey(id)) {
// repositoryConnection = repositoryConnectionItemMap.get(id).getConnection();
// } else {
// repositoryConnection = null;
// }
ChangeValuesFromRepository cmd1 = new ChangeValuesFromRepository(applyTo, repositoryConnection, EParameterName.PROPERTY_TYPE.getName() + ":" + EParameterName.PROPERTY_TYPE.getName(), //$NON-NLS-1$
propertyType);
ChangeValuesFromRepository cmd2 = new ChangeValuesFromRepository(applyTo, repositoryConnection, EParameterName.PROPERTY_TYPE.getName() + ":" + EParameterName.REPOSITORY_PROPERTY_TYPE.getName(), //$NON-NLS-1$
id);
CompoundCommand cc = new CompoundCommand();
cc.add(cmd1);
cc.add(cmd2);
boolean executed = false;
if (applyTo instanceof IGEFProcess) {
IDesignerCoreUIService designerCoreUIService = CoreUIPlugin.getDefault().getDesignerCoreUIService();
if (designerCoreUIService != null) {
executed = designerCoreUIService.executeCommand((IGEFProcess) applyTo, cc);
}
}
if (!executed) {
cc.execute();
}
continue;
}
if (PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.PROPERTY_TYPE.getName()).equals(EmfComponent.BUILTIN)) {
if (parameterName.equals(EParameterName.DB_TYPE.getName())) {
elementParameterType.setValue(element.getElementParameter(EParameterName.DB_TYPE.getName()).getValue());
continue;
}
if (parameterName.equals(EParameterName.HOST.getName())) {
elementParameterType.setValue(element.getElementParameter(EParameterName.HOST.getName()).getValue());
continue;
}
if (parameterName.equals(EParameterName.PORT.getName())) {
elementParameterType.setValue(element.getElementParameter(EParameterName.PORT.getName()).getValue());
continue;
}
if (parameterName.equals(EParameterName.DBNAME.getName())) {
elementParameterType.setValue(element.getElementParameter(EParameterName.DBNAME.getName()).getValue());
continue;
}
if (parameterName.equals(EParameterName.PROPERTIES.getName())) {
elementParameterType.setValue(element.getElementParameter(EParameterName.PROPERTIES.getName()).getValue());
continue;
}
if (parameterName.equals(EParameterName.DBFILE.getName())) {
elementParameterType.setValue(element.getElementParameter(EParameterName.DBFILE.getName()).getValue());
continue;
}
if (parameterName.equals(EParameterName.SCHEMA_DB.getName())) {
elementParameterType.setValue(element.getElementParameter(EParameterName.SCHEMA_DB.getName()).getValue());
continue;
}
if (parameterName.equals(EParameterName.USER.getName())) {
elementParameterType.setValue(element.getElementParameter(EParameterName.USER.getName()).getValue());
continue;
}
if (parameterName.equals(EParameterName.PASS.getName())) {
elementParameterType.setValue(element.getElementParameter(EParameterName.PASS.getName()).getValue());
continue;
}
if (parameterName.equals(EParameterName.TABLE_STATS.getName())) {
elementParameterType.setValue(element.getElementParameter(EParameterName.TABLE_STATS.getName()).getValue());
continue;
}
if (parameterName.equals(EParameterName.TABLE_LOGS.getName())) {
elementParameterType.setValue(element.getElementParameter(EParameterName.TABLE_LOGS.getName()).getValue());
continue;
}
if (parameterName.equals(EParameterName.TABLE_METER.getName())) {
elementParameterType.setValue(element.getElementParameter(EParameterName.TABLE_METER.getName()).getValue());
continue;
}
if (parameterName.equals(EParameterName.CATCH_RUNTIME_ERRORS.getName())) {
elementParameterType.setValue(element.getElementParameter(EParameterName.CATCH_RUNTIME_ERRORS.getName()).getValue());
continue;
}
if (parameterName.equals(EParameterName.CATCH_USER_ERRORS.getName())) {
elementParameterType.setValue(element.getElementParameter(EParameterName.CATCH_USER_ERRORS.getName()).getValue());
continue;
}
if (parameterName.equals(EParameterName.CATCH_USER_WARNING.getName())) {
elementParameterType.setValue(element.getElementParameter(EParameterName.CATCH_USER_WARNING.getName()).getValue());
continue;
}
if (parameterName.equals(EParameterName.CATCH_REALTIME_STATS.getName())) {
elementParameterType.setValue(element.getElementParameter(EParameterName.CATCH_REALTIME_STATS.getName()).getValue());
continue;
}
}
}
}
Aggregations