Java 类org.eclipse.ui.part.EditorInputTransfer 实例源码

项目:limpet    文件:ApplicationWorkbenchWindowAdvisor.java   
public void preWindowOpen()
{
  IWorkbenchWindowConfigurer configurer = getWindowConfigurer();

  // show the shortcut bar and progress indicator, which are hidden by
  // default
  configurer.setShowPerspectiveBar(true);
  configurer.setShowFastViewBars(true);
  configurer.setShowProgressIndicator(true);

  // add the drag and drop support for the editor area
  configurer.addEditorAreaTransfer(EditorInputTransfer.getInstance());
  configurer.addEditorAreaTransfer(ResourceTransfer.getInstance());
  configurer.addEditorAreaTransfer(FileTransfer.getInstance());
  configurer.addEditorAreaTransfer(MarkerTransfer.getInstance());
  configurer.configureEditorAreaDropListener(new EditorAreaDropAdapter(
      configurer.getWindow()));

  hookTitleUpdateListeners(configurer);
}
项目:Eclipse-Postfix-Code-Completion    文件:EditorInputTransferDragAdapter.java   
@Override
public void dragStart(DragSourceEvent event) {
    fEditorInputDatas= new ArrayList<EditorInputData>();

    ISelection selection= fProvider.getSelection();
    if (selection instanceof IStructuredSelection) {
        IStructuredSelection structuredSelection= (IStructuredSelection) selection;
        for (Iterator<?> iter= structuredSelection.iterator(); iter.hasNext();) {
            Object element= iter.next();
            IEditorInput editorInput= EditorUtility.getEditorInput(element);
            if (editorInput != null && editorInput.getPersistable() != null) {
                try {
                    String editorId= EditorUtility.getEditorID(editorInput);
                    // see org.eclipse.ui.internal.ide.EditorAreaDropAdapter.openNonExternalEditor(..):
                    IEditorRegistry editorReg= PlatformUI.getWorkbench().getEditorRegistry();
                    IEditorDescriptor editorDesc= editorReg.findEditor(editorId);
                    if (editorDesc != null && !editorDesc.isOpenExternal()) {
                        fEditorInputDatas.add(EditorInputTransfer.createEditorInputData(editorId, editorInput));
                    }
                } catch (PartInitException e) {
                    JavaPlugin.log(e);
                }
            }
        }
    }

    event.doit= fEditorInputDatas.size() > 0;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:EditorInputTransferDragAdapter.java   
@Override
public void dragStart(DragSourceEvent event) {
    fEditorInputDatas= new ArrayList<EditorInputData>();

    ISelection selection= fProvider.getSelection();
    if (selection instanceof IStructuredSelection) {
        IStructuredSelection structuredSelection= (IStructuredSelection) selection;
        for (Iterator<?> iter= structuredSelection.iterator(); iter.hasNext();) {
            Object element= iter.next();
            IEditorInput editorInput= EditorUtility.getEditorInput(element);
            if (editorInput != null && editorInput.getPersistable() != null) {
                try {
                    String editorId= EditorUtility.getEditorID(editorInput);
                    // see org.eclipse.ui.internal.ide.EditorAreaDropAdapter.openNonExternalEditor(..):
                    IEditorRegistry editorReg= PlatformUI.getWorkbench().getEditorRegistry();
                    IEditorDescriptor editorDesc= editorReg.findEditor(editorId);
                    if (editorDesc != null && !editorDesc.isOpenExternal()) {
                        fEditorInputDatas.add(EditorInputTransfer.createEditorInputData(editorId, editorInput));
                    }
                } catch (PartInitException e) {
                    JavaPlugin.log(e);
                }
            }
        }
    }

    event.doit= fEditorInputDatas.size() > 0;
}
项目:Eclipse-Postfix-Code-Completion    文件:EditorInputTransferDragAdapter.java   
public Transfer getTransfer() {
    return EditorInputTransfer.getInstance();
}
项目:Eclipse-Postfix-Code-Completion    文件:EditorInputTransferDragAdapter.java   
@Override
public void dragSetData(DragSourceEvent event) {
    if (EditorInputTransfer.getInstance().isSupportedType(event.dataType) && fEditorInputDatas.size() > 0) {
        event.data= fEditorInputDatas.toArray(new EditorInputData[fEditorInputDatas.size()]);
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:EditorInputTransferDragAdapter.java   
public Transfer getTransfer() {
    return EditorInputTransfer.getInstance();
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:EditorInputTransferDragAdapter.java   
@Override
public void dragSetData(DragSourceEvent event) {
    if (EditorInputTransfer.getInstance().isSupportedType(event.dataType) && fEditorInputDatas.size() > 0) {
        event.data= fEditorInputDatas.toArray(new EditorInputData[fEditorInputDatas.size()]);
    }
}