当前位置: 首页>>代码示例>>Java>>正文


Java JavaPlugin类代码示例

本文整理汇总了Java中org.eclipse.jdt.internal.ui.JavaPlugin的典型用法代码示例。如果您正苦于以下问题:Java JavaPlugin类的具体用法?Java JavaPlugin怎么用?Java JavaPlugin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JavaPlugin类属于org.eclipse.jdt.internal.ui包,在下文中一共展示了JavaPlugin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configure

import org.eclipse.jdt.internal.ui.JavaPlugin; //导入依赖的package包/类
@Override
protected void configure() {
  bind(JavadocService.class);
  bind(JavaNavigationService.class);
  bind(JavaReconcileService.class);
  bind(CodeAssistService.class);
  bind(JavaFormatterService.class);
  bind(JdtExceptionMapper.class);
  bind(CompilerSetupService.class);
  bind(ResourcesPlugin.class).asEagerSingleton();
  bind(JavaPlugin.class).asEagerSingleton();
  bind(FileBuffersPlugin.class).asEagerSingleton();
  bind(ProjectListeners.class).asEagerSingleton();
  bind(RefactoringManager.class).asEagerSingleton();
  bind(RefactoringService.class);
  bind(SearchJsonRpcService.class).asEagerSingleton();

  bind(JavaReconcileRequestHandler.class).asEagerSingleton();

  bind(JavadocUrlProvider.class).to(JavadocUrlProviderImpl.class);
  requestStaticInjection(UrlContextProvider.class);
}
 
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:JdtGuiceModule.java

示例2: delete

import org.eclipse.jdt.internal.ui.JavaPlugin; //导入依赖的package包/类
/**
 * Removes a resource. Retries if deletion failed (e.g. because the indexer still locks the file).
 *
 * @param resource the resource to delete
 * @throws CoreException if operation failed
 */
public static void delete(IResource resource) throws CoreException {
  for (int i = 0; i < MAX_RETRY; i++) {
    try {
      resource.delete(IResource.FORCE | IResource.ALWAYS_DELETE_PROJECT_CONTENT, null);
      i = MAX_RETRY;
    } catch (CoreException e) {
      if (i == MAX_RETRY - 1) {
        JavaPlugin.log(e);
        throw e;
      }
      try {
        JavaPlugin.log(
            new IllegalStateException(
                "sleep before retrying JavaProjectHelper.delete() for "
                    + resource.getLocationURI()));
        Thread.sleep(RETRY_DELAY); // give other threads time to close the file
      } catch (InterruptedException e1) {
      }
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:28,代码来源:JavaProjectHelper.java

示例3: createRefactoring

import org.eclipse.jdt.internal.ui.JavaPlugin; //导入依赖的package包/类
/** {@inheritDoc} */
public Refactoring createRefactoring(final RefactoringStatus status) throws CoreException {
  Refactoring refactoring = null;
  final String id = getID();
  final RefactoringContribution contribution = RefactoringCore.getRefactoringContribution(id);
  if (contribution != null) {
    if (contribution instanceof JavaRefactoringContribution) {
      JavaRefactoringContribution javaContribution = (JavaRefactoringContribution) contribution;
      refactoring = javaContribution.createRefactoring(this, status);
    } else
      JavaPlugin.log(
          new Status(
              IStatus.ERROR,
              JavaPlugin.getPluginId(),
              0,
              MessageFormat.format(
                  DescriptorMessages.JavaRefactoringDescriptor_no_resulting_descriptor,
                  new Object[] {id}),
              null));
  }
  return refactoring;
}
 
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:JavaRefactoringDescriptor.java

示例4: setUp

import org.eclipse.jdt.internal.ui.JavaPlugin; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
  super.setUp();
  Hashtable options = TestOptions.getDefaultOptions();
  options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
  options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "1");
  options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
  JavaCore.setOptions(options);

  IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
  store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);

  fJProject1 = ProjectTestSetup.getProject();

  String newFileTemplate = "${package_declaration}\n\n${type_declaration}";
  StubUtility.setCodeTemplate(CodeTemplateContextType.NEWTYPE_ID, newFileTemplate, null);
  StubUtility.setCodeTemplate(CodeTemplateContextType.TYPECOMMENT_ID, "", null);
  StubUtility.setCodeTemplate(CodeTemplateContextType.METHODSTUB_ID, "", null);

  fSourceFolder = JavaProjectHelper.addSourceContainer(fJProject1, "src");
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:UnresolvedTypesQuickFixTest.java

示例5: setUp

import org.eclipse.jdt.internal.ui.JavaPlugin; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
  super.setUp();
  Hashtable options = TestOptions.getDefaultOptions();
  options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
  options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
  JavaCore.setOptions(options);

  IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
  store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);

  fJProject1 = ProjectTestSetup.getProject();

  fSourceFolder = JavaProjectHelper.addSourceContainer(fJProject1, "src");
  fConvertLoopProposal = null;
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:ConvertForLoopQuickFixTest.java

示例6: reopenWithGWTJavaEditor

import org.eclipse.jdt.internal.ui.JavaPlugin; //导入依赖的package包/类
public static void reopenWithGWTJavaEditor(IEditorReference[] openEditors) {
  IWorkbenchPage page = JavaPlugin.getActivePage();

  for (IEditorReference editorRef : openEditors) {
    try {
      IEditorPart editor = editorRef.getEditor(false);
      IEditorInput input = editorRef.getEditorInput();

      // Close the editor, prompting the user to save if document is dirty
      if (page.closeEditor(editor, true)) {
        // Re-open the .java file in the GWT Java Editor
        IEditorPart gwtEditor = page.openEditor(input, GWTJavaEditor.EDITOR_ID);

        // Save the file from the new editor if the Java editor's
        // auto-format-on-save action screwed up the JSNI formatting
        gwtEditor.doSave(null);
      }
    } catch (PartInitException e) {
      GWTPluginLog.logError(e, "Could not open GWT Java editor on {0}", editorRef.getTitleToolTip());
    }
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:23,代码来源:GWTProjectPropertyPage.java

示例7: remember

import org.eclipse.jdt.internal.ui.JavaPlugin; //导入依赖的package包/类
/**
 * Remembers the selection of a right hand side type (proposal type) for a certain left hand side
 * (expected type) in content assist.
 *
 * @param lhs the left hand side / expected type
 * @param rhs the selected right hand side
 */
public void remember(IType lhs, IType rhs) {
  Assert.isLegal(lhs != null);
  Assert.isLegal(rhs != null);

  try {
    if (!isCacheableRHS(rhs)) return;
    ITypeHierarchy hierarchy = rhs.newSupertypeHierarchy(getProgressMonitor());
    if (hierarchy.contains(lhs)) {
      // TODO remember for every member of the LHS hierarchy or not? Yes for now.
      IType[] allLHSides = hierarchy.getAllSupertypes(lhs);
      String rhsQualifiedName = rhs.getFullyQualifiedName();
      for (int i = 0; i < allLHSides.length; i++)
        rememberInternal(allLHSides[i], rhsQualifiedName);
      rememberInternal(lhs, rhsQualifiedName);
    }
  } catch (JavaModelException x) {
    JavaPlugin.log(x);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:ContentAssistHistory.java

示例8: setUp

import org.eclipse.jdt.internal.ui.JavaPlugin; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
  super.setUp();
  Hashtable options = TestOptions.getDefaultOptions();
  options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
  options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
  options.put(
      DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_LOCAL_VARIABLE,
      JavaCore.DO_NOT_INSERT);
  options.put(JavaCore.COMPILER_PB_STATIC_ACCESS_RECEIVER, JavaCore.ERROR);
  options.put(JavaCore.COMPILER_PB_MISSING_SYNCHRONIZED_ON_INHERITED_METHOD, JavaCore.ERROR);

  JavaCore.setOptions(options);

  IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
  store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);

  fJProject1 = ProjectTestSetup.getProject();

  StubUtility.setCodeTemplate(CodeTemplateContextType.METHODSTUB_ID, "", null);
  StubUtility.setCodeTemplate(CodeTemplateContextType.CONSTRUCTORSTUB_ID, "", null);

  fSourceFolder = JavaProjectHelper.addSourceContainer(fJProject1, "src");
}
 
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:ModifierCorrectionsQuickFixTest.java

示例9: NewDefiningMethodProposal

import org.eclipse.jdt.internal.ui.JavaPlugin; //导入依赖的package包/类
public NewDefiningMethodProposal(
    String label,
    ICompilationUnit targetCU,
    ASTNode invocationNode,
    ITypeBinding binding,
    IMethodBinding method,
    String[] paramNames,
    int relevance) {
  super(label, targetCU, invocationNode, binding, relevance, null);
  fMethod = method;
  fParamNames = paramNames;

  ImageDescriptor desc =
      JavaElementImageProvider.getMethodImageDescriptor(
          binding.isInterface() || binding.isAnnotation(), method.getModifiers());
  setImage(JavaPlugin.getImageDescriptorRegistry().get(desc));
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:NewDefiningMethodProposal.java

示例10: setUp

import org.eclipse.jdt.internal.ui.JavaPlugin; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
  super.setUp();
  Hashtable options = TestOptions.getDefaultOptions();
  options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
  options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
  JavaCore.setOptions(options);

  IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
  store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);

  fProject = ProjectTestSetup.getProject();

  fSourceFolder = JavaProjectHelper.addSourceContainer(fProject, "src");
  fConvertLoopProposal = null;
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:ConvertIterableLoopQuickFixTest.java

示例11: setUp

import org.eclipse.jdt.internal.ui.JavaPlugin; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
  super.setUp();
  Hashtable options = TestOptions.getDefaultOptions();
  options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
  options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");

  JavaCore.setOptions(options);

  IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
  store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);
  store.setValue(PreferenceConstants.CODEGEN_KEYWORD_THIS, false);

  StubUtility.setCodeTemplate(
      CodeTemplateContextType.METHODSTUB_ID, "//TODO\n${body_statement}", null);

  //		Preferences corePrefs = JavaPlugin.getJavaCorePluginPreferences();
  //		corePrefs.setValue(JavaCore.CODEASSIST_FIELD_PREFIXES, "");
  //		corePrefs.setValue(JavaCore.CODEASSIST_STATIC_FIELD_PREFIXES, "");
  //		corePrefs.setValue(JavaCore.CODEASSIST_FIELD_SUFFIXES, "");
  //		corePrefs.setValue(JavaCore.CODEASSIST_STATIC_FIELD_SUFFIXES, "");

  fJProject1 = ProjectTestSetup.getProject();

  fSourceFolder = JavaProjectHelper.addSourceContainer(fJProject1, "src");
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:AdvancedQuickAssistTest.java

示例12: setUp

import org.eclipse.jdt.internal.ui.JavaPlugin; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
  super.setUp();
  Hashtable options = TestOptions.getDefaultOptions();
  options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
  options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");

  JavaCore.setOptions(options);

  IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
  store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);
  store.setValue(PreferenceConstants.CODEGEN_KEYWORD_THIS, false);

  StubUtility.setCodeTemplate(
      CodeTemplateContextType.METHODSTUB_ID, "//TODO\n${body_statement}", null);

  //		Preferences corePrefs = JavaPlugin.getJavaCorePluginPreferences();
  //		corePrefs.setValue(JavaCore.CODEASSIST_FIELD_PREFIXES, "");
  //		corePrefs.setValue(JavaCore.CODEASSIST_STATIC_FIELD_PREFIXES, "");
  //		corePrefs.setValue(JavaCore.CODEASSIST_FIELD_SUFFIXES, "");
  //		corePrefs.setValue(JavaCore.CODEASSIST_STATIC_FIELD_SUFFIXES, "");

  fJProject1 = Java17ProjectTestSetup.getProject();

  fSourceFolder = JavaProjectHelper.addSourceContainer(fJProject1, "src");
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:AssistQuickFixTest17.java

示例13: formatOnSaveEnabled

import org.eclipse.jdt.internal.ui.JavaPlugin; //导入依赖的package包/类
private boolean formatOnSaveEnabled(IJavaProject javaProject) {
  SaveParticipantRegistry spr = JavaPlugin.getDefault().getSaveParticipantRegistry();
  IPostSaveListener[] listeners = spr.getEnabledPostSaveListeners(javaProject.getProject());

  for (IPostSaveListener listener : listeners) {
    if (listener instanceof CleanUpPostSaveListener) {
      Map<String, String> settings =
          CleanUpPreferenceUtil.loadSaveParticipantOptions(new ProjectScope(
          javaProject.getProject()));

      if (settings == null) {
        return false;
      }

      return (CLEAN_UP_OPTION_TRUE.equals(settings.get(CleanUpConstants.FORMAT_SOURCE_CODE)));
    }
  }

  return false;
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:21,代码来源:GWTJavaEditor.java

示例14: getExpectedType

import org.eclipse.jdt.internal.ui.JavaPlugin; //导入依赖的package包/类
/**
 * Returns the expected type if any, <code>null</code> otherwise.
 *
 * <p><strong>Note:</strong> This method may run {@linkplain
 * org.eclipse.jdt.core.ICodeAssist#codeComplete(int, org.eclipse.jdt.core.CompletionRequestor)
 * codeComplete} on the compilation unit.
 *
 * @return the expected type if any, <code>null</code> otherwise
 */
public IType getExpectedType() {
  if (fType == null && getCompilationUnit() != null) {
    CompletionContext context = getCoreContext();
    if (context != null) {
      char[][] expectedTypes = context.getExpectedTypesSignatures();
      if (expectedTypes != null && expectedTypes.length > 0) {
        IJavaProject project = getCompilationUnit().getJavaProject();
        if (project != null) {
          try {
            fType =
                project.findType(
                    SignatureUtil.stripSignatureToFQN(String.valueOf(expectedTypes[0])));
          } catch (JavaModelException x) {
            JavaPlugin.log(x);
          }
        }
      }
    }
  }
  return fType;
}
 
开发者ID:eclipse,项目名称:che,代码行数:31,代码来源:JavaContentAssistInvocationContext.java

示例15: computeKeywordsAndContext

import org.eclipse.jdt.internal.ui.JavaPlugin; //导入依赖的package包/类
/**
 * Fallback to retrieve a core context and keyword proposals when no collector is available. Runs
 * code completion on the cu and collects keyword proposals. {@link #fKeywordProposals} is non-
 * <code>null</code> after this call.
 *
 * @since 3.3
 */
private void computeKeywordsAndContext() {
  ICompilationUnit cu = getCompilationUnit();
  if (cu == null) {
    if (fKeywordProposals == null) fKeywordProposals = new IJavaCompletionProposal[0];
    return;
  }

  CompletionProposalCollector collector = new CompletionProposalCollector(cu, true);
  collector.setIgnored(CompletionProposal.KEYWORD, false);

  try {
    cu.codeComplete(getInvocationOffset(), collector);
    if (fCoreContext == null) fCoreContext = collector.getContext();
    if (fKeywordProposals == null) fKeywordProposals = collector.getKeywordCompletionProposals();
    if (fLabelProvider == null) fLabelProvider = collector.getLabelProvider();
  } catch (JavaModelException x) {
    if (!x.isDoesNotExist()
        || cu.getJavaProject() == null
        || cu.getJavaProject().isOnClasspath(cu)) JavaPlugin.log(x);
    if (fKeywordProposals == null) fKeywordProposals = new IJavaCompletionProposal[0];
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:30,代码来源:JavaContentAssistInvocationContext.java


注:本文中的org.eclipse.jdt.internal.ui.JavaPlugin类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。