本文整理汇总了Java中com.intellij.openapi.project.Project.getBasePath方法的典型用法代码示例。如果您正苦于以下问题:Java Project.getBasePath方法的具体用法?Java Project.getBasePath怎么用?Java Project.getBasePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.project.Project
的用法示例。
在下文中一共展示了Project.getBasePath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getWorkDir
import com.intellij.openapi.project.Project; //导入方法依赖的package包/类
public File getWorkDir() {
Project p = this.project;
if (p == null) {
p = ProjectManager.getInstance().getDefaultProject();
Project[] ps = ProjectManager.getInstance().getOpenProjects();
if (ps != null) {
for (Project t : ps) {
if (!t.isDefault()) {
p = t;
}
}
}
}
File dir = new File(p.getBasePath(), Project.DIRECTORY_STORE_FOLDER);
return dir;
}
示例2: unpackCourseArchive
import com.intellij.openapi.project.Project; //导入方法依赖的package包/类
private static void unpackCourseArchive(final Project project) {
FileChooserDescriptor descriptor =
new FileChooserDescriptor(true, true, true, true, true, false);
final VirtualFile virtualFile = FileChooser.chooseFile(descriptor, project, null);
if (virtualFile == null) {
return;
}
final String basePath = project.getBasePath();
if (basePath == null) return;
Course course = StudyProjectGenerator.getCourse(virtualFile.getPath());
if (course == null) {
Messages.showErrorDialog("This course is incompatible with current version", "Failed to Unpack Course");
return;
}
generateFromStudentCourse(project, course);
}
示例3: getWizard
import com.intellij.openapi.project.Project; //导入方法依赖的package包/类
private AddModuleWizard getWizard(final Project project) throws ConfigurationException {
final HybrisProjectImportProvider provider = getHybrisProjectImportProvider();
final String basePath = project.getBasePath();
final String projectName = project.getName();
final Sdk jdk = ProjectRootManager.getInstance(project).getProjectSdk();
final String compilerOutputUrl = CompilerProjectExtension.getInstance(project).getCompilerOutputUrl();
final HybrisProjectSettings settings = HybrisProjectSettingsComponent.getInstance(project).getState();
final AddModuleWizard wizard = new AddModuleWizard(null, basePath, provider) {
protected void init() {
// non GUI mode
}
};
final WizardContext wizardContext = wizard.getWizardContext();
wizardContext.setProjectJdk(jdk);
wizardContext.setProjectName(projectName);
wizardContext.setCompilerOutputDirectory(compilerOutputUrl);
final StepSequence stepSequence = wizard.getSequence();
for (ModuleWizardStep step : stepSequence.getAllSteps()) {
if (step instanceof NonGuiSupport) {
((NonGuiSupport) step).nonGuiModeImport(settings);
}
}
return wizard;
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:27,代码来源:ProjectRefreshAction.java
示例4: runActivity
import com.intellij.openapi.project.Project; //导入方法依赖的package包/类
@Override
public void runActivity(@NotNull Project project)
{
String expectedPath = project.getBasePath() + "/roc.config.js";
File configFile = new File(expectedPath);
if (!configFile.isFile())
{
return;
}
try
{
FetchCompletions fetchCompletions = new FetchCompletions(project);
fetchCompletions.run();
}
catch (Exception e)
{
NotificationGroup group = new NotificationGroup("ROC_GROUP", NotificationDisplayType.STICKY_BALLOON, true, null, RocIcons.ROC);
Notification notification = group.createNotification("Failed to fetch roc-completions!", "", e.getMessage(), NotificationType.ERROR);
Notifications.Bus.notify(notification);
}
}
示例5: getProjectTitle
import com.intellij.openapi.project.Project; //导入方法依赖的package包/类
@Override
public String getProjectTitle(@NotNull Project project) {
String projectCustomTitle;
try {
String projectDefaultTitle = defaultBuilder.getProjectTitle(project);
String projectName = project.getName();
String projectPath = project.getBasePath();
projectCustomTitle = engine.eval("projectTemplate({" +
"projectDefaultTitle: '" + projectDefaultTitle + "'," +
"projectName: '" + projectName + "'," +
"projectPath: '" + projectPath + "'" +
"})").toString();
} catch (Exception e) {
projectCustomTitle = defaultBuilder.getProjectTitle(project);
}
return projectCustomTitle;
}
示例6: generateClassPath
import com.intellij.openapi.project.Project; //导入方法依赖的package包/类
public static String generateClassPath(Project project,String classRootPath,String packagePath, String className) {
classRootPath = classRootPath.replace("/",File.separator);
classRootPath = classRootPath.replace("\\\\",File.separator);
try {
classRootPath = classRootPath.replace("\\", File.separator);
}catch (Exception ex){}
if(!classRootPath.substring(classRootPath.length()-1).equals(File.separator)){
classRootPath = classRootPath+File.separator;
}
if(!classRootPath.substring(0,1).equals(File.separator)){
classRootPath = File.separator + classRootPath;
}
return project.getBasePath() + classRootPath + packagePath.replace(".",File.separator) +File.separator + className;
}
示例7: doAction
import com.intellij.openapi.project.Project; //导入方法依赖的package包/类
@Override
public void doAction(AnActionEvent anActionEvent) {
Project project = anActionEvent.getData(PlatformDataKeys.PROJECT);
String path = project.getBasePath();
gradleLocation = RNPathUtil.getAndroidProjectPath(path);
if (gradleLocation == null) {
NotificationUtils.gradleFileNotFound();
} else {
if(command() == null) {
return;
}
terminal.createNewSession();
new Thread(() -> {
try {
// Wait 0.5 second for the terminal to show up, no wait works ok on WebStorm but not on Android Studio
Thread.currentThread().sleep(500L);
} catch (InterruptedException e) {
e.printStackTrace();
}
// Below code without ApplicationManager.getApplication().invokeLater() will throw exception
// : IDEA Access is allowed from event dispatch thread only.
ApplicationManager.getApplication().invokeLater(() -> {
terminal.executeShell("cd \"" + gradleLocation + "\"");
terminal.executeShell(command());
});
}).start();
}
}
示例8: hadInitFreeline
import com.intellij.openapi.project.Project; //导入方法依赖的package包/类
/**
* if had init freeline return true
*/
public static boolean hadInitFreeline(Project project) {
if (project != null) {
String projectPath = project.getBasePath();
// freeline directory
File freelineDir = new File(projectPath, "freeline");
// freeline.py file
File freeline_py = new File(projectPath, "freeline.py");
if (freelineDir.exists() && freeline_py.exists()) {
return true;
}
}
return false;
}
示例9: getRNProjectRootPathFromConfig
import com.intellij.openapi.project.Project; //导入方法依赖的package包/类
/**
* Get the real react native project root path.
* @param project
* @return
*/
private static String getRNProjectRootPathFromConfig(Project project) {
String path = project.getBasePath();
File file = new File(path, RN_CONSOLE_FILE);
if (file.exists()) {
String p = parseCurrentPathFromRNConsoleJsonFile(file);
if(p != null) {
return new File(path, p).getAbsolutePath();
}
return null;
} else {
return null;
}
}
示例10: deploy
import com.intellij.openapi.project.Project; //导入方法依赖的package包/类
private void deploy(TelemetryToolWindow window, Project project, DataContext context) {
setActionEnabled(false);
String projectPath = project.getBasePath();
String modules = composeModulesArgument(project);
String classpath = composeClasspathArgument(context);
String androidSdkPath = Utils.getAndroidSdkPath(project);
window.message("Deployment in progress...");
window.message(" ");
window.update();
new AsyncExecutor<DetailedDeployReport>() {
@Override
public DetailedDeployReport onBackground() {
DeployResult result = executeJar(window, projectPath, modules, classpath, androidSdkPath);
return new DetailedDeployReport(result, ImmutableList.of());
}
@Override
public void onActionComplete(DetailedDeployReport report) {
if (report.result == DeployResult.OK) {
window.green(report.result.message);
EventLog.info(report.result.message);
} else if (report.result == DeployResult.TERMINATED) {
window.warn(report.result.message);
EventLog.warn(report.result.message);
} else {
window.error(report.result.message);
EventLog.error(report.result.message);
}
window.update();
setActionEnabled(true);
}
}.start();
}
示例11: setCompilerOutput
import com.intellij.openapi.project.Project; //导入方法依赖的package包/类
protected void setCompilerOutput(@NotNull Project project) {
CompilerProjectExtension compilerProjectExtension = CompilerProjectExtension.getInstance(project);
String basePath = project.getBasePath();
if (compilerProjectExtension != null && basePath != null) {
compilerProjectExtension.setCompilerOutputUrl(VfsUtilCore.pathToUrl(FileUtilRt.toSystemDependentName(basePath)));
}
}
示例12: OnProjectSync
import com.intellij.openapi.project.Project; //导入方法依赖的package包/类
public OnProjectSync(Project project) {
if (project == null) {
return;
}
projectBasePath = project.getBasePath();
}
示例13: getSourceBasePath
import com.intellij.openapi.project.Project; //导入方法依赖的package包/类
public static String getSourceBasePath(Project project) {
return project.getBasePath();
//String classPath = project.getProjectFilePath();
//return classPath.substring(0, classPath.lastIndexOf('/'));
}
示例14: getProjectBasePath
import com.intellij.openapi.project.Project; //导入方法依赖的package包/类
static String getProjectBasePath(Project project) {
return project.getBasePath() != null ? project.getBasePath() : "./";
}
示例15: processNamespaces
import com.intellij.openapi.project.Project; //导入方法依赖的package包/类
public static void processNamespaces(Project project, Set<PhpNamespaceRootInfo> roots) {
VirtualFile composerFile = project.getBaseDir().findChild("composer.json");
if (composerFile == null) {
PhpPsr4NamespaceNotifier.showNotificationByMessageId(
project,
"actions.detect.namespace.roots.no.composer.json.detected",
(NotificationListener)null
);
throw new ProcessCanceledException();
}
JsonFile psiFile = (JsonFile) PsiManager.getInstance(project).findFile(composerFile);
if (psiFile != null) {
JsonProperty[] properties = PsiTreeUtil.getChildrenOfType(psiFile.getTopLevelValue(), JsonProperty.class);
if (properties != null) {
boolean found = false;
for (JsonProperty property : properties) {
if (!property.getName().equals("autoload") && !property.getName().equals("autoload-dev")) {
continue;
}
if (property.getValue() != null && property.getValue() instanceof JsonObject) {
JsonProperty[] namespacesTypes = PsiTreeUtil.getChildrenOfType(
property.getValue(),
JsonProperty.class
);
if (namespacesTypes != null) {
for (JsonProperty namespaceType : namespacesTypes) {
if (!namespaceType.getName().equals("psr-4")) {
continue;
}
JsonProperty[] namespaces = PsiTreeUtil.getChildrenOfType(
namespaceType.getValue(),
JsonProperty.class
);
if (namespaces != null) {
for (JsonProperty namespace : namespaces) {
if (namespace.getValue() != null &&
namespace.getValue() instanceof JsonStringLiteral
) {
String path = project.getBasePath()
+ File.separator
+ ((JsonStringLiteral) namespace.getValue()).getValue();
if (!FileUtil.exists(path)) {
continue;
}
PhpNamespaceRootInfo rootInfo = PhpNamespaceRootInfo.create(
path,
namespace.getName()
);
roots.add(rootInfo);
}
}
}
}
}
}
}
}
}
}
开发者ID:aurimasniekis,项目名称:idea-php-psr4-namespace-detector,代码行数:72,代码来源:PhpPsr4NamespaceRootDetector.java