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


Java Project类代码示例

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


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

示例1: showHint

import com.intellij.openapi.project.Project; //导入依赖的package包/类
public void showHint(Project project) {
  Course course = StudyTaskManager.getInstance(project).getCourse();
  if (course == null) {
    return;
  }
  StudyState studyState = new StudyState(StudyUtils.getSelectedStudyEditor(project));
  if (!studyState.isValid()) {
    return;
  }
  PsiFile file = PsiManager.getInstance(project).findFile(studyState.getVirtualFile());
  final Editor editor = studyState.getEditor();
  int offset = editor.getCaretModel().getOffset();
  AnswerPlaceholder answerPlaceholder = studyState.getTaskFile().getAnswerPlaceholder(offset);
  if (file == null) {
    return;
  }
  EduUsagesCollector.hintShown();

  final StudyToolWindow hintComponent = getHint(project, answerPlaceholder).getStudyToolWindow();
  hintComponent.setPreferredSize(new Dimension(400, 150));
  showHintPopUp(project, studyState, editor, hintComponent);
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:23,代码来源:StudyShowHintAction.java

示例2: showTestResultsToolWindow

import com.intellij.openapi.project.Project; //导入依赖的package包/类
public static void showTestResultsToolWindow(@NotNull final Project project, @NotNull final String message) {
  ApplicationManager.getApplication().invokeLater(() -> {
    final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
    ToolWindow window = toolWindowManager.getToolWindow(StudyTestResultsToolWindowFactoryKt.ID);
    if (window == null) {
      toolWindowManager.registerToolWindow(StudyTestResultsToolWindowFactoryKt.ID, true, ToolWindowAnchor.BOTTOM);
      window = toolWindowManager.getToolWindow(StudyTestResultsToolWindowFactoryKt.ID);
      new StudyTestResultsToolWindowFactory().createToolWindowContent(project, window);
    }

    final Content[] contents = window.getContentManager().getContents();
    for (Content content : contents) {
      final JComponent component = content.getComponent();
      if (component instanceof ConsoleViewImpl) {
        ((ConsoleViewImpl)component).clear();
        ((ConsoleViewImpl)component).print(message, ConsoleViewContentType.ERROR_OUTPUT);
        window.setAvailable(true,null);
        window.show(null);
      }
    }
  });
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:23,代码来源:StudyCheckUtils.java

示例3: showMessage

import com.intellij.openapi.project.Project; //导入依赖的package包/类
private static void showMessage(final Project project, final MessageType messageType, final String format, final Object[] args) {
    StatusBar statusBar = windowManager.getStatusBar(project);
    if(statusBar == null || statusBar.getComponent() == null){
        return;
    }
    String message = String.format(format, args);
    jbPopupFactory.createHtmlTextBalloonBuilder(message, messageType, null)
                .setFadeoutTime(7500)
                .createBalloon()
                .show(RelativePoint.getNorthEastOf(statusBar.getComponent()), Balloon.Position.atRight);

    if(messageType == MessageType.INFO){
        log.info(message);
    }
    else if(messageType == MessageType.WARNING) {
        log.warn(message);
    }
    else{
        log.debug(message);
    }
}
 
开发者ID:satr,项目名称:intellij-idea-plugin-connector-for-aws-lambda,代码行数:22,代码来源:MessageHelper.java

示例4: computeChildren

import com.intellij.openapi.project.Project; //导入依赖的package包/类
@Override
protected MultiMap<PsiFile, ClassNode> computeChildren(@Nullable PsiFile psiFile) {
    MultiMap<PsiFile, ClassNode> children = new MultiMap<>();
    children.putValue(aggregateRoot.getContainingFile(), new AggregateRootNode(this, aggregateRoot));
    Project project = getProject();
    if (project != null) {
        JavaPsiFacade javaPsiFacade = JavaPsiFacade.getInstance(project);
        PsiClass entityInterface = javaPsiFacade.findClass(ENTITY_INTERFACE, GlobalSearchScope.allScope(project));
        PsiClass valueObjectInterface = javaPsiFacade.findClass(VO_INTERFACE, GlobalSearchScope.allScope(project));
        if (entityInterface != null && valueObjectInterface != null) {
            for (PsiClass psiClass : psiPackage.getClasses(GlobalSearchScope.allScope(project))) {
                if (psiClass.isInheritor(entityInterface, true) && !psiClass.equals(aggregateRoot)) {
                    children.putValue(psiClass.getContainingFile(), new EntityNode(this, psiClass));
                } else if (psiClass.isInheritor(valueObjectInterface, true)) {
                    children.putValue(psiClass.getContainingFile(), new ValueObjectNode(this, psiClass));
                }
            }
        }
    }
    return children;
}
 
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:22,代码来源:AggregateNode.java

示例5: multiResolve

import com.intellij.openapi.project.Project; //导入依赖的package包/类
@NotNull
@Override
public ResolveResult[] multiResolve(final boolean incompleteCode) {
    Project project = myElement.getProject();
    final String enumLiteralJavaModelName = myElement.getText().replaceAll("\"", "").toUpperCase();

    final PsiShortNamesCache psiShortNamesCache = PsiShortNamesCache.getInstance(project);
    final PsiField[] javaEnumLiteralFields = psiShortNamesCache.getFieldsByName(
        enumLiteralJavaModelName, GlobalSearchScope.allScope(project)
    );

    final Set<PsiField> enumFields = stream(javaEnumLiteralFields)
        .filter(literal -> literal.getParent() != null)
        .filter(literal -> literal.getParent() instanceof ClsClassImpl)
        .filter(literal -> ((ClsClassImpl) literal.getParent()).isEnum())
        .collect(Collectors.toSet());

    return PsiElementResolveResult.createResults(enumFields);
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:20,代码来源:HybrisEnumLiteralItemReference.java

示例6: createLessonContent

import com.intellij.openapi.project.Project; //导入依赖的package包/类
@Override
public PsiDirectory createLessonContent(@NotNull Project project, @NotNull Lesson lesson, @Nullable IdeView view, @NotNull PsiDirectory parentDirectory) {
  NewModuleAction newModuleAction = new NewModuleAction();
  String courseDirPath = parentDirectory.getVirtualFile().getPath();
  Module utilModule = ModuleManager.getInstance(project).findModuleByName(EduIntelliJNames.UTIL);
  if (utilModule == null) {
    return null;
  }
  newModuleAction.createModuleFromWizard(project, null, new AbstractProjectWizard("", project, "") {
    @Override
    public StepSequence getSequence() {
      return null;
    }

    @Override
    public ProjectBuilder getProjectBuilder() {
      return new EduLessonModuleBuilder(courseDirPath, lesson, utilModule);
    }
  });
  return parentDirectory.findSubdirectory(EduNames.LESSON + lesson.getIndex());
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:22,代码来源:EduPluginConfiguratorBase.java

示例7: ApplicationDictionaryImpl

import com.intellij.openapi.project.Project; //导入依赖的package包/类
public ApplicationDictionaryImpl(@NotNull Project project, @NotNull XmlFile dictionaryXmlFile,
                                 @NotNull String applicationName, @Nullable File applicationBundleFile) {
  this.project = project;
  this.dictionaryFile = dictionaryXmlFile.getVirtualFile();
  readDictionaryFromXmlFile(dictionaryXmlFile);
  this.applicationName = applicationName;
  if (applicationBundleFile != null) {
    this.applicationBundleFile = applicationBundleFile;
    setIconFromBundle(applicationBundleFile);
  }
  if (StringUtil.isEmpty(dictionaryName))
    dictionaryName = this.applicationName;
  LOG.info("Dictionary [" + dictionaryName + "] for application [" + this.applicationName + "] " +
          "initialized In project[" + project.getName() + "] " + " Commands: " + dictionaryCommandMap.size() +
          ". " + "Classes: " + dictionaryClassMap.size());
}
 
开发者ID:ant-druha,项目名称:AppleScript-IDEA,代码行数:17,代码来源:ApplicationDictionaryImpl.java

示例8: createToolWindowContent

import com.intellij.openapi.project.Project; //导入依赖的package包/类
@Override
public void createToolWindowContent(@NotNull final Project project, @NotNull ToolWindow toolWindow) {
    SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true);

    BsConsole console = new BsConsole(project);
    panel.setContent(console.getComponent());

    ActionToolbar toolbar = console.createToolbar();
    panel.setToolbar(toolbar.getComponent());

    Content content = ContentFactory.SERVICE.getInstance().createContent(panel, "", true);
    toolWindow.getContentManager().addContent(content);

    // Start compiler
    BsCompiler bsc = BucklescriptProjectComponent.getInstance(project).getCompiler();
    if (bsc != null) {
        bsc.addListener(new BsOutputListener(project));
        ProcessHandler handler = bsc.getHandler();
        if (handler == null) {
            console.print("Bsb not found, check the event logs.", ERROR_OUTPUT);
        } else {
            console.attachToProcess(handler);
        }
        bsc.startNotify();
    }
}
 
开发者ID:reasonml-editor,项目名称:reasonml-idea-plugin,代码行数:27,代码来源:BsToolWindowFactory.java

示例9: getStudyToolWindow

import com.intellij.openapi.project.Project; //导入依赖的package包/类
@Nullable
public static StudyToolWindow getStudyToolWindow(@NotNull final Project project) {
  if (project.isDisposed()) return null;

  ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(StudyToolWindowFactory.STUDY_TOOL_WINDOW);
  if (toolWindow != null) {
    Content[] contents = toolWindow.getContentManager().getContents();
    for (Content content: contents) {
      JComponent component = content.getComponent();
      if (component != null && component instanceof StudyToolWindow) {
        return (StudyToolWindow)component;
      }
    }
  }
  return null;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:17,代码来源:StudyUtils.java

示例10: addCompletions

import com.intellij.openapi.project.Project; //导入依赖的package包/类
@Override
protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet result) {
    String namespace = parameters.getPosition().getPrevSibling().getPrevSibling().getText();

    Project project = parameters.getOriginalFile().getProject();
    Collection<TSFnDeclStmt> functions = TSUtil.getFunctionList(project);

    for (TSFnDeclStmt function : functions) {
        if (function.getFunctionType() == TSFunctionType.GLOBAL)
            continue;
        if (namespace != null && !function.getNamespace().equalsIgnoreCase(namespace))
            continue;

        result.addElement(
                LookupElementBuilder.create(function.getFunctionName())
                        .withCaseSensitivity(false)
                        .withPresentableText(function.getNamespace() + "::" + function.getFunctionName())
                        .withTailText(function.getArgList())
                        .withInsertHandler(TSCaseCorrectingInsertHandler.INSTANCE)
        );
    }
}
 
开发者ID:CouleeApps,项目名称:TS-IJ,代码行数:23,代码来源:TSGlobalNSCallCompletionContributor.java

示例11: actionPerformed

import com.intellij.openapi.project.Project; //导入依赖的package包/类
/**
 * Inserts the string generated by {@link #generateString()} at the caret(s) in the editor.
 *
 * @param event the performed action
 */
@Override
public final void actionPerformed(final AnActionEvent event) {
    final Editor editor = event.getData(CommonDataKeys.EDITOR);
    if (editor == null) {
        return;
    }
    final Project project = event.getData(CommonDataKeys.PROJECT);
    final Document document = editor.getDocument();
    final CaretModel caretModel = editor.getCaretModel();

    final Runnable replaceCaretSelections = () -> caretModel.getAllCarets().forEach(caret -> {
        final int start = caret.getSelectionStart();
        final int end = caret.getSelectionEnd();

        final String string = generateString();
        final int newEnd = start + string.length();

        document.replaceString(start, end, string);
        caret.setSelection(start, newEnd);
    });

    WriteCommandAction.runWriteCommandAction(project, replaceCaretSelections);
}
 
开发者ID:FWDekker,项目名称:intellij-randomness,代码行数:29,代码来源:DataInsertAction.java

示例12: findDeepestExactMatch

import com.intellij.openapi.project.Project; //导入依赖的package包/类
@Nullable
@Override
public MetadataNode findDeepestExactMatch(Project project, Module module,
    List<String> containerElements) {
  if (moduleNameToSanitisedRootSearchIndex.containsKey(module.getName())) {
    String[] pathSegments =
        containerElements.stream().flatMap(element -> stream(toPathSegments(element)))
            .toArray(String[]::new);
    MetadataNode searchStartNode = moduleNameToSanitisedRootSearchIndex.get(module.getName())
        .get(MetadataNode.sanitize(pathSegments[0]));
    if (searchStartNode != null) {
      if (pathSegments.length > 1) {
        return searchStartNode.findDeepestMatch(pathSegments, 1, true);
      }
      return searchStartNode;
    }
  }
  return null;
}
 
开发者ID:1tontech,项目名称:intellij-spring-assistant,代码行数:20,代码来源:SuggestionIndexServiceImpl.java

示例13: getIconDefinitionElements

import com.intellij.openapi.project.Project; //导入依赖的package包/类
@NotNull
public static PsiElement[] getIconDefinitionElements(@NotNull Project project, @NotNull String identifier) {
    Map<VirtualFile, IconStub> iconDefinitionByIdentifier = getIconDefinitionByIdentifier(project, identifier);
    if (iconDefinitionByIdentifier.size() > 0) {
        return iconDefinitionByIdentifier
                .keySet()
                .stream()
                .map(virtualFile -> {
                    IconStub iconStub = iconDefinitionByIdentifier.get(virtualFile);
                    PsiFile file = PsiManager.getInstance(project).findFile(virtualFile);
                    return file != null ? file.findElementAt(iconStub.getTextRange().getStartOffset()) : null;
                })
                .filter(Objects::nonNull)
                .toArray(PsiElement[]::new);
    }

    return new PsiElement[0];
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:19,代码来源:IconIndex.java

示例14: addAnnotation

import com.intellij.openapi.project.Project; //导入依赖的package包/类
public void addAnnotation(Project project) {
    for (FieldEntity entity : getFieldList()) {
        entity.addAnnotation(project);
    }

    editTableAnnotation(project, tablePsiAnnotation, getSelectedEntities().size() == 0);

    PsiJavaFile javaFile = (PsiJavaFile) psiClass.getContainingFile();
    Utils.saveDocument(javaFile);

    Utils.addImport(project, javaFile, null, AormConstants.tableQName, AormConstants.columnQName);
    Utils.optimizeImport(project, psiClass);

    CodeStyleManager.getInstance(project).reformat(psiClass);
    Utils.saveDocument(psiClass.getContainingFile());
}
 
开发者ID:Jamling,项目名称:Android-ORM-ASPlugin,代码行数:17,代码来源:ClassEntity.java

示例15: actionPerformed

import com.intellij.openapi.project.Project; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
    final Project project = e.getRequiredData(CommonDataKeys.PROJECT);
    final Editor editor = e.getRequiredData(CommonDataKeys.EDITOR);
    final PsiFile psiFile = e.getRequiredData(CommonDataKeys.PSI_FILE);
    
    CommandProcessor.getInstance().executeCommand(project, () -> {
        try {
            MultiHighlightHandler.invoke(project, editor, psiFile);
        } catch (IndexNotReadyException ex) {
            DumbService.getInstance(project)
                    .showDumbModeNotification("MultiHighlight requires indices "
                            + "and cannot be performed until they are built");
        }
    }, "MultiHighlight", null);
}
 
开发者ID:huoguangjin,项目名称:MultiHighlight,代码行数:17,代码来源:MultiHighlightAction.java


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