peopleTable.setHeaderVisible(false);
peopleTable.setLinesVisible(false);
peopleTable.setBackgroundMode(SWT.INHERIT_FORCE);
TreeColumn col = new TreeColumn(peopleTable, SWT.NONE);
col.setText(Messages.getString("campaign.editor.people.table.column.name.label"));
col.setToolTipText(Messages.getString("campaign.editor.people.table.column.name.tooltip"));
col.setWidth(500);
col.setMoveable(false);
col.setResizable(true);
peopleViewer = new TreeViewer(peopleTable);
campaignEditorAdapterFactory = new CampaignEditorAdapterFactory();
Platform.getAdapterManager().registerAdapters(campaignEditorAdapterFactory, CampaignEditor.class);
Platform.getAdapterManager().registerAdapters(campaignEditorAdapterFactory, Participant.class);
Platform.getAdapterManager().registerAdapters(campaignEditorAdapterFactory, Character.class);
peopleViewer.setLabelProvider(new CampaignEditorPeopleLabelProvider(this));
peopleViewer.setContentProvider(new BaseWorkbenchContentProvider());
peopleViewer.addDoubleClickListener(new CampaignEditorPeopleDoubleClickListener(this));
peopleViewer.setComparator(new ViewerComparator());
peopleViewer.setInput(this);
getSite().setSelectionProvider(peopleViewer);
// peopleViewer.setContentProvider(new CampaignEditorPeopleContentProvider(this));
// peopleViewer.setLabelProvider(new CampaignEditorPeopleLabelProvider(this));
// peopleViewer.setColumnProperties(new String[] { "name" });
// peopleViewer.setComparator(new CampaignPeopleComparator());
// peopleViewer.addSelectionChangedListener(new CampaignPeopleSelectionChangedListener(this));
// peopleViewer.setInput(((CampaignEditorInput)getEditorInput()).getCampaign().getParticipants());
}
// calendar group
{
logger.debug("creating calendar group");
Group calendarGroup = new Group(comp, SWT.NONE);
calendarGroup.setText(Messages.getString("campaign.editor.group.calendar.label"));
calendarGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 2));
calendarGroup.setLayout(new GridLayout(4, false));
// campaign date (line 1, columns 1,2)
logger.debug("creating current date field");
label = new Label(calendarGroup, SWT.RIGHT);
label.setText(Messages.getString("campaign.editor.campaign_date.label"));
label.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
campaignDate = new Text(calendarGroup, SWT.BORDER | SWT.READ_ONLY);
campaignDate.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
campaignDate.setText("TODO campaign date");
// toolbar
ToolBar campaignDateToolbar = new ToolBar(calendarGroup, SWT.FLAT | SWT.RIGHT);
campaignDateToolbar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
ToolItem item;
item = new ToolItem(campaignDateToolbar, SWT.PUSH | SWT.FLAT);
item.setImage(ImageLoader.getImage(bundleContext.getBundle(), CampaignEditorConstants.CAMPAIGN_DATE_DECREMENT_ICON_PATH));
// TODO: listeners
item = new ToolItem(campaignDateToolbar, SWT.PUSH | SWT.FLAT);
item.setImage(ImageLoader.getImage(bundleContext.getBundle(), CampaignEditorConstants.CAMPAIGN_DATE_INCREMENT_ICON_PATH));
// TODO: listeners
item = new ToolItem(campaignDateToolbar, SWT.PUSH | SWT.FLAT);
item.setImage(ImageLoader.getImage(bundleContext.getBundle(), CampaignEditorConstants.CAMPAIGN_DATE_ADD_EVENT_ICON_PATH));
// TODO: listeners
// TODO: populate toolbar
// calendar picker
Combo picker = new Combo(calendarGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
picker.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
// TODO: populate list
picker.addSelectionListener(new SelectionListener() {
/* (non-Javadoc)
* @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
*/
public void widgetDefaultSelected(SelectionEvent e) {
this.widgetSelected(e);
}
/* (non-Javadoc)
* @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
*/
public void widgetSelected(SelectionEvent e) {
logger.debug("calendar picker selected: " + e);
}
});
// event table
TableViewer eventTableViewer = new TableViewer(calendarGroup, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER);
Table eventTable = eventTableViewer.getTable();
eventTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1));
}
// // notes group
// {
// logger.debug("creating notes group");
// Group notesGroup = new Group(comp, SWT.NONE);
// notesGroup.setText(Messages.getString("campaign.editor.group.notes.label"));
// notesGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
// notesGroup.setLayout(new FillLayout());
//
// // notes field
// notes = new Text(notesGroup, SWT.MULTI);
// notes.setText(campaign.getNotes());
// notes.addModifyListener(new ModifyListener() {
// public void modifyText(ModifyEvent e)
// {
// logger.debug("setting notes");
// campaign.setNotes(notes.getText());
//
// logger.debug("setting editor as dirty");
// dirty = true;
// }
// });
// }
// libraries group
{
logger.debug("creating libraries group");
Group librariesGroup = new Group(comp, SWT.NONE);
librariesGroup.setText(Messages.getString("campaign.editor.group.libraries.label"));
librariesGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
librariesGroup.setLayout(new FillLayout());
// table viewer with participant list
librariesTable = new Tree(librariesGroup, SWT.SINGLE | SWT.FULL_SELECTION);
librariesTable.setHeaderVisible(false);
librariesTable.setLinesVisible(false);
librariesTable.setBackgroundMode(SWT.INHERIT_FORCE);
TreeColumn col = new TreeColumn(peopleTable, SWT.NONE);
col.setText(Messages.getString("campaign.editor.libraries.table.column.name.label"));
col.setToolTipText(Messages.getString("campaign.editor.libraries.table.column.name.tooltip"));
col.setWidth(500);
col.setMoveable(false);
col.setResizable(true);
librariesViewer = new TreeViewer(librariesTable);
// peopleViewer.setContentProvider(new CampaignPeopleContentProvider(this));
// peopleViewer.setLabelProvider(new CampaignPeopleLabelProvider(this));
// peopleViewer.setColumnProperties(new String[] { "name" });