Search in sources :

Example 26 with Cell

use of eu.esdihumboldt.hale.common.align.model.Cell in project hale by halestudio.

the class CellPrioritySection method refresh.

@Override
public void refresh() {
    super.refresh();
    Cell cell = getCell();
    if (cell != null) {
        comboViewer.getControl().setEnabled(true);
        setFromCell();
    } else {
        comboViewer.getControl().setEnabled(false);
    }
}
Also used : Cell(eu.esdihumboldt.hale.common.align.model.Cell)

Example 27 with Cell

use of eu.esdihumboldt.hale.common.align.model.Cell in project hale by halestudio.

the class CellPrioritySection method selectionChanged.

/**
 * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
 */
@Override
public void selectionChanged(SelectionChangedEvent event) {
    ISelection selection = event.getSelection();
    if (selection instanceof IStructuredSelection) {
        IStructuredSelection structuredSelection = (IStructuredSelection) selection;
        Object firstElement = structuredSelection.getFirstElement();
        if (firstElement instanceof Priority) {
            Priority priority = (Priority) firstElement;
            Cell cell = getCell();
            if (cell.getPriority() != priority) {
                AlignmentService alignmentService = PlatformUI.getWorkbench().getService(AlignmentService.class);
                alignmentService.setCellProperty(cell.getId(), Cell.PROPERTY_PRIORITY, priority);
            }
        }
    }
}
Also used : Priority(eu.esdihumboldt.hale.common.align.model.Priority) AlignmentService(eu.esdihumboldt.hale.ui.service.align.AlignmentService) ISelection(org.eclipse.jface.viewers.ISelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Cell(eu.esdihumboldt.hale.common.align.model.Cell)

Example 28 with Cell

use of eu.esdihumboldt.hale.common.align.model.Cell in project hale by halestudio.

the class CellPrioritySection method setFromCell.

private void setFromCell() {
    Cell cell = getCell();
    Priority currentPriority = cell.getPriority();
    comboViewer.setSelection(new StructuredSelection(currentPriority));
}
Also used : Priority(eu.esdihumboldt.hale.common.align.model.Priority) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Cell(eu.esdihumboldt.hale.common.align.model.Cell)

Example 29 with Cell

use of eu.esdihumboldt.hale.common.align.model.Cell in project hale by halestudio.

the class NotesCellSection method refresh.

@Override
public void refresh() {
    super.refresh();
    Cell cell = getCell();
    if (cell != null) {
        String notes = CellUtil.getNotes(cell);
        if (notes == null) {
            notes = "";
        }
        textField.setText(notes);
        textField.setEnabled(!cell.isBaseCell());
    } else {
        textField.setText("");
        textField.setEnabled(false);
    }
}
Also used : Cell(eu.esdihumboldt.hale.common.align.model.Cell)

Example 30 with Cell

use of eu.esdihumboldt.hale.common.align.model.Cell in project hale by halestudio.

the class NotesCellSection method createControls.

@Override
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
    super.createControls(parent, aTabbedPropertySheetPage);
    Composite page = getWidgetFactory().createComposite(parent);
    page.setLayout(GridLayoutFactory.fillDefaults().margins(8, 8).create());
    textField = new Text(page, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
    textField.setLayoutData(GridDataFactory.fillDefaults().hint(17, 17).grab(true, true).create());
    textField.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            Cell cell = getCell();
            if (cell != null && !cell.isBaseCell()) {
                String cellNotes = CellUtil.getNotes(cell);
                if (cellNotes == null) {
                    cellNotes = "";
                }
                String notes = textField.getText();
                if (!notes.equals(cellNotes)) {
                    CellUtil.setNotes(cell, notes);
                    ProjectService ps = PlatformUI.getWorkbench().getService(ProjectService.class);
                    if (ps != null) {
                        ps.setChanged();
                    }
                }
            }
        }
    });
}
Also used : ModifyEvent(org.eclipse.swt.events.ModifyEvent) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) ProjectService(eu.esdihumboldt.hale.ui.service.project.ProjectService) Text(org.eclipse.swt.widgets.Text) Cell(eu.esdihumboldt.hale.common.align.model.Cell)

Aggregations

Cell (eu.esdihumboldt.hale.common.align.model.Cell)123 ArrayList (java.util.ArrayList)33 MutableCell (eu.esdihumboldt.hale.common.align.model.MutableCell)28 ParameterValue (eu.esdihumboldt.hale.common.align.model.ParameterValue)28 Test (org.junit.Test)27 Entity (eu.esdihumboldt.hale.common.align.model.Entity)24 DefaultCell (eu.esdihumboldt.hale.common.align.model.impl.DefaultCell)24 EntityDefinition (eu.esdihumboldt.hale.common.align.model.EntityDefinition)18 BaseAlignmentCell (eu.esdihumboldt.hale.common.align.model.BaseAlignmentCell)16 TypeEntityDefinition (eu.esdihumboldt.hale.common.align.model.impl.TypeEntityDefinition)16 AlignmentService (eu.esdihumboldt.hale.ui.service.align.AlignmentService)16 TypeDefinition (eu.esdihumboldt.hale.common.schema.model.TypeDefinition)15 Alignment (eu.esdihumboldt.hale.common.align.model.Alignment)13 HashSet (java.util.HashSet)13 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)12 Type (eu.esdihumboldt.hale.common.align.model.Type)11 List (java.util.List)11 ModifiableCell (eu.esdihumboldt.hale.common.align.model.ModifiableCell)9 PropertyEntityDefinition (eu.esdihumboldt.hale.common.align.model.impl.PropertyEntityDefinition)9 Property (eu.esdihumboldt.hale.common.align.model.Property)8