use of org.netxms.ui.eclipse.agentmanager.views.helpers.PackageComparator in project netxms by netxms.
the class PackageManager method createPartControl.
/* (non-Javadoc)
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
final String[] names = { Messages.get().PackageManager_ColumnID, Messages.get().PackageManager_ColumnName, Messages.get().PackageManager_ColumnVersion, Messages.get().PackageManager_ColumnPlatform, Messages.get().PackageManager_ColumnFile, Messages.get().PackageManager_ColumnDescription };
final int[] widths = { 70, 120, 90, 120, 150, 400 };
viewer = new SortableTableViewer(parent, names, widths, COLUMN_ID, SWT.UP, SWT.FULL_SELECTION | SWT.MULTI);
viewer.setContentProvider(new ArrayContentProvider());
viewer.setLabelProvider(new PackageLabelProvider());
viewer.setComparator(new PackageComparator());
createActions();
contributeToActionBars();
createPopupMenu();
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
actionDeploy.setEnabled(selection.size() == 1);
actionRemove.setEnabled(selection.size() > 0);
}
});
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().PackageManager_OpenDatabase, this, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
try {
session.lockPackageDatabase();
} catch (NXCException e) {
// New versions may not require package DB lock
if (e.getErrorCode() != RCC.NOT_IMPLEMENTED)
throw e;
}
runInUIThread(new Runnable() {
@Override
public void run() {
refresh();
}
});
}
@Override
protected String getErrorMessage() {
return Messages.get().PackageManager_OpenError;
}
}.start();
}
Aggregations