本文整理汇总了Java中com.intellij.openapi.projectRoots.impl.SdkImpl类的典型用法代码示例。如果您正苦于以下问题:Java SdkImpl类的具体用法?Java SdkImpl怎么用?Java SdkImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SdkImpl类属于com.intellij.openapi.projectRoots.impl包,在下文中一共展示了SdkImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSdk
import com.intellij.openapi.projectRoots.impl.SdkImpl; //导入依赖的package包/类
@Override
protected Sdk createSdk(VirtualFile virtualFile)
{
SdkImpl sdk = new SdkImpl("Mono IKVM.NET", IkvmBundleType.getInstance());
VirtualFile mainMonoPath = virtualFile.getParent().getParent().getParent();
sdk.setHomePath(mainMonoPath.getPath());
sdk.setPredefined(true);
sdk.setVersionString(IkvmBundleType.getInstance().getVersionString(sdk));
SdkModificator sdkModificator = sdk.getSdkModificator();
for(String library : IkvmBundleType.ourLibraries)
{
VirtualFile libraryFile = mainMonoPath.findFileByRelativePath("lib/mono/ikvm/" + library);
if(libraryFile != null)
{
VirtualFile archiveLibraryFile = ArchiveVfsUtil.getArchiveRootForLocalFile(libraryFile);
if(archiveLibraryFile != null)
{
sdkModificator.addRoot(archiveLibraryFile, BinariesOrderRootType.getInstance());
}
}
}
sdkModificator.commitChanges();
return sdk;
}
示例2: createBundles
import com.intellij.openapi.projectRoots.impl.SdkImpl; //导入依赖的package包/类
@Override
public void createBundles(@NotNull Consumer<SdkImpl> consumer)
{
Map<String, LuaSdkType> map = new HashMap<String, LuaSdkType>();
map.put("Kahlua", KahluaSdkType.getInstance());
map.put("LuaJ", LuaJSdkType.getInstance());
for(Map.Entry<String, LuaSdkType> entry : map.entrySet())
{
LuaSdkType luaSdkType = entry.getValue();
SdkImpl sdkWithName = createSdkWithName(luaSdkType, entry.getKey());
sdkWithName.setHomePath(luaSdkType.getStdLibraryFile().getPath());
luaSdkType.setupSdkPaths(sdkWithName);
consumer.consume(sdkWithName);
}
}
示例3: initComponent
import com.intellij.openapi.projectRoots.impl.SdkImpl; //导入依赖的package包/类
@Override
public void initComponent() {
if (SystemProperties.is("consulo.disable.predefined.bundles")) {
return;
}
Consumer<SdkImpl> consumer = new Consumer<SdkImpl>() {
@Override
@RequiredDispatchThread
public void consume(final SdkImpl sdk) {
ApplicationManager.getApplication().runWriteAction(() -> {
sdk.setPredefined(true);
SdkTable.getInstance().addSdk(sdk);
});
}
};
for (PredefinedBundlesProvider predefinedBundlesProvider : PredefinedBundlesProvider.EP_NAME.getExtensions()) {
try {
predefinedBundlesProvider.createBundles(consumer);
}
catch (Throwable e) {
LOGGER.error(e);
}
}
}
示例4: doAdd
import com.intellij.openapi.projectRoots.impl.SdkImpl; //导入依赖的package包/类
public void doAdd(JComponent parent, final SdkType type, final Consumer<Sdk> callback) {
myModified = true;
if (type.supportsCustomCreateUI()) {
type.showCustomCreateUI(this, parent, new Consumer<Sdk>() {
@Override
public void consume(Sdk sdk) {
setupSdk(sdk, callback);
}
});
}
else {
SdkConfigurationUtil.selectSdkHome(type, new Consumer<String>() {
@Override
public void consume(final String home) {
String newSdkName = SdkConfigurationUtil.createUniqueSdkName(type, home, getSdks());
final SdkImpl newSdk = new SdkImpl(newSdkName, type);
newSdk.setHomePath(home);
setupSdk(newSdk, callback);
}
});
}
}
示例5: addSdkNode
import com.intellij.openapi.projectRoots.impl.SdkImpl; //导入依赖的package包/类
public boolean addSdkNode(final Sdk sdk, final boolean selectInTree) {
if (!myUiDisposed) {
myContext.getDaemonAnalyzer().queueUpdate(new SdkProjectStructureElement(myContext, sdk));
MyNode newSdkNode = new MyNode(new SdkConfigurable((SdkImpl)sdk, mySdksTreeModel, TREE_UPDATER, myHistory, myProject));
final MyNode groupNode = MasterDetailsComponent.findNodeByObject(myRoot, sdk.getSdkType());
if (groupNode != null) {
addNode(newSdkNode, groupNode);
}
else {
final MyNode sdkGroupNode = createSdkGroupNode((SdkType)sdk.getSdkType());
addNode(sdkGroupNode, myRoot);
addNode(newSdkNode, sdkGroupNode);
}
if (selectInTree) {
selectNodeInTree(newSdkNode);
}
return true;
}
return false;
}
示例6: reset
import com.intellij.openapi.projectRoots.impl.SdkImpl; //导入依赖的package包/类
@Override
public void reset() {
super.reset();
myProjectSdksModel.reset(myProject);
myRoot.removeAllChildren();
final Map<Sdk, Sdk> sdks = myProjectSdksModel.getProjectSdks();
for (Sdk sdk : sdks.keySet()) {
final SdkConfigurable configurable = new SdkConfigurable((SdkImpl)sdks.get(sdk), myProjectSdksModel, TREE_UPDATER, myHistory, myProject);
addNode(new MyNode(configurable), myRoot);
}
final String value = PropertiesComponent.getInstance().getValue(SPLITTER_PROPORTION);
if (value != null) {
try {
final Splitter splitter = extractSplitter();
if (splitter != null) {
(splitter).setProportion(Float.parseFloat(value));
}
}
catch (NumberFormatException e) {
//do not set proportion
}
}
}
示例7: createActions
import com.intellij.openapi.projectRoots.impl.SdkImpl; //导入依赖的package包/类
@Override
@Nullable
protected ArrayList<AnAction> createActions(final boolean fromPopup) {
final ArrayList<AnAction> actions = new ArrayList<AnAction>();
DefaultActionGroup group = new DefaultActionGroup(ProjectBundle.message("add.action.name"), true);
group.getTemplatePresentation().setIcon(IconUtil.getAddIcon());
myProjectSdksModel.createAddActions(group, myTree, new Consumer<Sdk>() {
@Override
public void consume(final Sdk projectJdk) {
addNode(new MyNode(new SdkConfigurable(((SdkImpl)projectJdk), myProjectSdksModel, TREE_UPDATER, myHistory, myProject), false), myRoot);
selectNodeInTree(findNodeByObject(myRoot, projectJdk));
}
}, SdkListConfigurable.ADD_SDK_FILTER);
actions.add(new MyActionGroupWrapper(group));
actions.add(new MyDeleteAction(forAll(Conditions.alwaysTrue())));
return actions;
}
示例8: createBundles
import com.intellij.openapi.projectRoots.impl.SdkImpl; //导入依赖的package包/类
@Override
public void createBundles(@NotNull Consumer<SdkImpl> consumer)
{
MicrosoftDotNetSdkType sdkType = MicrosoftDotNetSdkType.getInstance();
Collection<MicrosoftDotNetFramework> microsoftDotNetFrameworks = buildPaths(sdkType);
for(MicrosoftDotNetFramework netFramework : microsoftDotNetFrameworks)
{
SdkImpl sdk = createSdkWithName(sdkType, sdkType.getPresentableName() + " " + netFramework.toString());
sdk.setHomePath(netFramework.getPath());
sdk.setVersionString(netFramework.getVersion().getPresentableName());
consumer.consume(sdk);
}
}
示例9: createBundles
import com.intellij.openapi.projectRoots.impl.SdkImpl; //导入依赖的package包/类
@Override
public void createBundles(@Nonnull Consumer<SdkImpl> consumer) {
for (SdkType sdkType : SdkType.EP_NAME.getExtensions()) {
if(sdkType.canCreatePredefinedSdks()) {
Collection<String> paths = sdkType.suggestHomePaths();
for (String path : paths) {
path = sdkType.adjustSelectedSdkHome(path);
if(sdkType.isValidSdkHome(path)) {
VirtualFile dirPath = LocalFileSystem.getInstance().findFileByPath(path);
if(dirPath == null) {
continue;
}
String sdkPath = sdkType.sdkPath(dirPath);
SdkImpl sdk = createSdk(sdkType, sdkPath);
sdk.setHomePath(sdkPath);
sdk.setVersionString(sdkType.getVersionString(sdk));
sdkType.setupSdkPaths(sdk);
consumer.consume(sdk);
}
}
}
}
}
示例10: doSetHomePath
import com.intellij.openapi.projectRoots.impl.SdkImpl; //导入依赖的package包/类
private void doSetHomePath(final String homePath, final SdkType sdkType) {
if (homePath == null) {
return;
}
setHomePathValue(homePath.replace('/', File.separatorChar));
final String newSdkName = suggestSdkName(homePath);
((SdkImpl)mySdk).setName(newSdkName);
try {
final Sdk dummySdk = (Sdk)mySdk.clone();
SdkModificator sdkModificator = dummySdk.getSdkModificator();
sdkModificator.setHomePath(homePath);
sdkModificator.removeAllRoots();
sdkModificator.commitChanges();
sdkType.setupSdkPaths(dummySdk);
clearAllPaths();
myVersionString = dummySdk.getVersionString();
if (myVersionString == null) {
Messages
.showMessageDialog(ProjectBundle.message("sdk.java.corrupt.error", homePath), ProjectBundle.message("sdk.java.corrupt.title"),
Messages.getErrorIcon());
}
sdkModificator = dummySdk.getSdkModificator();
for (OrderRootType type : myPathEditors.keySet()) {
myPathEditors.get(type).addPaths(sdkModificator.getRoots(type));
}
mySdkModel.getMulticaster().sdkHomeSelected(dummySdk, homePath);
}
catch (CloneNotSupportedException e) {
BaseSdkEditor.LOGGER.error(e); // should not happen in normal program
}
}
示例11: SdkConfigurable
import com.intellij.openapi.projectRoots.impl.SdkImpl; //导入依赖的package包/类
public SdkConfigurable(@Nonnull final SdkImpl sdk,
final ProjectSdksModel sdksModel,
final Runnable updateTree,
@Nonnull History history,
Project project) {
super(!sdk.isPredefined(), updateTree);
mySdk = sdk;
mySdkEditor = createSdkEditor(sdksModel, history, mySdk);
final StructureConfigurableContext context = ModuleStructureConfigurable.getInstance(project).getContext();
myProjectStructureElement = new SdkProjectStructureElement(context, mySdk);
}
示例12: update
import com.intellij.openapi.projectRoots.impl.SdkImpl; //导入依赖的package包/类
@Override
public void update(final AnActionEvent e) {
if (myTree.getSelectionPaths() == null || myTree.getSelectionPaths().length != 1) {
e.getPresentation().setEnabled(false);
}
else {
Object selectedObject = getSelectedObject();
e.getPresentation().setEnabled(selectedObject instanceof SdkImpl && !(((SdkImpl)selectedObject).getSdkType() instanceof UnknownSdkType));
}
}
示例13: createSdkWithName
import com.intellij.openapi.projectRoots.impl.SdkImpl; //导入依赖的package包/类
@Nonnull
public SdkImpl createSdkWithName(@Nonnull SdkType sdkType, @Nonnull String suggestName) {
String uniqueSdkName = SdkConfigurationUtil.createUniqueSdkName(suggestName + SdkConfigurationUtil.PREDEFINED_PREFIX, SdkTable.getInstance().getAllSdks());
return new SdkImpl(uniqueSdkName, sdkType);
}
示例14: createSdk
import com.intellij.openapi.projectRoots.impl.SdkImpl; //导入依赖的package包/类
@Nonnull
public SdkImpl createSdk(@Nonnull SdkType sdkType, @Nonnull String sdkHome) {
return createSdkWithName(sdkType, sdkType.suggestSdkName(null, sdkHome));
}
示例15: SdkEditor
import com.intellij.openapi.projectRoots.impl.SdkImpl; //导入依赖的package包/类
public SdkEditor(@Nonnull SdkModel sdkModel, @Nonnull History history, @Nonnull SdkImpl sdk) {
super(sdkModel, sdk);
myHistory = history;
}