/** * ************************************************************************* Dispose the control * ************************************************************************ */ @Override public void dispose() { GuiNotifications.get().removeListener(this); super.dispose(); }
/** * ************************************************************************* Create the contents * ************************************************************************ */ @Override protected Control createControl(Composite parent) { m_base = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; layout.horizontalSpacing = 5; layout.marginLeft = 0; layout.marginRight = 0; layout.numColumns = 16; m_base.setLayout(layout); // LABEL GridData serverLabelData = new GridData(SWT.CENTER, SWT.CENTER, false, true); Label label = new Label(m_base, SWT.NONE); label.setText("Server: "); label.setFont(s_boldFont); label.setLayoutData(serverLabelData); // WIDGET GridData serverWidgetData = new GridData(SWT.CENTER, SWT.CENTER, false, true); m_connection = new Label(m_base, SWT.BORDER); m_connection.setText(ConnectionStatusConstants.DISCONNECTED); m_connection.setBackground(s_warnColor); m_connection.setAlignment(SWT.CENTER); m_connection.setLayoutData(serverWidgetData); // LABEL GridData contextLabelData = new GridData(SWT.CENTER, SWT.CENTER, false, true); Label label2 = new Label(m_base, SWT.NONE); label2.setText("Context: "); label2.setFont(s_boldFont); label2.setLayoutData(contextLabelData); // WIDGET GridData contextWidgetData = new GridData(SWT.CENTER, SWT.CENTER, false, true); m_context = new Label(m_base, SWT.BORDER); m_context.setText(ConnectionStatusConstants.UNKNOWN); m_context.setBackground(s_warnColor); m_context.setAlignment(SWT.CENTER); m_context.setLayoutData(contextWidgetData); // LABEL GridData modeLabelData = new GridData(SWT.CENTER, SWT.CENTER, false, true); Label label3 = new Label(m_base, SWT.NONE); label3.setText("Mode: "); label3.setFont(s_boldFont); label3.setLayoutData(modeLabelData); // WIDGET GridData modeWidgetData = new GridData(SWT.CENTER, SWT.CENTER, false, true); m_mode = new Label(m_base, SWT.BORDER); m_mode.setText(ConnectionStatusConstants.UNKNOWN); m_mode.setBackground(s_warnColor); m_mode.setAlignment(SWT.CENTER); m_mode.setLayoutData(modeWidgetData); // LABEL GridData domainLabelData = new GridData(SWT.CENTER, SWT.CENTER, false, true); Label label4 = new Label(m_base, SWT.NONE); label4.setFont(s_boldFont); label4.setText("Domain: "); label4.setLayoutData(domainLabelData); // WIDGET GridData domainWidgetData = new GridData(SWT.CENTER, SWT.CENTER, false, true); m_domain = new Label(m_base, SWT.BORDER); m_domain.setText(ConnectionStatusConstants.UNKNOWN); m_domain.setBackground(s_warnColor); m_domain.setAlignment(SWT.CENTER); m_domain.setLayoutData(domainWidgetData); // LABEL GridData familyLabelData = new GridData(SWT.CENTER, SWT.CENTER, false, true); Label label5 = new Label(m_base, SWT.NONE); label5.setFont(s_boldFont); label5.setText("Family: "); label5.setLayoutData(familyLabelData); // WIDGET GridData familyWidgetData = new GridData(SWT.CENTER, SWT.CENTER, false, true); m_family = new Label(m_base, SWT.BORDER); m_family.setText(ConnectionStatusConstants.UNKNOWN); m_family.setBackground(s_warnColor); m_family.setAlignment(SWT.CENTER); m_family.setLayoutData(familyWidgetData); // LABEL GridData driverLabelData = new GridData(SWT.CENTER, SWT.CENTER, false, true); Label label6 = new Label(m_base, SWT.NONE); label6.setFont(s_boldFont); label6.setText("Driver: "); label6.setLayoutData(driverLabelData); // WIDGET GridData driverWidgetData = new GridData(SWT.CENTER, SWT.CENTER, false, true); m_driver = new Label(m_base, SWT.BORDER); m_driver.setText(ConnectionStatusConstants.UNKNOWN); m_driver.setBackground(s_warnColor); m_driver.setAlignment(SWT.CENTER); m_driver.setLayoutData(driverWidgetData); // LABEL GridData memoryLabelData = new GridData(SWT.CENTER, SWT.CENTER, false, true); Label label7 = new Label(m_base, SWT.NONE); label7.setFont(s_boldFont); label7.setText("Memory left: "); label7.setLayoutData(memoryLabelData); // WIDGET GridData memoryWidgetData = new GridData(SWT.CENTER, SWT.CENTER, false, true); memoryWidgetData.widthHint = 50; m_memory = new Label(m_base, SWT.BORDER); m_memory.setText("0%"); m_memory.setBackground(s_warnColor); m_memory.setAlignment(SWT.CENTER); m_memory.setLayoutData(memoryWidgetData); // LABEL GridData keyLabelData = new GridData(SWT.CENTER, SWT.CENTER, false, true); Label label8 = new Label(m_base, SWT.NONE); label8.setFont(s_boldFont); label8.setText("Key: "); label8.setLayoutData(keyLabelData); // WIDGET GridData keyWidgetData = new GridData(SWT.CENTER, SWT.CENTER, false, true); keyWidgetData.widthHint = 20; m_key = new Label(m_base, SWT.BORDER); m_key.setText("?"); m_key.setBackground(s_warnColor); m_key.setAlignment(SWT.CENTER); m_key.setLayoutData(keyWidgetData); m_base.pack(); GuiNotifications.get().addListener(this, ICoreServerOperationListener.class); GuiNotifications.get().addListener(this, ICoreContextOperationListener.class); GuiNotifications.get().addListener(this, ICoreApplicationStatusListener.class); return m_base; }