use of org.eclipse.ui.IEditorInput in project cubrid-manager by CUBRID.
the class WorkbenchContrItem method processNodeRemoveWhenRefreshContainer.
/**
* When refresh the container node and if this child node is deleted, then
* close it's editor or view part
*
* @param eventNode ICubridNode
* @param page IWorkbenchPage
*/
protected void processNodeRemoveWhenRefreshContainer(ICubridNode eventNode, IWorkbenchPage page) {
synchronized (this) {
IEditorReference[] editorRefArr = page.getEditorReferences();
if (editorRefArr != null && editorRefArr.length > 0) {
for (IEditorReference editorRef : editorRefArr) {
try {
IEditorInput editorInput = editorRef.getEditorInput();
if (editorInput instanceof ICubridNode) {
ICubridNode editorNode = (ICubridNode) editorInput;
ICubridNode parentNode = editorNode.getParent();
if (editorNode != null && parentNode != null && parentNode.getId().equals(eventNode.getId()) && eventNode.getChild(editorNode.getId()) == null) {
processNodeRemove(editorNode, page);
}
}
} catch (PartInitException e1) {
LOGGER.error(e1.getMessage());
}
}
}
IViewReference[] viewRefArr = page.getViewReferences();
if (viewRefArr != null && viewRefArr.length > 0) {
for (IViewReference viewRef : viewRefArr) {
IViewPart viewPart = viewRef.getView(false);
if (viewPart instanceof CubridViewPart) {
ICubridNode viewPartNode = ((CubridViewPart) viewPart).getCubridNode();
if (viewPartNode == null) {
continue;
}
ICubridNode parentNode = viewPartNode.getParent();
if (viewPartNode != null && parentNode != null && parentNode.getId().equals(eventNode.getId()) && eventNode.getChild(viewPartNode.getId()) == null) {
processNodeRemove(viewPartNode, page);
}
}
}
}
}
}
use of org.eclipse.ui.IEditorInput in project cubrid-manager by CUBRID.
the class QueryEditorPart method changeQueryEditorPartName.
/**
*
* Change query editor part name
*
* @param text String
*
*/
public void changeQueryEditorPartName(String text) {
IEditorInput input = getEditorInput();
if (!(input instanceof QueryUnit) || !isUpdatePartName) {
return;
}
QueryUnit queryUnit = (QueryUnit) input;
queryUnit.setToolTip(text);
setPartName("[" + currentEditorIndex + "] " + text);
editorTabNameOriginal = text;
}
use of org.eclipse.ui.IEditorInput in project dbeaver by serge-rider.
the class ImageEditorPart method resourceChanged.
@Override
public void resourceChanged(IResourceChangeEvent event) {
IResourceDelta delta = event.getDelta();
if (delta == null) {
return;
}
IEditorInput input = getEditorInput();
IPath localPath = null;
if (input instanceof IPathEditorInput) {
localPath = ((IPathEditorInput) input).getPath();
}
if (localPath == null) {
return;
}
localPath = ContentUtils.convertPathToWorkspacePath(localPath);
delta = delta.findMember(localPath);
if (delta == null) {
return;
}
if (delta.getKind() == IResourceDelta.CHANGED) {
// Refresh editor
DBeaverUI.asyncExec(new Runnable() {
@Override
public void run() {
loadImage();
}
});
}
}
use of org.eclipse.ui.IEditorInput in project dbeaver by serge-rider.
the class XMLPanelEditor method primeEditorValue.
@Override
public void primeEditorValue(@NotNull DBRProgressMonitor monitor, @NotNull StyledText control, @NotNull DBDContent value) throws DBException {
monitor.beginTask("Prime content value", 1);
try {
monitor.subTask("Prime XML value");
IEditorInput sqlInput = new ContentEditorInput(valueController, null, null, monitor);
editor.init(subSite, sqlInput);
} catch (Exception e) {
throw new DBException("Can't load XML vaue", e);
} finally {
monitor.done();
}
}
use of org.eclipse.ui.IEditorInput in project gfm_viewer by satyagraha.
the class MarkdownEditorTrackerDefault method getTrackableFile.
private IFile getTrackableFile(IEditorPart editorPart) {
IFile result = null;
IEditorInput editorInput = editorPart.getEditorInput();
if (editorInput != null) {
IFile editorFile = ResourceUtil.getFile(editorInput);
if (editorFile != null) {
if (markdownFileNature.isTrackableFile(editorFile)) {
result = editorFile;
}
}
}
return result;
}
Aggregations