public EnterpriseCell() {

    this.enterpriseDAO = Lookup.getDefault().lookup(IEnterpriseBN.class);
    this.personDAO = Lookup.getDefault().lookup(IPersonBN.class);
    txtIdE = new JTextField();
    txtLogo = new JTextField();
    txtLogo.addMouseListener(this);
    txtNameE = new JTextField();
    txtSlogan = new JTextField();

    modelEnter = new DefaultComboBoxModel();
    modelEnter.addElement(" ");
    modelPerson = new DefaultComboBoxModel();
    modelPerson.addElement(" ");
    txtIdE.setText(" ");
    txtNameE.setText(" ");

    // Create model for combobox

    List<Enterprise> list = new ArrayList<Enterprise>();
    list = enterpriseDAO.getAllEnterprise();
    for (Enterprise bean : list) {
      modelEnter.addElement(bean);
    }

    List<Person> list1 = new ArrayList<Person>();
    list1 = personDAO.getAllPerson();
    for (Person bean : list1) {
      modelPerson.addElement(bean);
    }

    cboEnterprise = new JComboBox(modelEnter);
    cboPerson = new JComboBox(modelPerson);
  }
  // Initialize the list of ReportModules
  private void initModules() {
    for (TableReportModule module : Lookup.getDefault().lookupAll(TableReportModule.class)) {
      tableModules.add(module);
      modules.add(module);
    }

    for (GeneralReportModule module : Lookup.getDefault().lookupAll(GeneralReportModule.class)) {
      generalModules.add(module);
      modules.add(module);
    }

    for (FileReportModule module : Lookup.getDefault().lookupAll(FileReportModule.class)) {
      fileModules.add(module);
      modules.add(module);
    }

    Collections.sort(
        modules,
        new Comparator<ReportModule>() {
          @Override
          public int compare(ReportModule rm1, ReportModule rm2) {
            return rm1.getName().compareTo(rm2.getName());
          }
        });

    modulesJList.getSelectionModel().addListSelectionListener(this);
    modulesJList.setCellRenderer(new ModuleCellRenderer());
    modulesJList.setListData(modules.toArray(new ReportModule[modules.size()]));
    selectedIndex = 0;
    modulesJList.setSelectedIndex(selectedIndex);
  }
  public void clusterize(final Clusterer clusterer) {
    // Get Graph
    GraphController gc = Lookup.getDefault().lookup(GraphController.class);
    final GraphModel graphModel = gc.getModel();

    // Model
    final ClusteringModel model =
        Lookup.getDefault()
            .lookup(ProjectController.class)
            .getCurrentWorkspace()
            .getLookup()
            .lookup(ClusteringModel.class);

    // LongTask
    LongTask task = null;
    if (clusterer instanceof LongTask) {
      task = (LongTask) clusterer;
    }
    executor.execute(
        task,
        new Runnable() {

          public void run() {
            model.setRunning(true);
            clusterer.execute(graphModel);
            writeColumns(clusterer);
            model.setRunning(false);
          }
        });
  }
  public Export() {
    menu = new JMenu(NbBundle.getMessage(Export.class, "CTL_Export"));

    Lookup.getDefault()
        .lookup(ProjectController.class)
        .addWorkspaceListener(
            new WorkspaceListener() {

              public void initialize(Workspace workspace) {}

              public void select(Workspace workspace) {
                menu.setEnabled(true);
              }

              public void unselect(Workspace workspace) {}

              public void close(Workspace workspace) {}

              public void disable() {
                menu.setEnabled(false);
              }
            });
    boolean enabled =
        Lookup.getDefault().lookup(ProjectController.class).getCurrentWorkspace() != null;
    menu.setEnabled(enabled);
  }
示例#5
0
 private void executeInjection() {
   if (this.modello == null) {
     this.modello = Lookup.getDefault().lookup(Modello.class);
   }
   if (this.vista == null) {
     this.vista = Lookup.getDefault().lookup(Vista.class);
   }
 }
示例#6
0
  public TimelineControllerImpl() {
    listeners = new ArrayList<TimelineModelListener>();

    // Workspace events
    ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
    dynamicController = Lookup.getDefault().lookup(DynamicController.class);

    pc.addWorkspaceListener(
        new WorkspaceListener() {

          @Override
          public void initialize(Workspace workspace) {}

          @Override
          public void select(Workspace workspace) {
            model = workspace.getLookup().lookup(TimelineModelImpl.class);
            if (model == null) {
              model = new TimelineModelImpl(dynamicController.getModel(workspace));
              workspace.add(model);
            }
            attributeModel =
                Lookup.getDefault().lookup(AttributeController.class).getModel(workspace);
            setup();
          }

          @Override
          public void unselect(Workspace workspace) {
            unsetup();
          }

          @Override
          public void close(Workspace workspace) {}

          @Override
          public void disable() {
            model = null;
            attributeModel = null;
            fireTimelineModelEvent(
                new TimelineModelEvent(TimelineModelEvent.EventType.MODEL, null, null));
          }
        });

    if (pc.getCurrentWorkspace() != null) {
      model = pc.getCurrentWorkspace().getLookup().lookup(TimelineModelImpl.class);
      if (model == null) {
        model = new TimelineModelImpl(dynamicController.getModel(pc.getCurrentWorkspace()));
        pc.getCurrentWorkspace().add(model);
      }
      attributeModel =
          Lookup.getDefault().lookup(AttributeController.class).getModel(pc.getCurrentWorkspace());
      setup();
    }
  }
  public void script() {
    // Init a project - and therefore a workspace
    ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
    pc.newProject();
    Workspace workspace = pc.getCurrentWorkspace();

    // Get controllers and models
    ImportController importController = Lookup.getDefault().lookup(ImportController.class);

    // Import file
    Container container;
    try {
      File file =
          new File(
              getClass().getResource("/org/gephi/toolkit/demos/resources/polblogs.gml").toURI());
      container = importController.importFile(file);
      container.getLoader().setEdgeDefault(EdgeDefault.DIRECTED); // Force DIRECTED
      container.setAllowAutoNode(false); // Don't create missing nodes
    } catch (Exception ex) {
      ex.printStackTrace();
      return;
    }

    // Append imported data to GraphAPI
    importController.process(container, new DefaultProcessor(), workspace);

    // List node columns
    AttributeController ac = Lookup.getDefault().lookup(AttributeController.class);
    AttributeModel model = ac.getModel();
    for (AttributeColumn col : model.getNodeTable().getColumns()) {
      System.out.println(col);
    }

    // Add boolean column
    AttributeColumn testCol = model.getNodeTable().addColumn("test", AttributeType.BOOLEAN);

    // Write values to nodes
    GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();
    for (Node n : graphModel.getGraph().getNodes()) {
      n.getNodeData().getAttributes().setValue(testCol.getIndex(), Boolean.TRUE);
    }

    // Iterate values - fastest
    AttributeColumn sourceCol = model.getNodeTable().getColumn("source");
    for (Node n : graphModel.getGraph().getNodes()) {
      System.out.println(n.getNodeData().getAttributes().getValue(sourceCol.getIndex()));
    }

    // Iterate values - normal
    for (Node n : graphModel.getGraph().getNodes()) {
      System.out.println(n.getNodeData().getAttributes().getValue("source"));
    }
  }
  @Override
  public void restored() {
    final Result<Pipe> result = Lookup.getDefault().lookupResult(Pipe.class);
    Lookup.getDefault().lookup(ConfigurationManager.class);
    Lookup.getDefault().lookup(ConfigurationManagerImpl.class).buildPipe(result.allInstances());

    result.addLookupListener(
        new LookupListener() {
          public void resultChanged(LookupEvent le) {
            Lookup.getDefault()
                .lookup(ConfigurationManagerImpl.class)
                .buildPipe(result.allInstances());
          }
        });
  }
示例#9
0
  @Override
  public void process() {
    if (containers.length > 1) {
      throw new RuntimeException("This processor can only handle single containers");
    }
    ContainerUnloader container = containers[0];

    // Workspace
    ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
    if (workspace == null) {
      workspace = pc.newWorkspace(pc.getCurrentProject());
      pc.openWorkspace(workspace);
    }
    processConfiguration(container, workspace);

    if (container.getSource() != null) {
      pc.setSource(workspace, container.getSource());
    }

    process(container, workspace);

    // Clean
    workspace = null;
    graphModel = null;
    containers = null;
    progressTicket = null;
  }
  /**
   * Simulates deadlock issue 133616 - create MultiFileSystem - create lookup to set our
   * MultiFileSystem and system filesystem - create handler to manage threads - put test FileObject
   * to 'potentialLock' set - call hasLocks - it call LocalFileSystemEx.getInvalid which ends in our
   * DeadlockHandler - it starts lockingThread which calls FileObject.lock which locks our
   * FileObject - when we in LocalFileSystemEx.lock, we notify main thread which continues in
   * getInvalid and tries to accuire lock on FileObject and it dead locks
   */
  public void testLocalFileSystemEx133616() throws Exception {
    System.setProperty("workdir", getWorkDirPath());
    clearWorkDir();

    FileSystem lfs =
        TestUtilHid.createLocalFileSystem("mfs1" + getName(), new String[] {"/fold/file1"});
    LocalFileSystemEx exfs = new LocalFileSystemEx();
    exfs.setRootDirectory(FileUtil.toFile(lfs.getRoot()));
    FileSystem xfs = TestUtilHid.createXMLFileSystem(getName(), new String[] {});
    FileSystem mfs = new MultiFileSystem(exfs, xfs);
    testedFS = mfs;
    System.setProperty(
        "org.openide.util.Lookup", LocalFileSystemEx133616Test.class.getName() + "$Lkp");
    Lookup l = Lookup.getDefault();
    if (!(l instanceof Lkp)) {
      fail("Wrong lookup: " + l);
    }

    final FileObject file1FO = mfs.findResource("/fold/file1");
    File file1File = FileUtil.toFile(file1FO);

    Logger.getLogger(LocalFileSystemEx.class.getName()).setLevel(Level.FINEST);
    Logger.getLogger(LocalFileSystemEx.class.getName()).addHandler(new DeadlockHandler(file1FO));
    LocalFileSystemEx.potentialLock(file1FO.getPath());
    LocalFileSystemEx.hasLocks();
  }
示例#11
0
 /**
  * Retrieve the PathManager instance for the given Session, creating one if necessary.
  *
  * @param session Session for which to get PathManager.
  * @return path manager instance.
  */
 public static PathManager getPathManager(Session session) {
   synchronized (mapsLock) {
     PathManager inst = instanceMap.get(session);
     if (inst == null) {
       // Perform lookup to find a PathManager instance.
       PathManager prototype = Lookup.getDefault().lookup(PathManager.class);
       // Using this prototype, construct a new instance for the
       // given Session, rather than sharing the single instance.
       Class<? extends PathManager> protoClass = prototype.getClass();
       try {
         inst = protoClass.newInstance();
       } catch (InstantiationException ie) {
         logger.log(Level.SEVERE, null, ie);
         return null;
       } catch (IllegalAccessException iae) {
         logger.log(Level.SEVERE, null, iae);
         return null;
       }
       instanceMap.put(session, inst);
       reverseMap.put(inst, session);
       if (inst instanceof SessionListener) {
         session.addSessionListener((SessionListener) inst);
       }
     }
     return inst;
   }
 }
 /**
  * Create a scratch directory for tests. Will be in /tmp or whatever, and will be empty. If you
  * just need a java.io.File use clearWorkDir + getWorkDir.
  */
 public static FileObject makeScratchDir(NbTestCase test) throws IOException {
   boolean warned = false;
   test.clearWorkDir();
   File root = test.getWorkDir();
   assert root.isDirectory() && root.list().length == 0;
   FileObject fo = FileUtil.toFileObject(root);
   if (fo != null) {
     return fo;
   } else {
     if (!warned) {
       warned = true;
       System.err.println(
           "No FileObject for "
               + root
               + " found.\n"
               + "Maybe you need ${openide/masterfs.dir}/modules/org-netbeans-modules-masterfs.jar\n"
               + "in test.unit.run.cp.extra, or make sure Lookups.metaInfServices is included in Lookup.default, so that\n"
               + "Lookup.default<URLMapper>="
               + Lookup.getDefault().lookup(new Lookup.Template(URLMapper.class)).allInstances()
               + " includes MasterURLMapper\n"
               + "e.g. by using TestUtil.setLookup(Object[]) rather than TestUtil.setLookup(Lookup).");
     }
     // For the benefit of those not using masterfs.
     LocalFileSystem lfs = new LocalFileSystem();
     try {
       lfs.setRootDirectory(root);
     } catch (PropertyVetoException e) {
       assert false : e;
     }
     Repository.getDefault().addFileSystem(lfs);
     return lfs.getRoot();
   }
 }
 public void select() {
   AttributeController attributeController = Lookup.getDefault().lookup(AttributeController.class);
   attributeController.getModel(workspace).addAttributeListener(this);
   if (!autoRankings.isEmpty()) {
     autoTransformer.start();
   }
 }
示例#14
0
 /** Stores item appropriately in exam */
 public void addItem() {
   DocumentItemApi toAdd = extractItem();
   ExamApi exam = Lookup.getDefault().lookup(ExamApi.class);
   // If adding a question
   if (this instanceof QuestionView) {
     addItemQuestionsView(toAdd);
   }
   // If the DocumentItemView is an InstructionsView
   else if (this instanceof InstructionsView) {
     addItemInstructionsView(toAdd);
   }
   // if isEditView save changes to the exam
   if (isEditView()) {
     exam.replaceItem(item, toAdd);
     TableViewTopComponent tv =
         (TableViewTopComponent)
             WindowManager.getDefault().findTopComponent("TableViewTopComponent");
     // If the table exists, clear the selection status
     if (tv != null) {
       tv.clearSelection();
     }
   }
   // otherwise adds the item to the exam
   else {
     exam.addItem(toAdd);
   }
   setEditView(false);
 }
  private RankingTopComponent() {
    setName(NbBundle.getMessage(RankingTopComponent.class, "CTL_RankingTopComponent"));
    //        setToolTipText(NbBundle.getMessage(RankingTopComponent.class,
    // "HINT_RankingTopComponent"));
    setIcon(ImageUtilities.loadImage(ICON_PATH));

    modelChangeListener =
        new ChangeListener() {

          public void stateChanged(ChangeEvent ce) {
            refreshModel(ce == null ? null : (RankingUIModel) ce.getSource());
          }
        };
    controller = Lookup.getDefault().lookup(RankingUIController.class);
    controller.setModelChangeListener(modelChangeListener);
    model = controller.getModel();

    initComponents();
    initSouth();
    if (UIUtils.isAquaLookAndFeel()) {
      mainPanel.setBackground(UIManager.getColor("NbExplorerView.background"));
    }

    refreshModel(model);
  }
  private static void rescheduleImpl(FileObject file) {
    LazyHintComputationFactory f = Lookup.getDefault().lookup(LazyHintComputationFactory.class);

    if (f != null) {
      f.reschedule(file);
    }
  }
  public void testHttpOpenHandler() throws MalformedURLException {
    LineConvertor convertor = LineConvertors.httpUrl();

    List<ConvertedLine> lines = new ArrayList<ConvertedLine>();
    assertNull(convertor.convert("nourl1"));
    lines.addAll(convertor.convert("NetBeans site: http://www.netbeans.org"));
    lines.addAll(convertor.convert("https://www.netbeans.org"));

    assertEquals(2, lines.size());
    assertEquals("NetBeans site: http://www.netbeans.org", lines.get(0).getText());
    assertEquals("https://www.netbeans.org", lines.get(1).getText());

    for (ConvertedLine line : lines) {
      assertNotNull(line.getListener());
      line.getListener().outputLineAction(null);
    }

    HttpOpenHandler handler = Lookup.getDefault().lookup(HttpOpenHandler.class);
    assertTrue(handler instanceof TestHttpOpenHandler);

    List<URL> opened = ((TestHttpOpenHandler) handler).getOpened();
    assertEquals(2, opened.size());
    assertEquals(new URL("http://www.netbeans.org"), opened.get(0));
    assertEquals(new URL("https://www.netbeans.org"), opened.get(1));
  }
  protected ArrayList<TableTreeKey> setEntities(
      Collection<? extends IEntityWrapper> entities, IAuthenticatedDataStoreCoordinator dsc) {
    DataContext c;
    if (dsc == null) {
      c = Lookup.getDefault().lookup(ConnectionProvider.class).getConnection().getContext();
    } else {
      c = dsc.getContext();
    }

    ArrayList<TableTreeKey> properties = new ArrayList<TableTreeKey>();
    Set<String> uris = new HashSet<String>();
    Set<IEntityBase> entitybases = new HashSet();
    Set<String> owners = new HashSet();
    for (IEntityWrapper w : entities) {
      IEntityBase e = w.getEntity();
      entitybases.add(e);
      uris.add(e.getURIString());
      owners.add(e.getOwner().getUuid());
    }

    String currentUserUUID = c.currentAuthenticatedUser().getUuid();
    Iterator<User> users = c.getUsersIterator();
    boolean containsCurrentUser =
        false; // current user's property table should always exist, even if there are no properties
    while (users.hasNext()) {
      User u = users.next();
      Map<String, Object> userProps = new HashMap();
      for (IEntityBase e : entitybases) {
        userProps.putAll(e.getUserProperties(u));
      }
      if (!userProps.isEmpty()) {
        String uuid = u.getUuid();
        UserPropertySet propertySet;
        if (currentUserUUID.equals(uuid)) {
          containsCurrentUser = true;
          propertySet = new UserPropertySet(u, owners.contains(uuid), true, userProps, uris);
        } else {
          propertySet = new UserPropertySet(u, owners.contains(uuid), false, userProps, uris);
        }
        properties.add(propertySet);
      }
    }
    if (!containsCurrentUser) {
      User current = c.currentAuthenticatedUser();
      properties.add(
          new UserPropertySet(
              current,
              owners.contains(current.getUuid()),
              true,
              new HashMap<String, Object>(),
              uris));
    }

    Collections.sort(properties);

    ((ScrollableTableTree) jScrollPane1).setKeys(properties);

    this.entities = entities;
    return properties;
  }
示例#19
0
 public void addFormEditID(double i, String str) {
   Collection<? extends HelpTutorialDepartment> allSave =
       Lookup.getDefault().lookupAll(HelpTutorialDepartment.class);
   for (HelpTutorialDepartment editCookie : allSave) {
     editCookie.getTutorial(i, str);
   }
 }
 public static final void updateBlockChain(final NbEditorDocument doc) {
   if (doc == null) return;
   final Project p = J2MEProjectUtils.getProjectForDocument(doc);
   // TODO J2MEProject?
   if (p != null && p instanceof J2MEProject) {
     final ProjectConfigurationsHelper configHelper =
         p.getLookup().lookup(ProjectConfigurationsHelper.class);
     if (configHelper == null || !configHelper.isPreprocessorOn()) return;
     final HashMap<String, String> activeIdentifiers =
         new HashMap<String, String>(configHelper.getActiveAbilities());
     activeIdentifiers.put(configHelper.getActiveConfiguration().getDisplayName(), null);
     try {
       J2MEProjectUtilitiesProvider utilProvider =
           Lookup.getDefault().lookup(J2MEProjectUtilitiesProvider.class);
       if (utilProvider == null)
         return; // we do not run in full NetBeans, but this should not happen here (no editor)
       final CommentingPreProcessor cpp =
           new CommentingPreProcessor(
               utilProvider.createPPDocumentSource((NbEditorDocument) doc),
               null,
               activeIdentifiers);
       cpp.run();
       setLineInfo(doc, cpp.getLines(), cpp.getBlockList());
     } catch (PreprocessorException e) {
       ErrorManager.getDefault().notify(e);
     }
   }
 }
  public void initTarget(PreviewUIModel previewUIModel) {
    // inits the preview applet
    if (previewUIModel != null && target == null) {
      PreviewController previewController = Lookup.getDefault().lookup(PreviewController.class);
      Color background =
          previewController
              .getModel()
              .getProperties()
              .getColorValue(PreviewProperty.BACKGROUND_COLOR);
      if (background != null) {
        setBackgroundColor(background);
      }

      target = (ProcessingTarget) previewController.getRenderTarget(RenderTarget.PROCESSING_TARGET);
      if (target != null) {
        sketch = target.getApplet();
        sketch.init();
        sketch.registerPost(processingListener);
        sketch.registerPre(processingListener);
        sketchPanel.add(sketch, BorderLayout.CENTER);
      }
    } else if (previewUIModel == null) {
      sketchPanel.remove(sketch);
      target = null;
    }
  }
  public AttributeControllerImpl() {
    projectController = Lookup.getDefault().lookup(ProjectController.class);
    projectController.addWorkspaceListener(
        new WorkspaceListener() {

          public void initialize(Workspace workspace) {
            AttributeModel m = workspace.getLookup().lookup(AttributeModel.class);
            if (m == null) {
              workspace.add(new IndexedAttributeModel());
            }
          }

          public void select(Workspace workspace) {}

          public void unselect(Workspace workspace) {}

          public void close(Workspace workspace) {}

          public void disable() {}
        });
    if (projectController.getCurrentProject() != null) {
      for (Workspace workspace :
          projectController
              .getCurrentProject()
              .getLookup()
              .lookup(WorkspaceProvider.class)
              .getWorkspaces()) {
        AttributeModel m = workspace.getLookup().lookup(AttributeModel.class);
        if (m == null) {
          workspace.add(new IndexedAttributeModel());
        }
      }
    }
  }
示例#23
0
  public Workspace readWorkspace(XMLStreamReader reader) throws Exception {
    WorkspaceImpl workspace =
        project.getLookup().lookup(WorkspaceProviderImpl.class).newWorkspace();
    WorkspaceInformationImpl info = workspace.getLookup().lookup(WorkspaceInformationImpl.class);

    // Name
    info.setName(reader.getAttributeValue(null, "name"));

    // Status
    String workspaceStatus = reader.getAttributeValue(null, "status");
    if (workspaceStatus.equals("open")) {
      info.open();
    } else if (workspaceStatus.equals("closed")) {
      info.close();
    } else {
      info.invalid();
    }

    // Hack to set this workspace active, when readers need to use attributes for instance
    ProjectControllerImpl pc = Lookup.getDefault().lookup(ProjectControllerImpl.class);
    pc.setTemporaryOpeningWorkspace(workspace);

    // WorkspacePersistent
    readWorkspaceChildren(workspace, reader);
    if (currentProvider != null) {
      // One provider not correctly closed
      throw new ClueminerFormatException(
          "The '" + currentProvider.getIdentifier() + "' persistence provider is not ending read.");
    }
    pc.setTemporaryOpeningWorkspace(null);

    return workspace;
  }
示例#24
0
  /** Creates new form RendererManagerPanel */
  public RendererManager() {
    initComponents();
    buildTooltip();

    if (UIUtils.isAquaLookAndFeel()) {
      panel.setBackground(UIManager.getColor("NbExplorerView.background"));
    }
    if (UIUtils.isAquaLookAndFeel()) {
      toolBar.setBackground(UIManager.getColor("NbExplorerView.background"));
    }

    previewController = Lookup.getDefault().lookup(PreviewController.class);
    Lookup.getDefault().lookup(PreviewUIController.class).addPropertyChangeListener(this);
    panel.setLayout(new MigLayout("insets 3", "[pref!]"));
    setup();
  }
  public void testTwoPlatformsoverSameSDK() throws Exception {
    final File binDir = new File(getWorkDir(), "boot"); // NOI18N
    binDir.mkdir();
    final File jdocFile1 = new File(getWorkDir(), "jdoc1"); // NOI18N
    jdocFile1.mkdir();
    final File jdocFile2 = new File(getWorkDir(), "jdoc2"); // NOI18N
    jdocFile2.mkdir();
    JavaPlatformProviderImpl provider = Lookup.getDefault().lookup(JavaPlatformProviderImpl.class);
    final URL binRoot = Utilities.toURI(binDir).toURL();
    final ClassPath bootCp = ClassPathSupport.createClassPath(binRoot);
    final List<URL> javadoc1 = Collections.singletonList(Utilities.toURI(jdocFile1).toURL());
    final List<URL> javadoc2 = Collections.singletonList(Utilities.toURI(jdocFile2).toURL());
    final TestJavaPlatform platform1 = new TestJavaPlatform("platform1", bootCp); // NOI18N
    final TestJavaPlatform platform2 = new TestJavaPlatform("platform2", bootCp); // NOI18N
    platform2.setJavadoc(javadoc2);
    provider.addPlatform(platform1);
    provider.addPlatform(platform2);

    final JavadocForBinaryQuery.Result result1 = JavadocForBinaryQuery.findJavadoc(binRoot);
    assertEquals(javadoc2, Arrays.asList(result1.getRoots()));

    platform1.setJavadoc(javadoc1);
    assertEquals(javadoc1, Arrays.asList(result1.getRoots()));

    final JavadocForBinaryQuery.Result result2 = JavadocForBinaryQuery.findJavadoc(binRoot);
    assertEquals(javadoc1, Arrays.asList(result2.getRoots()));

    platform1.setJavadoc(Collections.<URL>emptyList());
    assertEquals(javadoc2, Arrays.asList(result1.getRoots()));
    assertEquals(javadoc2, Arrays.asList(result2.getRoots()));
  }
示例#26
0
  void chosePolicy() {
    if (support == null) {
      return;
    }

    Collection<? extends JaxWsPoliciesCodeGenerator> generators =
        Lookup.getDefault().lookupAll(JaxWsPoliciesCodeGenerator.class);
    JaxWsPoliciesCodeGenerator policyGenerator = null;
    for (JaxWsPoliciesCodeGenerator gen : generators) {
      if (gen.isApplicable(policyIds, support.getPlatform(), getLocalWsdl())) {
        policyGenerator = gen;
        break;
      }
    }
    if (policyGenerator == null) {
      return;
    }

    List<String> clientPolicyIds = support.getClientPolicyIds();
    StringBuilder builder = new StringBuilder();
    String clientPolicyId = null;
    if (policyIds.isEmpty()) {
      clientPolicyId = choosePolicyId(clientPolicyIds);
      if (clientPolicyId == null) {
        return;
      }
      policyIds = Collections.singleton(clientPolicyId);
    }

    generator = policyGenerator;
    importFqns = policyGenerator.getRequiredClasses(chosenId);
    support.extendsProjectClasspath(getPorject(), importFqns);
    chosenId = policyGenerator.generatePolicyAccessCode(policyIds, client, builder);
    optionalCode = builder.toString();
  }
示例#27
0
 /**
  * Retrieve the RuntimeFactory instance, creating one if necessary.
  *
  * @return RuntimeFactory instance.
  */
 public static synchronized RuntimeFactory getRuntimeFactory() {
   if (rtFactory == null) {
     // Perform lookup to find a RuntimeFactory instance.
     rtFactory = Lookup.getDefault().lookup(RuntimeFactory.class);
   }
   return rtFactory;
 }
示例#28
0
/** @author mkuchtiak */
public class CreatorProvider {

  private static final Lookup.Result<ClientCreatorProvider> clientProviders =
      Lookup.getDefault()
          .lookup(new Lookup.Template<ClientCreatorProvider>(ClientCreatorProvider.class));

  private static final Lookup.Result<ServiceCreatorProvider> serviceProviders =
      Lookup.getDefault()
          .lookup(new Lookup.Template<ServiceCreatorProvider>(ServiceCreatorProvider.class));

  private static final Lookup.Result<HandlerCreatorProvider> handlerProviders =
      Lookup.getDefault()
          .lookup(new Lookup.Template<HandlerCreatorProvider>(HandlerCreatorProvider.class));

  public static ClientCreator getClientCreator(Project project, WizardDescriptor wiz) {
    Collection<? extends ClientCreatorProvider> instances = clientProviders.allInstances();
    for (ClientCreatorProvider impl : instances) {
      ClientCreator creator = impl.getClientCreator(project, wiz);
      if (creator != null) {
        return creator;
      }
    }
    return null;
  }

  public static ServiceCreator getServiceCreator(Project project, WizardDescriptor wiz) {
    Collection<? extends ServiceCreatorProvider> instances = serviceProviders.allInstances();
    for (ServiceCreatorProvider impl : instances) {
      ServiceCreator creator = impl.getServiceCreator(project, wiz);
      if (creator != null) {
        return creator;
      }
    }
    return null;
  }

  public static HandlerCreator getHandlerCreator(Project project, WizardDescriptor wiz) {
    Collection<? extends HandlerCreatorProvider> instances = handlerProviders.allInstances();
    for (HandlerCreatorProvider impl : instances) {
      HandlerCreator creator = impl.getHandlerCreator(project, wiz);
      if (creator != null) {
        return creator;
      }
    }
    return null;
  }
}
  public ProjectControllerImpl() {

    // Listeners
    listeners = new ArrayList<>();
    listeners.addAll(Lookup.getDefault().lookupAll(WorkspaceListener.class));

    registerNetbeansPropertyEditors();
  }
 private ClustererBuilder getBuilder(Clusterer clusterer) {
   for (ClustererBuilder b : Lookup.getDefault().lookupAll(ClustererBuilder.class)) {
     if (b.getClustererClass().equals(clusterer.getClass())) {
       return b;
     }
   }
   return null;
 }