use of org.talend.mdm.repository.model.mdmproperties.ContainerItem in project tmdm-studio-se by Talend.
the class MDMRepositoryViewerSorter method category.
@Override
public int category(Object element) {
if (element instanceof IRepositoryViewObject) {
IRepositoryViewObject viewObject = (IRepositoryViewObject) element;
ERepositoryObjectType repositoryObjectType = viewObject.getRepositoryObjectType();
if (repositoryObjectType == null)
return 0;
if (repositoryObjectType == IServerObjectRepositoryType.TYPE_RECYCLE_BIN) {
return 2;
}
try {
Item item = viewObject.getProperty().getItem();
if (item != null) {
if (item instanceof MDMServerObjectItem) {
return 1;
}
if (item instanceof ContainerItem) {
return SortOrderFactory.getOrder((ContainerItem) item);
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
return 0;
}
use of org.talend.mdm.repository.model.mdmproperties.ContainerItem in project tmdm-studio-se by Talend.
the class MDMServerDecorator method decorateRecycleBin.
private void decorateRecycleBin(Item item, IDecoration decoration) {
ItemState state = item.getState();
String path = state.getPath();
if (item instanceof ContainerItem) {
int index = path.lastIndexOf(IPath.SEPARATOR);
if (index > 0) {
path = path.substring(0, index);
} else if (index == 0) {
// $NON-NLS-1$
path = "";
}
}
if (path.length() > 0) {
// $NON-NLS-1$ //$NON-NLS-2$
decoration.addSuffix(" (" + path + ")");
}
}
use of org.talend.mdm.repository.model.mdmproperties.ContainerItem in project tmdm-studio-se by Talend.
the class MDMExportRepositoryItemsWizard method getItemsToExport.
/**
* DOC hywang Comment method "getItemsToExport".
*/
private Collection<Item> getItemsToExport(Collection<IRepositoryViewObject> objs) {
List<Item> toReturn = null;
if (objs != null && objs.size() > 0) {
toReturn = new ArrayList<Item>();
for (IRepositoryViewObject obj : objs) {
Item item = obj.getProperty().getItem();
if (item != null && !(item instanceof ContainerItem)) {
item = RepositoryResourceUtil.assertItem(item);
toReturn.add(item);
}
}
}
return toReturn;
}
use of org.talend.mdm.repository.model.mdmproperties.ContainerItem in project tmdm-studio-se by Talend.
the class OpenObjectAction method doOpen.
public boolean doOpen() {
List<Object> sels = getSelectedObject();
if (selObjects != null) {
sels = selObjects;
}
if (sels.isEmpty()) {
return false;
}
Object obj = sels.get(0);
if (obj instanceof IRepositoryViewObject) {
if (obj instanceof WSRootRepositoryObject) {
return false;
}
IRepositoryViewObject viewObject = (IRepositoryViewObject) obj;
Item item = viewObject.getProperty().getItem();
if (item instanceof ContainerItem) {
if (viewObject.getRepositoryObjectType().equals(IServerObjectRepositoryType.TYPE_SERVICECONFIGURATION)) {
// service
boolean checkMissingJar = MissingJarService.getInstance().checkMissingJar(true);
if (!checkMissingJar) {
return false;
}
// configuration
MDMServerDef serverDef = openServerDialog(null);
openServiceConfig(serverDef);
} else {
getCommonViewer().expandToLevel(obj, 1);
}
} else {
IEditorReference editorRef = RepositoryResourceUtil.isOpenedInEditor(viewObject);
if (editorRef != null) {
if (page == null) {
page = getCommonViewer().getCommonNavigator().getSite().getWorkbenchWindow().getActivePage();
}
if (page != null) {
page.bringToTop(editorRef.getPart(false));
}
if (marker != null) {
IDE.gotoMarker(editorRef.getEditor(true), marker);
}
return false;
} else {
openItem(viewObject);
return true;
}
}
}
return true;
}
use of org.talend.mdm.repository.model.mdmproperties.ContainerItem in project tmdm-studio-se by Talend.
the class RefreshAction method refreshSelection.
private void refreshSelection() {
List<Object> selectedObject = getSelectedObject();
if (!selectedObject.isEmpty()) {
Object obj = selectedObject.get(0);
commonViewer.refresh(obj);
Item item = ((IRepositoryViewObject) obj).getProperty().getItem();
if (item instanceof ContainerItem) {
commonViewer.expandToLevel(obj, 1);
}
}
}
Aggregations