Exemple #1
0
  public static PaletteController getPalette(Lookup lookup) {
    if (null == palette) {
      paletteRoot = new CasaPaletteRootNode(new CasaPaletteCategoryChildren(lookup), lookup);
      paletteRoot.setName(CASA_PALETTE_ROOT);
      palette = PaletteFactory.createPalette(paletteRoot, new MyPaletteActions());

      disableCreateCategoryAction((Node) palette.getRoot().lookup(Node.class));
    }
    return palette;
  }
  @MimeRegistration(mimeType = "text/x-java", service = PaletteController.class)
  public static PaletteController createPalette() {
    try {
      if (null == palette) {
        return PaletteFactory.createPalette(
            // Folder:
            "JavaPalette",
            // Palette Actions:
            new PaletteActions() {
              @Override
              public Action[] getImportActions() {
                return null;
              }

              @Override
              public Action[] getCustomPaletteActions() {
                return null;
              }

              @Override
              public Action[] getCustomCategoryActions(Lookup lkp) {
                return null;
              }

              @Override
              public Action[] getCustomItemActions(Lookup lkp) {
                return null;
              }

              @Override
              public Action getPreferredAction(Lookup lkp) {
                return null;
              }
            },
            // Palette Filter:
            null,
            // Drag and Drop Handler:
            new DragAndDropHandler(true) {
              @Override
              public void customize(ExTransferable et, Lookup lkp) {}
            });
      }
    } catch (IOException ex) {
      Exceptions.printStackTrace(ex);
    }
    return null;
  }