Package org.eclipse.jdt.internal.ui.javaeditor

Examples of org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor


   */
  private void createJavaEditor()
  {
    try
    {
      javaEditor = new CompilationUnitEditor();
      javaEditor.init(getEditorSite(), getEditorInput());
     
      WicketFunMarkOccurrenceInstaller wfmoi = new WicketFunMarkOccurrenceInstaller(javaEditor);
      wfmoi.installOccurrencesFinder(true);
     
View Full Code Here


    return null;
  }
 
  private Menu createMenu(Control parent)
  {
    CompilationUnitEditor javaEditor = getCompilationUnitEditor();
   
    if (javaEditor == null)
      return null;
   
    ICompilationUnit compilationUnit = getCompilationUnit(javaEditor);
   
    Menu menu = new Menu(parent);
   
    ISelection selection = javaEditor.getSelectionProvider().getSelection();
   
    try
    {
      traverse(menu, compilationUnit, selection);
    }
View Full Code Here

    return manager.getWorkingCopy(javaEditor.getEditorInput());
  }
 
  private void selectElement(IJavaElement element)
  {
    CompilationUnitEditor javaEditor = getCompilationUnitEditor();
   
    if (javaEditor != null)
      javaEditor.setSelection(element);
  }
View Full Code Here

  public void partBroughtToTop(final IWorkbenchPart part) {
  }

  public void partOpened(final IWorkbenchPart part) {
    if (part instanceof CompilationUnitEditor) {// JAVA
      CompilationUnitEditor editor = (CompilationUnitEditor) part;
      final IResource openedResource = (IResource) editor.getEditorInput().getAdapter(IResource.class);
      String extension = "";
      if (!QWickieActivator.getDefault().openHTMLFiles() && QWickieActivator.getDefault().openPropertiesFiles()) {
        extension = WicketHyperlink.PROPERTIES;
      }
      final List<String> filenamesToOpen = new WicketHyperlink(new Region(1, 1), "", WicketHyperlink.JAVA).getFilenamesToOpen(openedResource, extension);
View Full Code Here

    assertEquals(proposal.computeCompletionProposals(context, monitor).size(), 0);

    final ICompilationUnit cu = JavaCore.createCompilationUnitFrom(javaFile);
    ITextViewer viewer = new TextViewer(new Shell(), 0);
    int offset = 420;
    context = new JavaContentAssistInvocationContext(viewer, offset, new CompilationUnitEditor()) {
      @SuppressWarnings("restriction")
      @Override
      public IType getExpectedType() {
        JavaElement je = null;
        return new ResolvedBinaryType(je, "String", "java.lang.String");
View Full Code Here

        });
    }
   
    public static void installContentAssistProcessor(IWorkbenchPart part) {
        if (part instanceof CompilationUnitEditor) {
            final CompilationUnitEditor ed = (CompilationUnitEditor)part;
            IContentAssistProcessor processor = null;
            //eclipse 3.2 class
            try {
        Class.forName("org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext"); //$NON-NLS-1$
        processor = getWojJavaCompletionProcessor32(ed);
      } catch (ClassNotFoundException e) {
        try {
          Class.forName("org.eclipse.jdt.ui.text.java.CompletionProposalCollector"); //$NON-NLS-1$
          processor = getWojJavaCompletionProcessor31(ed);
        } catch (ClassNotFoundException e2) {
          processor = getWojJavaCompletionProcessor30(ed);
        }
      }
      if(processor != null) {
        try {
          ContentAssistant assistant = (ContentAssistant) HookUtil.getPrivateAttributeValue(SourceViewer.class, "fContentAssistant", ed.getViewer()); //$NON-NLS-1$
          //HookUtil.callPrivateMethod("org.eclipse.jdt.internal.ui.javaeditor.JavaEditor","initializeEditor", null, ed, null);
          //assistant.install(ed.getViewer());
          assistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
          SourceViewerConfiguration conf = (SourceViewerConfiguration) HookUtil.getPrivateAttributeValue(AbstractTextEditor.class, "fConfiguration", ed); //$NON-NLS-1$
          ContentAssistPreference.configure(assistant, (IPreferenceStore) HookUtil.getPrivateAttributeValue(Class.forName("org.eclipse.ui.editors.text.TextSourceViewerConfiguration"),"fPreferenceStore", conf));
View Full Code Here

    }
    return null;
  }

  protected IEditorPart openEditor() throws CoreException, IOException {
    CompilationUnitEditor editor = openFileInEditor(testFile);

    return editor;
  }
View Full Code Here

    try {
      IEditorPart editorPart = openEditor();

      if (editorPart instanceof CompilationUnitEditor) {
        CompilationUnitEditor sourceEditor = (CompilationUnitEditor) editorPart;
        ITextViewer sourceViewer = sourceEditor.getViewer();

        JavaContentAssistInvocationContext testContext = new JavaContentAssistInvocationContext(sourceViewer,
            offset, editorPart);

        return testContext;
View Full Code Here

    try {
      IEditorPart editorPart = openEditor();

      if (editorPart instanceof CompilationUnitEditor) {
        CompilationUnitEditor sourceEditor = (CompilationUnitEditor) editorPart;
        ITextViewer sourceViewer = sourceEditor.getViewer();
        JavaContentAssistInvocationContext testContext = new JavaContentAssistInvocationContext(sourceViewer,
            offset, editorPart);
        return testContext;
      }
      else {
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.