本文整理匯總了Java中org.eclipse.swt.widgets.List.add方法的典型用法代碼示例。如果您正苦於以下問題:Java List.add方法的具體用法?Java List.add怎麽用?Java List.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.List
的用法示例。
在下文中一共展示了List.add方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createDialogArea
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
@Override
protected Control createDialogArea(Composite parent) {
Composite area = (Composite) super.createDialogArea(parent);
Composite container = new Composite(area, SWT.NONE);
container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
GridLayout layout = new GridLayout(2, false);
container.setLayout(layout);
Label lbtOcciServerUrl = new Label(container, SWT.NONE);
lbtOcciServerUrl.setText(Messages.OcciActionDialog_Label);
final List listOcciActions = new List (container, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL);
listOcciActions.addSelectionListener(
new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
selectedAction = listOcciActions.getSelection()[0];
}
}
);
listOcciActions.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
for(Action action : actions) {
listOcciActions.add(action.getScheme() + action.getTerm());
}
return area;
}
示例2: showRefs
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
private void showRefs(Scanner input, ArrayList<String> refStrings) {
while(input.hasNext()){
String line = input.nextLine();
if (!line.equals("") && line.length() > 0)
refStrings.add(line);
}
if (refStrings.size() == 0){
MessageBox dialog =
new MessageBox(parent.getShell(), SWT.ERROR | SWT.OK);
dialog.setText("Error");
dialog.setMessage("No refactoring information was found!");
dialog.open();
} else{
list = new List(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
list.setBounds (20, 100, 250, 250);
list.setVisible(true);
for (int i = 0; i < refStrings.size(); i++) {
list.add(refStrings.get(i));
}
}
}
示例3: loadListOfServers
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
private void loadListOfServers(List list) {
ServerStore serverStore = new ServerStore(
uk.ac.york.mondo.integration.api.dt.Activator.getDefault().getPreferenceStore());
java.util.List<Server> servers = serverStore.readAllServers();
list.removeAll();
list.add(CUSTOM_URL_TEXT);
list.setSelection(0); // by default select option "Custom URL"
for (Server server : servers) {
list.add(server.getBaseURL());
}
userName.setEnabled(false);
userName.setText("");
frontRepoURL.setText("");
}
示例4: createBottomSelectedLocalesComposite
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
* Creates the bottom part of this wizard where selected locales are stored.
*
* @param parent
* parent container
*/
private void createBottomSelectedLocalesComposite(Composite parent) {
// Selected locales Group
Group selectedGroup = new Group(parent, SWT.NULL);
GridLayout layout = new GridLayout();
layout = new GridLayout();
layout.numColumns = 1;
selectedGroup.setLayout(layout);
GridData gd = new GridData(GridData.FILL_BOTH);
selectedGroup.setLayoutData(gd);
selectedGroup.setText(Messages.editor_wiz_selected);
bundleLocalesList = new List(selectedGroup, SWT.READ_ONLY | SWT.MULTI | SWT.BORDER);
gd = new GridData(GridData.FILL_BOTH);
bundleLocalesList.setLayoutData(gd);
bundleLocalesList.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
removeButton.setEnabled(bundleLocalesList.getSelectionIndices().length != 0);
setAddButtonState();
}
});
// add a single Locale so that the bundleLocalesList isn't empty on
// startup
bundleLocalesList.add(DEFAULT_LOCALE);
}
示例5: getNewInputObject
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
* @see org.eclipse.jface.preference.ListEditor#getNewInputObject()
*/
protected String getNewInputObject() {
List myList = getListUnchecked();
CategoryDialog dialog = new CategoryDialog(getShell());
dialog.setTitle(chooserLabel);
dialog.setCategories(inactive);
dialog.open();
if (newOnes != null && myList != null) {
for (int i = 0; i< newOnes.size(); i++) {
myList.add(getLabel(newOnes.get(i)));
}
active.addAll(newOnes);
inactive.removeAll(newOnes);
newOnes = null;
selectionChanged();
}
return null;
}
示例6: initializeLists
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
public void initializeLists(List listObjects, List listSnippets) {
if (project == null) {
logger.warn("Unable to initialize controller - project is null");
return;
}
loadObjectsAndFields();
if (Utils.isNotEmpty(componentTypes)) {
Set<String> componentTypeKeys = componentTypes.keySet();
TreeSet<String> sortedComponentTypeKeys = new TreeSet<>();
sortedComponentTypeKeys.addAll(componentTypeKeys);
for (String sortedComponentTypeKey : sortedComponentTypeKeys) {
listObjects.add(sortedComponentTypeKey);
}
}
if (Utils.isNotEmpty(snippets)) {
Set<String> snippetKeys = snippets.keySet();
TreeSet<String> sortedSnippetKeys = new TreeSet<>();
sortedSnippetKeys.addAll(snippetKeys);
for (String sortedSnippetKey : sortedSnippetKeys) {
listSnippets.add(sortedSnippetKey);
}
}
}
示例7: createDialogArea
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
Label label = new Label(container, SWT.NONE);
label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
label.setText(message);
list = new List(container, SWT.BORDER);
GridData gd_list = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
list.setLayoutData(gd_list);
for(IEditorInput ei : editorInputs){
list.add(ei.getName());
}
return container;
}
示例8: createDialogArea
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
* @see Dialog#createDialogArea(Composite)
*/
protected Control createDialogArea(Composite parent) {
Composite result = new Composite(parent, SWT.NONE);
result.setLayout(new GridLayout());
result.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
catList = new List(result, SWT.BORDER | SWT.MULTI );
catList.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
if (categoryArray != null){
for (int i=0; i< categoryArray.size(); i++){
catList.add(getLabel(categoryArray.get(i)));
}
catList.pack(true);
catList.computeSize(SWT.DEFAULT, SWT.DEFAULT);
catList.setVisible(true);
}
result.setVisible(true);
catList.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
catList = null;
}
});
return result;
}
示例9: createDialogArea
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
* @see Dialog#createDialogArea(Composite)
*/
protected Control createDialogArea(Composite parent) {
Composite result = new Composite(parent, SWT.NONE);
result.setLayout(new GridLayout());
result.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
macList = new List(result, SWT.BORDER | SWT.MULTI );
macList.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
if (macroArray != null){
for (int i=0; i< macroArray.size(); i++){
macList.add(getLabel(macroArray.get(i)));
}
macList.pack(true);
macList.computeSize(SWT.DEFAULT, SWT.DEFAULT);
macList.setVisible(true);
}
result.setVisible(true);
macList.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
macList = null;
}
});
return result;
}
示例10: initialize
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
* This method initializes this
*
*/
private void initialize() {
ScreenClassTrigger trigger = (parent.getTrigger() instanceof ScreenClassTrigger) ? (ScreenClassTrigger) parent
.getTrigger() : null;
scrClass_label = new Label(this, SWT.NONE);
scrClass_label.setText("Screen classes");
scrClass_list = new List(this, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
java.util.List<HtmlScreenClass> scList = getScreenClassList();
java.util.List<String> items = new ArrayList<String>();
for (ScreenClass sc : scList) {
String scName = sc.getName();
scrClass_list.add(scName);
if (trigger != null) {
if (trigger.getScreenClasses().contains(scName)) {
items.add(scName);
}
}
}
scrClass_list.setSelection(items.toArray(new String[items.size()]));
GridData gridData2 = new GridData();
gridData2.horizontalAlignment = GridData.FILL;
gridData2.verticalAlignment = GridData.FILL;
gridData2.grabExcessHorizontalSpace = true;
scrClass_list.setLayoutData(gridData2);
scrClass_list.setSize(400, 250);
}
示例11: expandClassFiles
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
* Add the class files in the currently selected directory to the fileList.
* @param fileList The fileList to add the class files to.
*/
public void expandClassFiles(List fileList) {
Enumeration<JarEntry> entries = this.jaFfile.entries();
int preLength = this.fileName.length();
// Browse trough all entries, since jar files might be unordered and are not browsable hierarchically.
while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
// Find the correct directory.
if (!entry.isDirectory() && entry.getName().length() > preLength && entry.getName().substring(0, preLength).equals(this.fileName)) {
String remainingEntry = entry.getName().substring(preLength);
// Only add class files.
if (!remainingEntry.contains("/") && remainingEntry.length() >= 6 && remainingEntry.substring(remainingEntry.length() - 6).equals(".class")) {
Object[] object = {remainingEntry, entry.getName(), this.jaFfile};
this.fileList.add(object);
}
}
}
// Sort the new entries - first convert it into a String array.
String[] orderedEntries = new String[this.fileList.size()];
Iterator<Object[]> iterator = this.fileList.iterator();
int a = 0;
while (iterator.hasNext()) {
orderedEntries[a] = (String) iterator.next()[0];
a++;
}
// Use the standard sort functionality.
java.util.Arrays.sort(orderedEntries);
// And finally add the entries to the list.
for (a = 0; a < orderedEntries.length; a++) {
fileList.add(orderedEntries[a]);
}
}
示例12: createList
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
* List UI 생성
*
* @param operations
* void
*/
private void createList() {
Display display = this.getCurrentViewer().getControl().getShell().getDisplay();
Shell shell = new Shell(display);
org.eclipse.swt.graphics.Point currentPoint = this.getCurrentViewer()
.getControl()
.getDisplay()
.getCursorLocation();
shell.setLocation(currentPoint.x, currentPoint.y);
dialog = new Shell(shell, SWT.TOOL | SWT.APPLICATION_MODAL);
dialog.setSize(120, 50);
dialog.setLocation(currentPoint.x, currentPoint.y);
dialog.setLayout(new FillLayout());
final List list = new List(dialog, SWT.SINGLE | SWT.V_SCROLL);
list.add(UMLMessage.getMessage(UMLMessage.LABEL_NO_TYPE));
list.add(UMLMessage.getMessage(UMLMessage.LABEL_CREATE_CLASS));
list.add(UMLMessage.getMessage(UMLMessage.LABEL_SELECT_TYPE));
list.select(0);
list.addFocusListener(this);
list.addKeyListener(this);
list.addMouseListener(this);
dialog.open();
while (!dialog.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
shell.dispose();
}
開發者ID:SK-HOLDINGS-CC,項目名稱:NEXCORE-UML-Modeler,代碼行數:40,代碼來源:LifeLineCreationToolWithAdditionalInformation.java
示例13: doLoad
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
@Override
protected void doLoad() {
final List list = getList();
if (list != null) {
final Set<String> thresholds = new TreeSet<String>();
for (final String preferenceName : getPreferenceStore().preferenceNames()) {
if (preferenceName.startsWith(Thresholds.CFG_PREFIX + '.')) {
thresholds.add(preferenceName.substring(preferenceName.indexOf('.') + 1) + DELIMITER + getPreferenceStore().getString(preferenceName));
}
}
for (final String threshold : thresholds) {
list.add(threshold);
}
}
}
示例14: createControl
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
@Override
public Control createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
container.setLayout(new GridLayout());
Label l = new Label(container, SWT.NONE);
l.setText(Messages.DatePattern_template_formats);
list = new List(container, SWT.BORDER);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.verticalSpan = 3;
gd.heightHint = 200;
gd.widthHint = 100;
list.setLayoutData(gd);
SimpleDateFormat f = (SimpleDateFormat) getFormatter();
for (String s : getDefaults()) {
f.applyPattern(s);
list.add(f.format(getSample()));
}
list.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
formatChanged();
}
});
return container;
}
示例15: createDropDownList
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
* Create a list widget and populate it with the stack trace.
*
* @param parent
* Parent composite.
* @return List of lines made of the exception's stack trace.
*/
private List createDropDownList(Composite parent) {
list = new List(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
for (String line : ExceptionUtils.getFullStackTrace(throwable).split("\n")) {
list.add(line);
}
GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL);
data.heightHint = list.getItemHeight() * 7;
list.setLayoutData(data);
listCreated = true;
return list;
}