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


Java DataEditorSupport类代码示例

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


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


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