本文整理汇总了Java中org.eclipse.ui.dialogs.ResourceListSelectionDialog类的典型用法代码示例。如果您正苦于以下问题:Java ResourceListSelectionDialog类的具体用法?Java ResourceListSelectionDialog怎么用?Java ResourceListSelectionDialog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ResourceListSelectionDialog类属于org.eclipse.ui.dialogs包,在下文中一共展示了ResourceListSelectionDialog类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例7: createLinksTechnologySection
import org.eclipse.ui.dialogs.ResourceListSelectionDialog; //导入依赖的package包/类
private void createLinksTechnologySection(final ScrolledForm form, FormToolkit toolkit) {
Section sctnLinksTechnology = toolkit
.createSection(form.getForm().getBody(), Section.DESCRIPTION | ExpandableComposite.TWISTIE
| ExpandableComposite.TITLE_BAR | ExpandableComposite.EXPANDED);
GridData gd_sctnLinksTechnology = new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1);
gd_sctnLinksTechnology.widthHint = 588;
sctnLinksTechnology.setLayoutData(gd_sctnLinksTechnology);
sctnLinksTechnology.setDescription("Select a DSL technology to specify links between models");
// sctnLinksTechnology.setBounds(0, 193, 584, 187);
toolkit.paintBordersFor(sctnLinksTechnology);
sctnLinksTechnology.setText("Links Technology");
// sctnLinksTechnology.setExpanded(true);
Composite composite_2 = toolkit.createComposite(sctnLinksTechnology, SWT.NONE);
toolkit.paintBordersFor(composite_2);
sctnLinksTechnology.setClient(composite_2);
composite_2.setLayout(new GridLayout(2, false));
linksDslText = new Text(composite_2, SWT.NONE);
linksDslText.setEnabled(true);
// linksDslText.setBounds(0, 0, 456, 22);
toolkit.adapt(linksDslText, true, true);
Button modifyLinksDslButton = new Button(composite_2, SWT.NONE);
modifyLinksDslButton.setBounds(469, 0, 107, 25);
toolkit.adapt(modifyLinksDslButton, true, true);
modifyLinksDslButton.setText("Modify");
modifyLinksDslButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent evt) {
ResourceListSelectionDialog selectLinksDslDialog =
new ResourceListSelectionDialog(form.getShell(),
ResourcesPlugin.getWorkspace().getRoot(),
IResource.FILE);
selectLinksDslDialog.setTitle("Select DSL technology");
selectLinksDslDialog.create();
if (selectLinksDslDialog.open() == Window.OK) {
IFile matchingModelFile = (IFile) selectLinksDslDialog.getResult()[0];
String matchingModelPath = matchingModelFile.getFullPath().toString();
matchingModelPath = matchingModelPath.replaceFirst("/", "");
linksDslText.setText(matchingModelPath);
IDocument theDoc = viewpointTextEditor.getDocumentProvider()
.getDocument(viewpointTextEditor.getEditorInput());
String editorText = theDoc.get();
theDoc.set(updateViewpointDefinition(editorText, null, matchingModelPath));
}
}
});
}