⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 descriptioncelleditor.java

📁 这是java编写的一个开发例子,很值得参考!!!!!!!!!!!!!!!!
💻 JAVA
字号:
/*******************************************************************************
 * Copyright (c) 2004 Berthold Daum. All rights reserved. This program and the
 * accompanying materials are made available under the terms of the Common
 * Public License v1.0 which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors: Berthold Daum
 ******************************************************************************/
package com.bdaum.jukebox;

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.DialogCellEditor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;

/**
 * @author Berthold Daum
 * 
 * Creation date: 02.10.2003
 *  
 */
public class DescriptionCellEditor extends DialogCellEditor {

  // The playlist domain model
  IPlaylist playlistModel;

  /**
   * Constructor.
   * 
   * @param parent
   *        Containing Composite
   * @param playlistModel
   *        The playlist domain model
   */
  public DescriptionCellEditor(Composite parent,
                  IPlaylist playlistModel) {
    super(parent);
    // Save parameters
    this.playlistModel = playlistModel;
  }

  /**
   * Opens the window for description editing
   * @see org.eclipse.jface.viewers.DialogCellEditor#
   *      openDialogBox(org.eclipse.swt.widgets.Control)
   */
  protected Object openDialogBox(Control cellEditorWindow) {
    // Create new DescriptionEditorDialog instance
    DescriptionEditorDialog dialog = new DescriptionEditorDialog(
                    cellEditorWindow.getShell(), playlistModel);
    // Create the dialogs GUI-elements
    dialog.create();
    // Initialize with current cell content
    dialog.setText((String) getValue());
    if (dialog.open() == Dialog.OK) {
      // Indicate that value is valid
      setValueValid(true);
      // Return new text
      return dialog.getText();
    }
    return null;
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -