org.openide.util.ChangeSupport Java Examples

The following examples show how to use org.openide.util.ChangeSupport. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MultiModuleUnitTestsCompilerOptionsQueryImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
ResultImpl(
        @NonNull final Project project,
        @NonNull final MultiModule sourceModules,
        @NonNull final MultiModule testModules) {
    Parameters.notNull("project", project);     //NOI18N
    Parameters.notNull("sourceModules", sourceModules); //NOI18N
    Parameters.notNull("testModules", testModules);     //NOI18N
    this.sourceModules = sourceModules;
    this.testModules = testModules;
    this.slRes = SourceLevelQuery.getSourceLevel2(project.getProjectDirectory());
    this.listeners = new ChangeSupport(this);
    this.sourceModules.addPropertyChangeListener(WeakListeners.propertyChange(this, this.sourceModules));
    this.testModules.addPropertyChangeListener(WeakListeners.propertyChange(this, this.testModules));
    this.currentCps = new ArrayList<>();
    this.currentModuleInfos = new HashSet<>();
}
 
Example #2
Source File: MultiModuleBinaryForSourceQueryImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
R(
        @NonNull final URL url,
        @NonNull final MultiModule modules,
        @NonNull final String moduleName,
        @NonNull final String[] templates) {
    Parameters.notNull("url", url);             //NOI18N
    Parameters.notNull("modules", modules); //NOI18N
    Parameters.notNull("moduleName", moduleName);   //NOI18N
    Parameters.notNull("templates", templates);         //NOI18N
    this.url = url;
    this.pp = new EvaluatorPropertyProvider(MultiModuleBinaryForSourceQueryImpl.this.evaluator);
    this.evaluator = PropertyUtils.sequentialPropertyEvaluator(
        PropertyUtils.fixedPropertyProvider(Collections.singletonMap("module.name",moduleName)), //NOI18N
        pp);
    this.modules = modules;
    this.moduleName = moduleName;
    this.templates = templates;
    this.cache = new AtomicReference();
    this.listeners = new ChangeSupport(this);
    this.propsCache = new AtomicReference<>();
    this.scp = new AtomicReference<>();
    MultiModuleBinaryForSourceQueryImpl.this.evaluator.addPropertyChangeListener(WeakListeners.propertyChange(this, MultiModuleBinaryForSourceQueryImpl.this.evaluator));
    this.modules.addPropertyChangeListener(WeakListeners.propertyChange(this, this.modules));
}
 
Example #3
Source File: MultiModuleSourceForBinaryQueryImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
R(
        @NonNull final URI artefact,
        @NonNull final ClassPath srcPath,
        @NonNull final PropertyEvaluator eval,
        @NonNull final AntProjectHelper helper,
        @NonNull final String moduleName,
        @NonNull final String prop) {
    Parameters.notNull("artefact", artefact);   //NOI18N
    Parameters.notNull("srcPath", srcPath); //NOI18N
    Parameters.notNull("eval", eval);       //NOI18N
    Parameters.notNull("helper", helper);       //NOI18N
    Parameters.notNull("moduleName", moduleName);   //NOI18N
    Parameters.notNull("prop", prop);       //NOI18N
    this.artefact = artefact;
    this.srcPath = srcPath;
    this.eval = eval;
    this.helper = helper;
    this.moduleName = moduleName;
    this.prop = prop;
    this.listeners = new ChangeSupport(this);
    this.srcPath.addPropertyChangeListener(WeakListeners.propertyChange(this, this.srcPath));
    this.eval.addPropertyChangeListener(WeakListeners.propertyChange(this, this.eval));
}
 
Example #4
Source File: AutomaticModuleNameCompilerOptionsQueryImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
R(
        @NonNull final AntProjectHelper helper,
        @NonNull final PropertyEvaluator eval,
        @NonNull final SourceRoots sources,
        @NonNull final String manifestProp) {
    this.helper = helper;
    this.eval = eval;
    this.sources = sources;
    this.manifestProp = manifestProp;
    this.listeners = new ChangeSupport(this);
    Set<FCL.Op> filter = EnumSet.allOf(FCL.Op.class);
    filter.remove(FCL.Op.FILE_ATTR_CHANGED);
    this.manifestListener = new FCL(this::reset, filter);
    filter = EnumSet.allOf(FCL.Op.class);
    filter.remove(FCL.Op.FILE_ATTR_CHANGED);
    filter.remove(FCL.Op.FILE_CHANGED);
    this.modInfoListener = new FCL(this::reset, filter);
    this.eval.addPropertyChangeListener(WeakListeners.propertyChange(this, this.eval));
    this.sources.addPropertyChangeListener(WeakListeners.propertyChange(this, this.sources));
}
 
Example #5
Source File: J2SEActionProvider.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private CosAction(
        @NonNull final J2SEActionProvider owner,
        @NonNull final PropertyEvaluator eval,
        @NonNull final SourceRoots src,
        @NonNull final SourceRoots tests) {
    this.owner = owner;
    this.eval = eval;
    this.src = src;
    this.tests = tests;
    this.mapper = new BuildArtifactMapper();
    this.currentListeners = new HashMap<>();
    this.cs = new ChangeSupport(this);
    this.importantFilesCache = new AtomicReference<>(Pair.of(null,null));
    this.eval.addPropertyChangeListener(WeakListeners.propertyChange(this, this.eval));
    this.src.addPropertyChangeListener(WeakListeners.propertyChange(this, this.src));
    this.tests.addPropertyChangeListener(WeakListeners.propertyChange(this, this.tests));
    updateRootsListeners();
    instances.put(owner.getProject(), new WeakReference<>(this));
}
 
Example #6
Source File: AmazonInstanceManager.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private AmazonInstanceManager() {
    listeners = new ChangeSupport(this);
    /*if (getAmazonInstanceNames().size() == 0) {
        store(new AmazonInstance("test1", "somekey", "somepwd"));
        store(new AmazonInstance("some2", "somekey2", "somepwd2"));
        store(new AmazonInstance("last3", "somekey3", "somepwd3"));
    }*/
    init();
}
 
Example #7
Source File: MultiModuleJavadocForBinaryQueryImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
R(
        @NonNull final URI artefact,
        @NonNull final String jdocProperty,
        @NonNull final MultiModule modules,
        @NonNull final PropertyEvaluator evaluator,
        @NonNull final AntProjectHelper helper,
        @NonNull final String moduleName,
        @NonNull final String prop) {
    Parameters.notNull("artefact", artefact);               //NOI18N
    Parameters.notNull("jdocProperty", jdocProperty);       //NOI18N
    Parameters.notNull("modules", modules);                 //NOI18N
    Parameters.notNull("evaluator", evaluator);             //NOI18N
    Parameters.notNull("helper", helper);                   //NOI18N
    Parameters.notNull("moduleName", moduleName);           //NOI18N
    Parameters.notNull("prop", prop);                       //NOI18N
    this.artefact = artefact;
    this.jdocProperty = jdocProperty;
    this.modules = modules;
    this.evaluator = evaluator;
    this.helper = helper;
    this.moduleName = moduleName;
    this.prop = prop;
    this.listeners = new ChangeSupport(this);
    this.cache = new AtomicReference<>();
    this.currentModuleExists = new AtomicBoolean(true);
    this.modules.addPropertyChangeListener(WeakListeners.propertyChange(this, this.modules));
    this.evaluator.addPropertyChangeListener(WeakListeners.propertyChange(this, this.evaluator));
}
 
Example #8
Source File: UnitTestsCompilerOptionsQueryImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
ResultImpl(
        @NonNull final PropertyEvaluator eval,
        @NonNull final SourceRoots srcRoots,
        @NonNull final SourceRoots testRoots) {
    this.eval = eval;
    this.srcRoots = srcRoots;
    this.testRoots = testRoots;
    this.cs = new ChangeSupport(this);
    this.reenter = new ThreadLocal<>();
    this.moduleInfoListeners = new HashSet<>();
}
 
Example #9
Source File: ClasspathInfoListener.java    From netbeans with Apache License 2.0 5 votes vote down vote up
ClasspathInfoListener (
        @NonNull final ChangeSupport changedSupport,
        @NullAllowed final Runnable callBack) {
    assert changedSupport != null;
    this.changeSupport = changedSupport;
    this.callBack = callBack;
}
 
Example #10
Source File: JaxWsModelImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public JaxWsModelImpl(org.netbeans.modules.websvc.jaxwsmodel.project_config1_0.JaxWs jaxws, FileObject fo) {
    this.jaxws=jaxws;
    this.fo=fo;
    propertyChangeListeners = new ArrayList<PropertyChangeListener>();
    serviceListeners = new ArrayList<ServiceListener>();
    changeSupport = new ChangeSupport(this);
}
 
Example #11
Source File: HtmlIndex.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Creates a new instance of JsfIndex */
private HtmlIndex(Project project) throws IOException {
    //QuerySupport now refreshes the roots indexes so it can held until the source roots are valid
    Collection<FileObject> sourceRoots = QuerySupport.findRoots(project,
            null /* all source roots */,
            Collections.<String>emptyList(),
            Collections.<String>emptyList());
    this.querySupport = QuerySupport.forRoots(HtmlIndexer.Factory.NAME, HtmlIndexer.Factory.VERSION, sourceRoots.toArray(new FileObject[]{}));
    this.changeSupport = new ChangeSupport(this);
}
 
Example #12
Source File: TypeComparator.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private TypeComparator(
        final boolean caseSensitive,
        final boolean preferOpPrjs) {
    this.caseSensitive = caseSensitive;
    this.preferOpPrjs = preferOpPrjs;
    this.support = new ChangeSupport(this);
}
 
Example #13
Source File: ConfigManager.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public ConfigManager(ConfigProvider configProvider, String currentConfig) {
    this.configProvider = configProvider;
    changeSupport = new ChangeSupport(this);
    configs = createEmptyConfigs();
    configs.putAll(configProvider.getConfigs());
    this.currentConfig = currentConfig;

    List<String> tmp = new ArrayList<>(Arrays.asList(configProvider.getConfigProperties()));
    tmp.add(PROP_DISPLAY_NAME);
    propertyNames = tmp.toArray(new String[tmp.size()]);
}
 
Example #14
Source File: Models.java    From netbeans with Apache License 2.0 5 votes vote down vote up
ChainedFilter(@NonNull final Filter<T>... filters) {
    this.changeSupport = new ChangeSupport(this);
    this.filters = Arrays.asList(filters);
    for (Filter<T> filter : this.filters) {
        filter.addChangeListener(this);
    }
}
 
Example #15
Source File: FileComarator.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private FileComarator(
        final boolean usePreferred,
        final boolean caseSensitive,
        final boolean preferOpPrjs) {
    this.caseSensitive = caseSensitive;
    this.usePreferred = usePreferred;
    this.preferOpPrjs = preferOpPrjs;
    this.support = new ChangeSupport(this);
}
 
Example #16
Source File: CompilerOptionsQueryImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
ResultImpl(
        @NonNull final PropertyEvaluator eval,
        @NonNull final String additionalCompilerOptionsProperty) {
    this.eval = eval;
    this.additionalCompilerOptionsProperty = additionalCompilerOptionsProperty;
    this.listeners = new ChangeSupport(this);
    this.eval.addPropertyChangeListener(this);
}
 
Example #17
Source File: AttachmentPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public AttachmentPanel(AttachmentsPanel.NBBugzillaCallback nbCallback) {
    this.nbCallback = nbCallback;
    this.supp = new ChangeSupport(this);
    initComponents();
    setBackground( UIUtils.getSectionPanelBackground() );
    initFileTypeCombo();
    attachListeners();
}
 
Example #18
Source File: CssIndex.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Creates a new instance of JsfIndex */
private CssIndex(Project project) throws IOException {
    //QuerySupport now refreshes the roots indexes so it can held until the source roots are valid
    sourceRoots = QuerySupport.findRoots(project,
            null /* all source roots */,
            Collections.<String>emptyList(),
            Collections.<String>emptyList());
    this.querySupport = QuerySupport.forRoots(CssIndexer.Factory.NAME, CssIndexer.Factory.VERSION, sourceRoots.toArray(new FileObject[]{}));        
    this.changeSupport = new ChangeSupport(this);
}
 
Example #19
Source File: AddSubtaskPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
AddSubtaskPanel () {
    initComponents();

    support = new ChangeSupport(this);
    qs = IssueQuickSearch.create();
    qs.setChangeListener(this);
    GroupLayout layout = (GroupLayout) getLayout();
    layout.replace(issuePanel, qs.getComponent());
}
 
Example #20
Source File: WhiteListQueryImplementationMerged.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("LeakingThisInConstructor")
public WhiteListImplementationMerged(
    @NonNull final Lookup.Result<WhiteListQueryImplementation> lr,
    @NonNull final FileObject file) {
    this.lr = lr;
    this.file = file;
    this.changeSupport = new ChangeSupport(this);
    this.lr.addLookupListener(WeakListeners.create(LookupListener.class, this, this.lr));
}
 
Example #21
Source File: ResolveBrokenRuntimePlatform.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Creates new form ResolveMissingRuntimePlatform
 */
private ResolveBrokenRuntimePlatform(
        @NonNull final Type type,
        @NonNull final Project prj,
        @NonNull final Union2<String,RuntimePlatformProblemsProvider.InvalidPlatformData> data) {
    Parameters.notNull("type", type);   //NOI18N
    Parameters.notNull("prj", prj);   //NOI18N
    Parameters.notNull("data", data);   //NOI18N
    this.type = type;
    this.prj = prj;
    this.data = data;
    this.changeSupport = new ChangeSupport(this);
    initComponents();
    platforms.setRenderer(new PlatformRenderer());
    platforms.setModel(new DefaultComboBoxModel<JavaPlatform>());
    updatePlatforms();
    final ActionListener specificPlatformListener = new ActionListener() {
        @Override
        public void actionPerformed(@NullAllowed final ActionEvent e) {
            platforms.setEnabled(specificPlatform.isSelected());
            create.setEnabled(specificPlatform.isSelected());
            sourceLevelWarning.setEnabled(sourceLevel.isSelected());
            changeSupport.fireChange();
        }
    };
    specificPlatform.addActionListener(specificPlatformListener);
    projectPlatform.addActionListener(specificPlatformListener);
    sourceLevel.addActionListener(specificPlatformListener);
    specificPlatformListener.actionPerformed(null);
    projectPlatform.setSelected(true);
    if (type == Type.MISSING_PLATFORM) {
        sourceLevel.setVisible(false);
        sourceLevelWarning.setVisible(false);
    }
}
 
Example #22
Source File: CompilerOptionsQueryMerger.java    From netbeans with Apache License 2.0 5 votes vote down vote up
ResultImpl(
        @NonNull final FileObject artifact,
        @NonNull final Lookup lookup) {
    this.artifact = artifact;
    this.providers = lookup.lookupResult(CompilerOptionsQueryImplementation.class);
    this.listeners = new ChangeSupport(this);
    this.providers.addLookupListener(WeakListeners.create(LookupListener.class, this, providers));
    checkProviders();
}
 
Example #23
Source File: JavaFXPlatformJavadoc.java    From netbeans with Apache License 2.0 5 votes vote down vote up
ResultImpl(@NonNull final Collection<? extends JavaPlatform> platforms) {
    Parameters.notNull("platforms", platforms); //NOI18N
    this.plaforms = platforms;
    for (JavaPlatform jp : this.plaforms) {
        jp.addPropertyChangeListener(WeakListeners.propertyChange(this, jp));
    }
    this.support = new ChangeSupport(this);
}
 
Example #24
Source File: CompileOnSaveActionQuery.java    From netbeans with Apache License 2.0 5 votes vote down vote up
ProxyAction(
        @NonNull final URL root,
        @NonNull final Collection<CompileOnSaveAction> current,
        @NonNull final Lookup.Result<CompileOnSaveAction.Provider> eventSource) {
    this.root = root;
    this.active = new AtomicReference<>(current);
    this.listeners = new ChangeSupport(this);
    instances.addLookupListener(WeakListeners.create(
            LookupListener.class,
            this,
            instances));
    getActions(ALL)
            .forEach((a) -> a.addChangeListener(WeakListeners.change(this, a)));
}
 
Example #25
Source File: MockChangeListenerTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
    super.setUp();
    source = new Object();
    cs = new ChangeSupport(source);
    l = new MockChangeListener();
    cs.addChangeListener(l);
}
 
Example #26
Source File: ExtProjectConvertorServices.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("LeakingThisInConstructor")
LogicalView(@NonNull final Project project, @NonNull final ProjectConvertor.Result result) {
    Parameters.notNull("project", project); //NOI18N
    Parameters.notNull("result", result);   //NOI18N
    this.project = project;
    this.result = result;
    this.support = new ChangeSupport(this);
    this.eventSource = project.getLookup().lookupResult(LogicalViewProvider.class);
    this.eventSource.addLookupListener(WeakListeners.create(LookupListener.class, this, this.eventSource));
}
 
Example #27
Source File: TargetChooserPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public TargetChooserPanel(Project project, SourceGroup[] folders , 
        T id ) 
{
    myChangeSupport = new ChangeSupport( this );
    myFolders = folders;
    myProject = project;
    myId = id;
    
    loadProvider( );
    getProvider().init( this );
}
 
Example #28
Source File: MockChangeListenerTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
    super.setUp();
    source = new Object();
    cs = new ChangeSupport(source);
    l = new MockChangeListener();
    cs.addChangeListener(l);
}
 
Example #29
Source File: ProjectContext.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public ProjectContext(Lookup projectContext) {
    support = new ChangeSupport(this);
    res = projectContext.lookupResult(Project.class);
    res.addLookupListener(new LookupListener() {
        @Override
        public void resultChanged(LookupEvent ev) {
            support.fireChange();
        }
    });
}
 
Example #30
Source File: AttachmentsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public AttachmentsPanel(JComponent parentPanel) {
    this.parentPanel = parentPanel;
    this.supp = new ChangeSupport(this);
    setBackground(UIManager.getColor("TextArea.background")); // NOI18N
    ResourceBundle bundle = NbBundle.getBundle(AttachmentsPanel.class);
    noneLabel = new JLabel(bundle.getString("AttachmentsPanel.noneLabel.text")); // NOI18N
    createNewButton = new LinkButton(new CreateNewAction());
    createNewButton.getAccessibleContext().setAccessibleDescription(bundle.getString("AttachmentPanels.createNewButton.AccessibleContext.accessibleDescription")); // NOI18N
    try {
        maxMethod = GroupLayout.Group.class.getDeclaredMethod("calculateMaximumSize", int.class); // NOI18N
        maxMethod.setAccessible(true);
    } catch (NoSuchMethodException nsmex) {
        LOG.log(Level.INFO, nsmex.getMessage(), nsmex);
    }
}