本文整理汇总了Java中org.netbeans.core.spi.multiview.CloseOperationState.STATE_OK属性的典型用法代码示例。如果您正苦于以下问题:Java CloseOperationState.STATE_OK属性的具体用法?Java CloseOperationState.STATE_OK怎么用?Java CloseOperationState.STATE_OK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.netbeans.core.spi.multiview.CloseOperationState
的用法示例。
在下文中一共展示了CloseOperationState.STATE_OK属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: canCloseElement
@Override
public CloseOperationState canCloseElement() {
if (dObj == null || dObj.canClose()) {
return CloseOperationState.STATE_OK;
} else if (!this.callback.isSelectedElement()) {
return CloseOperationState.STATE_OK;
} else if (!dObj.isModified()) {
return CloseOperationState.STATE_OK;
} else {
boolean differ = false;
String message = dObj.getEditorSupport().messageSave();
try {
String encoding = dObj.encoding();
differ = dObj.encodingDiffer(encoding);
if (differ) {
message += " <b>" + dObj.encodingMessage(encoding) + "</b>";
}
} catch (IOException ex) {
LOGGER.log(Level.INFO, null, ex);
}
message = "<html>" + message + "</html>";
return MultiViewFactory.createUnsafeCloseState(
message, new SaveAction(differ), new DiscardAction());
}
}
示例2: canCloseElement
@Override
public CloseOperationState canCloseElement() {
if (closeState != null) {
return closeState;
}
return CloseOperationState.STATE_OK;
}
示例3: canCloseElement
@Messages({
"MSG_SaveModified=File {0} is modified. Save?"
})
@Override
public CloseOperationState canCloseElement() {
final CloneableEditorSupport sup = getLookup().lookup(CloneableEditorSupport.class);
Enumeration en = getReference().getComponents();
if (en.hasMoreElements()) {
en.nextElement();
if (en.hasMoreElements()) {
// at least two is OK
return CloseOperationState.STATE_OK;
}
}
PropertiesDataObject dataObject = getDataObject();
if (dataObject.isModified()) {
AbstractAction save = new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
try {
sup.saveDocument();
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
}
};
save.putValue(Action.LONG_DESCRIPTION, Bundle.MSG_SaveModified(FileUtil.getFileDisplayName(dataObject.getPrimaryFile())));
return MultiViewFactory.createUnsafeCloseState("editor", save, null);
}
return CloseOperationState.STATE_OK;
}
示例4: canCloseElement
@Messages({
"MSG_SaveModified=File {0} is modified. Save?"
})
@Override
public CloseOperationState canCloseElement() {
if (sqlEditorSupport().isConsole()) {
return CloseOperationState.STATE_OK;
} else {
DataObject sqlDO = sqlEditorSupport().getDataObject();
FileObject sqlFO = sqlEditorSupport().getDataObject().getPrimaryFile();
if (sqlDO.isModified()) {
if (sqlFO.canWrite()) {
Savable sav = sqlDO.getLookup().lookup(Savable.class);
if (sav != null) {
AbstractAction save = new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
try {
sqlEditorSupport().saveDocument();
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
}
};
save.putValue(Action.LONG_DESCRIPTION, Bundle.MSG_SaveModified(sqlFO.getNameExt()));
return MultiViewFactory.createUnsafeCloseState("editor", save, null);
}
}
}
}
return CloseOperationState.STATE_OK;
}
示例5: canCloseElement
@Messages({
"MSG_MODIFIED=File {0} is modified. Save?"
})
final CloseOperationState canCloseElement(TopComponent tc) {
// if this is not the last cloned java editor component, closing is OK
if (!FormEditorSupport.isLastView(tc)) {
return CloseOperationState.STATE_OK;
}
if (!isModified()) {
return CloseOperationState.STATE_OK;
}
AbstractAction save = new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
try {
saveDocument();
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
}
};
save.putValue(Action.LONG_DESCRIPTION, Bundle.MSG_MODIFIED(
getDataObject().getPrimaryFile().getNameExt()
));
// return a placeholder state - to be sure our CloseHandler is called
return MultiViewFactory.createUnsafeCloseState(
"ID_FORM_CLOSING", // NOI18N
save,
MultiViewFactory.NOOP_CLOSE_ACTION);
}
示例6: canCloseElement
public CloseOperationState canCloseElement() {
if(getEditorSupport().isModified()){
return MultiViewFactory.createUnsafeCloseState(PREFERRED_ID,
null,null);
}
return CloseOperationState.STATE_OK;
}
示例7: canCloseElement
@Override
public CloseOperationState canCloseElement() {
List<CloseOperationState> states = getInvalidStates();
return states.isEmpty()?
CloseOperationState.STATE_OK :
createCompositeState(states);
}
示例8: getInvalidStates
private List<CloseOperationState> getInvalidStates() {
List<CloseOperationState> states = new ArrayList<CloseOperationState>(elements.length);
for(ExpandableElementDescription description : elements) {
CloseOperationState state = description.getElement().canCloseElement();
if(CloseOperationState.STATE_OK != state)
states.add(state);
}
return states;
}
示例9: canCloseElement
@Override
public CloseOperationState canCloseElement() {
Savable sav = getLookup().lookup(Savable.class);
if(sav == null)
return CloseOperationState.STATE_OK;
Action proceed = null;
Action cancel = null;
return MultiViewFactory.createUnsafeCloseState("editor", proceed, cancel);
}
示例10: canCloseElement
@Override
public CloseOperationState canCloseElement() {
return CloseOperationState.STATE_OK;
}
示例11: canCloseElement
public CloseOperationState canCloseElement() {
return CloseOperationState.STATE_OK;
}
示例12: canCloseElement
@Override public CloseOperationState canCloseElement() {
return CloseOperationState.STATE_OK;
}
示例13: canCloseElement
@Override
public CloseOperationState canCloseElement() {
// TODO: maybe use superclass method?
return CloseOperationState.STATE_OK;
}
示例14: canCloseElement
@Override
public CloseOperationState canCloseElement() {
return CloseOperationState.STATE_OK;
}
示例15: canCloseElement
/**
*
* @return
*/
@Override
public CloseOperationState canCloseElement() {
return CloseOperationState.STATE_OK;
}