use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.
the class SQLBuilderDialog method close.
@Override
public boolean close() {
try {
SqlBuilderPlugin.getDefault().getRepositoryService().removeRepositoryChangedListener(this);
if (this.nodeInEditor != null) {
RepositoryNode root = SQLBuilderRepositoryNodeManager.getRoot(this.nodeInEditor);
if (root != null) {
DatabaseConnection connection = (DatabaseConnection) ((ConnectionItem) root.getObject().getProperty().getItem()).getConnection();
shutDownDb(connection);
}
}
clean();
SQLBuilderRepositoryNodeManager.removeAllRepositoryNodes();
} catch (Exception e) {
ExceptionHandler.process(e);
} finally {
super.close();
}
return true;
}
use of org.talend.repository.model.RepositoryNode in project tesb-studio-se by Talend.
the class RunCamelProcess method doRun.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
protected void doRun() {
ISelection selection = getSelection();
Object obj = ((IStructuredSelection) selection).getFirstElement();
if (!(obj instanceof RepositoryNode)) {
return;
}
// Add this job to running history list.
JobLaunchShortcutManager.run(selection);
}
use of org.talend.repository.model.RepositoryNode in project tesb-studio-se by Talend.
the class CamelEditorDropTargetListener method checkSelectionSource.
/**
* Routelet and context types are validated
*
* @return true if validated
*/
private boolean checkSelectionSource() {
isContextSource = false;
selectSourceList.clear();
boolean isRouteletSource = false;
LocalSelectionTransfer transfer = (LocalSelectionTransfer) getTransfer();
IStructuredSelection selection = (IStructuredSelection) transfer.getSelection();
Iterator iterator = selection.iterator();
while (iterator.hasNext()) {
Object obj = iterator.next();
if (obj instanceof RepositoryNode) {
RepositoryNode sourceNode = (RepositoryNode) obj;
if (sourceNode.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.PROCESS_ROUTELET) {
selectSourceList.add(obj);
isRouteletSource = true;
}
Item item = sourceNode.getObject().getProperty().getItem();
if (item instanceof ContextItem) {
selectSourceList.add(obj);
isContextSource = true;
}
} else if (obj instanceof PaletteEditPart) {
selectSourceList.add(obj);
Object newObject = ((CreateRequest) getTargetRequest()).getNewObject();
if (newObject != null && newObject instanceof INode) {
if (((INode) newObject).getComponent().getComponentType() == EComponentType.JOBLET) {
selectSourceList.add(newObject);
isRouteletSource = true;
}
}
}
}
if (selectSourceList.size() == 0) {
return false;
}
if (isRouteletSource) {
List<String> routeletList = new ArrayList<String>();
for (INode node : editor.getProcess().getGraphicalNodes()) {
if (node.getComponent().getComponentType() == EComponentType.JOBLET) {
routeletList.add(node.getComponent().getName());
}
}
boolean isDuplicateRoutelet = false;
String duplicatesName = "";
for (Object object : selectSourceList) {
if (object instanceof RepositoryNode) {
RepositoryNode sourceNode = (RepositoryNode) object;
if (sourceNode.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.PROCESS_ROUTELET) {
if (routeletList.contains(sourceNode.getProperties(EProperties.LABEL))) {
isDuplicateRoutelet = true;
//$NON-NLS-1$
duplicatesName += " ," + sourceNode.getProperties(EProperties.LABEL);
}
}
} else if (object instanceof INode) {
INode node = (INode) object;
if (node.getComponent().getComponentType() == EComponentType.JOBLET) {
if (routeletList.contains(node.getComponent().getName())) {
isDuplicateRoutelet = true;
//$NON-NLS-1$
duplicatesName += " ," + node.getComponent().getName();
}
}
}
}
if (isDuplicateRoutelet) {
//$NON-NLS-1$
MessageDialog.openInformation(//$NON-NLS-1$
editor.getEditorSite().getShell(), //$NON-NLS-1$
"Adding Routelet", //$NON-NLS-1$
"Do not allow duplicate Routelets\nRoutelet \"" + duplicatesName.substring(2) + "\" already exist.");
return false;
}
}
return true;
}
use of org.talend.repository.model.RepositoryNode in project tesb-studio-se by Talend.
the class EditCamelBean method init.
@Override
public void init(TreeViewer viewer, IStructuredSelection selection) {
super.init(viewer, selection);
boolean canWork = !selection.isEmpty() && selection.size() == 1;
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
if (factory.isUserReadOnlyOnCurrentProject()) {
canWork = false;
}
RepositoryNode node = (RepositoryNode) selection.getFirstElement();
if (canWork && (node.getObjectType() != CamelRepositoryNodeType.repositoryBeansType || !ProjectManager.getInstance().isInCurrentMainProject(node) || !isLastVersion(node))) {
canWork = false;
}
if (canWork) {
canWork = factory.getStatus(node.getObject()) != ERepositoryStatus.DELETED;
}
setEnabled(canWork);
}
use of org.talend.repository.model.RepositoryNode in project tesb-studio-se by Talend.
the class ReadCamelBean method init.
@Override
public void init(TreeViewer viewer, IStructuredSelection selection) {
boolean canWork = !selection.isEmpty() && selection.size() == 1;
if (canWork) {
Object o = selection.getFirstElement();
RepositoryNode node = (RepositoryNode) o;
switch(node.getType()) {
case REPOSITORY_ELEMENT:
if (node.getObjectType() != CamelRepositoryNodeType.repositoryBeansType) {
canWork = false;
}
break;
default:
canWork = false;
}
if (canWork && node.getObject() != null && ProxyRepositoryFactory.getInstance().getStatus(node.getObject()) == ERepositoryStatus.LOCK_BY_USER) {
canWork = false;
}
}
setEnabled(canWork);
}
Aggregations