Search in sources :

Example 1 with TaskDataModelListener

use of org.eclipse.mylyn.tasks.core.data.TaskDataModelListener in project linuxtools by eclipse.

the class RepositoryQuerySchemaPage method createPageContent.

@Override
protected void createPageContent(@NonNull SectionComposite parent) {
    this.scrolledComposite = parent;
    Composite scrolledBodyComposite = scrolledComposite.getContent();
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 10;
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 10;
    scrolledBodyComposite.setLayout(layout);
    Composite attributesComposite = new Composite(scrolledBodyComposite, SWT.NONE);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).span(2, 1).applyTo(attributesComposite);
    layout = new GridLayout(6, false);
    layout.marginHeight = 20;
    layout.marginWidth = 10;
    attributesComposite.setLayout(layout);
    GridData g = new GridData(GridData.FILL, GridData.FILL, true, true);
    g.widthHint = 600;
    attributesComposite.setLayoutData(g);
    attributesComposite.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND));
    FormToolkit toolkit = new FormToolkit(parent.getDisplay());
    TaskRepository repository = getTaskRepository();
    ITask nTask = new TaskTask(repository.getConnectorKind(), repository.getRepositoryUrl(), data.getTaskId());
    ITaskDataWorkingCopy workingCopy = TasksUi.getTaskDataManager().createWorkingCopy(nTask, data);
    final TaskDataModel model = new TaskDataModel(repository, nTask, workingCopy);
    factory = new RepositoryQueryAttributeEditorFactory(model, repository);
    model.addModelListener(new TaskDataModelListener() {

        @Override
        public void attributeChanged(TaskDataModelEvent event) {
            getContainer().updateButtons();
        }
    });
    targetTaskData = workingCopy.getLocalData();
    final TaskAttribute target = targetTaskData.getRoot();
    createFieldControls(attributesComposite, toolkit, layout.numColumns, target);
    Point p = scrolledBodyComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    scrolledComposite.setMinSize(p);
}
Also used : TaskAttribute(org.eclipse.mylyn.tasks.core.data.TaskAttribute) ITask(org.eclipse.mylyn.tasks.core.ITask) SectionComposite(org.eclipse.mylyn.commons.workbench.forms.SectionComposite) Composite(org.eclipse.swt.widgets.Composite) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) TaskRepository(org.eclipse.mylyn.tasks.core.TaskRepository) TaskDataModelEvent(org.eclipse.mylyn.tasks.core.data.TaskDataModelEvent) Point(org.eclipse.swt.graphics.Point) TaskTask(org.eclipse.mylyn.internal.tasks.core.TaskTask) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) TaskDataModelListener(org.eclipse.mylyn.tasks.core.data.TaskDataModelListener) ITaskDataWorkingCopy(org.eclipse.mylyn.tasks.core.data.ITaskDataWorkingCopy) TaskDataModel(org.eclipse.mylyn.tasks.core.data.TaskDataModel)

Aggregations

SectionComposite (org.eclipse.mylyn.commons.workbench.forms.SectionComposite)1 TaskTask (org.eclipse.mylyn.internal.tasks.core.TaskTask)1 ITask (org.eclipse.mylyn.tasks.core.ITask)1 TaskRepository (org.eclipse.mylyn.tasks.core.TaskRepository)1 ITaskDataWorkingCopy (org.eclipse.mylyn.tasks.core.data.ITaskDataWorkingCopy)1 TaskAttribute (org.eclipse.mylyn.tasks.core.data.TaskAttribute)1 TaskDataModel (org.eclipse.mylyn.tasks.core.data.TaskDataModel)1 TaskDataModelEvent (org.eclipse.mylyn.tasks.core.data.TaskDataModelEvent)1 TaskDataModelListener (org.eclipse.mylyn.tasks.core.data.TaskDataModelListener)1 Point (org.eclipse.swt.graphics.Point)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 FormToolkit (org.eclipse.ui.forms.widgets.FormToolkit)1