本文整理汇总了Java中org.eclipse.ui.dialogs.ResourceListSelectionDialog.getResult方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceListSelectionDialog.getResult方法的具体用法?Java ResourceListSelectionDialog.getResult怎么用?Java ResourceListSelectionDialog.getResult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.dialogs.ResourceListSelectionDialog
的用法示例。
在下文中一共展示了ResourceListSelectionDialog.getResult方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: widgetSelected
import org.eclipse.ui.dialogs.ResourceListSelectionDialog; //导入方法依赖的package包/类
@Override
public void widgetSelected(SelectionEvent e) {
final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
final ResourceListSelectionDialog elementSelector = new ResourceListSelectionDialog(shell, ResourcesPlugin.getWorkspace().getRoot(), IResource.DEPTH_INFINITE | IResource.FILE ) {
@Override
protected boolean select(IResource resource) {
// TODO Auto-generated method stub
return resource.getName().toLowerCase().endsWith(".hawkmodel");
}
};
elementSelector.setTitle("Remote Hawk access descriptors in the workspace");
elementSelector.setMessage("Select a remote Hawk access descriptor");
elementSelector.open();
if (elementSelector.getReturnCode() == Window.OK){
IFile f = (IFile) elementSelector.getResult()[0];
text.setText(f.getFullPath().toString());
}
}
示例2: handleEvent
import org.eclipse.ui.dialogs.ResourceListSelectionDialog; //导入方法依赖的package包/类
@Override
public void handleEvent(Event evt) {
if (SWT.Selection == evt.type) {
ResourceListSelectionDialog dlg = new ResourceListSelectionDialog(
PathPropertyPage.this.getShell(), currentProject, IResource.FOLDER);
if (ResourceListSelectionDialog.OK == dlg.open()) {
Object[] selected = dlg.getResult();
if (null != selected && selected.length > 0 && selected[0] instanceof IResource) {
IResource res = (IResource) selected[0];
try {
projectConfiguration.setPath(kind, res.getFullPath().toFile());
} catch (IOException e) {
MessageDialog.openError(getShell(), "Error setting path", e.getMessage());
}
}
}
}
}
示例3: browseFiles
import org.eclipse.ui.dialogs.ResourceListSelectionDialog; //导入方法依赖的package包/类
/***
* Open a resource chooser to select a file
**/
protected void browseFiles() {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
ResourceListSelectionDialog dialog = new ResourceListSelectionDialog(getShell(), root, IResource.FILE);
dialog.setTitle("Search File");
if (dialog.open() == Window.OK) {
Object[] files = dialog.getResult();
IFile file = (IFile) files[0];
fileText.setText(file.getFullPath().toString());
}
}
示例4: searchResource
import org.eclipse.ui.dialogs.ResourceListSelectionDialog; //导入方法依赖的package包/类
/**
* Open a resource chooser to select a resource as the main entry point for the launch.
*/
protected String searchResource() {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
ResourceListSelectionDialog dialog = new ResourceListSelectionDialog(getShell(), root,
getAcceptedResourceTypes());
dialog.setTitle("Search " + getResourceLabel());
if (dialog.open() == Window.OK) {
Object[] files = dialog.getResult();
IFile file = (IFile) files[0];
return file.getFullPath().toString();
}
return null;
}
示例5: browseEiffelFiles
import org.eclipse.ui.dialogs.ResourceListSelectionDialog; //导入方法依赖的package包/类
protected void browseEiffelFiles() {
ResourceListSelectionDialog dialog = new ResourceListSelectionDialog(
getShell(), ResourcesPlugin.getWorkspace().getRoot(), IResource.FILE);
dialog.setTitle("Eiffel Program");
dialog.setMessage("Select Eiffel Program");
if (dialog.open() == Window.OK) {
Object[] files = dialog.getResult();
IFile file = (IFile) files[0];
eiffelProgramText.setText(file.getFullPath().toString());
}
}
示例6: changeModel
import org.eclipse.ui.dialogs.ResourceListSelectionDialog; //导入方法依赖的package包/类
void changeModel(final TransformationEditor editor,
final String title,
final CTabItem tab) {
final IFolder classesFolder = editor.project().getFolder("target/classes");
final List<IResource> classes = new ArrayList<>();
try {
findClasses(classesFolder, classes);
final ResourceListSelectionDialog dlg =
new ResourceListSelectionDialog(getShell(),
classes.toArray(new IResource[classes.size()])) {
@Override
protected Control createDialogArea(final Composite parent) {
final Composite dlgArea = (Composite) super.createDialogArea(parent);
for (final Control child : dlgArea.getChildren()) {
if (child instanceof Text) {
((Text) child).setText(model == null ? "*" : model.getName());
break;
}
}
return dlgArea;
}
};
dlg.setTitle("Select " + title);
if (dlg.open() != Window.OK) {
return;
}
final IFile file = (IFile) dlg.getResult()[0];
String name =
file.getFullPath().makeRelativeTo(classesFolder.getFullPath()).toString()
.replace('/', '.');
name = name.substring(0, name.length() - ".class".length());
model = editor.changeModel(model, name);
tab.setText(title + ": " + model.getName());
modelViewer.rootModel = model;
refresh();
layout();
} catch (final Exception e) {
Activator.error(e);
}
}