Search in sources :

Example 1 with CreateMappingTableDialog

use of org.netxms.ui.eclipse.serverconfig.dialogs.CreateMappingTableDialog in project netxms by netxms.

the class MappingTables method createNewTable.

/**
 * Create new table
 */
private void createNewTable() {
    final CreateMappingTableDialog dlg = new CreateMappingTableDialog(getSite().getShell());
    if (dlg.open() != Window.OK)
        return;
    new ConsoleJob(Messages.get().MappingTables_CreateJobName, this, Activator.PLUGIN_ID, null) {

        @Override
        protected void runInternal(IProgressMonitor monitor) throws Exception {
            final Integer assignedId = session.createMappingTable(dlg.getName(), dlg.getDescription(), 0);
            runInUIThread(new Runnable() {

                @Override
                public void run() {
                    // descriptor may already be presented if creation notification
                    // was already processed
                    MappingTableDescriptor d = mappingTables.get(assignedId);
                    if (d == null) {
                        d = new MappingTableDescriptor(assignedId, dlg.getName(), dlg.getDescription(), 0);
                        mappingTables.put(assignedId, d);
                    }
                    viewer.setInput(mappingTables.values().toArray());
                    viewer.setSelection(new StructuredSelection(d));
                    editTable();
                }
            });
        }

        @Override
        protected String getErrorMessage() {
            // TODO Auto-generated method stub
            return null;
        }
    }.start();
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) MappingTableDescriptor(org.netxms.client.mt.MappingTableDescriptor) CreateMappingTableDialog(org.netxms.ui.eclipse.serverconfig.dialogs.CreateMappingTableDialog) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ConsoleJob(org.netxms.ui.eclipse.jobs.ConsoleJob) PartInitException(org.eclipse.ui.PartInitException)

Aggregations

IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 PartInitException (org.eclipse.ui.PartInitException)1 MappingTableDescriptor (org.netxms.client.mt.MappingTableDescriptor)1 ConsoleJob (org.netxms.ui.eclipse.jobs.ConsoleJob)1 CreateMappingTableDialog (org.netxms.ui.eclipse.serverconfig.dialogs.CreateMappingTableDialog)1