forked from alibaba/freeline
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3b21b25
commit 54aeaeb
Showing
33 changed files
with
698 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package models; | ||
|
||
/** | ||
* Created by pengwei on 2016/10/22. | ||
*/ | ||
public interface Constant { | ||
|
||
boolean DEBUG_MODE = true; | ||
|
||
// groupId | ||
String FREELINE_CLASSPATH_GROUP = "com.antfortune.freeline"; | ||
// artifactId | ||
String FREELINE_CLASSPATH_ARTIFACT = "gradle"; | ||
// plugin name | ||
String FREELINE_PLUGIN_ID = "com.antfortune.freeline"; | ||
|
||
// root folder | ||
String FREELINE_ROOT_FOLDER = "freeline"; | ||
String FREELINE_ROOT_FOLDER_CORE = "freeline_core"; | ||
String FREELINE_PYTHON = "freeline.py"; | ||
|
||
// gradle tool | ||
String ANDROID_GRADLE_TOOL_GROUP_NAME = "com.android.tools.build"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package models; | ||
|
||
import com.intellij.openapi.vfs.VirtualFile; | ||
import utils.LogUtil; | ||
|
||
import java.util.Collection; | ||
|
||
/** | ||
* Created by pengwei on 2016/10/31. | ||
*/ | ||
public class FreelineStatus { | ||
Collection<VirtualFile> gradleBuildFiles; | ||
boolean existClasspath = false; | ||
private VirtualFile classpathFile; | ||
boolean existPlugin = false; | ||
private VirtualFile pluginFile; | ||
// mac下只有freeline文件夹 + freeline.py , win下有freeline.py + freeline/ + freeline_core/ | ||
boolean existFreelineCore = false; | ||
|
||
public FreelineStatus setClasspathFile(VirtualFile classpathFile) { | ||
this.classpathFile = classpathFile; | ||
if (classpathFile != null) { | ||
existClasspath = true; | ||
} | ||
return this; | ||
} | ||
|
||
public FreelineStatus setPluginFile(VirtualFile pluginFile) { | ||
this.pluginFile = pluginFile; | ||
if (pluginFile != null) { | ||
existPlugin = true; | ||
} | ||
return this; | ||
} | ||
|
||
public FreelineStatus setExistFreelineCore(boolean existFreelineCore) { | ||
this.existFreelineCore = existFreelineCore; | ||
return this; | ||
} | ||
|
||
public boolean isExistClasspath() { | ||
return existClasspath; | ||
} | ||
|
||
public VirtualFile getClasspathFile() { | ||
return classpathFile; | ||
} | ||
|
||
public boolean isExistPlugin() { | ||
return existPlugin; | ||
} | ||
|
||
public VirtualFile getPluginFile() { | ||
return pluginFile; | ||
} | ||
|
||
public boolean isExistFreelineCore() { | ||
return existFreelineCore; | ||
} | ||
|
||
/** | ||
* 是否初始化Freeline | ||
* 满足一下三个条件 | ||
* 1. 存在classpath 'com.antfortune.freeline:gradle:*' | ||
* 2. 存在apply plugin: 'com.antfortune.freeline' | ||
* 3. 存在freeline_core、release_tools、freeline.py | ||
* @return | ||
*/ | ||
public boolean hasInitFreeline() { | ||
LogUtil.d("existClasspath=%s,existPlugin=%s,existFreelineCore=%s", existClasspath, existPlugin, existFreelineCore); | ||
return existClasspath && existPlugin && existFreelineCore; | ||
} | ||
|
||
public Collection<VirtualFile> getGradleBuildFiles() { | ||
return gradleBuildFiles; | ||
} | ||
|
||
public FreelineStatus setGradleBuildFiles(Collection<VirtualFile> gradleBuildFiles) { | ||
this.gradleBuildFiles = gradleBuildFiles; | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package utils; | ||
|
||
import com.intellij.openapi.ui.DialogBuilder; | ||
import com.intellij.openapi.ui.Messages; | ||
|
||
import javax.swing.*; | ||
|
||
/** | ||
* Created by pengwei on 2016/11/2. | ||
*/ | ||
public final class DialogUtil { | ||
|
||
/** | ||
* 创建普通对话框 | ||
* @param message | ||
* @param okText | ||
* @param cancelText | ||
* @return | ||
*/ | ||
public static boolean createDialog(String message, String okText, String cancelText) { | ||
DialogBuilder builder = new DialogBuilder(); | ||
builder.setTitle("Dialog Message"); | ||
builder.resizable(false); | ||
builder.setCenterPanel(new JLabel(message, Messages.getInformationIcon(), SwingConstants.CENTER)); | ||
builder.addOkAction().setText(okText); | ||
builder.addCancelAction().setText(cancelText); | ||
builder.setButtonsAlignment(SwingConstants.CENTER); | ||
return builder.show() == 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package utils; | ||
|
||
import com.intellij.openapi.application.ApplicationManager; | ||
import com.intellij.openapi.fileEditor.FileDocumentManager; | ||
|
||
/** | ||
* Created by pengwei on 2016/11/1. | ||
*/ | ||
public class DocumentUtil { | ||
|
||
/** | ||
* 保存文档和设置 | ||
*/ | ||
public static void saveDocument() { | ||
FileDocumentManager.getInstance().saveAllDocuments(); | ||
ApplicationManager.getApplication().saveSettings(); | ||
} | ||
} |
Oops, something went wrong.