org.eclipse.swt.widgets.Tree.getShell()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(11.5k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中org.eclipse.swt.widgets.Tree.getShell()方法的一些代码示例,展示了Tree.getShell()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tree.getShell()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Tree
类名称:Tree
方法名:getShell

Tree.getShell介绍

暂无

代码示例

代码示例来源:origin: org.eclipse/org.eclipse.ui.navigator

/**
 * Saves the changes and disposes of the text widget.
 * 
 * @param runnable
 *            Runnable to execute
 */
void saveChangesAndDispose(final Runnable runnable) {
  final String newText = textEditor.getText();
  // Run this in an async to make sure that the operation that triggered
  // this action is completed. Otherwise this leads to problems when the
  // icon of the item being renamed is clicked (i.e., which causes the rename
  // text widget to lose focus and trigger this method).
  Runnable editRunnable = new Runnable() {
    public void run() {
      disposeTextWidget();
      if (newText.length() > 0 && newText.equals(text) == false) {
        text = newText;
        runnable.run();
      }
      text = null;
    }
  };
  navigatorTree.getShell().getDisplay().asyncExec(editRunnable);
}

代码示例来源:origin: org.eclipse.ui.views/log

private void doDeleteLog() {
  String title = Messages.LogView_confirmDelete_title;
  String message = Messages.LogView_confirmDelete_message;
  if (!MessageDialog.openConfirm(fTree.getShell(), title, message))
    return;
  if (fInputFile.delete() || elements.size() > 0) {
    handleClear();
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.pde.runtime

private void doDeleteLog() {
  String title = PDERuntimeMessages.LogView_confirmDelete_title; 
  String message = PDERuntimeMessages.LogView_confirmDelete_message; 
  if (!MessageDialog.openConfirm(fTree.getShell(), title, message))
    return;
  if (fInputFile.delete() || fLogs.size() > 0) {
    fLogs.clear();
    asyncRefresh(false);
    resetDialogButtons();
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.wst.server.ui

getTree().getShell().getDisplay().asyncExec(new Runnable() {
  public void run() {
    try {

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

@Override
  public void handleEvent(Event event) {
    Widget focusElement= event.widget;
    boolean isFocusBreadcrumbTreeFocusWidget= focusElement == shell || focusElement instanceof Tree && ((Tree)focusElement).getShell() == shell;
    boolean isFocusWidgetParentShell= focusElement instanceof Control && ((Control)focusElement).getShell().getParent() == shell;
    switch (event.type) {
      case SWT.FocusIn:
        if (JavaPlugin.DEBUG_BREADCRUMB_ITEM_DROP_DOWN)
          System.out.println("focusIn - is breadcrumb tree: " + isFocusBreadcrumbTreeFocusWidget); //$NON-NLS-1$
        if (!isFocusBreadcrumbTreeFocusWidget && !isFocusWidgetParentShell) {
          if (JavaPlugin.DEBUG_BREADCRUMB_ITEM_DROP_DOWN)
            System.out.println("==> closing shell since focus in other widget"); //$NON-NLS-1$
          shell.close();
        }
        break;
      case SWT.FocusOut:
        if (JavaPlugin.DEBUG_BREADCRUMB_ITEM_DROP_DOWN)
          System.out.println("focusOut - is breadcrumb tree: " + isFocusBreadcrumbTreeFocusWidget); //$NON-NLS-1$
        if (event.display.getActiveShell() == null) {
          if (JavaPlugin.DEBUG_BREADCRUMB_ITEM_DROP_DOWN)
            System.out.println("==> closing shell since event.display.getActiveShell() == null"); //$NON-NLS-1$
          shell.close();
        }
        break;
      default:
        Assert.isTrue(false);
    }
  }
};

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
  public void handleEvent(Event event) {
    Widget focusElement= event.widget;
    boolean isFocusBreadcrumbTreeFocusWidget= focusElement == shell || focusElement instanceof Tree && ((Tree)focusElement).getShell() == shell;
    boolean isFocusWidgetParentShell= focusElement instanceof Control && ((Control)focusElement).getShell().getParent() == shell;
    switch (event.type) {
      case SWT.FocusIn:
        if (JavaPlugin.DEBUG_BREADCRUMB_ITEM_DROP_DOWN)
          System.out.println("focusIn - is breadcrumb tree: " + isFocusBreadcrumbTreeFocusWidget); //$NON-NLS-1$
        if (!isFocusBreadcrumbTreeFocusWidget && !isFocusWidgetParentShell) {
          if (JavaPlugin.DEBUG_BREADCRUMB_ITEM_DROP_DOWN)
            System.out.println("==> closing shell since focus in other widget"); //$NON-NLS-1$
          shell.close();
        }
        break;
      case SWT.FocusOut:
        if (JavaPlugin.DEBUG_BREADCRUMB_ITEM_DROP_DOWN)
          System.out.println("focusOut - is breadcrumb tree: " + isFocusBreadcrumbTreeFocusWidget); //$NON-NLS-1$
        if (event.display.getActiveShell() == null) {
          if (JavaPlugin.DEBUG_BREADCRUMB_ITEM_DROP_DOWN)
            System.out.println("==> closing shell since event.display.getActiveShell() == null"); //$NON-NLS-1$
          shell.close();
        }
        break;
      default:
        Assert.isTrue(false);
    }
  }
};

代码示例来源:origin: org.eclipse/org.eclipse.pde.runtime

private void makeHoverShell() {
  fTextShell = new Shell(fTree.getShell(), SWT.NO_FOCUS | SWT.ON_TOP | SWT.TOOL);
  Display display = fTextShell.getDisplay();
  fTextShell.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
  GridLayout layout = new GridLayout(1, false);
  int border = ((fTree.getShell().getStyle() & SWT.NO_TRIM) == 0) ? 0 : 1;
  layout.marginHeight = border;
  layout.marginWidth = border;

代码示例来源:origin: org.eclipse/org.eclipse.pde.runtime

private void createPropertiesAction() {
  fPropertiesAction = new EventDetailsDialogAction(fTree.getShell(), fTreeViewer);
  fPropertiesAction.setImageDescriptor(PDERuntimePluginImages.DESC_PROPERTIES);
  fPropertiesAction.setDisabledImageDescriptor(PDERuntimePluginImages.DESC_PROPERTIES_DISABLED);
  fPropertiesAction.setToolTipText(PDERuntimeMessages.LogView_properties_tooltip); 
  fPropertiesAction.setEnabled(false);
}

代码示例来源:origin: org.eclipse/org.eclipse.datatools.connectivity.ui.dse

/**
 * @see org.eclipse.jface.action.IAction#run()
 */
public void run() {
  failedConnection = false;
  ConnectAction connectAction = new ConnectAction(mViewer.getTree().getShell());
  connectAction.selectionChanged(this, this.getSelection());
  connectAction.run(this);
}

代码示例来源:origin: org.eclipse.ui.views/log

fTextShell.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
GridLayout layout = new GridLayout(1, false);
int border = ((fTree.getShell().getStyle() & SWT.NO_TRIM) == 0) ? 0 : 1;
layout.marginHeight = border;
layout.marginWidth = border;

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

private void handleNewBundle() {
  final Control control = fCategoryViewer.getControl();
  BusyIndicator.showWhile(control.getDisplay(), () -> {
    IPluginModelBase[] allModels = PluginRegistry.getAllModels();
    ArrayList<IPluginModelBase> newModels = new ArrayList<>();
    for (IPluginModelBase allModel : allModels) {
      if (canAdd(allModel))
        newModels.add(allModel);
    }
    IPluginModelBase[] candidateModels = newModels.toArray(new IPluginModelBase[newModels.size()]);
    PluginSelectionDialog dialog = new PluginSelectionDialog(fCategoryViewer.getTree().getShell(), candidateModels, true);
    if (dialog.open() == Window.OK) {
      Object[] models = dialog.getResult();
      try {
        doAddBundles(models);
      } catch (CoreException e) {
        PDEPlugin.log(e);
      }
    }
  });
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

private void handleNewFeature() {
  final Control control = fCategoryViewer.getControl();
  BusyIndicator.showWhile(control.getDisplay(), () -> {
    IFeatureModel[] allModels = PDECore.getDefault().getFeatureModelManager().getModels();
    ArrayList<IFeatureModel> newModels = new ArrayList<>();
    for (IFeatureModel allModel : allModels) {
      if (canAdd(allModel))
        newModels.add(allModel);
    }
    IFeatureModel[] candidateModels = newModels.toArray(new IFeatureModel[newModels.size()]);
    FeatureSelectionDialog dialog = new FeatureSelectionDialog(fCategoryViewer.getTree().getShell(), candidateModels, true);
    if (dialog.open() == Window.OK) {
      Object[] models = dialog.getResult();
      try {
        doAdd(models);
      } catch (CoreException e) {
        PDEPlugin.log(e);
      }
    }
  });
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.ws.consumption.ui

public WidgetDataEvents addControls( Composite parent, Listener statusListener )
{
  this.statusListener = statusListener;
 parent.setToolTipText(ConsumptionUIMessages.TOOLTIP_PWWS_PAGE);
 PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, pluginId_ + INFOPOP_PWWS_PAGE);
 Label wsdlLabel = new Label(parent, SWT.WRAP);
 wsdlLabel.setText(ConsumptionUIMessages.LABEL_SELECT_WSDL);
 wsdlLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
 tree_ = new Tree(parent, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
 GridData gd = new GridData(GridData.FILL_BOTH);
 gd.heightHint = 200;
 tree_.setLayoutData(gd);
 pageWidth_ = tree_.getShell().getSize().x;
 treeViewer_ = new TreeViewer(tree_);
 treeContentProvider = new TreeContentProvider();
 treeViewer_.setContentProvider(treeContentProvider);
 treeViewer_.setLabelProvider(new TreeLabelProvider());
 treeViewer_.addSelectionChangedListener(
  new ISelectionChangedListener()
  {
   public void selectionChanged(SelectionChangedEvent event)
   {
     handleTreeSelectionChangedEvent(event);
   }
  }
 );
 return this;
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

private void handleNewFeature() {
  final Control control = fCategoryViewer.getControl();
  BusyIndicator.showWhile(control.getDisplay(), () -> {
    IFeatureModel[] allModels = PDECore.getDefault().getFeatureModelManager().getModels();
    ArrayList<IFeatureModel> newModels = new ArrayList<>();
    for (IFeatureModel allModel : allModels) {
      if (canAdd(allModel))
        newModels.add(allModel);
    }
    IFeatureModel[] candidateModels = newModels.toArray(new IFeatureModel[newModels.size()]);
    FeatureSelectionDialog dialog = new FeatureSelectionDialog(fCategoryViewer.getTree().getShell(), candidateModels, true);
    if (dialog.open() == Window.OK) {
      Object[] models = dialog.getResult();
      try {
        doAdd(models);
      } catch (CoreException e) {
        PDEPlugin.log(e);
      }
    }
  });
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

private void handleAdd() {
  AddBundleContainerWizard wizard = new AddBundleContainerWizard(fTarget);
  Shell parent = fTreeViewer.getTree().getShell();
  WizardDialog dialog = new WizardDialog(parent, wizard);
  if (dialog.open() != Window.CANCEL) {
    contentsChanged(false);
    fTreeViewer.refresh();
    updateButtons();
  }
}

代码示例来源:origin: BiglySoftware/BiglyBT

/**
 * Initialize
 */
public SideBarToolTips(SideBar sidebar, Tree tree) {
  this.tree = tree;
  mainShell = tree.getShell();
  tree.addListener(SWT.Dispose, this);
  tree.addListener(SWT.KeyDown, this);
  tree.addListener(SWT.MouseMove, this);
  tree.addListener(SWT.MouseExit, this);
  tree.addListener(SWT.MouseHover, this);
  mainShell.addListener(SWT.Deactivate, this);
  tree.addListener(SWT.Deactivate, this);
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.ws.consumption.ui

public void refreshTreeViewer()
{
  if (webServicesParser != null && webServiceURI != null)
  {
   treeViewer_.refresh();
   Control shell = tree_.getShell();
   if (tree_.getSize().x > pageWidth_ || shell.getSize().x > pageWidth_)
   {
    tree_.setSize(pageWidth_, tree_.getSize().y);
    shell.setSize(pageWidth_, shell.getSize().y);
    shell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    shell.redraw();
   }
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

getTree().getShell().getDisplay().asyncExec(query);

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

IWizard editWizard = editor.getEditWizard(fTarget, location);
    if (editWizard != null) {
      Shell parent = fTreeViewer.getTree().getShell();
      WizardDialog wizard = new WizardDialog(parent, editWizard);
      if (wizard.open() == Window.OK) {
  Shell parent = fTreeViewer.getTree().getShell();
  EditBundleContainerWizard wizard = new EditBundleContainerWizard(fTarget, location);
  WizardDialog dialog = new WizardDialog(parent, wizard);
Shell parent = fTreeViewer.getTree().getShell();
EditBundleContainerWizard editWizard = new EditBundleContainerWizard(fTarget, wrapper.getParent());
WizardDialog wizard = new WizardDialog(parent, editWizard);

代码示例来源:origin: org.xworker/xworker_swt

public static void tableEditAction(ActionContext actionContext){
  //表格中的行
  Event event = (Event) actionContext.get("event");
  World world = World.getInstance();
  TreeItem item = (TreeItem) event.item;
  Tree table = item.getParent();
  //创建编辑窗体
  ActionContext ac = new ActionContext();
  Thing store = (Thing) table.getData("_store");
  ac.put("store", store);
  ac.put("parent", table.getShell());
  Thing editorThing = world.getThing("xworker.app.view.swt.widgets.table.DataObjectGridRowEditor/@shell");
  editorThing.doAction("create", ac);
  ((Thing) ac.get("form")).doAction("setDataObject", ac, UtilMap.toMap("dataObject", item.getData()));
  Shell shell = (Shell) ac.get("shell");
  shell.pack();
  SwtUtils.centerShell(shell);
  shell.open();
}

相关文章

Tree类方法