Java 类org.eclipse.ui.ISaveablePart 实例源码

项目:org.csstudio.display.builder    文件:DataBrowserPropertySheetPage.java   
@SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(final Class<T> adapter)
{
    if (adapter == ISaveablePart.class)
        return (T)clean_saveable;
    return null;
}
项目:PDFReporter-Studio    文件:DataAdapterEditorPart.java   
public void propertyChange(PropertyChangeEvent evt) {
    getSite().getWorkbenchWindow().getShell().getDisplay().asyncExec(new Runnable() {
        public void run() {
            isDirty = true;
            firePropertyChange(ISaveablePart.PROP_DIRTY);
        }
    });

}
项目:PDFReporter-Studio    文件:AMultiEditor.java   
@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;
}
项目:PDFReporter-Studio    文件:AMultiEditor.java   
public void propertyChange(PropertyChangeEvent evt) {
    getSite().getWorkbenchWindow().getShell().getDisplay().asyncExec(new Runnable() {
        public void run() {
            firePropertyChange(ISaveablePart.PROP_DIRTY);
        }
    });

}
项目:PDFReporter-Studio    文件:JrxmlEditor.java   
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);
        }
    });
}
项目:PDFReporter-Studio    文件:JrxmlEditor.java   
@Override
protected void handlePropertyChange(int propertyId) {
    if (!isRefresh) {
        if (propertyId == ISaveablePart.PROP_DIRTY && previewEditor != null)
            previewEditor.setDirty(true);
        super.handlePropertyChange(propertyId);
    }
}
项目:OpenSPIFe    文件:ChartEditor.java   
@Override
public void dirtyStateChanged() {
    WidgetUtils.runInDisplayThread(ChartEditor.this.getSite().getShell(), new Runnable() {
        @Override
        public void run() {
            firePropertyChange(ISaveablePart.PROP_DIRTY);
        }
    });
}
项目:OpenSPIFe    文件:MultiPagePlanEditor.java   
/**
 * 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);
}
项目:OpenSPIFe    文件:MultiPagePlanEditor.java   
/**
 * 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);
        }
    });
}
项目:CppStyle    文件:CppStyleHandler.java   
@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;
}
项目:Pydev    文件:EditIgnoredCaughtExceptions.java   
@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");
    //        }
}
项目:birt    文件:ScriptDocumentProvider.java   
/**
 * Creates a new script's document provider with the specified saveable
 * part.
 * 
 * @param part
 *            the saveable part.
 */
public ScriptDocumentProvider( ISaveablePart part )
{
    super( part );
}
项目:birt    文件:JSDocumentProvider.java   
/**
 * Creates a new javascript's document provider with the specified saveable
 * part.
 * 
 * @param part
 *            the saveable part.
 */
public JSDocumentProvider( ISaveablePart part )
{
    super( part );
}
项目:birt    文件:StorageDocumentProvider.java   
/**
 * Creates a new document provider with the specified saveable part.
 * 
 * @param part
 *            the saveable part.
 */
public StorageDocumentProvider( ISaveablePart part )
{
    super( part );
}
项目:birt    文件:DocumentProvider.java   
/**
 * Creates a new document provider with the specified saveable part.
 * 
 * @param part
 *            the saveable part.
 */
public DocumentProvider( ISaveablePart part )
{
    super( );
    this.part = part;
}