Java 类org.eclipse.ui.dialogs.ResourceListSelectionDialog 实例源码

项目:mondo-integration    文件:RemoteHawkModelConfigurationDialog.java   
@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());
    }
}
项目:mondo-hawk    文件:RemoteHawkModelConfigurationDialog.java   
@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());
    }
}
项目:mondo-collab-framework    文件:RemoteHawkModelConfigurationDialog.java   
@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());
    }
}
项目:EASyProducer    文件:PathPropertyPage.java   
@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());
                }
            }
        }
    }
}
项目:n4js    文件:LaunchConfigurationMainTab.java   
/***
 * 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());
    }

}
项目:n4js    文件:AbstractLaunchConfigurationMainTab.java   
/**
 * 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;
}
项目:LibertyEiffel-Eclipse-Plugin    文件:LibertyEiffelMainTab.java   
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());
    }
}
项目:data-mapper    文件:ModelTabFolder.java   
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);
    }
}
项目:emfviews    文件:ViewpointEditor.java   
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));

      }
    }

  });
}