📄 scaninfopanel.java
字号:
package com.galaxyworkstation.model;
/**
* 该面板在遍历文件建立索引时显示信息
* @author 李奕
* @version 1.0
*/
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import com.galaxyworkstation.control.CDManager;
public class ScanInfoPanel extends Dialog{
protected Object result;
protected Shell shell;
private Label label_1 ;
private Config config;
/**
* Create the dialog
* @param parent
*/
public ScanInfoPanel(Shell parent) {
super(parent);
config = CDManager.action.getConfig();
}
/**
* Open the dialog
* @return the result
*/
public Object open() {
createContents();
shell.open();
shell.layout();
Display display = getParent().getDisplay();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
label_1.setText(config.getScanningPath());
if(!config.isScanning())
shell.dispose();
}
return result;
}
/**
* Create contents of the dialog
*/
protected void createContents() {
shell = new Shell(getParent(), SWT.APPLICATION_MODAL);
shell.setLayout(new FormLayout());
shell.setSize(574, 93);
shell.setLocation((shell.getDisplay().getClientArea().width - shell.getClientArea().width) / 2,
(shell.getDisplay().getClientArea().height - shell.getClientArea().height) / 2);
shell.setText("SWT Dialog");
final Group group = new Group(shell, SWT.NONE);
final FormData fd_group = new FormData();
fd_group.left = new FormAttachment(0, 5);
fd_group.top = new FormAttachment(100, -90);
fd_group.bottom = new FormAttachment(100, -5);
fd_group.right = new FormAttachment(100, -5);
group.setLayoutData(fd_group);
group.setLayout(new FormLayout());
final Label label = new Label(group, SWT.NONE);
final FormData fd_label = new FormData();
fd_label.right = new FormAttachment(0, 195);
fd_label.bottom = new FormAttachment(0, 25);
fd_label.top = new FormAttachment(0, 5);
fd_label.left = new FormAttachment(0, 15);
label.setLayoutData(fd_label);
label.setText("正在建立索引,请稍候......");
label_1 = new Label(group, SWT.NONE);
FormData fd_label_1 = new FormData();
fd_label_1.right = new FormAttachment(100, -5);
fd_label_1.left = new FormAttachment(label, 0, SWT.LEFT);
fd_label_1.top = new FormAttachment(0, 40);
fd_label_1.bottom = new FormAttachment(0, 60);
label_1.setLayoutData(fd_label_1);
}
public Shell getShell() {
return shell;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -