use of org.eclipse.ui.IEditorInput in project tdi-studio-se by Talend.
the class EditPropertiesAction method getCorrespondingEditor.
/**
* Find the editor that is related to the node.
*
* @param node
* @return
*/
protected IEditorPart getCorrespondingEditor(final IRepositoryNode node) {
IEditorReference[] eidtors = getActivePage().getEditorReferences();
for (IEditorReference eidtor : eidtors) {
try {
IEditorInput input = eidtor.getEditorInput();
if (!(input instanceof RepositoryEditorInput)) {
continue;
}
RepositoryEditorInput repositoryInput = (RepositoryEditorInput) input;
if (node.getId() != null && node.getId().equals(repositoryInput.getId())) {
IPath path = repositoryInput.getFile().getLocation();
return eidtor.getEditor(false);
}
} catch (PartInitException e) {
continue;
}
}
return null;
}
use of org.eclipse.ui.IEditorInput in project tdi-studio-se by Talend.
the class OpenExistVersionProcessAction method getCorrespondingEditor.
@Override
protected IEditorPart getCorrespondingEditor(IRepositoryNode node) {
IEditorReference[] eidtors = getActivePage().getEditorReferences();
for (IEditorReference eidtor : eidtors) {
try {
IEditorInput input = eidtor.getEditorInput();
if (!(input instanceof JobEditorInput)) {
continue;
}
JobEditorInput repositoryInput = (JobEditorInput) input;
checkUnLoadedNodeForProcess(repositoryInput);
if (repositoryInput.getItem().equals(node.getObject().getProperty().getItem())) {
IPath path = repositoryInput.getFile().getLocation();
return eidtor.getEditor(false);
}
} catch (PartInitException e) {
continue;
}
}
return null;
}
use of org.eclipse.ui.IEditorInput in project tdi-studio-se by Talend.
the class ProcessPart method getAdapter.
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#getAdapter(java.lang.Class)
*/
@Override
public Object getAdapter(final Class adapter) {
if (adapter.equals(RepositoryNode.class)) {
if (node == null) {
RootEditPart rootEditPart = getRoot();
if (rootEditPart instanceof TalendScalableFreeformRootEditPart) {
TalendScalableFreeformRootEditPart rootEditPart2 = (TalendScalableFreeformRootEditPart) rootEditPart;
IEditorInput editorInput = rootEditPart2.getEditorInput();
if (editorInput instanceof ProcessEditorInput) {
ProcessEditorInput processEditorInput = (ProcessEditorInput) editorInput;
node = processEditorInput.getRepositoryNode();
}
}
}
return node;
}
if (adapter == SnapToHelper.class) {
List<Object> snapStrategies = new ArrayList<Object>();
Boolean val = (Boolean) getViewer().getProperty(RulerProvider.PROPERTY_RULER_VISIBILITY);
val = (Boolean) getViewer().getProperty(NodeSnapToGeometry.PROPERTY_SNAP_ENABLED);
if (val != null && val.booleanValue()) {
snapStrategies.add(new NodeSnapToGeometry(this));
}
val = (Boolean) getViewer().getProperty(SnapToGrid.PROPERTY_GRID_ENABLED);
if (val != null && val.booleanValue()) {
snapStrategies.add(new SnapToGrid(this));
}
if (snapStrategies.size() == 0) {
return null;
}
if (snapStrategies.size() == 1) {
return snapStrategies.get(0);
}
SnapToHelper[] ss = new SnapToHelper[snapStrategies.size()];
for (int i = 0; i < snapStrategies.size(); i++) {
ss[i] = (SnapToHelper) snapStrategies.get(i);
}
return new CompoundSnapToHelper(ss);
}
return super.getAdapter(adapter);
}
use of org.eclipse.ui.IEditorInput in project tdi-studio-se by Talend.
the class TalendJavaSourceViewer method initializeModel.
/*
* (non-Javadoc)
*
* @see org.talend.core.ui.viewer.ReconcilerViewer#initializeModel(IDocument document)
*/
@Override
protected void initializeModel() {
getSourceViewerDecorationSupport().install(JavaPlugin.getDefault().getCombinedPreferenceStore());
this.setRangeIndicator(new DefaultRangeIndicator());
IAnnotationModel model;
IDocument document;
if (checkCode) {
IDocumentProvider provider = JavaPlugin.getDefault().getCompilationUnitDocumentProvider();
IEditorInput ei = new FileEditorInput(file);
try {
provider.connect(ei);
} catch (CoreException e) {
ExceptionHandler.process(e);
}
document = provider.getDocument(ei);
model = provider.getAnnotationModel(ei);
} else {
model = new AnnotationModel();
document = getDocument();
model.connect(document);
}
if (document != null) {
setDocument(document, model);
showAnnotations(model != null && checkCode);
}
super.initializeModel();
}
use of org.eclipse.ui.IEditorInput in project tesb-studio-se by Talend.
the class ResourceEditorListener method partClosed.
@Override
public void partClosed(IWorkbenchPartReference partRef) {
IWorkbenchPart part = partRef.getPart(true);
if (part instanceof IEditorPart) {
IEditorInput input = ((IEditorPart) part).getEditorInput();
if (input instanceof RouteResourceInput) {
Item item = ((RouteResourceInput) input).getItem();
if (item.getProperty().getId().equals(editorInput.getItem().getProperty().getId())) {
try {
ProxyRepositoryFactory.getInstance().unlock(item);
page.getWorkbenchWindow().getPartService().removePartListener(this);
IResourceChangeListener l = editorInput.getListener();
if (null != l) {
ResourcesPlugin.getWorkspace().removeResourceChangeListener(l);
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
}
}
}
Aggregations