提交 3ffbac56 编写于 作者: S serge-rider

#3278 Popup UI model

上级 7b5559a7
......@@ -15,5 +15,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui.editors,
org.eclipse.ui.views,
org.eclipse.ui.workbench.texteditor,
org.eclipse.mylyn.commons.ui,
org.jkiss.dbeaver.model
Export-Package: org.jkiss.dbeaver.ui
Export-Package: org.jkiss.dbeaver.ui,
org.jkiss.dbeaver.ui.notifications
package org.jkiss.dbeaver.ui.notifications;
import org.eclipse.mylyn.commons.ui.dialogs.AbstractNotificationPopup;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.PlatformUI;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.utils.GeneralUtils;
public abstract class NotificationPopup extends AbstractNotificationPopup {
public NotificationPopup(Display display) {
super(display);
}
public NotificationPopup(Display display, int style) {
super(display, style);
}
}
\ No newline at end of file
package org.jkiss.dbeaver.ui.notifications;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.PlatformUI;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.utils.GeneralUtils;
public class NotificationPopupMessage extends NotificationPopup {
private final DBPDataSource dataSource;
private String messageText;
public NotificationPopupMessage(String text) {
this(null, text);
}
public NotificationPopupMessage(DBPDataSource dataSource, String text) {
super(PlatformUI.getWorkbench().getDisplay());
this.dataSource = dataSource;
this.messageText = text;
setDelayClose(3000);
}
@Override
protected String getPopupShellTitle() {
return dataSource == null ? GeneralUtils.getProductName() : dataSource.getContainer().getName();
}
@Override
protected void createContentArea(Composite composite)
{
composite.setLayout(new GridLayout(1, true));
Label linkGoogleNews = new Label(composite, SWT.NONE);
linkGoogleNews.setText(messageText);
//linkGoogleNews.setSize(400, 100);
}
public static void showMessage(DBPDataSource dataSource, String text) {
Display.getDefault().syncExec(() -> new NotificationPopupMessage(dataSource, text).open());
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册