当前位置: 首页>>代码示例>>Java>>正文


Java DataObject.addPropertyChangeListener方法代码示例

本文整理汇总了Java中org.openide.loaders.DataObject.addPropertyChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java DataObject.addPropertyChangeListener方法的具体用法?Java DataObject.addPropertyChangeListener怎么用?Java DataObject.addPropertyChangeListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openide.loaders.DataObject的用法示例。


在下文中一共展示了DataObject.addPropertyChangeListener方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: stateChanged

import org.openide.loaders.DataObject; //导入方法依赖的package包/类
@Override
public void stateChanged(ChangeEvent e) {
    Object source = e.getSource();
    if (source instanceof Collection) {
        FileObject bfo = this.fo;
        if (bfo == null) {
            return ;
        }
        for (Object obj : ((Collection) source)) {
            DataObject dobj = (DataObject) obj;
            FileObject primary = dobj.getPrimaryFile();
            if (bfo.equals(primary)) {
                synchronized (this) {
                    dobjRef = new WeakReference<DataObject>(dobj);
                    dobjwl = WeakListeners.propertyChange(this, dobj);
                    dobj.addPropertyChangeListener(dobjwl);
                    if (registryListener != null) {
                        DataObject.getRegistry().removeChangeListener(registryListener);
                        registryListener = null;
                    }
                }
                break;
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:FileMoveBreakpointsHandler.java

示例2: createKeys

import org.openide.loaders.DataObject; //导入方法依赖的package包/类
@Override protected boolean createKeys(List<DataObject> keys) {
    List<DataObject> files = new ArrayList<DataObject>();
    for (DataObject f : folder.getChildren()) {
        if (!filter.acceptDataObject(f)) {
            continue;
        }
        if (f instanceof DataFolder) {
            while (true) {
                DataObject candidate = null;
                f.addPropertyChangeListener(WeakListeners.propertyChange(this, f));
                for (DataObject kid : ((DataFolder) f).getChildren()) {
                    if (!filter.acceptDataObject(kid)) {
                        continue;
                    }
                    if (kid instanceof DataFolder) {
                        if (candidate == null) {
                            candidate = kid;
                        } else {
                            candidate = null;
                            break;
                        }
                    } else {
                        candidate = null;
                        break;
                    }
                }
                if (candidate != null) {
                    f = candidate;
                } else {
                    break;
                }
            }
            keys.add(f);
        } else {
            files.add(f);
        }
    }
    keys.addAll(files);
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:41,代码来源:TreeRootNode.java

示例3: DataObjectSource

import org.openide.loaders.DataObject; //导入方法依赖的package包/类
public DataObjectSource(DataObject data) {
    this.data = data;
    support = new PropertyChangeSupport(this);
    propertyChangeListener = new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if(DataObject.PROP_MODIFIED.equals(evt.getPropertyName())) {
                support.firePropertyChange(PROP_MODIFIED, evt.getOldValue(), evt.getNewValue());
            }
        }
    };
    data.addPropertyChangeListener(WeakListeners.propertyChange(propertyChangeListener, this.data));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:IDEServicesImpl.java

示例4: Prov

import org.openide.loaders.DataObject; //导入方法依赖的package包/类
Prov(Document doc, DataObject xml, LayerHandle handle) {
    this.doc = doc;
    this.xml = xml;
    this.handle = handle;
    xml.getPrimaryFile().addFileChangeListener(FileUtil.weakFileChangeListener(listener, xml.getPrimaryFile()));
    xml.addPropertyChangeListener(WeakListeners.propertyChange(pcl, xml));
    task = RP.post(this);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:LayerHints.java

示例5: DOEnvLookup

import org.openide.loaders.DataObject; //导入方法依赖的package包/类
private DOEnvLookup (DataObject dobj, InstanceContent ic) {
    super (ic);
    this.ic = ic;
    this.dobj = dobj;
	dobj.addPropertyChangeListener(WeakListeners.propertyChange(this, dobj));
     
    updateLookup ();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:DataEditorSupport.java

示例6: PropertiesDataNode

import org.openide.loaders.DataObject; //导入方法依赖的package包/类
/** Creates data node for a given data object.
 * The provided children object will be used to hold all child nodes.
 * @param dataObject  object to work with
 * @param children container for the node
 */
public PropertiesDataNode(DataObject dataObject, Children children, Lookup lookup) {
    super(dataObject, children, lookup);
    setIconBaseWithExtension("org/netbeans/modules/properties/propertiesObject.png"); // NOI18N
    dataObjectListener = new NameUpdater();
    dataObject.addPropertyChangeListener(
            WeakListeners.propertyChange(dataObjectListener, dataObject));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:PropertiesDataNode.java

示例7: JavaNode

import org.openide.loaders.DataObject; //导入方法依赖的package包/类
/** Create a node for the Java data object using the default children.
* @param jdo the data object to represent
*/
public JavaNode (final DataObject jdo, boolean isJavaSource) {
    super (jdo, Children.LEAF);
    this.isJavaSource = isJavaSource;
    this.isCompiled = new AtomicReference<>();
    this.isExecutable = new AtomicReference<>();
    this.computedIcon = new AtomicReference<>();
    this.computedIconListener = new AtomicReference<>();
    this.setIconBaseWithExtension(isJavaSource ? JAVA_ICON_BASE : CLASS_ICON_BASE);
    Logger.getLogger("TIMER").log(Level.FINE, "JavaNode", new Object[] {jdo.getPrimaryFile(), this});
    if (!jdo.isTemplate()) {
        WORKER.post(IconTask.create(this));
        if (isJavaSource) {
            WORKER.post(new BuildStatusTask(this));
            WORKER.post(new ExecutableTask(this));
            jdo.addPropertyChangeListener(new PropertyChangeListener() {
                public void propertyChange(PropertyChangeEvent evt) {
                    if (DataObject.PROP_PRIMARY_FILE.equals(evt.getPropertyName())) {
                        Logger.getLogger("TIMER").log(Level.FINE, "JavaNode", new Object[]{jdo.getPrimaryFile(), this});
                        WORKER.post(new Runnable() {
                            public void run() {
                                computedIconListener.set(null);
                                synchronized (JavaNode.this) {
                                    status = null;
                                    executableListener = null;
                                    WORKER.post(new BuildStatusTask(JavaNode.this));
                                    WORKER.post(new ExecutableTask(JavaNode.this));
                                }
                            }
                        });
                    }
                }
            });
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:39,代码来源:JavaNode.java

示例8: fillHibernateConfigurations

import org.openide.loaders.DataObject; //导入方法依赖的package包/类
public void fillHibernateConfigurations(Node[] activatedNodes) {
    Node node = activatedNodes[0];
    DataObject dO = node.getCookie(DataObject.class);
    if (dO instanceof HibernateCfgDataObject) {
        
        dO.addPropertyChangeListener(new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                if(DataObject.PROP_VALID.equals(evt.getPropertyName()) && Boolean.FALSE.equals(evt.getNewValue())){
                    if(SwingUtilities.isEventDispatchThread()){
                        close();//need to close if corresponding dataobject was invalidated (deleted)
                    } else {
                        SwingUtilities.invokeLater(new Runnable() {
                           @Override
                            public void run() {
                                close();//need to close if corresponding dataobject was invalidated (deleted)
                            }
                        });
                    }
                }
            }
        });
        
        Project enclosingProject = FileOwnerQuery.getOwner(dO.getPrimaryFile());
        env = enclosingProject.getLookup().lookup(HibernateEnvironment.class);
        if (env == null) {
            logger.warning("HiberEnv is not found in enclosing project.");
            return;
        }
        List<FileObject> configFileObjects = env.getAllHibernateConfigFileObjects();
        for (FileObject configFileObject : configFileObjects) {
            try {
                HibernateCfgDataObject hibernateCfgDataObject = (HibernateCfgDataObject) DataObject.find(configFileObject);
                String configName = hibernateCfgDataObject.getHibernateConfiguration().getSessionFactory().getAttributeValue("name"); //NOI18N
                if (configName == null || configName.equals("")) {
                    configName = configFileObject.getName();
                }
                hibernateConfigMap.put(configName, configFileObject);
            } catch (DataObjectNotFoundException ex) {
                Exceptions.printStackTrace(ex);
            }
        }
        hibernateConfigurationComboBox.setModel(new DefaultComboBoxModel(hibernateConfigMap.keySet().toArray()));
        HibernateConfiguration config = ((HibernateCfgDataObject) dO).getHibernateConfiguration();
        String selectedConfigName = config.getSessionFactory().getAttributeValue("name"); //NOI18N
        if (selectedConfigName == null || selectedConfigName.equals("")) {
            selectedConfigName = dO.getPrimaryFile().getName();
        }
        hibernateConfigurationComboBox.setSelectedItem(selectedConfigName);

    } else {
        //TODO Don't know whether this case will actually arise..
    }

}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:56,代码来源:HQLEditorTopComponent.java


注:本文中的org.openide.loaders.DataObject.addPropertyChangeListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。