• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java DataEditorSupport类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.openide.text.DataEditorSupport的典型用法代码示例。如果您正苦于以下问题:Java DataEditorSupport类的具体用法?Java DataEditorSupport怎么用?Java DataEditorSupport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DataEditorSupport类属于org.openide.text包,在下文中一共展示了DataEditorSupport类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: GsfDataObject

import org.openide.text.DataEditorSupport; //导入依赖的package包/类
public GsfDataObject(FileObject pf, MultiFileLoader loader, Language language) throws DataObjectExistsException {
    super(pf, loader);

    // If the user creates a file with a filename where we can't figure out the language
    // (e.g. the PHP New File wizard doesn't enforce a file extension, so if you create
    // a file named "pie.class" (issue 124044) the data loader doesn't know which language
    // to associate this with since it isn't a GSF file extension or mimetype). However
    // during template creation we know the language anyway so we can use it. On subsequent
    // IDE restarts the file won't be recognized so the user will have to rename or
    // add a new file extension to file type mapping.
    if (language == null) {
        language = templateLanguage;
    }
    this.language = language;
    getCookieSet().add(new Class[]{
            GenericEditorSupport.class, // NOI18N
            SaveAsCapable.class, Openable.class, EditorCookie.Observable.class, 
            PrintCookie.class, CloseCookie.class, Editable.class, LineCookie.class,
            DataEditorSupport.class, CloneableEditorSupport.class,
            CloneableOpenSupport.class
        }, new EditorSupportFactory());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:GsfDataObject.java


示例2: createCookie

import org.openide.text.DataEditorSupport; //导入依赖的package包/类
@Override
public <T extends Cookie> T createCookie(Class<T> klass) {
        if (
        klass.isAssignableFrom(DataEditorSupport.class) || 
        DataEditorSupport.class.isAssignableFrom(klass) || 
        klass.isAssignableFrom(Openable.class) || 
        klass.isAssignableFrom(Editable.class) || 
        klass.isAssignableFrom(EditorCookie.Observable.class) || 
        klass.isAssignableFrom(PrintCookie.class) || 
        klass.isAssignableFrom(CloseCookie.class) || 
        klass.isAssignableFrom(LineCookie.class)
    ) {
        return klass.cast(createEditorSupport());
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:GsfDataObject.java


示例3: loadFromStreamToKit

import org.openide.text.DataEditorSupport; //导入依赖的package包/类
@Override
protected void loadFromStreamToKit(StyledDocument doc, InputStream stream, EditorKit kit)
        throws IOException, BadLocationException {
    
    if (guardedEditor == null) {
        guardedEditor = new BIGES();
        GuardedSectionsFactory gFactory = GuardedSectionsFactory.find(((DataEditorSupport.Env) env).getMimeType());
        if (gFactory != null) {
            guardedProvider = gFactory.create(guardedEditor);
        }
    }
    
    if (guardedProvider != null) {
        guardedEditor.doc = doc;
        Charset c = FileEncodingQuery.getEncoding(this.getDataObject().getPrimaryFile());
        Reader reader = guardedProvider.createGuardedReader(stream, c);
        try {
            kit.read(reader, doc, 0);
        } finally {
            reader.close();
        }
    } else {
        super.loadFromStreamToKit(doc, stream, kit);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:BIEditorSupport.java


示例4: updateDisplayName

import org.openide.text.DataEditorSupport; //导入依赖的package包/类
/**
 * Updates the display name of the associated top component.
 */
public void updateDisplayName() {
    if (mvtc != null) {
        Utils.runInAwtDispatchThread(new Runnable() {
            public void run() {
                String displayName = messageName();
                if (!displayName.equals(mvtc.getDisplayName())) {
                    mvtc.setDisplayName(displayName);
                }
                String htmlDisplayName = messageHtmlName();
                if (!Utilities.compareObjects(htmlDisplayName, mvtc.getHtmlDisplayName())) {
                    mvtc.setHtmlDisplayName(htmlDisplayName);
                }
                mvtc.setToolTipText(DataEditorSupport.toolTip(
                        dObj.getPrimaryFile(), getDataObject().isModified(), !getDataObject().getPrimaryFile().canWrite()));
            }
        });
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:XmlMultiViewEditorSupport.java


示例5: getShortDescription

import org.openide.text.DataEditorSupport; //导入依赖的package包/类
@Override
public String getShortDescription () {
    DebuggerEngine currentEngine = DebuggerManager.getDebuggerManager ().
        getCurrentEngine ();
    if (currentEngine == null) return null;
    AntDebugger d = currentEngine.lookupFirst(null, AntDebugger.class);
    if (d == null) return null;

    Part lp = (Part)
        getAttachedAnnotatable();
    if (lp == null) return null;
    Line line = lp.getLine ();
    DataObject dob = DataEditorSupport.findDataObject (line);
    if (dob == null) return null;
    EditorCookie ec = dob.getLookup().lookup(EditorCookie.class);

    if (ec == null) return null;
    this.lp = lp;
    this.ec = ec;
    RequestProcessor.getDefault ().post (this);
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:ToolTipAnnotation.java


示例6: htmlDisplayName

import org.openide.text.DataEditorSupport; //导入依赖的package包/类
/**
 * Builds a HTML display name for this component.
 *
 * @return  the created display name
 * @see  #displayName()
 */
private String htmlDisplayName() {
    if (bundleStructure.getNthEntry(0)==null) {
        bundleStructure.updateEntries();
    }
    final Node node = bundleStructure.getNthEntry(0).getDataObject().getNodeDelegate();
    String displayName = node.getHtmlDisplayName();
    if (displayName != null) {
        if (!displayName.startsWith("<html>")) {                //NOI18N
            displayName = "<html>" + displayName;               //NOI18N
        }
    } else {
        displayName = node.getDisplayName();
    }
    return DataEditorSupport.annotateName(displayName, true, isModified(), false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:PropertiesOpen.java


示例7: propertyChange

import org.openide.text.DataEditorSupport; //导入依赖的package包/类
public void propertyChange(PropertyChangeEvent evt) {
    if(evt.getPropertyName() == EditorCookie.Observable.PROP_DOCUMENT) {
        if(evt.getNewValue() == null) {
            final DataObject dobj = ((DataEditorSupport)evt.getSource()).getDataObject();
            if(dobj != null) {
                //document is being closed
                if(DEBUG) System.out.println("document has been closed for DO: " + dobj.hashCode());
                
                //remove the property change listener from the DataObject's EditorSupport
                attachDataObject(null);
                //and navigate the document again (must be called asynchronously
                //otherwise the ClonableEditorSupport locks itself (new call to CES from CES.propertyChange))
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        if(dobj.isValid()) navigate(dobj);
                    }
                });
            }
        }
    }
    if (EditorRegistry.FOCUS_GAINED_PROPERTY.equals(evt.getPropertyName())) {
        SwingUtilities.invokeLater(this);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:NavigatorContent.java


示例8: loadFromStreamToKit

import org.openide.text.DataEditorSupport; //导入依赖的package包/类
@Override
protected void loadFromStreamToKit(StyledDocument doc, InputStream stream, EditorKit kit) throws IOException, BadLocationException {
    if (guardedEditor == null) {
        guardedEditor = new FormGEditor();
        GuardedSectionsFactory gFactory = GuardedSectionsFactory.find(((DataEditorSupport.Env) env).getMimeType());
        if (gFactory != null) {
            guardedProvider = gFactory.create(guardedEditor);
        }
    }
    
    if (guardedProvider != null) {
        guardedEditor.doc = doc;
        Charset c = FileEncodingQuery.getEncoding(this.getDataObject().getPrimaryFile());
        Reader reader = guardedProvider.createGuardedReader(stream, c);
        try {
            kit.read(reader, doc, 0);
        } finally {
            reader.close();
        }
    } else {
        super.loadFromStreamToKit(doc, stream, kit);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:FormEditorSupport.java


示例9: GlslGeometryShaderDataObject

import org.openide.text.DataEditorSupport; //导入依赖的package包/类
public GlslGeometryShaderDataObject(FileObject pf, GlslGeometryShaderDataLoader loader) throws DataObjectExistsException, IOException {

        super(pf, loader);

        CookieSet cookies = getCookieSet();
        observer = new GlslShaderFileObserver(this);

        final CloneableEditorSupport support = DataEditorSupport.create(this, getPrimaryEntry(), cookies);
        support.addPropertyChangeListener(new PropertyChangeListener() {

            public void propertyChange(PropertyChangeEvent event) {
                if ("document".equals(event.getPropertyName())) {
                    if (event.getNewValue() != null) {
                        support.getDocument().addDocumentListener(observer);
                        observer.runCompileTask();
                    } else if (event.getOldValue() != null) {
                        // cylab: I think this is never called.
                        // But I don't know if unregistering the observer makes any difference...
                        ((Document) event.getOldValue()).removeDocumentListener(observer);
                    }
                }
            }
        });
        cookies.add((Node.Cookie) support);
    }
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:26,代码来源:GlslGeometryShaderDataObject.java


示例10: BreakpointLineUpdater

import org.openide.text.DataEditorSupport; //导入依赖的package包/类
public BreakpointLineUpdater(LineBreakpoint lb, DataObject dataObject) {
    this.lb = lb;
    this.dataObject = dataObject;
    lineChangePostProcess.setRepeats(false);
    DataEditorSupport des = dataObject.getLookup().lookup(DataEditorSupport.class);
    if (des != null) {
        des.addPropertyChangeListener(this);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:LineTranslations.java


示例11: destroy

import org.openide.text.DataEditorSupport; //导入依赖的package包/类
public void destroy() {
    detach();
    DataEditorSupport des = dataObject.getLookup().lookup(DataEditorSupport.class);
    if (des != null) {
        des.removePropertyChangeListener(this);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:LineTranslations.java


示例12: createCookie

import org.openide.text.DataEditorSupport; //导入依赖的package包/类
@Override
public <T extends Cookie> T createCookie(Class<T> klass) {
    if (klass.isAssignableFrom(SimpleES.class)) {
        synchronized (this) {
            if (support == null) {
                support = DataEditorSupport.create(
                    outer, outer.getPrimaryEntry(),
                    outer.getCookieSet(), useMultiview ? this : null
                );
            }
        }
        return klass.cast(support);
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:MultiDOEditor.java


示例13: createMultiObject

import org.openide.text.DataEditorSupport; //导入依赖的package包/类
@Override
protected MultiDataObject createMultiObject(FileObject primaryFile) throws DataObjectExistsException, IOException {
    MultiDataObject obj = new MultiDataObject(primaryFile, this);
    cnt++;
    obj.getCookieSet().assign(EditorCookie.class, DataEditorSupport.create(obj, obj.getPrimaryEntry(), obj.getCookieSet()));

    if (nodeListener != null) {
        nodeListener.nodeDestroyed(null);
    }
    
    return obj;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:DefaultDataObjectTest.java


示例14: displayName

import org.openide.text.DataEditorSupport; //导入依赖的package包/类
/**
 * Builds a display name for this component.
 *
 * @return  the created display name
 * @see  #htmlDisplayName
 */
private String displayName() {
    //PENDING change to avoid call getNthEntry, in some cases it will throw an exception
    if (bundleStructure.getNthEntry(0)==null) {
        bundleStructure.updateEntries();
    }
    String nameBase = bundleStructure.getNthEntry(0).getDataObject().getNodeDelegate().getDisplayName();
    return DataEditorSupport.annotateName(nameBase, false, isModified(), false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:PropertiesOpen.java


示例15: messageName

import org.openide.text.DataEditorSupport; //导入依赖的package包/类
/** 
 * Overrides superclass abstract method. 
 * Constructs message that should be used to name the editor component.
 * @return name of the editor
 */
protected String messageName () {
    if (!myEntry.getDataObject().isValid()) {
        return "";                                                  //NOI18N       
    }
    return DataEditorSupport.annotateName(getFileLabel(), false, isModified(), !myEntry.getFile().canWrite());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:PropertiesEditorSupport.java


示例16: messageHtmlName

import org.openide.text.DataEditorSupport; //导入依赖的package包/类
/** */
@Override
protected String messageHtmlName () {
    if (!myEntry.getDataObject().isValid()) {
        return null;
    }

    String rawName = getFileLabel();
    
    String annotatedName = null;
    final FileObject entry = myEntry.getFile();
    try {
        StatusDecorator status = entry.getFileSystem().getDecorator();
        if (status != null) {
            Set<FileObject> files = Collections.singleton(entry);
            annotatedName = status.annotateNameHtml(rawName, files);
            if (rawName.equals(annotatedName)) {
                annotatedName = null;
            }
            if ((annotatedName != null)
                    && (!annotatedName.startsWith("<html>"))) { //NOI18N
                annotatedName = "<html>" + annotatedName;       //NOI18N
            }
            if (annotatedName == null) {
                annotatedName = status.annotateName(rawName, files);
            }
        }
    } catch (FileStateInvalidException ex) {
        //do nothing and fall through
    }
    
    String name = (annotatedName != null) ? annotatedName : /*XXX escape HTML content*/rawName;
    return DataEditorSupport.annotateName(name, true, isModified(), !myEntry.getFile().canWrite());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:PropertiesEditorSupport.java


示例17: getMVTCDisplayName

import org.openide.text.DataEditorSupport; //导入依赖的package包/类
/**
 * Returns display name of the multiview top component.
 * The first item of the array is normal display name,
 * the second item of the array is HTML display name.
 *
 * @param formDataObject form data object representing the multiview tc.
 * @return display names of the MVTC. The second item can be <code>null</code>.
 */
private static String[] getMVTCDisplayName(FormDataObject formDataObject) {
    Node node = formDataObject.getNodeDelegate();
    String title = node.getDisplayName();
    String htmlTitle = node.getHtmlDisplayName();
    if (htmlTitle == null) {
        try {
            htmlTitle = XMLUtil.toElementContent(title);
        } catch (CharConversionException x) {
            htmlTitle = "???";
        }
    }
    FormEditorSupport fes = (FormEditorSupport)formDataObject.getFormEditorSupport();
    if (fes != null) {
        FormDesignerTC designerTC = fes.getFormDesignerTC();
        if (designerTC != null && designerTC.isShowing()) {
            FormModel fm = fes.getFormModel();
            if (fm != null) {
                FormDesigner fd = FormEditor.getFormDesigner(fes.getFormModel());
                if (fd != null && fd.getFormModel() != null
                        && !fd.isTopRADComponent() && fd.getTopDesignComponent() != null) {
                    title = FormUtils.getFormattedBundleString(
                            "FMT_FormTitleWithContainerName", // NOI18N
                            new Object[] {title, fd.getTopDesignComponent().getName()});
                    htmlTitle = FormUtils.getFormattedBundleString(
                            "FMT_FormTitleWithContainerName", // NOI18N
                            new Object[] {htmlTitle, fd.getTopDesignComponent().getName()});
                }
            }
        }
    }
    boolean modified = formDataObject.isModified();
    boolean readOnly = readOnly(formDataObject);
    return new String[] {
        DataEditorSupport.annotateName(title, false, modified, readOnly),
        DataEditorSupport.annotateName(htmlTitle, true, modified, readOnly)
    };
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:46,代码来源:FormEditorSupport.java


示例18: findDataObject

import org.openide.text.DataEditorSupport; //导入依赖的package包/类
private DataObject findDataObject(TopComponent tc) {
    if (tc ==null) return null;
    System.out.println(tc.getLookup().lookupAll(Object.class));
    System.out.flush();
    DataObject dObj = tc.getLookup().lookup(DataObject.class);
    if (dObj != null) return dObj;
    DataEditorSupport des = tc.getLookup().lookup(DataEditorSupport.class);
    if (des != null) return des.getDataObject();
    return null;
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:11,代码来源:ResourceBundleTopComponent.java


示例19: clsDataObject

import org.openide.text.DataEditorSupport; //导入依赖的package包/类
public clsDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
        super(pf, loader);
        this.fileObject = pf;
//        registerEditor("text/isc-cls", false);
        CookieSet cookies = getCookieSet();
//        observer = new GlslShaderFileObserver(this);

        final CloneableEditorSupport support = DataEditorSupport.create(this, getPrimaryEntry(), cookies);
        support.addPropertyChangeListener(
                new PropertyChangeListenerImpl(support));
        cookies.add((Node.Cookie) support);
    }
 
开发者ID:daimor,项目名称:NBStudio,代码行数:13,代码来源:clsDataObject.java


示例20: macDataObject

import org.openide.text.DataEditorSupport; //导入依赖的package包/类
public macDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
        super(pf, loader);
//        registerEditor("text/isc-mac", false);
        registerEntry(pf);
        CookieSet cookies = getCookieSet();

        final CloneableEditorSupport support = DataEditorSupport.create(this, getPrimaryEntry(), cookies);
//        support.addPropertyChangeListener(
//                new PropertyChangeListenerImpl(support));
        cookies.add((Node.Cookie) support);
    }
 
开发者ID:daimor,项目名称:NBStudio,代码行数:12,代码来源:macDataObject.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SequenceStyleGenerator类代码示例发布时间:2022-05-22
下一篇:
Java ConnectionProvider类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap