當前位置: 首頁>>代碼示例>>Java>>正文


Java Extensions類代碼示例

本文整理匯總了Java中com.intellij.openapi.extensions.Extensions的典型用法代碼示例。如果您正苦於以下問題:Java Extensions類的具體用法?Java Extensions怎麽用?Java Extensions使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Extensions類屬於com.intellij.openapi.extensions包,在下文中一共展示了Extensions類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: assertNavigationMatch

import com.intellij.openapi.extensions.Extensions; //導入依賴的package包/類
private void assertNavigationMatch(ElementPattern<?> pattern) {

        PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset());

        Set<String> targetStrings = new HashSet<String>();

        for (GotoDeclarationHandler gotoDeclarationHandler : Extensions.getExtensions(GotoDeclarationHandler.EP_NAME)) {

            PsiElement[] gotoDeclarationTargets = gotoDeclarationHandler.getGotoDeclarationTargets(psiElement, 0, myFixture.getEditor());
            if(gotoDeclarationTargets == null || gotoDeclarationTargets.length == 0) {
                continue;
            }

            for (PsiElement gotoDeclarationTarget : gotoDeclarationTargets) {
                targetStrings.add(gotoDeclarationTarget.toString());
                if(pattern.accepts(gotoDeclarationTarget)) {
                    return;
                }
            }
        }

        fail(String.format("failed that PsiElement (%s) navigate matches one of %s", psiElement.toString(), targetStrings.toString()));
    }
 
開發者ID:adelf,項目名稱:idea-php-dotenv-plugin,代碼行數:24,代碼來源:DotEnvLightCodeInsightFixtureTestCase.java

示例2: getFindUsagesHandler

import com.intellij.openapi.extensions.Extensions; //導入依賴的package包/類
public static FindUsagesHandler getFindUsagesHandler(PsiElement element, Project project) {
    FindUsagesHandlerFactory[] arrs = (FindUsagesHandlerFactory[]) Extensions.getExtensions(FindUsagesHandlerFactory.EP_NAME, project);
    FindUsagesHandler handler = null;
    int length = arrs.length;
    for (int i = 0; i < length; i++) {
        FindUsagesHandlerFactory arr = arrs[i];
        if (arr.canFindUsages(element)) {
            handler = arr.createFindUsagesHandler(element, false);
            if(handler == FindUsagesHandler.NULL_HANDLER) {
                return null;
            }

            if(handler != null) {
                return handler;
            }
        }
    }
    return null;
}
 
開發者ID:niorgai,項目名稱:Android-Resource-Usage-Count,代碼行數:20,代碼來源:FindUsageUtils.java

示例3: allForFile

import com.intellij.openapi.extensions.Extensions; //導入依賴的package包/類
@NotNull
public static List<ExternalAnnotator> allForFile(@NotNull Language language, @NotNull final PsiFile file) {
  List<ExternalAnnotator> annotators = INSTANCE.allForLanguage(language);
  final ExternalAnnotatorsFilter[] filters = Extensions.getExtensions(ExternalAnnotatorsFilter.EXTENSION_POINT_NAME);
  return ContainerUtil.findAll(annotators, new Condition<ExternalAnnotator>() {
    @Override
    public boolean value(ExternalAnnotator annotator) {
      for (ExternalAnnotatorsFilter filter : filters) {
        if (filter.isProhibited(annotator, file)) {
          return false;
        }
      }
      return true;
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:ExternalLanguageAnnotators.java

示例4: VcsChangeDetailsManager

import com.intellij.openapi.extensions.Extensions; //導入依賴的package包/類
public VcsChangeDetailsManager(final Project project) {
  myProject = project;
  myQueue = new BackgroundTaskQueue(myProject, "Loading change details");
  myDedicatedList = new ArrayList<VcsChangeDetailsProvider>();

  myDedicatedList.add(new BinaryDetailsProviderNew(project));
  myDedicatedList.add(new FragmentedDiffDetailsProvider(myProject));

  VcsChangeDetailsProvider[] extensions = Extensions.getExtensions(VcsChangeDetailsProvider.EP_NAME, myProject);
  myProviders.addAll(Arrays.asList(extensions));

  Disposer.register(project, new Disposable() {
    @Override
    public void dispose() {
      myQueue.clear();
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:VcsChangeDetailsManager.java

示例5: install

import com.intellij.openapi.extensions.Extensions; //導入依賴的package包/類
@Override
public void install(@NotNull StatusBar statusBar) {
    Toolkit.getDefaultToolkit().addAWTEventListener(this,
            AWTEvent.KEY_EVENT_MASK |
                    AWTEvent.MOUSE_EVENT_MASK |
                    AWTEvent.MOUSE_MOTION_EVENT_MASK
    );
    saveDocumentListener = new FileDocumentManagerAdapter() {
        @Override
        public void beforeAllDocumentsSaving() {
            foldRunningTime();
        }

        @Override
        public void beforeDocumentSaving(@NotNull Document document) {
            foldRunningTime();
        }
    };
    Extensions.getArea(null).getExtensionPoint(FileDocumentManagerListener.EP_NAME).registerExtension(saveDocumentListener);

    synchronized (ALL_OPENED_TRACKERS_LOCK) {
        ALL_OPENED_TRACKERS.add(this);
    }
}
 
開發者ID:Darkyenus,項目名稱:DarkyenusTimeTracker,代碼行數:25,代碼來源:TimeTrackerWidget.java

示例6: ExtensibleQueryFactory

import com.intellij.openapi.extensions.Extensions; //導入依賴的package包/類
protected ExtensibleQueryFactory(@NonNls final String epNamespace) {
  myPoint = new NotNullLazyValue<SimpleSmartExtensionPoint<QueryExecutor<Result, Parameters>>>() {
    @Override
    @NotNull
    protected SimpleSmartExtensionPoint<QueryExecutor<Result, Parameters>> compute() {
      return new SimpleSmartExtensionPoint<QueryExecutor<Result, Parameters>>(new SmartList<QueryExecutor<Result, Parameters>>()){
        @Override
        @NotNull
        protected ExtensionPoint<QueryExecutor<Result, Parameters>> getExtensionPoint() {
          @NonNls String epName = ExtensibleQueryFactory.this.getClass().getName();
          int pos = epName.lastIndexOf('.');
          if (pos >= 0) {
            epName = epName.substring(pos+1);
          }
          epName = epNamespace + "." + StringUtil.decapitalize(epName);
          return Extensions.getRootArea().getExtensionPoint(epName);
        }
      };
    }
  };
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:ExtensibleQueryFactory.java

示例7: invoke

import com.intellij.openapi.extensions.Extensions; //導入依賴的package包/類
@Override
public void invoke(@NotNull final Project project, Editor editor, PsiFile file, DataContext dataContext) {
  editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);

  PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext);
  if (element == null) {
    element = BaseRefactoringAction.getElementAtCaret(editor, file);
  }
  if (element != null) {
    for(InlineActionHandler handler: Extensions.getExtensions(InlineActionHandler.EP_NAME)) {
      if (handler.canInlineElementInEditor(element, editor)) {
        handler.inlineElement(project, editor, element);
        return;
      }
    }

    if (invokeInliner(editor, element)) return;

    String message = RefactoringBundle.getCannotRefactorMessage(RefactoringBundle.message("error.wrong.caret.position.method.or.local.name"));
    CommonRefactoringUtil.showErrorHint(project, editor, message, REFACTORING_NAME, null);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:InlineRefactoringActionHandler.java

示例8: getNavigationElement

import com.intellij.openapi.extensions.Extensions; //導入依賴的package包/類
@Override
@NotNull
public PsiElement getNavigationElement() {
  if (DumbService.isDumb(getProject())) return this;
  
  for (ClsCustomNavigationPolicy customNavigationPolicy : Extensions.getExtensions(ClsCustomNavigationPolicy.EP_NAME)) {
    PsiElement navigationElement = customNavigationPolicy.getNavigationElement(this);
    if (navigationElement != null) {
      return navigationElement;
    }
  }

  PsiClass sourceClassMirror = ((ClsClassImpl)getParent()).getSourceMirrorClass();
  PsiElement sourceFieldMirror = sourceClassMirror != null ? sourceClassMirror.findFieldByName(getName(), false) : null;
  return sourceFieldMirror != null ? sourceFieldMirror.getNavigationElement() : this;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:ClsFieldImpl.java

示例9: collectListeners

import com.intellij.openapi.extensions.Extensions; //導入依賴的package包/類
protected void collectListeners(JavaParameters javaParameters, StringBuilder buf, String epName, String delimiter) {
  final T configuration = getConfiguration();
  final Object[] listeners = Extensions.getExtensions(epName);
  for (final Object listener : listeners) {
    boolean enabled = true;
    for (RunConfigurationExtension ext : Extensions.getExtensions(RunConfigurationExtension.EP_NAME)) {
      if (ext.isListenerDisabled(configuration, listener, getRunnerSettings())) {
        enabled = false;
        break;
      }
    }
    if (enabled) {
      if (buf.length() > 0) buf.append(delimiter);
      final Class classListener = listener.getClass();
      buf.append(classListener.getName());
      javaParameters.getClassPath().add(PathUtil.getJarPathForClass(classListener));
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,代碼來源:JavaTestFrameworkRunnableState.java

示例10: getReturnType

import com.intellij.openapi.extensions.Extensions; //導入依賴的package包/類
@Nullable
private PyType getReturnType(@NotNull TypeEvalContext context) {
  for (PyTypeProvider typeProvider : Extensions.getExtensions(PyTypeProvider.EP_NAME)) {
    final Ref<PyType> returnTypeRef = typeProvider.getReturnType(this, context);
    if (returnTypeRef != null) {
      final PyType returnType = returnTypeRef.get();
      if (returnType != null) {
        returnType.assertValid(typeProvider.toString());
      }
      return returnType;
    }
  }
  final PyType docStringType = getReturnTypeFromDocString();
  if (docStringType != null) {
    docStringType.assertValid("from docstring");
    return docStringType;
  }
  if (context.allowReturnTypes(this)) {
    final Ref<? extends PyType> yieldTypeRef = getYieldStatementType(context);
    if (yieldTypeRef != null) {
      return yieldTypeRef.get();
    }
    return getReturnStatementType(context);
  }
  return null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:PyFunctionImpl.java

示例11: shortenReferences

import com.intellij.openapi.extensions.Extensions; //導入依賴的package包/類
private void shortenReferences() {
  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    @Override
    public void run() {
      final PsiFile file = getPsiFile();
      if (file != null) {
        IntArrayList indices = initEmptyVariables();
        mySegments.setSegmentsGreedy(false);
        for (TemplateOptionalProcessor processor : Extensions.getExtensions(TemplateOptionalProcessor.EP_NAME)) {
          processor.processText(myProject, myTemplate, myDocument, myTemplateRange, myEditor);
        }
        mySegments.setSegmentsGreedy(true);
        restoreEmptyVariables(indices);
      }
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:TemplateState.java

示例12: performRefactoring

import com.intellij.openapi.extensions.Extensions; //導入依賴的package包/類
protected void performRefactoring(@NotNull UsageInfo[] usages) {
  final PsiMigration psiMigration = PsiMigrationManager.getInstance(myProject).startMigration();
  LocalHistoryAction a = LocalHistory.getInstance().startAction(getCommandName());

  try {
    for (int i = 0; i < myMigrationMap.getEntryCount(); i++) {
      MigrationMapEntry entry = myMigrationMap.getEntryAt(i);
      if (entry.getType() == MigrationMapEntry.PACKAGE) {
        MigrationUtil.doPackageMigration(myProject, psiMigration, entry.getNewName(), usages);
      }
      if (entry.getType() == MigrationMapEntry.CLASS) {
        MigrationUtil.doClassMigration(myProject, psiMigration, entry.getNewName(), usages);
      }
    }

    for(RefactoringHelper helper: Extensions.getExtensions(RefactoringHelper.EP_NAME)) {
      Object preparedData = helper.prepareOperation(usages);
      //noinspection unchecked
      helper.performOperation(myProject, preparedData);
    }
  }
  finally {
    a.finish();
    psiMigration.finish();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:MigrationProcessor.java

示例13: computeParameters

import com.intellij.openapi.extensions.Extensions; //導入依賴的package包/類
public static Map<String, String> computeParameters(final Project project, boolean replaceParameters) {
  final Map<String, String> parameters = new HashMap<String, String>();
  if (replaceParameters) {
    ApplicationManager.getApplication().runReadAction(new Runnable() {
      public void run() {
        ProjectTemplateParameterFactory[] extensions = Extensions.getExtensions(ProjectTemplateParameterFactory.EP_NAME);
        for (ProjectTemplateParameterFactory extension : extensions) {
          String value = extension.detectParameterValue(project);
          if (value != null) {
            parameters.put(value, extension.getParameterId());
          }
        }
      }
    });
  }
  return parameters;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:SaveProjectAsTemplateAction.java

示例14: getWithItemVariableType

import com.intellij.openapi.extensions.Extensions; //導入依賴的package包/類
@Nullable
private static PyType getWithItemVariableType(TypeEvalContext context, PyWithItem item) {
  final PyExpression expression = item.getExpression();
  if (expression != null) {
    final PyType exprType = context.getType(expression);
    if (exprType instanceof PyClassType) {
      final PyClass cls = ((PyClassType)exprType).getPyClass();
      final PyFunction enter = cls.findMethodByName(PyNames.ENTER, true);
      if (enter != null) {
        final PyType enterType = enter.getCallType(expression, Collections.<PyExpression, PyNamedParameter>emptyMap(), context);
        if (enterType != null) {
          return enterType;
        }
        for (PyTypeProvider provider: Extensions.getExtensions(PyTypeProvider.EP_NAME)) {
          PyType typeFromProvider = provider.getContextManagerVariableType(cls, expression, context);
          if (typeFromProvider != null) {
            return typeFromProvider;
          }
        }
        // Guess the return type of __enter__
        return PyUnionType.createWeakType(exprType);
      }
    }
  }
  return null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:PyTargetExpressionImpl.java

示例15: getNewFindUsagesHandler

import com.intellij.openapi.extensions.Extensions; //導入依賴的package包/類
@Nullable
public FindUsagesHandler getNewFindUsagesHandler(@NotNull PsiElement element, final boolean forHighlightUsages) {
  for (FindUsagesHandlerFactory factory : Extensions.getExtensions(FindUsagesHandlerFactory.EP_NAME, myProject)) {
    if (factory.canFindUsages(element)) {
      Class<? extends FindUsagesHandlerFactory> aClass = factory.getClass();
      FindUsagesHandlerFactory copy = (FindUsagesHandlerFactory)new ConstructorInjectionComponentAdapter(aClass.getName(), aClass)
        .getComponentInstance(myProject.getPicoContainer());
      final FindUsagesHandler handler = copy.createFindUsagesHandler(element, forHighlightUsages);
      if (handler == FindUsagesHandler.NULL_HANDLER) return null;
      if (handler != null) {
        return handler;
      }
    }
  }
  return null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:FindUsagesManager.java


注:本文中的com.intellij.openapi.extensions.Extensions類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。