SolutionEditor.java 文件源码

java
阅读 24 收藏 0 点赞 0 评论 0

项目:dawn-marketplace-server 作者:
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
    setSite(site);
    setInput(input);

    fSaveAction= ActionFactory.SAVE.create(getSite().getWorkbenchWindow());
    site.getActionBars().setGlobalActionHandler(ActionFactory.SAVE.getId(), fSaveAction);
    site.getActionBars().updateActionBars();

    FileEditorInput i = (FileEditorInput) input;
    try {
        node = MarketplaceSerializer.loadNode(i.getPath().toFile());
    } catch (Exception e) {
        // TODO: Notify about error loading
    }
    if (node==null) {
        node = MarketplaceFactory.eINSTANCE.createNode();
    }
    // detect changes
    EContentAdapter adapter = new EContentAdapter() {
        @Override
        public void notifyChanged(org.eclipse.emf.common.notify.Notification notification) {
            super.notifyChanged(notification);              
            dirty = true;
            SolutionEditor.this.firePropertyChange(IEditorPart.PROP_DIRTY);
            SolutionEditor.this.setPartName(getSolutionTitle());
        }
    };
    node.eAdapters().add(adapter);
    adapter.setTarget(node);
    setPartName(getSolutionTitle());
    firePropertyChange(IEditorPart.PROP_DIRTY);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号