private void executeInjection() {
   if (this.modello == null) {
     this.modello = Lookup.getDefault().lookup(Modello.class);
   }
   if (this.viewTransformationAction == null) {
     this.viewTransformationAction =
         Lookups.forPath("Azione").lookup(ActionViewTransformation.class);
   }
   if (this.actionViewInstances == null) {
     this.actionViewInstances = Lookups.forPath("Azione").lookup(ActionViewInstances.class);
   }
 }
  public static synchronized JContextTree getContextTree() {
    if (tree == null) {
      final JContextTree tree = new JContextTree();

      // search available popup menu items
      Lookup lk = Lookups.forPath("/Puzzle/ContextTree/Actions");
      for (TreePopupItem item : lk.lookupAll(TreePopupItem.class)) {
        tree.controls().add(item);
      }

      final List<PropertyPane> configPanes = new ArrayList<PropertyPane>();

      JPropertyTree propertyTree = new JPropertyTree();

      DefaultMutableTreeNode root = new DefaultMutableTreeNode();

      // search available property panels
      lk = Lookups.forPath("/Puzzle/ContextTree/PropertyPanels");
      for (PropertyPane p : lk.lookupAll(PropertyPane.class)) {
        root.add(new DefaultMutableTreeNode(p));
      }

      // search filter panels
      DefaultMutableTreeNode filterNodes =
          new DefaultMutableTreeNode(CoreResource.getString("filter"));
      lk = Lookups.forPath("/Puzzle/ContextTree/FilterPanels");
      for (PropertyPane p : lk.lookupAll(PropertyPane.class)) {
        filterNodes.add(new DefaultMutableTreeNode(p));
      }
      root.add(filterNodes);

      // search style panels
      DefaultMutableTreeNode styleNodes =
          new DefaultMutableTreeNode(CoreResource.getString("symbology"));
      lk = Lookups.forPath("/Puzzle/ContextTree/StylePanels");
      for (PropertyPane p : lk.lookupAll(PropertyPane.class)) {
        styleNodes.add(new DefaultMutableTreeNode(p));
      }
      root.add(styleNodes);

      if (!tree.controls().isEmpty()) {
        tree.controls().add(new SeparatorItem());
      }

      LayerPropertyItem property = new LayerPropertyItem(root);
      tree.controls().add(property);

      tree.revalidate();
      tree.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
      ContextTreeTopComponent.tree = tree;
    }
    return tree;
  }
Пример #3
0
 private void executeInjection() {
   if (this.modello == null) {
     this.modello = Lookup.getDefault().lookup(Modello.class);
   }
   if (this.actionViewSpicy == null) {
     this.actionViewSpicy = Lookups.forPath("Azione").lookup(ActionViewSpicy.class);
   }
   if (this.actionViewBestMappings == null) {
     this.actionViewBestMappings = Lookups.forPath("Azione").lookup(ActionViewBestMappings.class);
   }
   this.mappingFinder =
       (IFindBestMappingsStrategy)
           Application.getInstance().getComponentInstance(IFindBestMappingsStrategy.class);
 }
Пример #4
0
 @Override
 public Action[] getActions(boolean context) {
   List<Action> actions = new ArrayList<>();
   actions.add((Action) OpenAction.findObject(OpenAction.class, true));
   actions.addAll(
       Lookups.forPath(OutlineTopComponent.NODE_ACTIONS_FOLDER).lookupAll(Action.class));
   return actions.toArray(new Action[actions.size()]);
 }
Пример #5
0
 private NamedOption findOption(String name) {
   for (String category :
       Arrays.asList(
           HIGHLIGTING_CATEGORY, HINTS_CATEGORY, MAKE_PROJECT_CATEGORY, OTHER_CATEGORY)) {
     for (NamedOption option : Lookups.forPath(category).lookupAll(NamedOption.class)) {
       if (name.equals(option.getName())) {
         return option;
       }
     }
   }
   for (NamedOption option : Lookup.getDefault().lookupAll(NamedOption.class)) {
     if (name.equals(option.getName())) {
       return option;
     }
   }
   throw new IllegalArgumentException("Not found option " + name); // NOI18N
 }
Пример #6
0
  /**
   * Launches the tool
   *
   * @return true if successful with the class loading
   */
  public ClothoAlgorithm getAlgorithm() {
    // If it's already loaded, return it
    if (_plugin != null) {
      return _plugin;
    }

    try {
      Template<? extends ClothoAlgorithm> t =
          new Template<ClothoAlgorithm>(
              ClothoAlgorithm.class, "plugins/algorithms/" + _classname, null);
      Item<? extends ClothoAlgorithm> result = Lookups.forPath("plugins/algorithms").lookupItem(t);
      _plugin = result.getInstance();
      return _plugin;
    } catch (Exception e) {
      JOptionPane.showMessageDialog(
          null, "Plugin tool loading failed", "Plugin Failure", JOptionPane.ERROR_MESSAGE);
      return null;
    }
  }
  @Override
  protected void setUp() throws Exception {
    super.setUp();

    MockLookup.init();
    Collection<? extends AntBasedProjectType> all =
        Lookups.forPath("Services/AntBasedProjectTypes").lookupAll(AntBasedProjectType.class);
    Iterator<? extends AntBasedProjectType> it = all.iterator();
    AntBasedProjectType t = it.next();
    MockLookup.setInstances(
        t,
        new org.netbeans.modules.java.project.ProjectSourceLevelQueryImpl(),
        new org.netbeans.modules.projectapi.SimpleFileOwnerQueryImplementation(),
        new TestPlatformProvider());
    Properties p = System.getProperties();
    if (p.getProperty("netbeans.user") == null) {
      p.put("netbeans.user", FileUtil.toFile(makeScratchDir(this)).getAbsolutePath());
    }
  }
Пример #8
0
  @Override
  public void restored() {
    Locale.setDefault(Locale.Category.FORMAT, Locale.ENGLISH);
    System.setProperty("jffi.unsafe.disabled", "true");

    //        System.setProperty("netbeans.winsys.no_toolbars", "true");
    //
    //        SwingUtilities.invokeLater(new Runnable() {
    //
    //            @Override
    //            public void run() {
    //                //Get the main window of the NetBeans Platform:
    //                JFrame frame = (JFrame) WindowManager.getDefault().getMainWindow();
    //                //Get our custom main toolbar:
    //                JPanel panel = new JPanel();
    //                panel.setLayout(new FlowLayout(FlowLayout.CENTER));
    //                panel.add(new blue.ui.core.toolbar.MainToolBar(), BorderLayout.CENTER);
    //                panel.setPreferredSize(new Dimension(100, 70));
    //
    //                //Set the new layout of our root pane:
    //                frame.getRootPane().setLayout(new MyRootPaneLayout(panel));
    //                //Install a new toolbar component into the layered pane
    //                //of the main frame on layer 0:
    //                panel.putClientProperty(JLayeredPane.LAYER_PROPERTY, 0);
    //                frame.getRootPane().getLayeredPane().add(panel, 0);
    //            }
    //        });
    ParameterTimeManagerFactory.setInstance(new ParameterTimeManagerImpl());

    windowTitlePropertyChangeListener =
        (PropertyChangeEvent evt) -> {
          SwingUtilities.invokeLater(
              () -> {
                if (WindowManager.getDefault().getMainWindow() != null) {
                  setWindowTitle();
                }
              });
        };

    BlueProjectManager.getInstance().addPropertyChangeListener(windowTitlePropertyChangeListener);
    BlueProjectManager.getInstance().addPropertyChangeListener(tempFileCleaner);

    WindowManager.getDefault()
        .invokeWhenUIReady(
            () -> {
              setWindowTitle();
              backupFileSaver = new BackupFileSaver();
              Thread t = new Thread(backupFileSaver);
              t.setPriority(Thread.MIN_PRIORITY);
              t.setDaemon(true);
              t.start();
            });

    PythonProxy.setLibDir(InstalledFileLocator.getDefault().locate("pythonLib", "jython", false));

    //        WindowManager.getDefault().invokeWhenUIReady(new Runnable() {
    //
    //            public void run() {
    //
    //                new Thread() {
    //
    //                    public void run() {
    //
    //                        ProgressHandle handle =
    // ProgressHandleFactory.createHandle("Initializing Python Interpreter...");
    //                        handle.start();
    //                        handle.progress("Initializing...");
    //
    //                        try {
    //                            PythonProxy.reinitialize();
    //                            PythonProxy.processScript("import random");
    //                        } catch (Exception e) {
    //
    //                        }
    //
    //                        handle.finish();
    //                    }
    //
    //                }.start();
    //            }
    //        });
    SwingUtilities.invokeLater(
        () -> {
          MidiInputManager.getInstance().addReceiver(MidiInputEngine.getInstance());
        });

    OSCManager oscManager = OSCManager.getInstance();
    OSCActions.installActions(oscManager);
    oscManager.start();

    Lookup lkp = Lookups.forPath("blue/score/layers");
    result = lkp.lookupResult(LayerGroupProvider.class);
    result.addLookupListener(lookupListener);

    LayerGroupProviderManager.getInstance().updateProviders(result.allInstances());

    lookupListener =
        (LookupEvent ev) -> {
          LayerGroupProviderManager.getInstance().updateProviders(result.allInstances());
        };

    //        for(LayerGroupPanelProvider provider : lkp.lookupAll(
    //                LayerGroupPanelProvider.class)) {
    //            JComponent comp = provider.getLayerGroupPanel(layerGroup, timeState, data);
    //
    //            if(comp != null) {
    //                return comp;
    //            }
    //        }

    Platform.setImplicitExit(false);
    // Initialize JavaFX by using this call
    new JFXPanel();
    //        Platform.runLater(()
    //                -> jfxPanel.setScene(new Scene(new Group())));

    //        FileChooserManager.getDefault().setJFXPanel(jfxPanel);
    //        WindowManager.getDefault().invokeWhenUIReady(()
    //                -> WindowManager.getDefault().getMainWindow().add(jfxPanel));
  }