Examples of ElementTreeSelectionDialog


Examples of org.eclipse.ui.dialogs.ElementTreeSelectionDialog

       
        _detailSection.setVisible(false);
    }

    protected void handleBrowserLayout(Text textControl) {
        ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(Display.getCurrent().getActiveShell(), new WorkbenchLabelProvider(), new BaseWorkbenchContentProvider());
        IFile syncInfo = ((IFileEditorInput)getEditorInput()).getFile();
        WGADesignStructureHelper helper = new WGADesignStructureHelper(syncInfo);       
        dialog.setInput(helper.getTmlRoot());
        dialog.setAllowMultiple(false);
        dialog.setHelpAvailable(false);
        dialog.setTitle("TML layout selection");
        dialog.setValidator(new ISelectionStatusValidator() {
           
            public IStatus validate(Object[] selection) {
                if (selection != null && selection.length == 1) {
                    if (selection[0] instanceof IFile) {
                        return new Status(Status.OK, Plugin.PLUGIN_ID, ((IFile)selection[0]).getFullPath().toString());
                    }
                }
                return new Status(Status.ERROR, Plugin.PLUGIN_ID, "Please select a tml layout file.");
            }
        });
        // first try to find reference in medium "html" - otherwise check all available mediaKeys in design
        IFile preSelection = helper.findReferencedTMLModule(textControl.getText(), "html");
        if (preSelection == null) {
            for (String mediaKey : helper.getMediaKeys()) {
                preSelection = helper.findReferencedTMLModule(textControl.getText(), mediaKey);
                if (preSelection != null) {
                    break;
                }
            }
        }
        if (preSelection != null) {
            dialog.setInitialSelection(preSelection);
        }
        int result = dialog.open();
        if (result == Dialog.OK) {
            IFile selection = (IFile) dialog.getFirstResult();
            textControl.setText(helper.computeTMLReference(selection));
        }
    }
View Full Code Here

Examples of org.eclipse.ui.dialogs.ElementTreeSelectionDialog

        setControl(composite);
    }

    void doAdd() {
        ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
        dialog.setValidator(new ISelectionStatusValidator() {
            public IStatus validate(Object[] selection) {
                if (selection.length > 0 && selection[0] instanceof IFile) {
                    return new Status(IStatus.OK, Plugin.PLUGIN_ID, IStatus.OK, "", null); //$NON-NLS-1$
                }
                return new Status(IStatus.ERROR, Plugin.PLUGIN_ID, IStatus.ERROR, "", null); //$NON-NLS-1$
            }
        });
        dialog.setAllowMultiple(true);
        dialog.setTitle("JAR File Selection");
        dialog.addFilter(new FileExtensionFilter("jar")); //$NON-NLS-1$
        dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());

        if (dialog.open() == Window.OK) {
            Object[] result = dialog.getResult();
            List<File> added = new ArrayList<File>(result.length);
            for (Object fileObj : result) {
                IFile ifile = (IFile) fileObj;
                File file = ifile.getLocation().toFile();
                analyseFile(file);
View Full Code Here

Examples of org.eclipse.ui.dialogs.ElementTreeSelectionDialog

            launchTargetTxt.setText(selected.getName());
        }
    }

    void doBrowseBndrun() {
        ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(launchTargetTxt.getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
        dialog.setValidator(new ISelectionStatusValidator() {
            public IStatus validate(Object[] selection) {
                if (selection.length > 0 && selection[0] instanceof IFile) {
                    return new Status(IStatus.OK, Plugin.PLUGIN_ID, IStatus.OK, "", null); //$NON-NLS-1$
                }
                return new Status(IStatus.ERROR, Plugin.PLUGIN_ID, IStatus.ERROR, "", null); //$NON-NLS-1$
            }
        });
        dialog.setAllowMultiple(false);
        dialog.setTitle("Run File Selection");
        dialog.setMessage("Select the Run File to launch.");
        dialog.addFilter(new FileExtensionFilter(LaunchConstants.EXT_BNDRUN));
        dialog.setInput(ResourcesPlugin.getWorkspace());

        if (dialog.open() == Window.OK) {
            Object[] files = dialog.getResult();
            if (files != null && files.length == 1) {
                IPath path = ((IResource) files[0]).getFullPath().makeRelative();
                launchTargetTxt.setText(path.toString());
            } else {
                launchTargetTxt.setText("");
View Full Code Here

Examples of org.eclipse.ui.dialogs.ElementTreeSelectionDialog

        gd.heightHint = 75;
        table.setLayoutData(gd);
    }

    private void doAddJar() {
        ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getSection().getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
        dialog.setAllowMultiple(true);
        dialog.setTitle("JAR Selection");
        dialog.setMessage("Select JAR Files to add to the Classpath.");
        dialog.addFilter(new FileExtensionFilter("jar")); //$NON-NLS-1$

        IResource resource = getInputResource();
        dialog.setInput(resource.getProject());

        if (dialog.open() == Window.OK) {
            Object[] files = dialog.getResult();
            List<IPath> added = new ArrayList<IPath>(files.length);
            for (Object file : files) {
                IPath newPath = ((IResource) file).getFullPath().makeRelative();
                // Remove the first segment (project name)
                newPath = newPath.removeFirstSegments(1);
View Full Code Here

Examples of org.eclipse.ui.dialogs.ElementTreeSelectionDialog

            }
        }
    }

    private void doAddFolder() {
        ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getSection().getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
        dialog.setAllowMultiple(true);
        dialog.setTitle("Class Folder Selection");
        dialog.setMessage("Select Class Folders to add to the Classpath.");
        dialog.addFilter(new ClassFolderFilter());

        IResource resource = getInputResource();
        dialog.setInput(resource.getProject());

        if (dialog.open() == Window.OK) {
            Object[] folders = dialog.getResult();
            List<IPath> added = new ArrayList<IPath>(folders.length);
            for (Object folder : folders) {
                IPath newPath = ((IResource) folder).getFullPath().makeRelative().addTrailingSeparator();
                // Remove the first segment (project name)
                newPath = newPath.removeFirstSegments(1);
View Full Code Here

Examples of org.eclipse.ui.dialogs.ElementTreeSelectionDialog

    public void run(IAction action) {
        if (fSelection instanceof IStructuredSelection) {
            final IProject project = (IProject) ((IStructuredSelection) fSelection)
                    .getFirstElement();

            ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(
                    getDisplay().getActiveShell(),
                    new WorkbenchLabelProvider(),
                    new BaseWorkbenchContentProvider());
            dialog.setMessage("Select content sync root location (containing the jcr root)");
            dialog.setTitle("Content Sync Root");
            IContainer initialContainer = ProjectHelper
                    .getInferredContentProjectContentRoot(project);
            if (initialContainer != null) {
                dialog.setInitialElementSelections(Arrays
                        .asList(initialContainer));
            }
            dialog.addFilter(new ViewerFilter() {

                @Override
                public boolean select(Viewer viewer, Object parentElement,
                        Object element) {
                    if (element instanceof IProject) {
                        return ((IProject) element).equals(project);
                    }
                    // display folders only
                    return element instanceof IContainer;
                }
            });
            dialog.setInput(new IWorkbenchAdapter() {

                @Override
                public Object getParent(Object o) {
                    return null;
                }

                @Override
                public String getLabel(Object o) {
                    return null;
                }

                @Override
                public ImageDescriptor getImageDescriptor(Object object) {
                    return null;
                }

                @Override
                public Object[] getChildren(Object o) {
                    return new Object[] { project };
                }
            }); // this is the root element
            dialog.setAllowMultiple(false);
            dialog.setValidator(new ISelectionStatusValidator() {

                @Override
                public IStatus validate(Object[] selection) {

                    if (selection.length > 0) {
                        final Object item = selection[0];
                        if (item instanceof IContainer) {
                            IContainer selectedContainer = (IContainer) item;
                            String errorMsg = ProjectHelper
                                    .validateContentPackageStructure(selectedContainer);
                            if (errorMsg != null) {
                                return new Status(IStatus.ERROR,
                                        Activator.PLUGIN_ID, errorMsg);
                            } else {
                                return new Status(IStatus.OK,
                                        Activator.PLUGIN_ID, "");
                            }
                        }
                    }
                    return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "");
                }

            });
            if (dialog.open() == ContainerSelectionDialog.OK) {
                Object[] result = dialog.getResult();
                if (result != null && result.length > 0) {
                    final IContainer container = (IContainer) result[0];
                    IRunnableWithProgress r = new IRunnableWithProgress() {

                        @Override
View Full Code Here

Examples of org.eclipse.ui.dialogs.ElementTreeSelectionDialog

    this.htdocs.setText(this.project.getDefaultWebFolder().getProjectRelativePath().toString());
   
    this.browse = SWTUtil.createButton(composite2, Messages.ProjectPropertyPage_Browse);
    this.browse.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent se) {
                ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new ProjectContentProvider());
                dialog.setTitle(Messages.ProjectPropertyPage_SelectHtdocsFolderTitle);
                dialog.setMessage(Messages.ProjectPropertyPage_SelectHtdocsFolderDescription);
                dialog.setInput(project.getEclipseProject().getWorkspace());
                dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
                dialog.setInitialSelection(project.getDefaultWebFolder());
                dialog.setAllowMultiple(false);
                if (dialog.open() == IDialogConstants.OK_ID) {
                    IResource resource = (IResource) dialog.getFirstResult();
                    if (resource != null) {
                      htdocs.setText(resource.getProjectRelativePath().toString());
                      validate();
                    }
                }
View Full Code Here

Examples of org.eclipse.ui.dialogs.ElementTreeSelectionDialog

      this.browseButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
          if (WebRootsList.this.table.getSelection() == null || WebRootsList.this.table.getSelection().length == 0) return;
          ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new ProjectContentProvider());
          final TableItem item = WebRootsList.this.table.getSelection()[0];
                  dialog.setTitle(Messages.ProjectPropertyPage_SelectHtdocsFolderTitle);
                  dialog.setMessage(Messages.ProjectPropertyPage_SelectHtdocsFolderDescription);
                  dialog.setInput(project.getEclipseProject().getWorkspace());
                  dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
                  dialog.setInitialSelection(((WebRootItem)item.getData()).getFolder());
                  dialog.setAllowMultiple(false);
                  if (dialog.open() == IDialogConstants.OK_ID) {
                      IResource resource = (IResource) dialog.getFirstResult();
                      if (resource != null) {
                        ((WebRootItem)item.getData()).setFolder((IContainer) resource);
                        item.setText(1, resource.getProjectRelativePath().toString());
                        validate();
                      }
                  }
        }
       
      });
     
      this.addButton = SWTUtil.createButton(composite, Messages.ProjectPropertyPage_Add);
      this.addButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
          ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new ProjectContentProvider());
          dialog.setTitle(Messages.ProjectPropertyPage_SelectHtdocsFolderTitle);
                  dialog.setMessage(Messages.ProjectPropertyPage_SelectHtdocsFolderDescription);
                  dialog.setInput(project.getEclipseProject().getWorkspace());
                  dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
                  dialog.setAllowMultiple(false);
                  if (dialog.open() == IDialogConstants.OK_ID) {
                      IResource resource = (IResource) dialog.getFirstResult();
                      if (resource != null) {
                        final TableItem item = new TableItem(table, SWT.NONE);
                        final WebRootItem rootItem = new WebRootItem("/" + resource.getProjectRelativePath().toString(), (IContainer) resource); //$NON-NLS-1$
                        item.setText(0, rootItem.getPathName());
                        item.setText(1, rootItem.getFolder().getProjectRelativePath().toString());
View Full Code Here

Examples of org.eclipse.ui.dialogs.ElementTreeSelectionDialog

    }
  }
 
  private void setUpWhitelistPackagesDialog() {
    IJavaProject project = getSelectedProject();
    ElementTreeSelectionDialog dialog =
        new ElementTreeSelectionDialog(getControl().getShell(),
            new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_BASICS),
            new JavaPackageElementContentProvider());
    dialog.setInput(project);
    dialog.addFilter(new ViewerFilter() {

      @Override
      public boolean select(Viewer viewer, Object parentElement, Object element) {
        if (element instanceof IPackageFragment) {
          return !((IPackageFragment) element).getElementName().equals("");
        }
        if (element instanceof ICompilationUnit) {
          return false;
        }
        return true;
      }
     
    });
    dialog.setMessage("Choose packages to whitelist:");

    if (dialog.open() == Window.OK) {
      Object[] results = dialog.getResult();
      String[] stringArray = new String[results.length];
      for (int i = 0; i < results.length; i++) {
        if (results[i] instanceof IJavaElement) {
          stringArray[i] = ((IJavaElement) results[i]).getElementName();
        }
View Full Code Here

Examples of org.eclipse.ui.dialogs.ElementTreeSelectionDialog

       * Opens the corpus folder chooser dialog and shows the chosen dialog in the corpus folder
       * text field.
       */
      public void widgetSelected(SelectionEvent e) {

        final ElementTreeSelectionDialog folderSelectionDialog = new ElementTreeSelectionDialog(
                getShell(), new DecoratingLabelProvider(new WorkbenchLabelProvider(), PlatformUI
                        .getWorkbench().getDecoratorManager().getLabelDecorator()),
                new BaseWorkbenchContentProvider());

        folderSelectionDialog.addFilter(new CorpusElementFilter());

        if (corpusElement != null) {
          folderSelectionDialog.setInitialSelection(corpusElement);
        }

        folderSelectionDialog.setInput(CasEditorPlugin.getNlpModel());

        folderSelectionDialog.setTitle("Choose corpus");
        folderSelectionDialog.setMessage("Please choose a corpus.");

        folderSelectionDialog.setValidator(new ISelectionStatusValidator() {
          public IStatus validate(Object[] selection) {

            if (selection.length == 1 && selection[0] instanceof CorpusElement) {
              return new Status(IStatus.OK, CasEditorPlugin.ID, 0, "", null);
            }

            return new Status(IStatus.ERROR, CasEditorPlugin.ID, 0, "Please select a corpus!", null);
          }
        });

        folderSelectionDialog.open();

        Object[] results = folderSelectionDialog.getResult();

        if (results != null) {
          // validator makes sure that one CorpusElement is selected
          corpusElement = (CorpusElement) results[0];

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.