本文整理汇总了Java中org.netbeans.api.actions.Editable类的典型用法代码示例。如果您正苦于以下问题:Java Editable类的具体用法?Java Editable怎么用?Java Editable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Editable类属于org.netbeans.api.actions包,在下文中一共展示了Editable类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GsfDataObject
import org.netbeans.api.actions.Editable; //导入依赖的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());
}
示例2: createCookie
import org.netbeans.api.actions.Editable; //导入依赖的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;
}
示例3: performer
import org.netbeans.api.actions.Editable; //导入依赖的package包/类
static ContextAction.Performer<?> performer(final Map fo) {
String type = (String)fo.get("type");
if (type.equals(Openable.class.getName())) {
return new ActionDefaultPerfomer(0);
}
if (type.equals(Viewable.class.getName())) {
return new ActionDefaultPerfomer(1);
}
if (type.equals(Editable.class.getName())) {
return new ActionDefaultPerfomer(2);
}
if (type.equals(Closable.class.getName())) {
return new ActionDefaultPerfomer(3);
}
if (type.equals(Printable.class.getName())) {
return new ActionDefaultPerfomer(4);
}
throw new IllegalStateException(type);
}
示例4: edit
import org.netbeans.api.actions.Editable; //导入依赖的package包/类
private static void edit(@NonNull final DataObject dobj, final int lineNo) {
// if linenumber is given then try to open file at this line
// code taken from org.netbeans.modules.java.stackanalyzer.StackLineAnalyser.Link.show()
LineCookie lineCookie = dobj.getLookup().lookup(LineCookie.class);
if (lineCookie == null) {
//Workaround of non functional org.openide.util.Lookup class hierarchy cache.
lineCookie = dobj.getLookup().lookup(EditorCookie.class);
}
if (lineCookie != null && lineNo != -1) {
try {
final Line l = lineCookie.getLineSet().getCurrent(lineNo - 1);
if (l != null) {
// open file at the given line
l.show(Line.ShowOpenType.OPEN, Line.ShowVisibilityType.FOCUS, -1);
return;
}
} catch (IndexOutOfBoundsException oob) {
LOG.log(Level.FINE, "Line no more exists.", oob); //NOI18N
}
}
Editable editable = dobj.getLookup().lookup(Editable.class);
if (editable == null) {
//Workaround of non functional org.openide.util.Lookup class hierarchy cache.
editable = dobj.getLookup().lookup(EditCookie.class);
}
if (editable != null) {
editable.edit();
return;
}
open(dobj);
}
示例5: Edit
import org.netbeans.api.actions.Editable; //导入依赖的package包/类
public Edit(Editable context) {
this.context = context;
task = Utilities.actionsGlobalContext().lookup(EGTask.class);
dto = Utilities.actionsGlobalContext().lookup(EGTaskDataObjectDataObject.class);
}
示例6: Edit
import org.netbeans.api.actions.Editable; //导入依赖的package包/类
public Edit(Editable context) {
this.context = context;
egt = Utilities.actionsGlobalContext().lookup(EGTask.class);
dto = Utilities.actionsGlobalContext().lookup(EGTaskDataObjectDataObject.class);
}
示例7: actionPerformed
import org.netbeans.api.actions.Editable; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
Editable editor = getLookup().lookup(Editable.class);
if(editor != null)
editor.edit();
}