use of org.talend.dataprofiler.core.ui.editor.AbstractItemEditorInput in project tdq-studio-se by Talend.
the class RenameTdqFolderAction method getFirstOpenedChild.
/*
* MOD 20130530 TDQ-7143, when any items are opened under the current folder, should not let it be renamed
*/
@Override
protected String getFirstOpenedChild(IRepositoryNode node) {
if (node.hasChildren()) {
IWorkbenchPage page = getActivePage();
IEditorReference[] editorReferences = page.getEditorReferences();
List<String> openEditor = new ArrayList<String>();
List<IRepositoryNode> children = node.getChildren();
for (IEditorReference tmpInput : editorReferences) {
try {
IEditorInput editorInput = tmpInput.getEditorInput();
if (editorInput instanceof AbstractItemEditorInput) {
AbstractItemEditorInput einput = (AbstractItemEditorInput) editorInput;
openEditor.add(einput.getItem().getProperty().getId());
} else if (editorInput instanceof FileEditorInput) {
if (editorInput instanceof FileEditorInput) {
FileEditorInput fileInput = (FileEditorInput) editorInput;
for (IRepositoryNode currentNode : children) {
IFile nodeFile = RepositoryNodeHelper.getIFile(currentNode);
if (nodeFile != null && nodeFile.getFullPath().toString().equals(fileInput.getFile().getFullPath().toString())) {
return currentNode.getObject().getLabel();
}
}
}
}
} catch (PartInitException e) {
ExceptionHandler.process(e, Level.WARN);
}
}
for (IRepositoryNode currentNode : children) {
if (currentNode.getType() == ENodeType.REPOSITORY_ELEMENT) {
if (openEditor.contains(currentNode.getObject().getId())) {
return currentNode.getObject().getLabel();
}
} else if (currentNode.getType() == ENodeType.SIMPLE_FOLDER) {
String childOpen = getFirstOpenedChild(currentNode);
if (childOpen != null) {
return childOpen;
}
}
}
}
return null;
}
Aggregations