Examples of IStructuredSelection


Examples of org.eclipse.jface.viewers.IStructuredSelection

  }

  public void selectionChanged(IAction action, ISelection selection) {
    action.setEnabled(false);
    if (selection != null && selection instanceof IStructuredSelection) {
      IStructuredSelection structSelection = (IStructuredSelection) selection;
      Object selectedElement = structSelection.getFirstElement();   
        if (selectedElement instanceof IFolder) {
          IFolder folder = (IFolder)selectedElement;
          if(WGADesignStructureHelper.isDirlinkFolder(folder)){
            _selectedFodler = folder;
            action.setEnabled(true);
View Full Code Here

Examples of org.eclipse.jface.viewers.IStructuredSelection

          @Override
          public void selectionChanged(ISelection selection) {             
            super.selectionChanged(selection);
            boolean enabled = true;
            if (selection instanceof IStructuredSelection) {
              IStructuredSelection structSelection = (IStructuredSelection) selection;
              Object selectedElement = structSelection.getFirstElement();
              if (selectedElement instanceof ISynchronizeModelElement) {
                if ((((ISynchronizeModelElement)selectedElement).getKind() & SyncInfo.CONFLICTING) == SyncInfo.CONFLICTING) {
                  enabled = false;                  
                }
              }
View Full Code Here

Examples of org.eclipse.jface.viewers.IStructuredSelection

 
  private void handleExportWebApplication() {
      if (_tblWebApplications.getTable().getSelectionCount() > 0) {
            try {
                WebApplication app = _webAppModel.getBeans().get(_tblWebApplications.getTable().getSelectionIndex());
                IStructuredSelection selection = new SingleStructuredSelection(app);
                WorkbenchUtils.openWizard(WGADesignerPlugin.getDefault().getWorkbench(), ResourceIDs.WIZARD_EXPORT_WGAAPPLICATION, selection);             
            } catch (Exception e) {
                WorkbenchUtils.showErrorDialog(WGADesignerPlugin.getDefault(), getSite().getShell(), "Unable to open export wizard for web application", e);
            }
        } else {
View Full Code Here

Examples of org.eclipse.jface.viewers.IStructuredSelection

          fContentProvider.refreshCache(new IMark[] { mark }, false);
      }

      @Override
      protected void runInUI(IProgressMonitor monitor) {
        IStructuredSelection oldSelection = null;
        Object value = fgSelectionCache.get(fInput.hashCode());
        if (value != null)
          oldSelection = new StructuredSelection(value);

        /* Set input to News-Table if Visible */
        if (!fBgMonitor.isCanceled() && isTableViewerVisible())
          stableSetInputToNewsTable(mark, oldSelection);

        /* Clear old Input from Table */
        else if (!fBgMonitor.isCanceled() && reused)
          fNewsTableControl.setPartInput(null);

        /* Set input to News-Browser if visible */
        if (!fBgMonitor.isCanceled() && (!isTableViewerVisible() || (BROWSER_SHOWS_ALL && oldSelection == null)))
          fNewsBrowserControl.setPartInput(mark);

        /* Reset old Input to Browser if availabel */
        else if (!fBgMonitor.isCanceled() && oldSelection != null)
          fNewsBrowserControl.setPartInput(oldSelection.getFirstElement());

        /* Clear old Input from Browser */
        else if (!fBgMonitor.isCanceled() && reused)
          fNewsBrowserControl.setPartInput(null);

View Full Code Here

Examples of org.eclipse.jface.viewers.IStructuredSelection

      tree.getParent().setRedraw(true);
    }
  }

  private void rememberSelection() {
    IStructuredSelection sel = (IStructuredSelection) fNewsTableControl.getViewer().getSelection();
    if (!sel.isEmpty()) {
      Object obj = sel.getFirstElement();
      if (obj instanceof INews)
        fgSelectionCache.put(fInput.hashCode(), new NewsReference(((INews) obj).getId()));
      else
        fgSelectionCache.remove(fInput.hashCode());
    }
View Full Code Here

Examples of org.eclipse.jface.viewers.IStructuredSelection

    fFolderViewer.setLabelProvider(new BookMarkLabelProvider());
    fFolderViewer.setInput(new Object());

    fFolderViewer.addSelectionChangedListener(new ISelectionChangedListener() {
      public void selectionChanged(SelectionChangedEvent event) {
        IStructuredSelection selection = (IStructuredSelection) event.getSelection();
        if (!selection.isEmpty())
          onFolderSelected((IFolder) selection.getFirstElement());
      }
    });

    fFolderViewer.addDoubleClickListener(new IDoubleClickListener() {
      public void doubleClick(DoubleClickEvent event) {
        IStructuredSelection selection = (IStructuredSelection) event.getSelection();
        IFolder folder = (IFolder) selection.getFirstElement();

        /* Expand / Collapse Folder */
        if (!folder.getFolders().isEmpty()) {
          boolean expandedState = !fFolderViewer.getExpandedState(folder);
          fFolderViewer.setExpandedState(folder, expandedState);
View Full Code Here

Examples of org.eclipse.jface.viewers.IStructuredSelection

    /* Make sure Folder-List is visible */
    if (((GridData) fFolderViewerContainer.getLayoutData()).exclude)
      onToggle();

    /* Create new Folder */
    IStructuredSelection selection = (IStructuredSelection) fFolderViewer.getSelection();
    NewFolderAction action = new NewFolderAction(fFolderViewer.getTree().getShell(), (IFolder) selection.getFirstElement(), null);
    action.run(null);
  }
View Full Code Here

Examples of org.eclipse.jface.viewers.IStructuredSelection

    });
  }

  private void updateSelectionAfterDelete(Runnable runnable) {
    Tree tree = (Tree) getControl();
    IStructuredSelection selection = (IStructuredSelection) getSelection();

    /* Nothing to do, since no selection */
    if (selection.isEmpty()) {
      runnable.run();
      return;
    }

    /* Look for the minimal Index of all selected Elements */
    int minSelectedIndex = Integer.MAX_VALUE;
    TreeItemAdapter parentOfMinSelected = new TreeItemAdapter(tree);

    /* For each selected Element */
    Object[] selectedElements = selection.toArray();
    for (Object selectedElement : selectedElements) {
      Widget widget = findItem(selectedElement);
      if (widget instanceof TreeItem) {
        TreeItem item = (TreeItem) widget;
        TreeItemAdapter parent = new TreeItemAdapter(item).getParent();
View Full Code Here

Examples of org.eclipse.jface.viewers.IStructuredSelection

        /* Only Track selections from the HeadlineControl */
        if (!part.equals(fEditorSite.getPart()))
          return;

        IStructuredSelection selection = (IStructuredSelection) sel;

        /* Restore Initial Input if selection is empty */
        if (selection.isEmpty())
          fViewer.setInput(fInitialInput);

        /* Set Elements as Input if 1 Item is selected */
        else if (selection.size() == 1)
          setPartInput(selection.getFirstElement());
      }
    };
    fEditorSite.getPage().addPostSelectionListener(fSelectionListener);

    /* Send Browser-Status to Workbench-Status */
 
View Full Code Here

Examples of org.eclipse.jface.viewers.IStructuredSelection

    }
    fViewer.getTree().setFocus();
  }

  private void onEdit() {
    IStructuredSelection selection = (IStructuredSelection) fViewer.getSelection();
    if (!selection.isEmpty()) {
      ILabel label = (ILabel) selection.getFirstElement();
      LabelDialog dialog = new LabelDialog(getShell(), DialogMode.EDIT, label);
      if (dialog.open() == IDialogConstants.OK_ID) {
        boolean changed = false;
        String name = dialog.getName();
        RGB color = dialog.getColor();
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.