Package org.eclipse.ui.dialogs

Examples of org.eclipse.ui.dialogs.FilteredResourcesSelectionDialog


   * Open a browser to select an existing resource. By default, set a filter
   * to "*.dpans".
   */
  private void fileBrowse() {
    Shell shell = new Shell(Display.getDefault());
    FilteredResourcesSelectionDialog dialog =
      new FilteredResourcesSelectionDialog(
        shell, false, ResourcesPlugin.getWorkspace().getRoot(), IResource.FILE);
    dialog.setInitialPattern("*.dpans");
    if (dialog.open() == ResourceSelectionDialog.OK) {
      Object[] result = dialog.getResult();
      if (result.length == 1) {
        System.out.println(result[0].getClass());
        if (result[0] instanceof File) {
          File resource = (File) result[0];
          file.setText(resource.getFullPath().toOSString());
View Full Code Here


      final Procedure1<IFile> listener) {
    button.addSelectionListener(new SelectionListener() {

      @Override
      public void widgetSelected(final SelectionEvent event) {
        FilteredResourcesSelectionDialog dialog = new FilteredResourcesSelectionDialog(
            button.getShell(), false, root, IResource.FILE);
        dialog.setInitialPattern("*.g4");
        if (dialog.open() == FilteredResourcesSelectionDialog.OK) {
          listener.apply((IFile) dialog.getResult()[0]);
        }
      }

      @Override
      public void widgetDefaultSelected(final SelectionEvent event) {
View Full Code Here

  public boolean canFlipToNextPage() {
    return super.canFlipToNextPage() && getXmlFileUnderTest() != null;
  }

  private IFile chooseXmlFileToTestType() {
    FilteredResourcesSelectionDialog dialog = new FilteredResourcesSelectionDialog(getShell(), false,
        resourceContainer, IResource.FILE) {

      /*
       * (non-Javadoc)
       * @see org.eclipse.ui.dialogs.FilteredResourcesSelectionDialog#fillContentProvider(org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.AbstractContentProvider, org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.ItemsFilter, org.eclipse.core.runtime.IProgressMonitor)
       */
      @Override
      protected void fillContentProvider(final AbstractContentProvider contentProvider, ItemsFilter itemsFilter,
          IProgressMonitor progressMonitor) throws CoreException {
        AbstractContentProvider filteringContentProvider = new AbstractContentProvider() {
          /*
           * (non-Javadoc)
           * @see org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.AbstractContentProvider#add(java.lang.Object, org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.ItemsFilter)
           */
          @Override
          public void add(Object item, ItemsFilter itemsFilter) {
            if (itemsFilter.matchItem(item)) {
              if (item instanceof IFile) {
                IFile ifile = (IFile) item;
                boolean matches = camelXmlMatcher.matches(ifile);
                Activator.getLogger().debug("File " + ifile + " matches CamelXML: " + matches);
                if (matches) {
                  contentProvider.add(item, itemsFilter);
                }
              }
            }
          }
        };
        super.fillContentProvider(filteringContentProvider, itemsFilter, progressMonitor);
      }

    };

    dialog.setInitialPattern("*.xml", FilteredItemsSelectionDialog.FULL_SELECTION);
    dialog.setTitle(WizardMessages.NewCamelTestWizardPageOne_class_to_test_dialog_title);
    dialog.setMessage(WizardMessages.NewCamelTestWizardPageOne_class_to_test_dialog_message);

    if (dialog.open() == Window.OK) {
      Object[] resultArray = dialog.getResult();
      if (resultArray != null && resultArray.length > 0) {
        Object firstSelection = resultArray[0];
        if (firstSelection instanceof IFile) {
          return (IFile) firstSelection;
        }
View Full Code Here

       * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
       */
      @Override
      public void widgetSelected(SelectionEvent e) {
        IContainer container = ResourcesPlugin.getWorkspace().getRoot();
        browseDialog = new FilteredResourcesSelectionDialog(e.display.getActiveShell(), false, container, IResource.FILE) {
         
          /*
           * (non-Javadoc)
           * @see org.eclipse.ui.dialogs.FilteredResourcesSelectionDialog#fillContentProvider(org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.AbstractContentProvider, org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.ItemsFilter, org.eclipse.core.runtime.IProgressMonitor)
           */
 
View Full Code Here

      Button bWorkspace = new Button( container, SWT.NONE );
      bWorkspace.setText( "Workspace ..." );
      bWorkspace.addSelectionListener( new SelectionAdapter() {
        @Override
        public void widgetSelected( final SelectionEvent e ) {
          FilteredResourcesSelectionDialog d = new FilteredResourcesSelectionDialog( getShell(), false, resourceContainer, IResource.FILE ) {
            @Override
            protected IStatus validateItem( final Object item ) {
              IFile f = (IFile) item;
              if ( f.getParent() instanceof IProject ) {
                return new Status( IStatus.ERROR, JavaFXUIPlugin.PLUGIN_ID, "The selected resource has to be part of the source folder" );
              }
              return super.validateItem( item );
            }
          };
          if ( d.open() == ResourceSelectionDialog.OK ) {
            Object[] rv = d.getResult();
            if ( rv.length == 1 ) {
              IFile f = (IFile) rv[0];
              tFile.setText( "${workspace}/" + f.getProject().getName() + "/" + f.getProjectRelativePath().toString() );
            }
          }
View Full Code Here

        dbc.bindValue( textModify.observeDelayed( DELAY, t ), prop.observeDetail( bean ) );
        Button b = toolkit.createButton( sectionClient, "Workspace ...", SWT.NONE );
        b.addSelectionListener( new SelectionAdapter() {
          @Override
          public void widgetSelected( final SelectionEvent e ) {
            FilteredResourcesSelectionDialog d = new FilteredResourcesSelectionDialog( getSite().getShell(), false,
                ( (IFileEditorInput) getEditorInput() ).getFile().getProject(), IResource.FILE ) {
              @Override
              protected IStatus validateItem( final Object item ) {
                IFile f = (IFile) item;
                if ( f.getParent() instanceof IProject ) {
                  return new Status( IStatus.ERROR, JavaFXUIPlugin.PLUGIN_ID, "The selected resource has to be part of the source folder" );
                }
                if ( !f.getName().endsWith( JavaFXUIPlugin.FILEEXTENSION_HTML_TEMPLATE ) ) {
                  return new Status( IStatus.ERROR, JavaFXUIPlugin.PLUGIN_ID, "The selected resource does not seem to be a html file" );
                }
                return super.validateItem( item );
              }
            };

            if ( d.open() == ResourceSelectionDialog.OK ) {
              Object[] rv = d.getResult();
              if ( rv.length == 1 ) {
                IFile f = (IFile) rv[0];
                IJavaElement j = JavaCore.create( f.getParent() );
                String template = null;
                if ( j instanceof IPackageFragment ) {
View Full Code Here

    AddManifestAttributeDialog d = new AddManifestAttributeDialog( getSite().getShell(), editingDomain, getTask() );
    return d.open() == TitleAreaDialog.OK;
  }

  private String handleSplashImage( Shell shell ) {
    FilteredResourcesSelectionDialog d = new FilteredResourcesSelectionDialog( shell, false,
        ( (IFileEditorInput) getEditorInput() ).getFile().getProject(), IResource.FILE ) {
      @Override
      protected IStatus validateItem( Object item ) {
        IFile f = (IFile) item;
        if ( f.getParent() instanceof IProject ) {
          return new Status( IStatus.ERROR, JavaFXUIPlugin.PLUGIN_ID, "The selected resource has to part of the source folder" );
        }
        return super.validateItem( item );
      }
    };
    if ( d.open() == ResourceSelectionDialog.OK ) {
      Object[] rv = d.getResult();
      if ( rv.length == 1 ) {
        IFile f = (IFile) rv[0];
        IJavaElement j = JavaCore.create( f.getParent() );
        if ( j instanceof IPackageFragment ) {
          IPackageFragment p = (IPackageFragment) j;
View Full Code Here

      Button b = new Button( container, SWT.NONE );
      b.setText( "Browse ..." );
      b.addSelectionListener( new SelectionAdapter() {
        @Override
        public void widgetSelected( final SelectionEvent e ) {
          FilteredResourcesSelectionDialog d = new FilteredResourcesSelectionDialog( getShell(), false, resourceContainer, IResource.FILE ) {
            @Override
            protected IStatus validateItem( final Object item ) {
              IFile f = (IFile) item;
              if ( f.getParent() instanceof IProject ) {
                return new Status( IStatus.ERROR, JavaFXUIPlugin.PLUGIN_ID, "The selected resource has to be part of the source folder" );
              }
              if ( !f.getName().endsWith( ".ttf" ) ) {
                return new Status( IStatus.ERROR, JavaFXUIPlugin.PLUGIN_ID, "The selected resource does not seem to be a font" );
              }
              return super.validateItem( item );
            }
          };
         
          if ( d.open() == ResourceSelectionDialog.OK ) {
            Object[] rv = d.getResult();
            if ( rv.length == 1 ) {
              IFile f = (IFile) rv[0];
              IJavaElement j = JavaCore.create( f.getParent() );
              if ( j instanceof IPackageFragment ) {
                IPackageFragment p = (IPackageFragment) j;
View Full Code Here

TOP

Related Classes of org.eclipse.ui.dialogs.FilteredResourcesSelectionDialog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.