use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.
the class ImportDemoItemAction method init.
@Override
public void init(TreeViewer viewer, IStructuredSelection selection) {
toolbarAction = false;
boolean canWork = false;
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
if (selection.size() == 1) {
if (selection.getFirstElement() instanceof RepositoryNode) {
RepositoryNode repositoryNode = (RepositoryNode) selection.getFirstElement();
if (factory.isUserReadOnlyOnCurrentProject() || !ProjectManager.getInstance().isInCurrentMainProject(repositoryNode)) {
setEnabled(false);
return;
}
if (repositoryNode.getType().equals(ENodeType.SYSTEM_FOLDER) || repositoryNode.getType().equals(ENodeType.SIMPLE_FOLDER)) {
canWork = true;
}
if (repositoryNode.getContentType() == ERepositoryObjectType.REFERENCED_PROJECTS) {
canWork = false;
}
if (repositoryNode.getContentType() == ERepositoryObjectType.SVN_ROOT) {
canWork = false;
}
if (repositoryNode.getObject() != null && repositoryNode.getObject().getRepositoryStatus() == ERepositoryStatus.DELETED) {
canWork = false;
}
}
}
setEnabled(canWork);
}
use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.
the class DetecteViewImpactAction method doRun.
@Override
protected void doRun() {
RepositoryNode node = getCurrentRepositoryNode();
if (node == null) {
return;
}
IStructuredSelection selection = new StructuredSelection(node);
// try to check via extension point first.
UpdateManagerProviderDetector.INSTANCE.updateForRepository(selection, true);
}
use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.
the class AbstractSection method setInput.
@Override
public void setInput(IWorkbenchPart part, ISelection selection) {
super.setInput(part, selection);
Assert.isTrue(selection instanceof IStructuredSelection);
Object input = ((IStructuredSelection) selection).getFirstElement();
if (!(input instanceof RepositoryNode)) {
if (input instanceof IAdaptable) {
// see ProcessPart.getAdapter()
IAdaptable adaptable = (IAdaptable) input;
input = adaptable.getAdapter(RepositoryNode.class);
}
}
Assert.isTrue(input instanceof RepositoryNode);
repositoryNode = (RepositoryNode) input;
repositoryObject = repositoryNode.getObject();
if (repositoryObject == null) {
repositoryObject = new EmptyRepositoryObject();
enableControls(false);
showControls(false);
return;
}
manageLock();
ERepositoryObjectType type = repositoryObject.getRepositoryObjectType();
showControls(type != ERepositoryObjectType.METADATA_CON_TABLE);
}
use of org.talend.repository.model.RepositoryNode in project tesb-studio-se by Talend.
the class OpenAnotherVersionResourceAction method doRun.
@Override
protected void doRun() {
final IRepositoryNode node = (RepositoryNode) ((IStructuredSelection) getSelection()).getFirstElement();
IPath path = RepositoryNodeUtilities.getPath(node);
String originalName = node.getObject().getLabel();
RepositoryObject repositoryObj = new RepositoryObject(node.getObject().getProperty());
repositoryObj.setRepositoryNode(node.getObject().getRepositoryNode());
OpenAnotherVersionResrouceWizard wizard = new OpenAnotherVersionResrouceWizard(repositoryObj);
WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
dialog.setPageSize(300, 250);
//$NON-NLS-1$
dialog.setTitle("Open another version");
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.talend.repository.model.RepositoryNode in project tesb-studio-se by Talend.
the class RouteResourcesButtonPart method buttonSelected.
@Override
protected void buttonSelected(SelectionEvent e) {
try {
Class<?> dialogClass = Platform.getBundle("org.talend.camel.designer").loadClass("org.talend.camel.designer.dialog.RouteResourceSelectionDialog");
Dialog dialog = (Dialog) dialogClass.getConstructor(Shell.class).newInstance(getShell());
if (dialog.open() == Dialog.OK) {
RepositoryNode resourceNode = (RepositoryNode) dialogClass.getMethod("getResult").invoke(dialog);
if (resourceNode != null) {
listener.routeResourceNodeSelected(resourceNode);
}
}
} catch (Exception e1) {
ExceptionHandler.process(new IllegalStateException("Can't load RouteResourceSelectionDialog from specific bundle", e1));
}
}
Aggregations