コード例 #1
0
public class NewTaskPlugIn extends AbstractPlugIn {
  public NewTaskPlugIn() {
    this.setShortcutKeys(KeyEvent.VK_N);
    this.setShortcutModifiers(KeyEvent.CTRL_MASK);
  }

  public boolean execute(PlugInContext context) throws Exception {
    reportNothingToUndoYet(context);
    context.getWorkbenchFrame().addTaskFrame();

    return true;
  }
  // [sstein 26.08.2006] added for toolbar
  public static MultiEnableCheck createEnableCheck(final WorkbenchContext workbenchContext) {
    return new MultiEnableCheck();
  }

  ImageIcon icon16 = IconLoader.icon("page_oj_16.v2.png");
  ImageIcon icon20 = IconLoader.icon("page_oj_20.v3.png");

  // [sstein 26.08.2006] added for toolbar
  public ImageIcon getIcon(int size) {
    return (size > 16) ? icon20 : icon16;
  }
}
コード例 #2
0
ファイル: UndoPlugIn.java プロジェクト: eric-lemesre/openjump
public class UndoPlugIn extends AbstractPlugIn {
  private MultiEnableCheck check =
      new MultiEnableCheck()
          .add(EnableCheckFactory.getInstance().createWindowWithLayerManagerMustBeActiveCheck())
          .add(
              new EnableCheck() {
                public String check(JComponent component) {
                  UndoManager undoManager =
                      ((LayerManagerProxy)
                              JUMPWorkbench.getInstance().getFrame().getActiveInternalFrame())
                          .getLayerManager()
                          .getUndoableEditReceiver()
                          .getUndoManager();
                  if (component != null)
                    component.setToolTipText(undoManager.getUndoPresentationName());
                  return (!undoManager.canUndo())
                      ? I18N.get(
                          "com.vividsolutions.jump.workbench.ui.plugin.UndoPlugIn.nothing-to-undo")
                      : null;
                }
              });

  private ImageIcon icon = IconLoader.icon("Undo.gif");

  public UndoPlugIn() {
    this.setShortcutKeys(KeyEvent.VK_Z);
    this.setShortcutModifiers(KeyEvent.CTRL_MASK);
  }

  public boolean execute(PlugInContext context) throws Exception {
    ((LayerManagerProxy)
            context.getWorkbenchContext().getWorkbench().getFrame().getActiveInternalFrame())
        .getLayerManager()
        .getUndoableEditReceiver()
        .getUndoManager()
        .undo();
    // Exclude the plug-in's activity from the undo history [Jon Aquino]
    reportNothingToUndoYet(context);
    context.getWorkbenchFrame().getToolBar().updateEnabledState();
    return true;
  }

  public MultiEnableCheck createEnableCheck(final WorkbenchContext workbenchContext) {
    return check;
  }

  public ImageIcon getIcon() {
    return icon;
  }
}
コード例 #3
0
public class BeanShellPlugIn extends ToolboxPlugIn {

  private static final String sName =
      I18N.get("com.vividsolutions.jump.workbench.ui.plugin.BeanShellPlugIn.BeanShell-Console");
  private static final ImageIcon icon = IconLoader.icon("famfam/application_bean.png");

  public void initialize(PlugInContext context) throws Exception {
    // [Michael Michaud 2007-03-23]
    // Moves MenuNames.TOOLS/MenuNames.TOOLS_PROGRAMMING to MenuNames.CUSTOMIZE
    createMainMenuItem(new String[] {MenuNames.CUSTOMIZE}, null, context.getWorkbenchContext());
  }

  public String getName() {
    // [Michael Michaud 2007-03-23] Rename BeanShell to BeanShell Console to
    // differentiate
    // from BeanShell scripts menus
    return sName;
  }

  protected void initializeToolbox(ToolboxDialog toolbox) {
    try {
      toolbox.setIconImage(icon.getImage());
      final JConsole console = new JConsole();
      console.setPreferredSize(new Dimension(430, 240));
      console.print(
          I18N.get("ui.plugin.BeanShellPlugIn.the-workbenchcontext-may-be-referred-to-as-wc"));
      console.print(
          I18N.get(
              "ui.plugin.BeanShellPlugIn.warning-pasting-in-multiple-statements-may-cause-the-application-to-freeze"));
      toolbox.getCenterPanel().add(console, BorderLayout.CENTER);
      Interpreter interpreter = new Interpreter(console);
      interpreter.setClassLoader(
          toolbox.getContext().getWorkbench().getPlugInManager().getClassLoader());
      interpreter.set("wc", toolbox.getContext());
      interpreter.eval("setAccessibility(true)");
      interpreter.eval("import com.vividsolutions.jts.geom.*");
      interpreter.eval("import com.vividsolutions.jump.feature.*");
      new Thread(interpreter).start();
    } catch (EvalError e) {
      toolbox.getContext().getErrorHandler().handleThrowable(e);
    }
  }

  public static Icon getIcon() {
    return icon;
  }
}
コード例 #4
0
 public ImageIcon getIcon() {
   return IconLoader.icon("World.gif");
 }
コード例 #5
0
ファイル: UndoPlugIn.java プロジェクト: fearus/newmotorbac
 public ImageIcon getIcon() {
   return IconLoader.icon("Undo.gif");
 }