org.eclipse.ui.ISaveablePart Java Examples
The following examples show how to use
org.eclipse.ui.ISaveablePart.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SaveCoolbarItem.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
public void createDirtyStateTracker() { dirtyStateTracker = new DirtyStateTracker() { @Override public void propertyChanged(final Object source, final int propID) { IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .getActiveEditor(); if (activeEditor instanceof ISaveablePart && propID == ISaveablePart.PROP_DIRTY) { update(); if (item != null && !item.isDisposed()) { item.setEnabled(((ISaveablePart) activeEditor).isDirty()); } } } }; }
Example #2
Source File: CppStyleHandler.java From CppStyle with MIT License | 5 votes |
@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; }
Example #3
Source File: SaveCoolbarItem.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public void partActivated(IWorkbenchPart part) { if (part instanceof ISaveablePart) { final DirtyStateTracker dirtyStateTracker = getDirtyStateTracker(); dirtyStateTracker.partActivated(part); } }
Example #4
Source File: SaveCoolbarItem.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public void partBroughtToTop(IWorkbenchPart part) { if (part instanceof ISaveablePart) { final DirtyStateTracker dirtyStateTracker = getDirtyStateTracker(); dirtyStateTracker.partBroughtToTop(part); } }
Example #5
Source File: SaveCoolbarItem.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public void partClosed(IWorkbenchPart part) { if (part instanceof ISaveablePart) { final DirtyStateTracker dirtyStateTracker = getDirtyStateTracker(); dirtyStateTracker.partClosed(part); } }
Example #6
Source File: SaveCoolbarItem.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public void partDeactivated(IWorkbenchPart part) { if (part instanceof ISaveablePart) { final DirtyStateTracker dirtyStateTracker = getDirtyStateTracker(); dirtyStateTracker.partDeactivated(part); } }
Example #7
Source File: SaveCoolbarItem.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public void partOpened(IWorkbenchPart part) { if (part instanceof ISaveablePart) { final DirtyStateTracker dirtyStateTracker = getDirtyStateTracker(); dirtyStateTracker.partOpened(part); } }
Example #8
Source File: MultiPageEditor.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * Finish save. * * @param monitor the monitor * @param modelOK the model OK */ private void finishSave(IProgressMonitor monitor, boolean modelOK) { if (modelOK) { if (dirtyTypeNameHash.size() > 0) jcasGen(monitor); dirtyTypeNameHash.clear(); } fileDirty = false; firePropertyChange(ISaveablePart.PROP_DIRTY); }
Example #9
Source File: MultiPageEditor.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * Sets the file dirty. */ public void setFileDirty() { if (m_bIsInited) { fileDirty = true; // next is key this.firePropertyChange(ISaveablePart.PROP_DIRTY); } }
Example #10
Source File: EditIgnoredCaughtExceptions.java From Pydev with Eclipse Public License 1.0 | 4 votes |
@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"); // } }
Example #11
Source File: BonitaPropertiesView.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
@Override protected ISaveablePart getSaveablePart() { return null; }
Example #12
Source File: ScriptDocumentProvider.java From birt with Eclipse Public License 1.0 | 2 votes |
/** * Creates a new script's document provider with the specified saveable * part. * * @param part * the saveable part. */ public ScriptDocumentProvider( ISaveablePart part ) { super( part ); }
Example #13
Source File: JSDocumentProvider.java From birt with Eclipse Public License 1.0 | 2 votes |
/** * Creates a new javascript's document provider with the specified saveable * part. * * @param part * the saveable part. */ public JSDocumentProvider( ISaveablePart part ) { super( part ); }
Example #14
Source File: StorageDocumentProvider.java From birt with Eclipse Public License 1.0 | 2 votes |
/** * Creates a new document provider with the specified saveable part. * * @param part * the saveable part. */ public StorageDocumentProvider( ISaveablePart part ) { super( part ); }
Example #15
Source File: DocumentProvider.java From birt with Eclipse Public License 1.0 | 2 votes |
/** * Creates a new document provider with the specified saveable part. * * @param part * the saveable part. */ public DocumentProvider( ISaveablePart part ) { super( ); this.part = part; }