本文整理汇总了Java中org.eclipse.ui.ISaveablePart类的典型用法代码示例。如果您正苦于以下问题:Java ISaveablePart类的具体用法?Java ISaveablePart怎么用?Java ISaveablePart使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISaveablePart类属于org.eclipse.ui包,在下文中一共展示了ISaveablePart类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAdapter
import org.eclipse.ui.ISaveablePart; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(final Class<T> adapter)
{
if (adapter == ISaveablePart.class)
return (T)clean_saveable;
return null;
}
示例2: propertyChange
import org.eclipse.ui.ISaveablePart; //导入依赖的package包/类
public void propertyChange(PropertyChangeEvent evt) {
getSite().getWorkbenchWindow().getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
isDirty = true;
firePropertyChange(ISaveablePart.PROP_DIRTY);
}
});
}
示例3: doSave
import org.eclipse.ui.ISaveablePart; //导入依赖的package包/类
@Override
public void doSave(IProgressMonitor monitor) {
isRefresh = true;
String xml = null;
if (activePage == 0) {
xml = model2xml();
} else if (activePage == 1) {
xml2model();
}
doSaveParticipate(monitor);
xmlEditor.doSave(monitor);
if (xml != null) {
try {
IFile f = getCurrentFile();
if (f != null)
f.setContents(new ByteArrayInputStream(xml.getBytes("UTF-8")), IFile.KEEP_HISTORY | IFile.FORCE, monitor);
} catch (Throwable e) {
UIUtils.showError(e);
}
}
Display.getDefault().asyncExec(new Runnable() {
public void run() {
isRefresh = false;
firePropertyChange(ISaveablePart.PROP_DIRTY);
}
});
xmlFresh = true;
}
示例4: propertyChange
import org.eclipse.ui.ISaveablePart; //导入依赖的package包/类
public void propertyChange(PropertyChangeEvent evt) {
getSite().getWorkbenchWindow().getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
firePropertyChange(ISaveablePart.PROP_DIRTY);
}
});
}
示例5: finishSave
import org.eclipse.ui.ISaveablePart; //导入依赖的package包/类
protected void finishSave(IFile resource) {
String resourceAbsolutePath = resource.getRawLocation().toOSString();
if (DefaultManager.INSTANCE.isCurrentDefault(resourceAbsolutePath)) {
DefaultManager.INSTANCE.reloadCurrentDefault();
}
Display.getDefault().asyncExec(new Runnable() {
public void run() {
isRefresh = false;
firePropertyChange(ISaveablePart.PROP_DIRTY);
}
});
}
示例6: handlePropertyChange
import org.eclipse.ui.ISaveablePart; //导入依赖的package包/类
@Override
protected void handlePropertyChange(int propertyId) {
if (!isRefresh) {
if (propertyId == ISaveablePart.PROP_DIRTY && previewEditor != null)
previewEditor.setDirty(true);
super.handlePropertyChange(propertyId);
}
}
示例7: dirtyStateChanged
import org.eclipse.ui.ISaveablePart; //导入依赖的package包/类
@Override
public void dirtyStateChanged() {
WidgetUtils.runInDisplayThread(ChartEditor.this.getSite().getShell(), new Runnable() {
@Override
public void run() {
firePropertyChange(ISaveablePart.PROP_DIRTY);
}
});
}
示例8: setInput
import org.eclipse.ui.ISaveablePart; //导入依赖的package包/类
/**
* Required by IReusableEditor - change our editor to a new input.
* Unconditionally remove the existing input if there is one, undoing listeners and providers.
* If the given input is not null, set the editor to work on it. Finally, notify that the
* dirty and input properties have changed.
* @param input the new input which is to replace the existing input
*/
@Override
public void setInput(IEditorInput input) {
unsetOldInput();
if (input == null) {
setPartName("<disposed>");
} else {
setNewInput(input);
}
setPageInputs(input);
firePropertyChange(ISaveablePart.PROP_DIRTY);
// following the instructions from the javadoc on IReusableEditor
firePropertyChange(IWorkbenchPartConstants.PROP_INPUT);
}
示例9: dirtyStateChanged
import org.eclipse.ui.ISaveablePart; //导入依赖的package包/类
/**
* When the dirty state changes, fire a property-change event for the "dirty" property.
*/
@Override
public void dirtyStateChanged() {
WidgetUtils.runInDisplayThread(MultiPagePlanEditor.this.getContainer(), new Runnable() {
@Override
public void run() {
firePropertyChange(ISaveablePart.PROP_DIRTY);
}
});
}
示例10: evaluate
import org.eclipse.ui.ISaveablePart; //导入依赖的package包/类
@Override
protected EvaluationResult evaluate(IEvaluationContext context) {
IWorkbenchWindow window = InternalHandlerUtil.getActiveWorkbenchWindow(context);
// no window? not active
if (window == null)
return EvaluationResult.FALSE;
WorkbenchPage page = (WorkbenchPage) window.getActivePage();
// no page? not active
if (page == null)
return EvaluationResult.FALSE;
// get saveable part
ISaveablePart saveablePart = getSaveablePart(context);
if (saveablePart == null)
return EvaluationResult.FALSE;
if (saveablePart instanceof ISaveablesSource) {
ISaveablesSource modelSource = (ISaveablesSource) saveablePart;
if (SaveableHelper.needsSave(modelSource))
return EvaluationResult.TRUE;
return EvaluationResult.FALSE;
}
if (saveablePart != null && saveablePart.isDirty())
return EvaluationResult.TRUE;
return EvaluationResult.FALSE;
}
示例11: run
import org.eclipse.ui.ISaveablePart; //导入依赖的package包/类
@Override
public void run() {
IPath ignoreThrownExceptionsPath = PyExceptionBreakPointManager.getInstance().ignoreCaughtExceptionsWhenThrownFrom
.getIgnoreThrownExceptionsPath();
File file = ignoreThrownExceptionsPath.toFile();
IEditorPart openFile = EditorUtils.openFile(file);
if (openFile instanceof ITextEditor) {
final ITextEditor textEditor = (ITextEditor) openFile;
IDocumentProvider documentProvider = textEditor.getDocumentProvider();
final IEditorInput input = openFile.getEditorInput();
if (documentProvider instanceof IStorageDocumentProvider) {
IStorageDocumentProvider storageDocumentProvider = (IStorageDocumentProvider) documentProvider;
// Make sure the file is seen as UTF-8.
storageDocumentProvider.setEncoding(input, "utf-8");
textEditor.doRevertToSaved();
}
if (textEditor instanceof ISaveablePart) {
IPropertyListener listener = new IPropertyListener() {
@Override
public void propertyChanged(Object source, int propId) {
if (propId == IWorkbenchPartConstants.PROP_DIRTY) {
if (source == textEditor) {
if (textEditor.getEditorInput() == input) {
if (!textEditor.isDirty()) {
PyExceptionBreakPointManager.getInstance().ignoreCaughtExceptionsWhenThrownFrom
.updateIgnoreThrownExceptions();
}
}
}
}
}
};
textEditor.addPropertyListener(listener);
}
}
// Code to provide a dialog to edit it (decided on opening the file instead).
// Collection<IgnoredExceptionInfo> ignoreThrownExceptionsForEdition = PyExceptionBreakPointManager.getInstance()
// .getIgnoreThrownExceptionsForEdition();
// HashMap<String, String> map = new HashMap<>();
// for (IgnoredExceptionInfo ignoredExceptionInfo : ignoreThrownExceptionsForEdition) {
// map.put(ignoredExceptionInfo.filename + ": " + ignoredExceptionInfo.line, ignoredExceptionInfo.contents);
// }
//
// EditIgnoredCaughtExceptionsDialog dialog = new EditIgnoredCaughtExceptionsDialog(EditorUtils.getShell(), map);
// int open = dialog.open();
// if (open == dialog.OK) {
// Map<String, String> result = dialog.getResult();
//
// } else {
// System.out.println("Cancel");
// }
}
示例12: ScriptDocumentProvider
import org.eclipse.ui.ISaveablePart; //导入依赖的package包/类
/**
* Creates a new script's document provider with the specified saveable
* part.
*
* @param part
* the saveable part.
*/
public ScriptDocumentProvider( ISaveablePart part )
{
super( part );
}
示例13: JSDocumentProvider
import org.eclipse.ui.ISaveablePart; //导入依赖的package包/类
/**
* Creates a new javascript's document provider with the specified saveable
* part.
*
* @param part
* the saveable part.
*/
public JSDocumentProvider( ISaveablePart part )
{
super( part );
}
示例14: StorageDocumentProvider
import org.eclipse.ui.ISaveablePart; //导入依赖的package包/类
/**
* Creates a new document provider with the specified saveable part.
*
* @param part
* the saveable part.
*/
public StorageDocumentProvider( ISaveablePart part )
{
super( part );
}
示例15: DocumentProvider
import org.eclipse.ui.ISaveablePart; //导入依赖的package包/类
/**
* Creates a new document provider with the specified saveable part.
*
* @param part
* the saveable part.
*/
public DocumentProvider( ISaveablePart part )
{
super( );
this.part = part;
}