Search in sources :

Example 31 with Project

use of com.intellij.openapi.project.Project in project intellij-community by JetBrains.

the class AbstractAuthenticator method getWithActive.

protected boolean getWithActive(SvnAuthenticationManager active) throws SVNException {
    MessageBusConnection connection = null;
    try {
        final Project project = myVcs.getProject();
        connection = project.getMessageBus().connect(project);
        connection.subscribe(SvnAuthenticationManager.AUTHENTICATION_PROVIDER_LISTENER, new MyAuthenticationProviderListener());
        makeAuthCall(active);
    } finally {
        if (connection != null) {
            connection.disconnect();
        }
    }
    return afterAuthCall();
}
Also used : Project(com.intellij.openapi.project.Project) MessageBusConnection(com.intellij.util.messages.MessageBusConnection)

Example 32 with Project

use of com.intellij.openapi.project.Project in project intellij-community by JetBrains.

the class ShareWholeProject method actionPerformed.

public void actionPerformed(AnActionEvent e) {
    final MyChecker checker = new MyChecker();
    checker.execute(e);
    if (!checker.isEnabled())
        return;
    final Project project = checker.getProject();
    final VirtualFile baseDir = project.getBaseDir();
    if (baseDir == null)
        return;
    boolean success = false;
    boolean excThrown = false;
    try {
        success = ShareProjectAction.share(project, baseDir);
    } catch (VcsException exc) {
        AbstractVcsHelper.getInstance(project).showError(exc, "Failed to Share Project");
        excThrown = true;
    } finally {
        // if success = false -> either action was cancelled or exception was thrown, so also check for exception
        if (success || excThrown) {
            baseDir.refresh(true, true, () -> ApplicationManager.getApplication().invokeLater(() -> {
                VcsDirtyScopeManager.getInstance(project).dirDirtyRecursively(project.getBaseDir());
                if (checker.isHadNoMappings() && SvnUtil.seemsLikeVersionedDir(baseDir)) {
                    final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project);
                    vcsManager.setDirectoryMappings(Arrays.asList(new VcsDirectoryMapping("", SvnVcs.VCS_NAME)));
                }
            }, ModalityState.NON_MODAL, project.getDisposed()));
        }
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) VcsDirectoryMapping(com.intellij.openapi.vcs.VcsDirectoryMapping) VcsException(com.intellij.openapi.vcs.VcsException) ProjectLevelVcsManager(com.intellij.openapi.vcs.ProjectLevelVcsManager)

Example 33 with Project

use of com.intellij.openapi.project.Project in project intellij-community by JetBrains.

the class ConfigureBranchesAction method update.

public void update(final AnActionEvent e) {
    final Project project = e.getProject();
    final Presentation presentation = e.getPresentation();
    if (project == null) {
        presentation.setEnabled(false);
        presentation.setVisible(false);
        return;
    }
    presentation.setText(SvnBundle.message("configure.branches.item"));
    presentation.setDescription(SvnBundle.message("configure.branches.item"));
    presentation.setIcon(SvnIcons.ConfigureBranches);
    presentation.setVisible(true);
    final ChangeList[] cls = e.getData(VcsDataKeys.CHANGE_LISTS);
    presentation.setEnabled((cls != null) && (cls.length > 0) && (SvnVcs.getInstance(project).getName().equals(((CommittedChangeList) cls[0]).getVcs().getName())) && (((SvnChangeList) cls[0]).getRoot() != null));
}
Also used : Project(com.intellij.openapi.project.Project) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) ChangeList(com.intellij.openapi.vcs.changes.ChangeList) CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) Presentation(com.intellij.openapi.actionSystem.Presentation)

Example 34 with Project

use of com.intellij.openapi.project.Project in project intellij-community by JetBrains.

the class ConfigureBranchesAction method actionPerformed.

public void actionPerformed(final AnActionEvent e) {
    final Project project = e.getProject();
    final ChangeList[] cls = e.getData(VcsDataKeys.CHANGE_LISTS);
    if ((cls == null) || (cls.length == 0) || (!SvnVcs.getInstance(project).getName().equals(((CommittedChangeList) cls[0]).getVcs().getName())) || (((SvnChangeList) cls[0]).getRoot() == null)) {
        return;
    }
    final SvnChangeList svnList = (SvnChangeList) cls[0];
    BranchConfigurationDialog.configureBranches(project, svnList.getRoot());
}
Also used : Project(com.intellij.openapi.project.Project) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) ChangeList(com.intellij.openapi.vcs.changes.ChangeList) CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList)

Example 35 with Project

use of com.intellij.openapi.project.Project in project intellij-community by JetBrains.

the class TestNGUtil method inheritsITestListener.

public static boolean inheritsITestListener(@NotNull PsiClass psiClass) {
    final Project project = psiClass.getProject();
    final PsiClass aListenerClass = JavaPsiFacade.getInstance(project).findClass(ITestNGListener.class.getName(), GlobalSearchScope.allScope(project));
    return aListenerClass != null && psiClass.isInheritor(aListenerClass, true);
}
Also used : Project(com.intellij.openapi.project.Project) ITestNGListener(org.testng.ITestNGListener)

Aggregations

Project (com.intellij.openapi.project.Project)3623 VirtualFile (com.intellij.openapi.vfs.VirtualFile)874 NotNull (org.jetbrains.annotations.NotNull)580 Nullable (org.jetbrains.annotations.Nullable)478 Module (com.intellij.openapi.module.Module)368 PsiFile (com.intellij.psi.PsiFile)334 Editor (com.intellij.openapi.editor.Editor)301 PsiElement (com.intellij.psi.PsiElement)292 ArrayList (java.util.ArrayList)214 File (java.io.File)212 Document (com.intellij.openapi.editor.Document)180 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)172 List (java.util.List)158 IOException (java.io.IOException)107 TextRange (com.intellij.openapi.util.TextRange)99 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)96 IncorrectOperationException (com.intellij.util.IncorrectOperationException)95 Presentation (com.intellij.openapi.actionSystem.Presentation)94 DataContext (com.intellij.openapi.actionSystem.DataContext)92 PsiDirectory (com.intellij.psi.PsiDirectory)90