本文整理汇总了Java中org.eclipse.ui.dialogs.ListDialog.setAddCancelButton方法的典型用法代码示例。如果您正苦于以下问题:Java ListDialog.setAddCancelButton方法的具体用法?Java ListDialog.setAddCancelButton怎么用?Java ListDialog.setAddCancelButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.dialogs.ListDialog
的用法示例。
在下文中一共展示了ListDialog.setAddCancelButton方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createQueryRunnable
import org.eclipse.ui.dialogs.ListDialog; //导入方法依赖的package包/类
private Runnable createQueryRunnable(final String question, final Object[] elements, final int[] result) {
return new Runnable() {
public void run() {
ListDialog dialog= new YesNoListDialog(fShell, true);
dialog.setAddCancelButton(false);
dialog.setBlockOnOpen(true);
dialog.setContentProvider(new ArrayContentProvider());
dialog.setLabelProvider(new JavaElementLabelProvider());
dialog.setTitle(fDialogTitle);
dialog.setMessage(question);
dialog.setInput(elements);
dialog.open();
result[0]= dialog.getReturnCode();
}
};
}
示例2: askSaveAllDirtyEditors
import org.eclipse.ui.dialogs.ListDialog; //导入方法依赖的package包/类
private boolean askSaveAllDirtyEditors(Shell shell, IEditorPart[] dirtyEditors) {
final boolean canSaveAutomatically= fSaveMode != SAVE_ALL_ALWAYS_ASK;
if (canSaveAutomatically && RefactoringSavePreferences.getSaveAllEditors()) //must save everything
return true;
ListDialog dialog= new ListDialog(shell) {
{
setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL);
}
@Override
protected Control createDialogArea(Composite parent) {
Composite result= (Composite) super.createDialogArea(parent);
if (canSaveAutomatically) {
final Button check= new Button(result, SWT.CHECK);
check.setText(RefactoringMessages.RefactoringStarter_always_save);
check.setSelection(RefactoringSavePreferences.getSaveAllEditors());
check.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
RefactoringSavePreferences.setSaveAllEditors(check.getSelection());
}
});
applyDialogFont(result);
}
return result;
}
};
dialog.setTitle(RefactoringMessages.RefactoringStarter_save_all_resources);
dialog.setAddCancelButton(true);
dialog.setLabelProvider(createDialogLabelProvider());
dialog.setMessage(RefactoringMessages.RefactoringStarter_must_save);
dialog.setContentProvider(new ArrayContentProvider());
dialog.setInput(Arrays.asList(dirtyEditors));
return dialog.open() == Window.OK;
}
示例3: addVariables
import org.eclipse.ui.dialogs.ListDialog; //导入方法依赖的package包/类
private void addVariables(Text target, Map bindings) {
final List variables = new ArrayList(bindings.size());
ILabelProvider labelProvider = new LabelProvider() {
public String getText(Object element) {
return ((StringPair) element).s1
+ " - " + ((StringPair) element).s2; //$NON-NLS-1$
}
};
IStructuredContentProvider contentsProvider = new IStructuredContentProvider() {
public Object[] getElements(Object inputElement) {
return variables.toArray(new StringPair[variables.size()]);
}
public void dispose() {
}
public void inputChanged(Viewer viewer, Object oldInput,
Object newInput) {
}
};
for (Iterator it = bindings.keySet().iterator(); it.hasNext();) {
StringPair variable = new StringPair();
variable.s1 = (String) it.next(); // variable
variable.s2 = (String) bindings.get(variable.s1); // description
variables.add(variable);
}
ListDialog dialog = new ListDialog(this.getShell());
dialog.setContentProvider(contentsProvider);
dialog.setAddCancelButton(true);
dialog.setLabelProvider(labelProvider);
dialog.setInput(variables);
dialog.setTitle(Policy
.bind("DiffMergePreferencePage.addVariableDialogTitle")); //$NON-NLS-1$
if (dialog.open() != ListDialog.OK)
return;
Object[] result = dialog.getResult();
for (int i = 0; i < result.length; i++) {
target.insert("${" + ((StringPair) result[i]).s1 + "}"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
示例4: addVariables
import org.eclipse.ui.dialogs.ListDialog; //导入方法依赖的package包/类
/**
* Add another variable to the given target. The variable is inserted at
* current position A ListSelectionDialog is shown and the choose the
* variables to add
*/
private void addVariables(Text target, Map bindings) {
final List variables = new ArrayList(bindings.size());
ILabelProvider labelProvider = new LabelProvider() {
public String getText(Object element) {
return ((StringPair) element).s1
+ " - " + ((StringPair) element).s2; //$NON-NLS-1$
}
};
IStructuredContentProvider contentsProvider = new IStructuredContentProvider() {
public Object[] getElements(Object inputElement) {
return variables.toArray(new StringPair[variables.size()]);
}
public void dispose() {
}
public void inputChanged(Viewer viewer, Object oldInput,
Object newInput) {
}
};
for (Iterator it = bindings.keySet().iterator(); it.hasNext();) {
StringPair variable = new StringPair();
variable.s1 = (String) it.next(); // variable
variable.s2 = (String) bindings.get(variable.s1); // description
variables.add(variable);
}
ListDialog dialog = new ListDialog(this.getShell());
dialog.setContentProvider(contentsProvider);
dialog.setAddCancelButton(true);
dialog.setLabelProvider(labelProvider);
dialog.setInput(variables);
dialog.setTitle(Policy
.bind("DiffMergePreferencePage.addVariableDialogTitle")); //$NON-NLS-1$
if (dialog.open() != ListDialog.OK)
return;
Object[] result = dialog.getResult();
for (int i = 0; i < result.length; i++) {
target.insert("${" + ((StringPair) result[i]).s1 + "}"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
示例5: openLibraryApplicationDialog
import org.eclipse.ui.dialogs.ListDialog; //导入方法依赖的package包/类
/**
* 라이브러리 적용하는 다이얼로그 여는 메소드 void
*/
protected void openLibraryApplicationDialog() {
ListDialog libraryApplicationDialog = new ListDialog(getShell());
libraryApplicationDialog.setAddCancelButton(true);
libraryApplicationDialog.setContentProvider(new ArrayContentProvider());
libraryApplicationDialog.setLabelProvider(new LabelProvider() {
/**
* @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
*/
@Override
public String getText(Object element) {
if (element instanceof Package) {
return ((Package) element).getName();
}
return UICoreConstant.PROJECT_CONSTANTS__EMPTY_STRING;
}
});
initializeApplicableLibraryList();
libraryApplicationDialog.setInput(applicableLibraryList.toArray());
libraryApplicationDialog.setInitialSelections(applicableLibraryList.toArray());
libraryApplicationDialog.setTitle(UMLMessage.LABEL_LIBRARY_APPLICATION);
if (libraryApplicationDialog.open() == Window.OK) {
Object[] libraries = libraryApplicationDialog.getResult();
Package newLibrary = (Package) libraries[0];
applyingLibraryList.add(newLibrary);
// RecordingCommand command = new
// HandleImportedPackageCommand(DomainRegistry.getEditingDomain(),
// model, newLibrary, true);
// DomainUtil.executeCommand(command);
libraryTableViewer.setInput(applyingLibraryList.toArray());
libraryTableViewer.refresh();
apply();
callerSection.isDirty();
}
}