Examples of ElementTreeSelectionDialog


Examples of org.eclipse.ui.dialogs.ElementTreeSelectionDialog

   * returns the absolute path of selected JavaScript file.
   *
   * @return the absolute path of selected JavaScript file.
   */
  private static String browseJavaScriptFile() {
    ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(
        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
        new WorkbenchLabelProvider(), new WorkbenchContentProvider());
    dialog.setInput(ResourcesPlugin.getWorkspace());
    dialog.addFilter(new ViewerFilter(){
        public boolean select(Viewer viewer, Object parentElement, Object element){
        if(element instanceof IProject || element instanceof IFolder){
          return true;
        }
        if(element instanceof IFile){
          if(((IFile)element).getName().endsWith(".js")){
            return true;
          }
        }
        return false;
      }
    });
    dialog.setAllowMultiple(false);
    dialog.setTitle(HTMLPlugin.getResourceString("Launcher.JavaScript.Dialog.SelectFile"));
   
    if (dialog.open() == Dialog.OK) {
      IFile file = (IFile) dialog.getFirstResult();
      return file.getLocation().toString();
    }
   
    return null;
  }
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(org.apache.uima.caseditor.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

Examples of org.eclipse.ui.dialogs.ElementTreeSelectionDialog

    // return null;
    // }

    // TODO: preselect entered text entry

    final ElementTreeSelectionDialog fileSelectionDialog = new ElementTreeSelectionDialog(
            getShell(), new WorkbenchLabelProvider(), new BaseWorkbenchContentProvider());

    fileSelectionDialog.addFilter(new FileElementFilter());
    fileSelectionDialog.setInput(mProject);
    fileSelectionDialog.setTitle(title);
    fileSelectionDialog.setMessage(message);
    fileSelectionDialog.setValidator(new ISelectionStatusValidator() {
      public IStatus validate(Object[] selection) {
        if (selection.length == 1 && selection[0] instanceof IFile) {
          return new Status(IStatus.OK, CasEditorPlugin.ID, 0, "", null);
        }

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

    fileSelectionDialog.open();

    Object[] results = fileSelectionDialog.getResult();

    if (results != null) {
      return ((IFile) results[0]).getFullPath().removeFirstSegments(1).toString();
    }
View Full Code Here

Examples of org.eclipse.ui.dialogs.ElementTreeSelectionDialog

  @Override
  protected String changePressed() {
    // TODO: preselect entered text entry

    final ElementTreeSelectionDialog folderSelectionDialog = new ElementTreeSelectionDialog(
            getShell(), new WorkbenchLabelProvider(), new BaseWorkbenchContentProvider());

    folderSelectionDialog.setInput(mProject);
    folderSelectionDialog.setTitle(getLabelText());
    folderSelectionDialog.setMessage(getPreferenceName());
    folderSelectionDialog.setValidator(new ISelectionStatusValidator() {
      public IStatus validate(Object[] selection) {
        if (selection.length == 1 && selection[0] instanceof IFolder) {
          return new Status(IStatus.OK, CasEditorPlugin.ID, 0, "", null);
        }

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

    folderSelectionDialog.open();

    Object[] results = folderSelectionDialog.getResult();

    if (results.length != 1) {
      return null;
    }
View Full Code Here

Examples of org.eclipse.ui.dialogs.ElementTreeSelectionDialog

  }

  @Override
  protected String getNewInputObject() {
    final ElementTreeSelectionDialog folderSelectionDialog = new ElementTreeSelectionDialog(
            getShell(), new WorkbenchLabelProvider(), new BaseWorkbenchContentProvider());

    folderSelectionDialog.addFilter(new FolderElementFilter());
    folderSelectionDialog.setInput(mProject);
    folderSelectionDialog.setTitle(title);
    folderSelectionDialog.setMessage(message);
    folderSelectionDialog.setValidator(new ISelectionStatusValidator() {
      public IStatus validate(Object[] selection) {
        if (selection.length == 1 && selection[0] instanceof IFolder) {
          return new Status(IStatus.OK, CasEditorPlugin.ID, 0, "", null);
        }

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

    folderSelectionDialog.open();

    Object[] results = folderSelectionDialog.getResult();

    if (results != null) {
      return ((IFolder) results[0]).getFullPath().removeFirstSegments(1).toString();
    }
View Full Code Here

Examples of org.eclipse.ui.dialogs.ElementTreeSelectionDialog

   
    Button browseButton = new Button(composite, SWT.PUSH);
    browseButton.setText("Browse ...");
    browseButton.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(),
                new WorkbenchLabelProvider(), new WorkbenchContentProvider());
        dialog.setTitle("Select descriptor");
        dialog.setMessage("Select descriptor");
        dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
        dialog.setInitialSelection(ResourcesPlugin.getWorkspace().getRoot().
                findMember(typeSystemText.getText()));
        if (dialog.open() == IDialogConstants.OK_ID) {
          IResource resource = (IResource) dialog.getFirstResult();
          if (resource != null) {
            String fileLoc = resource.getFullPath().toString();
            typeSystemText.setText(fileLoc);
          }
        }
View Full Code Here

Examples of org.eclipse.ui.dialogs.ElementTreeSelectionDialog

public class SelectType {
 
 
  public static ToolComponent select(ToolComponent component, ToolComponent initialSelection){
    IProject project  = component.getFile().getProject();
    ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(
        Display.getDefault().getActiveShell(),
          new LabelProvider(),
          new SupplierContentProvider(project));
   
      ToolPlan rootPlan = null;
      if (component instanceof ToolServiceObject){
        rootPlan = ((ToolServiceObject)component).getPlan();
      } else if (component instanceof ToolType){
        rootPlan = ((ToolType)component).getPlan();
      }
      Set<String> planNames = new HashSet<String>(rootPlan.getSupplierPlans());
      planNames.add(rootPlan.getToolName());
      dialog.setTitle("Type Selection");
      dialog.setMessage("Select the type from the tree:");
      dialog.setInput(planNames);
      dialog.setAllowMultiple(false);
      dialog.setEmptyListMessage("No types available");
      dialog.setSorter(new ViewerSorter());
      if (initialSelection != null)
        dialog.setInitialSelection(initialSelection);
      if (dialog.open() == ElementTreeSelectionDialog.OK){
        Object selectedObject = dialog.getFirstResult();
        if (selectedObject instanceof ToolType)
          return (ToolType)selectedObject;
        else
          return null;
      }else {
View Full Code Here

Examples of org.eclipse.ui.dialogs.ElementTreeSelectionDialog

    ISelectionStatusValidator validator = getContainerDialogSelectionValidator();
    ViewerFilter filter = getContainerDialogViewerFilter();
    ITreeContentProvider contentProvider = new WorkbenchContentProvider();
    ILabelProvider labelProvider = new DecoratingLabelProvider(new WorkbenchLabelProvider(), PlatformUI.getWorkbench()
        .getDecoratorManager().getLabelDecorator());
    ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), labelProvider, contentProvider);
    dialog.setValidator(validator);
    dialog.setTitle(J2EEUIMessages.CONTAINER_SELECTION_DIALOG_TITLE);
    dialog.setMessage(J2EEUIMessages.CONTAINER_SELECTION_DIALOG_DESC);
    dialog.addFilter(filter);
    String projectName = projectNameCombo.getText();;
    if (projectName==null || projectName.length()==0)
      return;
    IProject project = ProjectUtilities.getProject(projectName);
    dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());

    if (project != null)
      dialog.setInitialSelection(project);
    if (dialog.open() == Window.OK) {
      Object element = dialog.getFirstResult();
      try {
        if (element instanceof IContainer) {
          IContainer container = (IContainer) element;
          folderText.setText(container.getFullPath().toString());
          // dealWithSelectedContainerResource(container);
View Full Code Here

Examples of org.eclipse.ui.dialogs.ElementTreeSelectionDialog

    ISelectionStatusValidator validator = getContainerDialogSelectionValidator();
    ViewerFilter filter = getContainerDialogViewerFilter();
    ITreeContentProvider contentProvider = new WorkbenchContentProvider();
    ILabelProvider labelProvider = new DecoratingLabelProvider(new WorkbenchLabelProvider(), PlatformUI.getWorkbench()
        .getDecoratorManager().getLabelDecorator());
    ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), labelProvider, contentProvider);
    dialog.setValidator(validator);
    dialog.setTitle(J2EEUIMessages.CONTAINER_SELECTION_DIALOG_TITLE);
    dialog.setMessage(J2EEUIMessages.CONTAINER_SELECTION_DIALOG_DESC);
    dialog.addFilter(filter);
    String projectName = projectNameCombo.getText();;
    if (projectName==null || projectName.length()==0)
      return;
    IProject project = ProjectUtilities.getProject(projectName);
    dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());

    if (project != null)
      dialog.setInitialSelection(project);
    if (dialog.open() == Window.OK) {
      Object element = dialog.getFirstResult();
      try {
        if (element instanceof IContainer) {
          IContainer container = (IContainer) element;
          folderText.setText(container.getFullPath().toString());
          // dealWithSelectedContainerResource(container);
View Full Code Here

Examples of org.eclipse.ui.dialogs.ElementTreeSelectionDialog

    ISelectionStatusValidator validator = getContainerDialogSelectionValidator();
    ViewerFilter filter = getContainerDialogViewerFilter();
    ITreeContentProvider contentProvider = new WorkbenchContentProvider();
    ILabelProvider labelProvider = new DecoratingLabelProvider(new WorkbenchLabelProvider(), PlatformUI.getWorkbench()
        .getDecoratorManager().getLabelDecorator());
    ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), labelProvider, contentProvider);
    dialog.setValidator(validator);
    dialog.setTitle(WizardConstants.CONTAINER_SELECTION_DIALOG_TITLE);
    dialog.setMessage(WizardConstants.CONTAINER_SELECTION_DIALOG_DESC);
    dialog.addFilter(filter);
    String projectName = projectNameCombo.getText();;
    if (projectName==null || projectName.length()==0)
      return;
    IProject project = ResourcesPlugin.getWorkspace().getRoot().findMember(projectName).getProject();
    dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());

    if (project != null)
      dialog.setInitialSelection(project);
    if (dialog.open() == Window.OK) {
      Object element = dialog.getFirstResult();
      try {
        if (element instanceof IContainer) {
          IContainer container = (IContainer) element;
          folderText.setText(container.getFullPath().toString());
          model.put("JAVA_PACKAGE_FRAGMENT_ROOT", null);
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.