Examples of ListSelectionDialog


Examples of org.eclipse.ui.dialogs.ListSelectionDialog

      } else updateStatus("You may select only one resource.");
    }
  }
 
  private void handleUmlModelBrowse() {
    ListSelectionDialog dialog =
      new ListSelectionDialog(getShell(),
          project,
          new IStructuredContentProvider() {

            @Override
            public Object[] getElements(Object inputElement) {
              if (inputElement instanceof ModelingProject) {
                ModelingProject prj = (ModelingProject)inputElement;
                return prj.getAllResources(UmlResource.class).values().toArray();
              }
             
              if (inputElement instanceof UmlResource) return new Object[0];
              return new Object[0];
            }

            @Override
            public void dispose() {
            }

            @Override
            public void inputChanged(Viewer viewer,Object oldInput, Object newInput) {
            }
          },
          new LabelProvider() {
            @Override
            public String getText(Object element) {
              if (element instanceof UmlResource) return ((UmlResource)element).getName();
              return null;
            }
          },
          "Select an UML model"
          );
    if (dialog.open() == ContainerSelectionDialog.OK) {
      Object[] result = dialog.getResult();
      if (result.length == 1) {
        if (result[0] instanceof UmlResource) {
          umlResource = (UmlResource) result[0];
          umlModelPathText.setText(umlResource.getLocation());
        } else updateStatus("Invalid resource selected.");
View Full Code Here

Examples of org.eclipse.ui.dialogs.ListSelectionDialog

        public String getText(Object element) {
          return ((Activity)element).getQualifiedName();
        }
      };
     
      ListSelectionDialog dialog =
        new ListSelectionDialog(getShell(), modelDec, contentProvider, labelProvider, "Select an Activity Diagram");
      if (dialog.open() == ListSelectionDialog.OK) {
        Object[] result = dialog.getResult();
        if (result.length == 1) {
          if (result[0] instanceof Activity) {
            activity = (Activity) result[0];
            activityQualifiedNameText.setText(activity.getQualifiedName());
            prismModelNameText.setText(activity.getName());
View Full Code Here

Examples of org.eclipse.ui.dialogs.ListSelectionDialog

            }
        };

        SelectionDialog selectionDialog;
        if (selectMultiple) {
            selectionDialog = new ListSelectionDialog(workbenchWindow.getShell(), interpreters, contentProvider,
                    labelProvider, msg);
        } else {

            ListDialog listDialog = new ListDialog(workbenchWindow.getShell());
View Full Code Here

Examples of org.eclipse.ui.dialogs.ListSelectionDialog

        }
      };

      final IStructuredContentProvider contentsProvider = ArrayContentProvider.getInstance();

      final ListSelectionDialog dialog = new ListSelectionDialog(text
          .getShell(), bindings.entrySet(), contentsProvider,
          labelProvider,
          UIText.DecoratorPreferencesPage_selectVariablesToAdd);
      dialog.setHelpAvailable(false);
      dialog
      .setTitle(UIText.DecoratorPreferencesPage_addVariablesTitle);
      if (dialog.open() != Window.OK)
        return;

      Object[] result = dialog.getResult();

      for (int i = 0; i < result.length; i++) {
        text.insert("{" + ((Map.Entry) result[i]).getKey() + "}"); //$NON-NLS-1$ //$NON-NLS-2$
      }
    }
View Full Code Here

Examples of org.eclipse.ui.dialogs.ListSelectionDialog

      }
      Object[] selectArr = selectable.toArray();
      new ModelElementSorter().sort(null, selectArr);
      // IScriptProject project = elem.getScriptProject();
      ScriptUILabelProvider labelProvider = new ScriptUILabelProvider();
      ListSelectionDialog dialog = new ListSelectionDialog(
          getShell(),
          Arrays.asList(selectArr),
          new ArrayContentProvider(),
          labelProvider,
          NewWizardMessages.ProjectsWorkbookPage_chooseProjects_message);
      dialog
          .setTitle(NewWizardMessages.ProjectsWorkbookPage_chooseProjects_title);
      dialog.setHelpAvailable(false);
      if (dialog.open() == Window.OK) {
        Object[] result = dialog.getResult();
        BPListElement[] cpElements = new BPListElement[result.length];
        for (int i = 0; i < result.length; i++) {
          IScriptProject curr = (IScriptProject) result[i];
          cpElements[i] = new BPListElement(fCurrJProject,
              IBuildpathEntry.BPE_PROJECT, curr.getPath(), curr
View Full Code Here

Examples of org.springframework.richclient.selection.dialog.ListSelectionDialog

    protected ApplicationDialog createSelectionDialog() {
        EventList eventList = createEventList(selectableItemsHolder);
        final ValueModel2EventListBridge itemRefresher = new ValueModel2EventListBridge(selectableItemsHolder,
                eventList, true);

        ListSelectionDialog selectionDialog = null;
        if (filtered) {
            FilterListSelectionDialog filterDialog = new FilterListSelectionDialog("", null, new FilterList(eventList));
            if (filterProperties == null) {
                filterDialog.setFilterator(new StringTextFilterator());
            } else {
                filterDialog.setFilterator(new BeanTextFilterator(filterProperties));
            }

            selectionDialog = filterDialog;
        } else {
            selectionDialog = new ListSelectionDialog("", null, eventList);
        }

        selectionDialog.setOnAboutToShow(new Block() {
            protected void handle(Object ignore) {
                itemRefresher.synchronize();
            }
        });

        selectionDialog.setOnSelectAction(new Closure() {
            public Object call(Object argument) {
                controlValueChanged(argument);
                selectField.setValue(argument);

                return argument;
            }
        });
        selectionDialog.setRenderer(getRendererForSelectionDialog());

        if (StringUtils.hasText(descriptionKey)) {
            String description = getMessage(descriptionKey);
            selectionDialog.setDescription(description);
        }
        if (StringUtils.hasText(titleKey)) {
            String title = getMessage(titleKey);
            selectionDialog.setTitle(title);
        }

        return selectionDialog;
    }
View Full Code Here

Examples of org.springframework.richclient.selection.dialog.ListSelectionDialog

   */
  @Nullable
  public static <T> T userSelect( @NotNull List<? extends T> values, @NotNull @NonNls String titleKey, @NotNull DefaultLabelProvider<? super T> labelProvider ) throws CanceledException {
    final Object[] selected = new Object[]{null};

    ListSelectionDialog dialog = new ListSelectionDialog( SpringSupport.INSTANCE.getMessage( titleKey ), values ) {
      @Override
      protected void onSelect( Object selection ) {
        selected[0] = selection;
      }
    };

    dialog.setRenderer( new LabelProviderListCellRenderer( labelProvider ) );
    dialog.showDialog();

    if ( selected[0] == null ) {
      throw new CanceledException();
    }

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.