📄 messageslideshell.java
字号:
{
this$0 = MessageSlideShell.this;
popupParams = popupparams;
super();
}
});
GridData gridData = new GridData(1808);
gridData.horizontalSpan = 3;
canvas.setLayoutData(gridData);
}
private void setButtonNextText(int numAfter)
{
if (numAfter <= 0)
Messages.setLanguageText(btnNext, "popup.error.hide");
else
Messages.setLanguageText(btnNext, "popup.next", new String[] {
(new StringBuilder()).append("").append(numAfter).toString()
});
cShell.layout(true);
}
private void showPopup(final Display display, final PopupParams item, final boolean bSlide)
{
Utils.execSWTThread(new AERunnable() {
final Display val$display;
final PopupParams val$item;
final boolean val$bSlide;
final MessageSlideShell this$0;
public void runSupport()
{
new MessageSlideShell(display, item, bSlide);
}
{
this$0 = MessageSlideShell.this;
display = display1;
item = popupparams;
bSlide = flag;
super();
}
});
}
private void addMouseTrackListener(Composite parent, MouseTrackListener listener)
{
if (parent == null || listener == null || parent.isDisposed())
return;
parent.addMouseTrackListener(listener);
Control children[] = parent.getChildren();
for (int i = 0; i < children.length; i++)
{
Control control = children[i];
if (control instanceof Composite)
addMouseTrackListener((Composite)control, listener);
else
control.addMouseTrackListener(listener);
}
}
private void addPaintListener(Composite parent, PaintListener listener, Color colorBG, boolean childrenOnly)
{
if (parent == null || listener == null || parent.isDisposed())
return;
if (!childrenOnly)
{
parent.addPaintListener(listener);
parent.setBackground(colorBG);
}
Control children[] = parent.getChildren();
for (int i = 0; i < children.length; i++)
{
Control control = children[i];
control.addPaintListener(listener);
control.setBackground(colorBG);
if (control instanceof Composite)
addPaintListener((Composite)control, listener, colorBG, true);
}
}
private void removeMouseTrackListener(Composite parent, MouseTrackListener listener)
{
if (parent == null || listener == null || parent.isDisposed())
return;
Control children[] = parent.getChildren();
for (int i = 0; i < children.length; i++)
{
Control control = children[i];
control.removeMouseTrackListener(listener);
if (control instanceof Composite)
removeMouseTrackListener((Composite)control, listener);
}
}
private void runPopup(Rectangle endBounds, int idx, boolean bSlide, int timeoutSecs)
{
if (shell == null || shell.isDisposed())
{
return;
} else
{
Display display = shell.getDisplay();
AEThread thread = new AEThread(idx, display) {
private static final int PAUSE = 500;
final boolean val$bSlide;
final Rectangle val$endBounds;
final int val$timeoutSecs;
final int val$idx;
final Display val$display;
final MessageSlideShell this$0;
public void runSupport()
{
if (shell == null || shell.isDisposed())
return;
if (bSlide)
(new ShellSlider(shell, 128, endBounds)).run();
else
Utils.execSWTThread(new AERunnable() {
final 16 this$1;
public void runSupport()
{
shell.setBounds(endBounds);
shell.open();
}
{
this$1 = 16.this;
super();
}
});
int delayLeft = timeoutSecs * 1000;
final boolean autohide = delayLeft != 0;
long lastDelaySecs = 0L;
int lastNumPopups = -1;
while ((!autohide || bDelayPaused || delayLeft > 0) && !shell.isDisposed())
{
int delayPausedOfs = bDelayPaused ? 1 : 0;
final long delaySecs = Math.round((double)delayLeft / 1000D) + (long)delayPausedOfs;
final int numPopups = MessageSlideShell.historyList.size();
if (lastDelaySecs != delaySecs || lastNumPopups != numPopups)
{
lastDelaySecs = delaySecs;
lastNumPopups = numPopups;
shell.getDisplay().asyncExec(new AERunnable() {
final boolean val$autohide;
final long val$delaySecs;
final int val$numPopups;
final 16 this$1;
public void runSupport()
{
String sText = "";
if (lblCloseIn == null || lblCloseIn.isDisposed())
return;
lblCloseIn.setRedraw(false);
if (!bDelayPaused && autohide)
sText = (new StringBuilder()).append(sText).append(MessageText.getString("popup.closing.in", new String[] {
String.valueOf(delaySecs)
})).toString();
int numPopupsAfterUs = numPopups - idx - 1;
boolean bHasMany = numPopupsAfterUs > 0;
if (bHasMany)
{
sText = (new StringBuilder()).append(sText).append("\n").toString();
sText = (new StringBuilder()).append(sText).append(MessageText.getString("popup.more.waiting", new String[] {
String.valueOf(numPopupsAfterUs)
})).toString();
}
lblCloseIn.setText(sText);
if (btnHideAll.getVisible() != bHasMany)
{
cShell.setRedraw(false);
btnHideAll.setVisible(bHasMany);
lblCloseIn.getParent().layout(true);
cShell.setRedraw(true);
}
setButtonNextText(numPopupsAfterUs);
lblCloseIn.setRedraw(true);
}
{
this$1 = 16.this;
autohide = flag;
delaySecs = l;
numPopups = i;
super();
}
});
}
if (!bDelayPaused)
delayLeft -= 500;
try
{
Thread.sleep(500L);
}
catch (InterruptedException e)
{
delayLeft = 0;
}
}
if (isInterrupted())
{
disposeShell(shell);
return;
}
if (shell != null && !shell.isDisposed())
{
if (idx + 1 < MessageSlideShell.historyList.size())
showPopup(display, (PopupParams)MessageSlideShell.historyList.get(idx + 1), true);
if (bSlide)
(new ShellSlider(shell, 0x20000)).run();
disposeShell(shell);
}
}
{
this$0 = MessageSlideShell.this;
bSlide = flag;
endBounds = rectangle;
timeoutSecs = i;
idx = j;
display = display1;
super(x0, x1);
}
};
thread.start();
return;
}
}
private void disposeShell(final Shell shell)
{
if (shell == null || shell.isDisposed())
{
return;
} else
{
Utils.execSWTThread(new AERunnable() {
final Shell val$shell;
final MessageSlideShell this$0;
public void runSupport()
{
shell.dispose();
}
{
this$0 = MessageSlideShell.this;
shell = shell1;
super();
}
});
return;
}
}
public static void waitUntilClosed()
{
if (currentPopupIndex < 0)
return;
Display display = Display.getCurrent();
do
{
if (currentPopupIndex < 0)
break;
if (!display.readAndDispatch())
display.sleep();
} while (true);
}
public static void main(String args[])
{
Display display = Display.getDefault();
Shell shell = new Shell(display, 2144);
shell.setLayout(new FillLayout());
Button btn = new Button(shell, 8);
btn.addListener(13, new Listener(display) {
final Display val$display;
public void handleEvent(Event event)
{
MessageSlideShell.test(display);
}
{
display = display1;
super();
}
});
shell.open();
do
{
if (shell.isDisposed())
break;
if (!display.readAndDispatch())
display.sleep();
} while (true);
}
public static void test(Display display)
{
String title = "This is the title that never ends, never ends!";
String text = "This is a very long message with lots of information and stuff you really should read. Are you still reading? Good, because reading <a href=\"http://moo.com\">stimulates</a> the mind and grows hair on your chest.\n\n Unless you are a girl, then it makes you want to read more. It's an endless cycle of reading that will never end. Cursed is the long text that is in this test and may it fillevery last line of the shell until there is no more.";
try
{
Thread.sleep(2000L);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
new MessageSlideShell(display, 2, "Simple. . . . . . . . . . . . . . . . . . .", "Simple", (String)null, -1);
new MessageSlideShell(display, 2, (new StringBuilder()).append(title).append("1").toString(), text, (new StringBuilder()).append("Details: ").append(text).toString(), -1);
new MessageSlideShell(display, 2, "ShortTitle2", "ShortText", "Details", -1);
waitUntilClosed();
new MessageSlideShell(display, 2, "ShortTitle3", "ShortText", (String)null, -1);
for (int x = 0; x < 10; x++)
text = (new StringBuilder()).append(text).append("\n\n\n\n\n\n\n\nWow").toString();
new MessageSlideShell(display, 2, (new StringBuilder()).append(title).append("4").toString(), text, "Details", -1);
new MessageSlideShell(display, 1, (new StringBuilder()).append(title).append("5").toString(), text, (String)null, -1);
waitUntilClosed();
}
public Image getImgPopup()
{
return imgPopup;
}
public void setImgPopup(Image imgPopup)
{
this.imgPopup = imgPopup;
}
public Color getUrlColor()
{
return colorURL;
}
public void setUrlColor(Color urlColor)
{
colorURL = urlColor;
}
public Color getColorFG()
{
return colorFG;
}
public void setColorFG(Color colorFG)
{
this.colorFG = colorFG;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -