Search in sources :

Example 16 with BrokerConfig

use of com.cubrid.common.ui.spi.model.BrokerConfig in project cubrid-manager by CUBRID.

the class UnifyHostConfigEditor method delBrokerConfColumn.

/**
	 * delBrokerConfColumn
	 */
public void delBrokerConfColumn() {
    editorInput.setBrokerConfPropertyCount(brokerConfTabTableViewer.getTable().getColumnCount());
    LinkedHashMap<String, BrokerConfig> brokerConfMap = unifyHostConfigUtil.parseCommonTableValueToCubridBrokerConfig(cubridBrokerConfListData, editorInput.getBrokerConfPropertyCount());
    Point pt = cubridBrokerTableClickPoint;
    int selectIndex = brokerConfTabTableViewer.getTable().getSelectionIndex();
    if (selectIndex < 0) {
        return;
    }
    final TableItem item = brokerConfTabTableViewer.getTable().getItem(selectIndex);
    if (item == null) {
        return;
    }
    for (int i = 0; i < brokerConfTabTableViewer.getTable().getColumnCount(); i++) {
        Rectangle rect = item.getBounds(i);
        if (rect.contains(pt)) {
            cubridBrokerConfListData.clear();
            cubridBrokerConfListData.addAll(unifyHostConfigUtil.parseCubridBrokerConfigToCommonTableValue(cubridBrokerConfigDataMap));
            String serverName = cubridBrokerConfListData.get(0).get(i + "");
            String brokerName = cubridBrokerConfListData.get(1).get(i + "");
            if (!CommonUITool.openConfirmBox(Messages.bind(Messages.unifyHostConfigEditorDelColumnConfirmMsg, brokerName, serverName))) {
                return;
            }
            BrokerConfig cubridBrokerConfig = brokerConfMap.get(serverName);
            cubridBrokerConfUtil.deleteBrokerPropertyByBrokerName(cubridBrokerConfig, brokerName);
            cubridBrokerConfigDataMap.clear();
            cubridBrokerConfigDataMap.putAll(brokerConfMap);
            createBrokerConfTableData();
            setDirty(true);
            return;
        }
    }
}
Also used : BrokerConfig(com.cubrid.common.ui.spi.model.BrokerConfig) TableItem(org.eclipse.swt.widgets.TableItem) Rectangle(org.eclipse.swt.graphics.Rectangle) Point(org.eclipse.swt.graphics.Point) Point(org.eclipse.swt.graphics.Point)

Aggregations

BrokerConfig (com.cubrid.common.ui.spi.model.BrokerConfig)16 PartInitException (org.eclipse.ui.PartInitException)6 CubridBrokerProperty (com.cubrid.common.ui.spi.model.CubridBrokerProperty)5 ArrayList (java.util.ArrayList)3 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)3 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3 Point (org.eclipse.swt.graphics.Point)3 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)2 File (java.io.File)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 List (java.util.List)2 Map (java.util.Map)2 Rectangle (org.eclipse.swt.graphics.Rectangle)2 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 TableItem (org.eclipse.swt.widgets.TableItem)2 ToolBar (org.eclipse.swt.widgets.ToolBar)2 ToolItem (org.eclipse.swt.widgets.ToolItem)2