示例#1
0
  protected void initializeViewer() {
    Object[] elems = fSelection.toArray();
    ArrayList checked = new ArrayList(elems.length);

    for (int i = 0; i < elems.length; i++) {
      Object elem = elems[i];
      IProject project = null;

      if (elem instanceof IFile) {
        IFile file = (IFile) elem;
        project = file.getProject();
      } else if (elem instanceof IProject) {
        project = (IProject) elem;
      } else if (elem instanceof IJavaProject) {
        project = ((IJavaProject) elem).getProject();
      }
      if (project != null) {
        IModel model = findModelFor(project);
        if (model != null && !checked.contains(model)) {
          checked.add(model);
        }
      }
    }
    fExportPart.setSelection(checked.toArray());
    if (checked.size() > 0) fExportPart.getTableViewer().reveal(checked.get(0));
  }
 private void handleDelete() {
   IStructuredSelection ssel = (IStructuredSelection) fPluginTable.getSelection();
   if (ssel.size() > 0) {
     Object[] objects = ssel.toArray();
     IProductPlugin[] plugins = new IProductPlugin[objects.length];
     System.arraycopy(objects, 0, plugins, 0, objects.length);
     getProduct().removePlugins(plugins);
     updateRemoveButtons(true, true);
   }
 }
 private void handleProperties() {
   IStructuredSelection ssel = (IStructuredSelection) fPluginTable.getSelection();
   if (ssel.size() == 1) {
     IProductPlugin plugin = (IProductPlugin) ssel.toArray()[0];
     VersionDialog dialog =
         new VersionDialog(PDEPlugin.getActiveWorkbenchShell(), isEditable(), plugin.getVersion());
     dialog.create();
     SWTUtil.setDialogSize(dialog, 400, 200);
     if (dialog.open() == Window.OK) {
       plugin.setVersion(dialog.getVersion());
     }
   }
 }
示例#4
0
 @Override
 public Object execute(ExecutionEvent event) throws ExecutionException {
   IWorkbenchPart part = HandlerUtil.getActivePartChecked(event);
   ISelection selection = HandlerUtil.getCurrentSelectionChecked(event);
   if (part instanceof MarketDataView && selection instanceof IStructuredSelection) {
     MarketDataView view = (MarketDataView) part;
     IStructuredSelection sselection = (IStructuredSelection) selection;
     StringBuilder builder = new StringBuilder();
     for (Object obj : sselection.toArray()) {
       if (obj instanceof MarketDataViewItem) {
         MarketDataViewItem item = (MarketDataViewItem) obj;
         builder.append(item);
         builder.append(System.getProperty("line.separator")); // $NON-NLS-1$
       }
     }
     view.getClipboard()
         .setContents(
             new Object[] {builder.toString()}, new Transfer[] {TextTransfer.getInstance()});
   }
   return null;
 }