public NbEditorToolBar(JTextComponent component) {
    this.componentRef = new WeakReference(component);

    setFloatable(false);
    // mkleint - instead of here, assign the border in CloneableEditor and MultiView module.
    //        // special border installed by core or no border if not available
    //        Border b = (Border)UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
    //        setBorder(b);
    addMouseListener(sharedMouseListener);

    installModulesInstallationListener();
    installNoOpActionMappings();

    lookupResult =
        MimeLookup.getLookup(DocumentUtilities.getMimeType(component))
            .lookupResult(KeyBindingSettings.class);
    lookupResult.addLookupListener(
        WeakListeners.create(LookupListener.class, keybindingsTracker, lookupResult));

    String mimeType = DocumentUtilities.getMimeType(component);
    preferences =
        MimeLookup.getLookup(mimeType == null ? MimePath.EMPTY : MimePath.parse(mimeType))
            .lookup(Preferences.class);
    preferences.addPreferenceChangeListener(
        WeakListeners.create(PreferenceChangeListener.class, prefsTracker, preferences));

    refreshToolbarButtons();
    setBorderPainted(true);
  }
 public void run() {
   computeKeys();
   refreshKeys();
   try {
     FileSystem fs = root.getFileSystem();
     wfcl = (FileChangeListener) WeakListeners.create(FileChangeListener.class, this, fs);
     fs.addFileChangeListener(wfcl);
   } catch (FileStateInvalidException e) {
     ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
   }
   wvqcl = WeakListeners.change(this, VisibilityQuery.getDefault());
   VisibilityQuery.getDefault().addChangeListener(wvqcl);
 }
  DefaultPraxisProject(FileObject directory, FileObject projectFile, ProjectState state)
      throws IOException {
    this.directory = directory;
    this.projectFile = projectFile;
    this.state = state;
    properties = parseProjectFile(projectFile);
    propsListener = new PropertiesListener();
    properties.addPropertyChangeListener(propsListener);

    Lookup base =
        Lookups.fixed(
            new Object[] {
              this,
              properties,
              new Info(),
              new ActionImpl(),
              state,
              new PraxisCustomizerProvider(this),
              new PraxisLogicalViewProvider(this),
              new BaseTemplates(),
              UILookupMergerSupport.createPrivilegedTemplatesMerger()
            });

    this.lookup = LookupProviderSupport.createCompositeLookup(base, LOOKUP_PATH);
    helperListener = new HelperListener();
    ProjectHelper.getDefault()
        .addPropertyChangeListener(
            WeakListeners.propertyChange(helperListener, ProjectHelper.getDefault()));
  }
 public void annotate(Line.Set set, Lookup lookup) {
   final FileObject fo = lookup.lookup(FileObject.class);
   if (fo != null) {
     DataObject dobj = lookup.lookup(DataObject.class);
     if (dobj != null) {
       PropertyChangeListener pchl =
           new PropertyChangeListener() {
             /** annotate renamed files. */
             public void propertyChange(PropertyChangeEvent evt) {
               if (DataObject.PROP_PRIMARY_FILE.equals(evt.getPropertyName())) {
                 DataObject dobj = (DataObject) evt.getSource();
                 FileObject newFO = dobj.getPrimaryFile();
                 annotate(newFO);
               }
             }
           };
       dobj.addPropertyChangeListener(WeakListeners.propertyChange(pchl, dobj));
       synchronized (this) {
         if (dataObjectListeners == null) {
           dataObjectListeners = new HashSet<PropertyChangeListener>();
         }
         // Prevent from GC.
         dataObjectListeners.add(pchl);
       }
     }
     annotate(fo);
   }
 }
 public void annotate(final FileObject fo) {
   synchronized (breakpointToAnnotations) {
     if (annotatedFiles.contains(fo)) {
       // Already annotated
       return;
     }
     Set<VisageLineBreakpoint> annotatedBreakpoints = breakpointToAnnotations.keySet();
     for (Breakpoint breakpoint : DebuggerManager.getDebuggerManager().getBreakpoints()) {
       if (isAnnotatable(breakpoint)) {
         VisageLineBreakpoint b = (VisageLineBreakpoint) breakpoint;
         if (!annotatedBreakpoints.contains(b)) {
           b.addPropertyChangeListener(this);
           breakpointToAnnotations.put(b, new WeakSet<Annotation>());
           LineTranslations.getTranslations().registerForLineUpdates(b);
         }
         addAnnotationTo(b, fo);
       }
     }
     annotatedFiles.add(fo);
   }
   if (attachManagerListener) {
     attachManagerListener = false;
     DebuggerManager.getDebuggerManager()
         .addDebuggerListener(
             WeakListeners.create(
                 DebuggerManagerListener.class, this, DebuggerManager.getDebuggerManager()));
   }
 }
 public CreateGeoCodingDisplacementBandsAction(Lookup lookup) {
   super(Bundle.CTL_CreateGeoCodingDisplacementBandsActionText());
   this.lookup = lookup;
   Lookup.Result<ProductNode> lkpContext = lookup.lookupResult(ProductNode.class);
   lkpContext.addLookupListener(WeakListeners.create(LookupListener.class, this, lkpContext));
   setEnableState();
   putValue(Action.SHORT_DESCRIPTION, Bundle.CTL_CreateGeoCodingDisplacementBandsDescription());
 }
 public TakeScreenshotActionProvider(ContextProvider contextProvider) {
   debugger = contextProvider.lookupFirst(null, JPDADebugger.class);
   addEngineListener();
   bpListener = new BPListener();
   DebuggerManager.getDebuggerManager()
       .addDebuggerListener(
           WeakListeners.create(
               DebuggerManagerListener.class, bpListener, DebuggerManager.getDebuggerManager()));
 }
 public ImportVectorDataNodeFromCsvAction(Lookup lookup) {
   this.lookup = lookup;
   result = lookup.lookupResult(Product.class);
   result.addLookupListener(WeakListeners.create(LookupListener.class, this, result));
   setEnableState();
   setHelpId(Bundle.CTL_ImportVectorDataNodeFromCsvActionHelp());
   putValue(Action.NAME, Bundle.CTL_ImportVectorDataNodeFromCsvActionText());
   putValue(Action.SHORT_DESCRIPTION, Bundle.CTL_ImportVectorDataNodeFromCsvActionDescription());
 }
  /** Creates new form DefinitionsPanel */
  public DefinitionsPanel(SectionView view, Definitions definitions, Node node) {
    super(view);
    this.definitions = definitions;
    this.model = this.definitions.getModel();
    this.node = node;
    initComponents();
    disableEnterKey();
    if (!isClient(node)) {
      enableAsyncMappingCB.setVisible(false);
    }

    enableAsyncMappingCB.setToolTipText(
        NbBundle.getMessage(DefinitionsPanel.class, "TOOLTIP_ENABLE_ASYNC"));
    enableWrapperStyleCB.setToolTipText(
        NbBundle.getMessage(DefinitionsPanel.class, "TOOLTIP_ENABLE_WRAPPER"));
    enableMIMEContentCB.setToolTipText(
        NbBundle.getMessage(DefinitionsPanel.class, "TOOLTIP_ENABLE_MIME"));
    packageNameText.setToolTipText(NbBundle.getMessage(DefinitionsPanel.class, "TOOLTIP_PACKAGE"));
    wsdlDirty = false;
    sync();

    defaultListener = new DefaultItemListener();
    ItemListener itemListener =
        (ItemListener) WeakListeners.create(ItemListener.class, defaultListener, defaultPackageCB);
    defaultPackageCB.addItemListener(itemListener);

    addValidatee(packageNameText);

    listener = new DefinitionsActionListener();
    addModifier(packageNameText);
    addModifier(defaultPackageCB);

    ActionListener eamListener =
        (ActionListener) WeakListeners.create(ActionListener.class, listener, enableAsyncMappingCB);
    enableAsyncMappingCB.addActionListener(eamListener);
    ActionListener emcListener =
        (ActionListener) WeakListeners.create(ActionListener.class, listener, enableMIMEContentCB);
    enableMIMEContentCB.addActionListener(emcListener);
    ActionListener ewsListener =
        (ActionListener) WeakListeners.create(ActionListener.class, listener, enableWrapperStyleCB);
    enableWrapperStyleCB.addActionListener(ewsListener);
  }
 private LineBreakpointComparable(String url) {
   setURL(url);
   try {
     fo = URLMapper.findFileObject(new URL(getURL()));
     if (fo != null) {
       fo.addFileChangeListener(WeakListeners.create(FileChangeListener.class, this, fo));
     }
   } catch (MalformedURLException ex) {
     ErrorManager.getDefault().notify(ex);
   }
 }
 private java.util.ArrayList getListOfTags() {
   java.util.ArrayList l = new java.util.ArrayList();
   List groups = dataset.getGroupsList();
   for (int i = 0; i < groups.size(); ++i) {
     JRDesignGroup group = (JRDesignGroup) groups.get(i);
     l.add(new Tag(group.getName(), group.getName()));
     group
         .getEventSupport()
         .addPropertyChangeListener(WeakListeners.propertyChange(this, group.getEventSupport()));
   }
   return l;
 }
 private JPDAWatchEvaluating(
     WatchesModel model, Watch w, JPDADebuggerImpl debugger, int cloneNumber) {
   super(debugger, null, (cloneNumber > 0) ? w + "_clone" + cloneNumber : "" + w);
   this.model = model;
   this.w = w;
   this.debugger = debugger;
   if (w.isEnabled()) {
     parseExpression(w.getExpression());
   }
   if (cloneNumber == 0) {
     debugger.varChangeSupport.addPropertyChangeListener(
         WeakListeners.propertyChange(this, debugger.varChangeSupport));
   }
 }
  @SuppressWarnings("unchecked")
  public EvaluationGroupProperty(HtmlComponent component, JRDesignDataset dataset) {
    // TODO: Replace WhenNoDataType with the right constant
    super(
        HtmlComponent.PROPERTY_EVALUATION_GROUP,
        JRGroup.class,
        "Evaluation group",
        "Evaluate the expression when the specified group changes",
        true,
        true);
    this.component = component;
    this.dataset = dataset;
    setValue("suppressCustomEditor", Boolean.TRUE);

    dataset
        .getEventSupport()
        .addPropertyChangeListener(WeakListeners.propertyChange(this, dataset.getEventSupport()));
  }
 /**
  * #25793 fix - adds project name to given ant script name if needed.
  *
  * @return ant script name annotated with project name or ant script name unchanged
  */
 private String annotateWithProjectName(String name) {
   DataObject d = getDataObject();
   if (d.getPrimaryFile().getNameExt().equals("build.xml")) { // NOI18N
     // #25793: show project name in case the script name does not suffice
     AntProjectCookie cookie = d.getCookie(AntProjectCookie.class);
     Element pel = cookie.getProjectElement();
     if (pel != null) {
       String projectName = pel.getAttribute("name"); // NOI18N
       if (!projectName.equals("")) { // NOI18N
         name =
             NbBundle.getMessage(AntProjectDataEditor.class, "LBL_editor_tab", name, projectName);
       }
     }
     if (!addedChangeListener) {
       cookie.addChangeListener(WeakListeners.change(this, cookie));
       addedChangeListener = true;
     }
   }
   return name;
 }
  private PropertyChangeListener getWeakListener(AXIComponent proxy, boolean remove) {
    if (listenerMap == null) {
      listenerMap = new WeakHashMap<AXIComponent, PropertyChangeListener>();
    }
    if (remove) return listenerMap.remove(proxy);

    if (proxy.getComponentType() != ComponentType.PROXY) {
      Set<AXIComponent> keySet = listenerMap.keySet();
      for (AXIComponent key : keySet) {
        if (key.getPeer() == proxy.getPeer()) return null;
      }
    }

    PropertyChangeListener listener = listenerMap.get(proxy);
    if (listener == null) {
      listener =
          (PropertyChangeListener) WeakListeners.create(PropertyChangeListener.class, proxy, this);
      listenerMap.put(proxy, listener);
      return listener;
    }

    // if exists, return null.
    return null;
  }
 private void init() {
   ServerList.addPropertyChangeListener(WeakListeners.propertyChange(this, this));
   presenter.setEnabled(!ServerList.getDefaultRecord().getExecutionEnvironment().isLocal());
 }
 public SaasGroupNodeChildren(SaasGroup group) {
   this.group = group;
   SaasServicesModel model = SaasServicesModel.getInstance();
   model.addPropertyChangeListener(WeakListeners.propertyChange(this, model));
 }