📄 searchview.java
字号:
package com.hnjchina.example;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.part.ViewPart;
import com.hnjchina.example.qq.HideInvisibleComposite;
public class SearchView extends ViewPart{
private Composite comLower,comTotal,comDetail;
public void createPartControl(Composite parent) {
GridData gridData = new GridData (GridData.FILL_BOTH);
parent.setLayoutData (gridData);
GridLayout layout = new GridLayout(1, true);
layout.verticalSpacing=0;
parent.setLayout (layout);
createSearchPath(parent);
createSearch(parent);
createSearchButton(parent);
}
private void createSearchPath(Composite parent){
GridData gridData = new GridData (GridData.FILL_HORIZONTAL);
comLower=new Composite(parent,SWT.NONE);
comLower.setLayoutData(gridData);
GridLayout gridLayout = new GridLayout ();
gridLayout.numColumns = 2;
gridLayout.verticalSpacing=0;
comLower.setLayout (gridLayout);
Label labelSearch = new Label(comLower,SWT.NONE);
labelSearch.setText("搜索路径:");
Combo comboSearch=new Combo(comLower,SWT.DROP_DOWN);
comboSearch.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
comboSearch.add("list1");
comboSearch.add("list2");
comboSearch.add("list3");
}
private void createSearch(Composite parent){
GridData gridData;
GridLayout gridLayout;
gridData = new GridData (GridData.FILL_BOTH);
// ScrolledComposite groupContainer = new ScrolledComposite(parent,SWT.V_SCROLL|SWT.BORDER);
// comp2 = new HideInvisibleComposite(pane, SWT.NONE);
comTotal=new HideInvisibleComposite(parent,SWT.V_SCROLL|SWT.BORDER);
// comTotal=new Composite(parent,SWT.V_SCROLL|SWT.BORDER);
comTotal.setLayoutData(gridData);
gridLayout = new GridLayout ();
gridLayout.numColumns = 1;
gridLayout.verticalSpacing=0;
gridLayout.marginWidth=0;
gridLayout.marginHeight=0;
comTotal.setLayout (gridLayout);
Button buttonList = new Button (comTotal, SWT.PUSH);
buttonList.setText ("列名 = 数值");
buttonList.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// buttonList = new Button (comTotal, SWT.PUSH);
// buttonList.setText ("列名 = 数值");
// buttonList.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// buttonList = new Button (comTotal, SWT.PUSH);
// buttonList.setText ("列名 = 数值");
buttonList.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
buttonList.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
comDetail.setVisible(!comDetail.isVisible());
comTotal.layout(true);
}
});
gridData = new GridData (GridData.FILL_HORIZONTAL);
comDetail=new Composite(comTotal,SWT.NONE);
comDetail.setLayoutData(gridData);
gridLayout = new GridLayout ();
gridLayout.numColumns = 2;
gridLayout.verticalSpacing=0;
comDetail.setLayout (gridLayout);
Label labelColName = new Label(comDetail,SWT.NONE);
labelColName.setText("列名:");
Combo comboColName=new Combo(comDetail,SWT.DROP_DOWN);
comboColName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
comboColName.add("list1");
comboColName.add("list2");
comboColName.add("list3");
Label labelOper = new Label(comDetail,SWT.NONE);
labelOper.setText("比较符:");
Combo comboOper=new Combo(comDetail,SWT.DROP_DOWN);
comboOper.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
comboOper.add("list1");
comboOper.add("list2");
comboOper.add("list3");
Label labelData = new Label(comDetail,SWT.NONE);
labelData.setText("数值:");
Combo comboData=new Combo(comDetail,SWT.DROP_DOWN);
comboData.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
comboData.add("list1");
comboData.add("list2");
comboData.add("list3");
buttonList = new Button (comTotal, SWT.PUSH);
buttonList.setText ("列名 = 数值");
buttonList.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
private void createSearchButton(Composite parent){
Button buttonSearch = new Button (parent, SWT.PUSH);
buttonSearch.setText ("搜索");
buttonSearch.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
public void setFocus() {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -