use of org.eclipse.compare.ICompareInputLabelProvider in project tdq-studio-se by Talend.
the class ModelElementCompareEditorLauncher method open.
@Override
public void open(IPath file) {
try {
// final EObject snapshot = ModelUtils.load(file.toFile(), new ResourceSetImpl());
// if (snapshot instanceof ComparisonResourceSnapshot) {
CompareConfiguration comapreConfiguration = new CompareConfiguration();
comapreConfiguration.setDefaultLabelProvider(new ICompareInputLabelProvider() {
@Override
public Image getAncestorImage(Object input) {
return null;
}
@Override
public String getAncestorLabel(Object input) {
// $NON-NLS-1$
return "";
}
@Override
public Image getLeftImage(Object input) {
return null;
}
@Override
public String getLeftLabel(Object input) {
// $NON-NLS-1$
String showLabel = Messages.getString("ModelElementCompareEditorLauncher.LocalStructure", connectionName);
if (compareEachOther) {
// $NON-NLS-1$
showLabel = Messages.getString("ModelElementCompareEditorLauncher.FirstElement");
}
return showLabel;
}
@Override
public Image getRightImage(Object input) {
return null;
}
@Override
public String getRightLabel(Object input) {
// $NON-NLS-1$
String showLabel = Messages.getString("ModelElementCompareEditorLauncher.DistantStructure");
if (compareEachOther) {
// $NON-NLS-1$
showLabel = Messages.getString("ModelElementCompareEditorLauncher.SecondElement");
}
return showLabel;
}
@Override
public Image getImage(Object element) {
return null;
}
@Override
public String getText(Object element) {
// $NON-NLS-1$
return Messages.getString("ModelElementCompareEditorLauncher.TextLabel");
}
@Override
public void addListener(ILabelProviderListener listener) {
// needn't to do anything ???
}
@Override
public void dispose() {
// needn't to do anything ???
}
@Override
public boolean isLabelProperty(Object element, String property) {
return false;
}
@Override
public void removeListener(ILabelProviderListener listener) {
// needn't to do anything ???
}
});
// ModelElementCompareEditorInput compEditorInput = new ModelElementCompareEditorInput(
// (ComparisonResourceSnapshot) snapshot, comapreConfiguration, selectedObject);
// MOD mzhao bug 8581 Add the specific title for comparison
// editor.
// $NON-NLS-1$
String editorTitle = Messages.getString("ModelElementCompareEditorLauncher.Compare");
if (selectedObject instanceof IFile) {
editorTitle = PrvResourceFileHelper.getInstance().findProvider((IFile) selectedObject).getName();
} else if (selectedObject instanceof IFolderNode) {
editorTitle = ((ModelElement) ((IFolderNode) selectedObject).getParent()).getName();
} else if (selectedObject instanceof Catalog) {
editorTitle = ((Catalog) selectedObject).getName();
} else if (selectedObject instanceof IRepositoryViewObject) {
editorTitle = ((ConnectionItem) ((IRepositoryViewObject) selectedObject).getProperty().getItem()).getConnection().getName();
} else if (selectedObject instanceof Connection) {
editorTitle = ((Connection) selectedObject).getName();
}
// compEditorInput.setTitle(editorTitle);
// CompareUI.openCompareEditor(compEditorInput);
// compEditorInput.hookLeftPanelContextMenu(compareEachOther);
// compEditorInput.hookToolBar(compareEachOther);
// }
// } catch (IOException e) {
} catch (Exception e) {
// Fichier non lisible
System.out.println(e);
assert false;
}
}
Aggregations