use of com.liferay.ide.project.ui.migration.MarkUndoneAction in project liferay-ide by liferay.
the class FindBreakingChangesPage method createTableView.
public void createTableView(Composite container) {
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.minimumWidth = 200;
gridData.minimumHeight = 200;
Composite tableComposite = new Composite(container, SWT.NONE);
_problemsViewer = new TableViewer(tableComposite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER | SWT.VIRTUAL);
_problemsViewer.getTable().setLayoutData(gridData);
_createColumns(_problemsViewer);
final Table table = _problemsViewer.getTable();
table.setHeaderVisible(true);
_problemsViewer.setContentProvider(ArrayContentProvider.getInstance());
_problemsViewer.setComparer(null);
_comparator = new MigratorComparator();
_problemsViewer.setComparator(_comparator);
MenuManager menuMgr = new MenuManager();
IAction markDoneAction = new MarkDoneAction(_problemsViewer);
IAction markUndoneAction = new MarkUndoneAction(_problemsViewer);
IAction ignoreAction = new IgnoreAction(_problemsViewer);
IAction ignoreAlways = new IgnoreAlwaysAction(_problemsViewer);
IAction autoCorrectAction = new AutoCorrectAction(_problemsViewer);
menuMgr.add(markDoneAction);
menuMgr.add(markUndoneAction);
menuMgr.add(ignoreAction);
menuMgr.add(autoCorrectAction);
menuMgr.add(ignoreAlways);
Menu menu = menuMgr.createContextMenu(table);
table.setMenu(menu);
_problemsViewer.addDoubleClickListener(this);
}
use of com.liferay.ide.project.ui.migration.MarkUndoneAction in project liferay-ide by liferay.
the class FindBreakingChangesPage method _createColumns.
private void _createColumns(final TableViewer problemsViewer) {
final String[] titles = { "Resolved", "Line", "Problem" };
TableViewerColumn col0 = _createTableViewerColumn(titles[0], problemsViewer);
col0.getColumn().pack();
col0.setEditingSupport(new EditingSupport(problemsViewer) {
@Override
protected boolean canEdit(Object element) {
return true;
}
@Override
protected CellEditor getCellEditor(Object element) {
return new CheckboxCellEditor(problemsViewer.getTable());
}
@Override
protected Object getValue(Object element) {
return ((Problem) element).getStatus() == Problem.STATUS_RESOLVED;
}
@Override
protected void setValue(Object element, Object value) {
if (value == Boolean.TRUE) {
new MarkDoneAction().run((Problem) element, problemsViewer);
} else {
new MarkUndoneAction().run((Problem) element, problemsViewer);
}
}
});
col0.setLabelProvider(new ColumnLabelProvider() {
@Override
public Image getImage(Object element) {
Problem p = (Problem) element;
if (p.getStatus() == Problem.STATUS_RESOLVED) {
return _imageChecked;
} else {
return _imageUnchecked;
}
}
@Override
public String getText(Object element) {
return null;
}
});
TableViewerColumn col1 = _createTableViewerColumn(titles[1], problemsViewer);
col1.getColumn().pack();
col1.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
Problem p = (Problem) element;
return p.lineNumber > -1 ? (p.lineNumber + "") : "";
}
});
TableViewerColumn col2 = _createTableViewerColumn(titles[2], problemsViewer);
col2.getColumn().pack();
col2.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
Problem p = (Problem) element;
return p.title;
}
@Override
public void update(ViewerCell cell) {
super.update(cell);
Table table = problemsViewer.getTable();
table.getColumn(2).pack();
}
});
TableColumnLayout tableLayout = new TableColumnLayout();
TableColumn column0 = col0.getColumn();
TableColumn column1 = col1.getColumn();
TableColumn column2 = col2.getColumn();
tableLayout.setColumnData(column0, new ColumnWeightData(50, column0.getWidth()));
tableLayout.setColumnData(column1, new ColumnWeightData(50, column1.getWidth()));
tableLayout.setColumnData(column2, new ColumnWeightData(100, column2.getWidth()));
Table table = problemsViewer.getTable();
table.getParent().setLayout(tableLayout);
}
Aggregations