本文整理汇总了Java中org.eclipse.ui.dialogs.CheckedTreeSelectionDialog.open方法的典型用法代码示例。如果您正苦于以下问题:Java CheckedTreeSelectionDialog.open方法的具体用法?Java CheckedTreeSelectionDialog.open怎么用?Java CheckedTreeSelectionDialog.open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.dialogs.CheckedTreeSelectionDialog
的用法示例。
在下文中一共展示了CheckedTreeSelectionDialog.open方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: select
import org.eclipse.ui.dialogs.CheckedTreeSelectionDialog; //导入方法依赖的package包/类
public List<IProject> select() {
CheckedTreeSelectionDialog dialog = new CheckedTreeSelectionDialog(
shell,
new WorkbenchLabelProvider(),
new ProjectSelectionContentProvider()) {
@Override
protected Label createMessageArea(Composite composite) {
Label label = new Label(composite, SWT.WRAP);
if (getMessage() != null) {
label.setText(getMessage());
}
label.setFont(composite.getFont());
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
gd.widthHint = 300;
label.setLayoutData(gd);
return label;
}
};
dialog.setContainerMode(true);
dialog.setMessage("Choose projects to export");
dialog.setTitle("Project selection");
dialog.setInput(ResourcesPlugin.getWorkspace());
dialog.setInitialSelection(ResourcesPlugin.getWorkspace().getRoot().getProjects());
if (dialog.open() == Dialog.OK && dialog.getResult() != null) {
ArrayList<IProject> projects = new ArrayList<IProject>();
for (Object o: dialog.getResult()) {
if (o instanceof IProject) {
projects.add((IProject)o);
}
}
return projects;
}
return Collections.emptyList();
}
示例2: select
import org.eclipse.ui.dialogs.CheckedTreeSelectionDialog; //导入方法依赖的package包/类
public List<IProject> select(Set<IProject> obsoleteProjects) {
CheckedTreeSelectionDialog dialog = new CheckedTreeSelectionDialog(
shell,
new WorkbenchLabelProvider(),
new ProjectSelectionContentProvider()) {
@Override
protected Label createMessageArea(Composite composite) {
Label label = new Label(composite, SWT.WRAP);
if (getMessage() != null) {
label.setText(getMessage());
}
label.setFont(composite.getFont());
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
gd.widthHint = 300;
label.setLayoutData(gd);
return label;
}
};
dialog.setContainerMode(true);
dialog.setMessage("Following project has been detected as obsolete, please select those to be removed from your workspace. Note, that their contents will not be removed from the file system.");
dialog.setTitle("Delete obsolete projects");
dialog.setInput(obsoleteProjects);
if (dialog.open() == Dialog.OK && dialog.getResult() != null) {
ArrayList<IProject> projects = new ArrayList<IProject>();
for (Object o: dialog.getResult()) {
if (o instanceof IProject) {
projects.add((IProject)o);
}
}
return projects;
}
return Collections.emptyList();
}
示例3: select
import org.eclipse.ui.dialogs.CheckedTreeSelectionDialog; //导入方法依赖的package包/类
public List<String> select(Repository repo) {
CheckedTreeSelectionDialog dialog = new CheckedTreeSelectionDialog(
shell,
new BranchesLabelProvider(),
new BranchesContentProvider()) {
@Override
public void create() {
super.create();
getTreeViewer().expandAll();
}
};
dialog.setContainerMode(true);
dialog.setMessage("Choose change branches to remove from local repository:");
dialog.setTitle("Changes cleanup");
dialog.setInput(repo);
dialog.setInitialSelection(ResourcesPlugin.getWorkspace().getRoot().getProjects());
if (dialog.open() == Dialog.OK && dialog.getResult() != null) {
ArrayList<String> changes = new ArrayList<String>();
for (Object o: dialog.getResult()) {
if (o instanceof Change) {
changes.add(((Change)o).getFullName());
}
}
return changes;
}
return Collections.emptyList();
}