use of org.talend.repository.model.IProxyRepositoryFactory in project tdi-studio-se by Talend.
the class AbstractJobSettingsPage method createContents.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createContents(Composite parent) {
Composite composite = widgetFactory.createComposite(parent, SWT.NONE);
composite.setLayout(new FormLayout());
FormData data = createFormData();
composite.setLayoutData(data);
//
checkSettingExisted();
elem = checkAndCreateElement();
if (getParametersType() != null) {
ElementParameter2ParameterType.loadElementParameters(elem, getParametersType(), getPropertyTypeName());
}
// update connection from repository if needed
updateProjectSetting();
mComposite = new ProjectSettingMultipleThreadDynamicComposite(composite, SWT.V_SCROLL | SWT.BORDER, getCategory(), elem, true, getRepositoryPropertyName());
mComposite.setLayoutData(createFormData());
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
if (factory.isUserReadOnlyOnCurrentProject()) {
composite.setEnabled(false);
}
return composite;
}
use of org.talend.repository.model.IProxyRepositoryFactory in project tdi-studio-se by Talend.
the class JobSettingProjectSettingPage method createImplicitGroup.
protected Composite createImplicitGroup(Composite parent) {
Group group = new Group(parent, SWT.NONE);
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
group.setLayout(new GridLayout(3, false));
Composite composite = new Composite(group, SWT.NONE);
GridLayout gridLayout = new GridLayout(3, false);
composite.setLayout(gridLayout);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.grabExcessHorizontalSpace = true;
gridData.horizontalSpan = 3;
composite.setLayoutData(gridData);
//$NON-NLS-1$
group.setText(Messages.getString("JobSettingProjectSettingPage.implictLabel"));
implicitBtn = new Button(composite, SWT.CHECK);
//$NON-NLS-1$
implicitBtn.setText(Messages.getString("JobSettingProjectSettingPage.UseProjectsetting"));
GridLayout layout = new GridLayout();
layout.numColumns = 3;
layout.marginWidth = 0;
layout.marginHeight = 0;
layout.horizontalSpacing = 8;
composite.setLayout(layout);
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
if (factory.isUserReadOnlyOnCurrentProject()) {
parent.setEnabled(false);
}
return group;
}
use of org.talend.repository.model.IProxyRepositoryFactory in project tdi-studio-se by Talend.
the class MultipleThreadDynamicComposite method updateRepositoryList.
public void updateRepositoryList() {
ProgressDialog progressDialog = new ProgressDialog(this.getShell(), 1000) {
private IProgressMonitor monitorWrap;
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitorWrap = new EventLoopProgressMonitor(monitor);
IProxyRepositoryFactory factory = DesignerPlugin.getDefault().getProxyRepositoryFactory();
List<IRepositoryViewObject> repositoryObjects = getAllRepositoryMetadata();
// + elem.getElementParameters().size();
int total = repositoryObjects.size();
//$NON-NLS-1$
monitorWrap.beginTask(Messages.getString("MultipleThreadDynamicComposite.gatherInformation"), total);
IElementParameter propertyParam = elem.getElementParameterFromField(EParameterFieldType.PROPERTY_TYPE, section);
String repositoryValue = null;
if (propertyParam != null) {
repositoryValue = propertyParam.getRepositoryValue();
}
if (repositoryObjects != null && (repositoryObjects.size() != 0)) {
tableIdAndDbTypeMap.clear();
tableIdAndDbSchemaMap.clear();
for (IRepositoryViewObject curObject : repositoryObjects) {
Item item = curObject.getProperty().getItem();
if (item instanceof ConnectionItem) {
ConnectionItem connectionItem = (ConnectionItem) item;
Connection connection = connectionItem.getConnection();
if (connection == null || connection.isReadOnly()) {
continue;
}
for (Object tableObj : ConnectionHelper.getTables(connection)) {
org.talend.core.model.metadata.builder.connection.MetadataTable table;
table = (org.talend.core.model.metadata.builder.connection.MetadataTable) tableObj;
if (factory.getStatus(connectionItem) != ERepositoryStatus.DELETED) {
if (!factory.isDeleted(table)) {
IMetadataTable newTable = ConvertionHelper.convert(table);
// newTable);
if (connection instanceof DatabaseConnection) {
String dbType = ((DatabaseConnection) connection).getDatabaseType();
String schema = ((DatabaseConnection) connection).getUiSchema();
tableIdAndDbTypeMap.put(newTable.getId(), dbType);
if (schema != null && !schema.equals("")) {
//$NON-NLS-1$
tableIdAndDbSchemaMap.put(newTable.getId(), schema);
}
}
}
}
}
monitorWrap.worked(1);
}
// hywang add for feature 6484
if (item instanceof FileItem) {
FileItem FileItem = (FileItem) item;
if (repositoryValue != null) {
if (repositoryValue.equals("RULE")) {
//$NON-NLS-1$
repositoryFileItemMap.put(FileItem.getProperty().getId(), FileItem);
}
}
monitorWrap.worked(1);
}
if (item instanceof LinkRulesItem) {
LinkRulesItem linkItem = (LinkRulesItem) item;
if (repositoryValue != null) {
if (repositoryValue.equals("RULE")) {
//$NON-NLS-1$
repositoryLinkRulesItemMap.put(linkItem.getProperty().getId(), linkItem);
}
}
monitorWrap.worked(1);
}
}
}
monitorWrap.done();
}
};
try {
progressDialog.executeProcess();
} catch (InvocationTargetException e) {
ExceptionHandler.process(e);
return;
} catch (Exception e) {
ExceptionHandler.process(e);
return;
}
}
use of org.talend.repository.model.IProxyRepositoryFactory in project tdi-studio-se by Talend.
the class MultipleThreadDynamicComposite method getAllRepositoryMetadata.
/**
*
* cli Comment method "getAllRepositoryMetadata".
*
* fixed for 8971
*/
private List<IRepositoryViewObject> getAllRepositoryMetadata() {
IProxyRepositoryFactory factory = DesignerPlugin.getDefault().getProxyRepositoryFactory();
ProjectManager pManager = ProjectManager.getInstance();
// retrieve reference project.
pManager.getReferencedProjects();
List<IRepositoryViewObject> repositoryObjects;
try {
repositoryObjects = retrieveMetadataFromProject(factory, pManager, pManager.getCurrentProject());
} catch (PersistenceException e) {
throw new RuntimeException(e);
}
return repositoryObjects;
}
use of org.talend.repository.model.IProxyRepositoryFactory in project tdi-studio-se by Talend.
the class CreateDiagramAction method run.
/*
* added by wchen for intro
*
* @see org.eclipse.ui.intro.config.IIntroAction#run(org.eclipse.ui.intro.IIntroSite, java.util.Properties)
*/
@Override
public void run(IIntroSite site, Properties params) {
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
if (factory.isUserReadOnlyOnCurrentProject()) {
MessageDialog.openWarning(null, "User Authority", "Can't create Business Model! Current user is read-only on this project!");
} else {
PlatformUI.getWorkbench().getIntroManager().closeIntro(PlatformUI.getWorkbench().getIntroManager().getIntro());
setRepositoryNode(params);
doRun();
}
}
Aggregations