Search in sources :

Example 1 with PendingUpdateAdapter

use of org.eclipse.ui.progress.PendingUpdateAdapter in project cubrid-manager by CUBRID.

the class ExportObjectLabelProvider method update.

/**
	 * update
	 *
	 * @param cell ViewerCell
	 */
public void update(ViewerCell cell) {
    if (cell.getColumnIndex() == 0) {
        if (cell.getElement() instanceof ICubridNode) {
            ICubridNode node = (ICubridNode) cell.getElement();
            cell.setImage(CommonUIPlugin.getImage(node.getIconPath()));
            cell.setText(node.getName());
        } else if (cell.getElement() instanceof PendingUpdateAdapter) {
            cell.setText(Messages.msgLoading);
        }
    } else if (cell.getColumnIndex() == 1 && cell.getElement() instanceof ICubridNode) {
        ICubridNode node = (ICubridNode) cell.getElement();
        String condition = (String) node.getData(CONDITION);
        if (condition != null) {
            cell.setText(condition);
        }
        // cell can't edit ,set it to gray color
        if (node.getType().equals(NodeType.TABLE_COLUMN)) {
            cell.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));
        }
    }
}
Also used : PendingUpdateAdapter(org.eclipse.ui.progress.PendingUpdateAdapter) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode)

Example 2 with PendingUpdateAdapter

use of org.eclipse.ui.progress.PendingUpdateAdapter in project cubrid-manager by CUBRID.

the class NavigatorTreeLabelProvider method getText.

public String getText(Object element) {
    if (element instanceof ICubridNode) {
        if (element instanceof CubridDatabase) {
            CubridDatabase database = (CubridDatabase) element;
            StringBuffer sbLabel = new StringBuffer();
            sbLabel.append(((ICubridNode) element).getLabel());
            DatabaseEditorConfig editorConfig = QueryOptions.getEditorConfig(database, true);
            if (editorConfig != null && editorConfig.getDatabaseComment() != null && editorConfig.getDatabaseComment().length() > 0) {
                sbLabel.append("(").append(editorConfig.getDatabaseComment()).append(")");
                return sbLabel.toString();
            }
        } else if (element instanceof CubridBroker) {
            CubridBroker broker = (CubridBroker) element;
            BrokerInfo brokerInfo = broker.getBrokerInfo();
            if (brokerInfo == null || brokerInfo.getAccess_mode() == null) {
                return broker.getName();
            }
            return broker.getName() + " (" + brokerInfo.getPort() + "," + brokerInfo.getAccess_mode() + ")";
        } else if (element instanceof CubridServer) {
            CubridServer server = (CubridServer) element;
            return decorateServerText(server.getLabel(), server);
        }
        return ((ICubridNode) element).getLabel();
    } else if (element instanceof PendingUpdateAdapter) {
        return com.cubrid.common.ui.common.Messages.msgLoading;
    }
    return element == null ? "" : element.toString();
}
Also used : PendingUpdateAdapter(org.eclipse.ui.progress.PendingUpdateAdapter) CubridBroker(com.cubrid.cubridmanager.ui.spi.model.CubridBroker) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) CubridServer(com.cubrid.common.ui.spi.model.CubridServer) DatabaseEditorConfig(com.cubrid.common.ui.spi.model.DatabaseEditorConfig) BrokerInfo(com.cubrid.cubridmanager.core.broker.model.BrokerInfo)

Example 3 with PendingUpdateAdapter

use of org.eclipse.ui.progress.PendingUpdateAdapter in project cubrid-manager by CUBRID.

the class NavigatorTreeLabelProvider method getText.

public String getText(Object element) {
    if (element instanceof ICubridNode) {
        if (element instanceof CubridDatabase) {
            CubridDatabase database = (CubridDatabase) element;
            StringBuffer sbLabel = new StringBuffer();
            sbLabel.append(((ICubridNode) element).getLabel());
            DatabaseEditorConfig editorConfig = QueryOptions.getEditorConfig(database, false);
            if (editorConfig != null && editorConfig.getDatabaseComment() != null && editorConfig.getDatabaseComment().length() > 0) {
                sbLabel.append("(").append(editorConfig.getDatabaseComment()).append(")");
                // [TOOLS-2425]Support shard broker
                DatabaseInfo dbInfo = database.getDatabaseInfo();
                if (dbInfo != null && dbInfo.isShard()) {
                    if (dbInfo.getShardQueryType() == DatabaseInfo.SHARD_QUERY_TYPE_ID) {
                        sbLabel.append("[SHARD-ID:").append(dbInfo.getCurrentShardId()).append("]");
                    } else {
                        sbLabel.append("[SHARD-VAL:").append(dbInfo.getCurrentShardVal()).append("]");
                    }
                }
                return sbLabel.toString();
            }
        }
        return ((ICubridNode) element).getLabel();
    } else if (element instanceof PendingUpdateAdapter) {
        return Messages.msgLoading;
    }
    return element == null ? "" : element.toString();
}
Also used : PendingUpdateAdapter(org.eclipse.ui.progress.PendingUpdateAdapter) DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) DatabaseEditorConfig(com.cubrid.common.ui.spi.model.DatabaseEditorConfig)

Aggregations

ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)3 PendingUpdateAdapter (org.eclipse.ui.progress.PendingUpdateAdapter)3 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)2 DatabaseEditorConfig (com.cubrid.common.ui.spi.model.DatabaseEditorConfig)2 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)1 BrokerInfo (com.cubrid.cubridmanager.core.broker.model.BrokerInfo)1 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)1 CubridBroker (com.cubrid.cubridmanager.ui.spi.model.CubridBroker)1