use of org.hibernate.eclipse.jdt.ui.internal.jpa.common.RefEntityInfo in project jbosstools-hibernate by jbosstools.
the class ResolveAmbiguous method updateEditorRel.
public void updateEditorRel(TableItem item) {
// Clean up any previous editor control
Control oldEditorRel = editorRel.getEditor();
if (oldEditorRel != null) {
oldEditorRel.dispose();
}
CCombo comboRel = new CCombo(table, SWT.NONE);
comboRel.setEditable(false);
Color bkgnd = table.getBackground();
comboRel.setBackground(bkgnd);
comboRel.add(JdtUiMessages.ResolveAmbiguous_empty);
String fullyQualifiedName = item.getText(0);
RefEntityInfo rei = (RefEntityInfo) item.getData();
Set<RefFieldInfo> setRefEntityInfo = findRelatedRefFieldInfos(fullyQualifiedName, rei);
Iterator<RefFieldInfo> itTmp = setRefEntityInfo.iterator();
while (itTmp.hasNext()) {
RefFieldInfo rfi = itTmp.next();
comboRel.add(rfi.fieldId);
}
if (null != rei.mappedBy) {
comboRel.setText(rei.mappedBy);
} else {
comboRel.setText(JdtUiMessages.ResolveAmbiguous_empty);
}
comboRel.addModifyListener(editorRelModifyListener);
// comboRel.selectAll();
// comboRel.setFocus();
editorRel.setEditor(comboRel, item, COLUMN_RELATED);
}
use of org.hibernate.eclipse.jdt.ui.internal.jpa.common.RefEntityInfo in project jbosstools-hibernate by jbosstools.
the class ResolveAmbiguous method createControl.
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
GridLayout layout = new GridLayout();
container.setLayout(layout);
layout.numColumns = 1;
Label label = new Label(container, SWT.NULL);
label.setText(JdtUiMessages.ResolveAmbiguous_message);
table = new Table(container, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
table.setHeaderVisible(true);
table.setLinesVisible(true);
createTableColumns(table);
TableItem ti = null;
Iterator<Map.Entry<String, EntityInfo>> it = data.getEntities().entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, EntityInfo> entry = it.next();
if (entry.getValue().isAbstractFlag()) {
continue;
}
// collectModification(bufferManager, entry.getKey(), entry.getValue());
Iterator<Map.Entry<String, RefEntityInfo>> referencesIt = entry.getValue().getReferences().entrySet().iterator();
while (referencesIt.hasNext()) {
Map.Entry<String, RefEntityInfo> entryRef = referencesIt.next();
RefEntityInfo rei = entryRef.getValue();
ti = new TableItem(table, SWT.NONE);
ti.setData(rei);
ti.setText(COLUMN_CLASS, entry.getKey());
String shortName = getShortName(rei.fullyQualifiedName);
// $NON-NLS-1$
ti.setText(COLUMN_PROPERTY, shortName + " " + entryRef.getKey());
ti.setText(COLUMN_TYPE, Utils.refTypeToStr(rei.refType));
if (null != rei.mappedBy) {
ti.setText(COLUMN_RELATED, rei.mappedBy);
} else {
ti.setText(COLUMN_RELATED, JdtUiMessages.ResolveAmbiguous_empty);
}
ti.setText(COLUMN_OWNER, Utils.ownerTypeToStr(rei.owner));
}
}
//
editorType = new TableEditor(table);
// The editor must have the same size as the cell and must
// not be any smaller than 50 pixels.
editorType.horizontalAlignment = SWT.LEFT;
editorType.grabHorizontal = true;
editorType.minimumWidth = 50;
//
editorRel = new TableEditor(table);
// The editor must have the same size as the cell and must
// not be any smaller than 50 pixels.
editorRel.horizontalAlignment = SWT.LEFT;
editorRel.grabHorizontal = true;
editorRel.minimumWidth = 50;
//
editorOwner = new TableEditor(table);
// The editor must have the same size as the cell and must
// not be any smaller than 50 pixels.
editorOwner.horizontalAlignment = SWT.LEFT;
editorOwner.grabHorizontal = true;
editorOwner.minimumWidth = 50;
// editing the second column
table.addSelectionListener(new TableSelectionListener());
GridData data = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
data.heightHint = convertHeightInCharsToPixels(10);
table.setLayoutData(data);
setControl(container);
}
use of org.hibernate.eclipse.jdt.ui.internal.jpa.common.RefEntityInfo in project jbosstools-hibernate by jbosstools.
the class ResolveAmbiguous method updateTI.
public void updateTI(TableItem ti) {
if (ti == null) {
return;
}
RefEntityInfo rei = (RefEntityInfo) ti.getData();
ti.setText(COLUMN_TYPE, Utils.refTypeToStr(rei.refType));
if (null != rei.mappedBy) {
ti.setText(COLUMN_RELATED, rei.mappedBy);
} else {
ti.setText(COLUMN_RELATED, JdtUiMessages.ResolveAmbiguous_empty);
}
ti.setText(COLUMN_OWNER, Utils.ownerTypeToStr(rei.owner));
}
use of org.hibernate.eclipse.jdt.ui.internal.jpa.common.RefEntityInfo in project jbosstools-hibernate by jbosstools.
the class ResolveAmbiguous method findRelatedRefFieldInfos.
protected Set<RefFieldInfo> findRelatedRefFieldInfos(String fullyQualifiedName, RefEntityInfo rei) {
String fullyQualifiedName2 = rei.fullyQualifiedName;
EntityInfo entryInfo2 = data.getEntities().get(fullyQualifiedName2);
Set<RefFieldInfo> setRefEntityInfo = entryInfo2.getRefFieldInfoSet(fullyQualifiedName);
return setRefEntityInfo;
}
use of org.hibernate.eclipse.jdt.ui.internal.jpa.common.RefEntityInfo in project jbosstools-hibernate by jbosstools.
the class ResolveAmbiguous method updateEditorType.
public void updateEditorType(TableItem item) {
// Clean up any previous editor control
Control oldEditorType = editorType.getEditor();
if (oldEditorType != null) {
oldEditorType.dispose();
}
// The control that will be the editor must be a child of the Table
CCombo comboType = new CCombo(table, SWT.NONE);
comboType.setEditable(false);
Color bkgnd = table.getBackground();
comboType.setBackground(bkgnd);
RefEntityInfo rei = (RefEntityInfo) item.getData();
comboType.add(Utils.refTypeToStr(RefType.ONE2ONE));
comboType.add(Utils.refTypeToStr(RefType.ONE2MANY));
comboType.add(Utils.refTypeToStr(RefType.MANY2ONE));
comboType.add(Utils.refTypeToStr(RefType.MANY2MANY));
comboType.add(Utils.refTypeToStr(RefType.UNDEF));
comboType.setText(Utils.refTypeToStr(rei.refType));
comboType.addModifyListener(editorTypeModifyListener);
// comboType.selectAll();
comboType.setFocus();
editorType.setEditor(comboType, item, COLUMN_TYPE);
}
Aggregations