在这篇文章中,我们将为您详细介绍super.paintComponent的内容,并且讨论关于g有什么作用?的相关问题。此外,我们还会涉及一些关于有什么作用?、android.support.v4.co
在这篇文章中,我们将为您详细介绍super.paintComponent的内容,并且讨论关于g有什么作用?的相关问题。此外,我们还会涉及一些关于有什么作用?、android.support.v4.content.IntentCompat的实例源码、com.intellij.openapi.components.ComponentConfig的实例源码、com.intellij.openapi.components.ProjectComponent的实例源码的知识,以帮助您更全面地了解这个主题。
本文目录一览:- super.paintComponent(g)有什么作用?(super paint)
- 有什么作用?
- android.support.v4.content.IntentCompat的实例源码
- com.intellij.openapi.components.ComponentConfig的实例源码
- com.intellij.openapi.components.ProjectComponent的实例源码
super.paintComponent(g)有什么作用?(super paint)
有什么作用super.paintComponent(g)
(特别是当我们将其放入paintComponent()方法中时)?令我惊讶的是,我之前没有人问过这个问题。
我在Java Graphics上挖了我的学校笔记,在这行代码中唯一提到的是"do not delete"
。
但是,这几周来,我一直在练习和使用Java
paintComponent()方法。到目前为止,我还没有将该行包含在我的代码中,并且一切似乎都运行良好(到目前为止)。所以..
问题:
- 它有什么作用?
- 我们什么时候需要使用它?
- 通过在paintComponent()中编写它,给我们带来什么好处?
答案1
小编典典
- 它有什么作用?
它将打印该组件,就好像您没有覆盖该paintComponent
方法一样。例如,如果您设置了背景色,则通常由您要扩展的类来绘制背景色。
- 我们什么时候需要使用它?
如果不在整个组件上绘画,则可以使用它。您不绘画的零件将“照亮”,这意味着您应该让超类绘画那些零件。例如,以背景色为例:如果仅在组件中间绘制一个圆圈,super.paintComponent
则将确保在圆圈周围绘制背景色。
如果您 确实
绘制了组件的整个区域,那么您将在任何super.paintComponent绘制的内容之上绘制,因此调用super.paintComponent没有意义。
- 通过在paintComponent()中编写它,给我们带来什么好处?
那是放置它的唯一合乎逻辑的地方。paintComponent
在应喷涂组件时调用,并且如上所述,如果您自己不喷涂整个组件,则需要super.paintComponent
在穿透的零件上进行喷涂。
文档中paintComponent
说,它相当不错:
[…]如果您没有调用super的实现,则必须使用opaque属性,即,如果该组件是不透明的,则必须使用非不透明的颜色完全填充背景。如果您不尊重不透明属性,则可能会看到视觉瑕疵。
有什么作用?
如果一个网页以…开头有什么区别
<!DOCTYPE html> <html> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge">
并且如果页面以
<!DOCTYPE html> <html> <head> <!-- without X-UA-Compatible meta -->
如果没有区别,我想我可以忽略X-UA-Compatible
元标头,因为我只想在所有IE版本中以最标准的方式呈现它。
答案1
小编典典这个答案是几年前发布的,现在的问题确实应该是 您X-UA-Compatible
_是否 _应该考虑 在您的网站上 使用 标记?
微软对其浏览器所做的更改(更多有关以下内容)。
根据您支持的Microsoft浏览器,您可能不需要继续使用该X-UA-Compatible
标记。如果您需要支持IE9或IE8,那么我建议您使用标记。如果您仅支持最新的浏览器(IE11和/或Edge),那么我将考虑完全删除此标签。如果您使用Twitter
Bootstrap并且需要消除验证警告,则此标记必须以其指定的顺序出现。以下附加信息:
该X-UA-Compatible
元标记允许网页制作者选择什么版本的Internet
Explorer的页面是否应该呈现为。IE11对这些模式进行了更改;请参阅下面的IE11注释。替代IE11的浏览器Microsoft
Edge仅X-UA-Compatible
在某些情况下使用meta标签。请参阅下面的Microsoft Edge注释。
根据Microsoft的说法,使用X-UA-Compatible
标记时,标记应在文档中尽可能高head
:
如果您使用的是X-UA兼容的META标签,则希望将其放置在尽可能靠近页面HEAD顶部的位置。Internet
Explorer开始使用最新版本解释标记。当Internet Explorer遇到X-
UA兼容的META标签时,它将使用指定版本的引擎重新开始。这是性能下降的原因,因为浏览器必须停止并重新开始分析内容。
这是您的选择:
- “IE=edge”
- “IE=11”
- “IE=EmulateIE11”
- “IE=10”
- “IE=EmulateIE10”
- “IE=9”
- “IE=EmulateIE9
- “IE=8”
- “IE=EmulateIE8”
- “IE=7”
- “IE=EmulateIE7”
- “IE=5”
为了尝试理解每种含义,这里是Microsoft提供的定义:
Internet Explorer支持许多文档兼容模式,这些模式可启用不同的功能并会影响内容的显示方式:
边缘模式告诉Internet Explorer以可用的最高模式显示内容。使用Internet Explorer
9,这等效于IE9模式。如果将来的Internet
Explorer版本支持更高的兼容性模式,则设置为边缘模式的页面将以该版本支持的最高模式显示。使用Internet Explorer
9查看时,这些页面仍将以IE9模式显示。InternetExplorer支持许多文档兼容模式,这些模式可启用不同的功能并可能影响内容的显示方式:IE11模式为已建立和新兴的行业标准(包括HTML5,CSS3等)提供了最高的支持。
IE10模式为已建立和新兴的行业标准(包括HTML5,CSS3等)提供了最高的支持。
* IE9模式为已建立和新兴的行业标准提供了最高的支持,包括HTML5(工作草案),W3C级联样式表第3级规范(工作草案),可缩放矢量图形(SVG)1.0规范等。[编者注:IE 9 不 支持CSS3动画]。
* IE8模式支持许多已建立的标准,包括W3C级联样式表2.1规范和W3C选择器API。它还为W3C级联样式表3级规范(工作草案)和其他新兴标准提供了有限的支持。
IE7模式呈现的内容就像Internet Explorer 7在标准模式下显示的一样,无论页面是否包含指令。
模拟IE9模式告诉Internet
Explorer使用指令来确定如何呈现内容。标准模式指令以IE9模式显示,而怪癖模式指令以IE5模式显示。与IE9模式不同,仿真IE9模式遵循该指令。模拟IE8模式告诉Internet
Explorer使用指令来确定如何呈现内容。标准模式指令以IE8模式显示,而怪癖模式指令以IE5模式显示。与IE8模式不同,仿真IE8模式遵循该指令。模拟IE7模式告诉Internet Explorer使用指令来确定如何呈现内容。标准模式指令以Internet Explorer
7标准模式显示,而怪癖模式指令以IE5模式显示。与IE7模式不同,仿真IE7模式遵循该指令。对于许多网站,这是首选的兼容模式。IE5模式呈现的内容就像Internet Explorer 7以怪癖模式显示的内容一样,与Microsoft Internet Explorer
5中内容的显示方式非常相似。
IE10注:
从IE10开始,怪异模式的行为与早期版本的浏览器不同。在IE9和更早版本中,怪癖模式将网页限制为IE5.5支持的功能。在IE10中,怪癖模式符合HTML5规范中指定的差异。
就个人而言,我总是选择http-equiv="X-UA-Compatible"content="IE=edge"
meta标记,因为较旧的版本存在很多错误,并且我不希望IE决定进入“兼容模式”并将我的网站显示为IE7 vs
IE8或9。我总是更喜欢最新版本的IE浏览器
IE11
从IE11开始,边缘模式是首选的文档模式。它代表了对浏览器可用的现代标准的最高支持。
使用HTML5文档类型声明来启用边缘模式:
<!doctype html>
Edge模式是Internet Explorer8中引入的,并且在每个后续发行版中都可用。请注意,边缘模式支持的功能仅限于呈现内容的浏览器特定版本支持的功能。
从IE11开始,不建议使用文档模式,除非临时使用,否则不应再使用。确保更新依赖于旧功能和文档模式以反映现代标准的网站。
如果必须针对一种特定的文档模式,以便您的站点在重新支持现代标准和功能时可以正常运行,请注意,您正在使用的是过渡功能,该功能可能在将来的版本中不可用。
如果当前使用兼容x-ua的标头将旧文档模式作为目标,则您的网站可能无法反映IE11的最佳使用体验。
X-UA-Compatible
IE的“Edge”版本的元标记信息。
引入“活着的”边缘文档模式
正如我们在2013年8月宣布的那样,我们将从IE11开始弃用文档模式。通过我们最新的平台更新,对旧文档模式的需求主要限于企业旧版Web应用程序。随着新的体系结构更改,这些旧文档模式将与“活动”Edge模式的更改隔离开来,这将有助于确保依赖那些模式的客户具有更高的兼容性,并帮助我们更快地改进Edge。IE仍将支持Intranet网站,“兼容性视图”列表上的网站以及仅与企业模式一起使用的网站提供的文档模式。
公共Internet站点将使用新的Edge模式平台呈现(忽略X-UA-Compatible)。我们的目标是,Edge从现在开始就是“活动”文档模式,以后将不再介绍其他文档模式。
大多数情况下,由于MicrosoftEdge的更改不再支持文档模式,因此Microsoft提供了一种工具来扫描您的站点以检查其是否具有与Edge不兼容的代码。
Chrome = 1 IE的信息
还有chrome=1
,你可以使用或与像上述选项一起使用:<meta http-equiv="X-UA-Compatible"content="IE=Edge,chrome=1">
。chrome=1
适用于Google的Chrome浏览器内嵌框架,定义为:
Google Chrome浏览器内嵌框架是一个开源浏览器插件。安装了该插件的用户在浏览器中打开页面时,可以访问Google
Chrome的开放式网络技术和快速的JavaScript引擎。
Google Chrome浏览器内嵌框架无缝增强了您在InternetExplorer中的浏览体验。它使用GoogleChrome的渲染技术显示启用了Google Chrome Frame的网站,使您可以访问最新的HTML5功能以及GoogleChrome的性能和安全性功能,而不会以任何方式中断您正常的浏览器使用。
安装了Google Chrome浏览器内嵌框架后,您无需考虑网络情况就会变得更好。
但是,要使该插件正常工作,您必须chrome=1
在X-UA-Compatible
meta标记中使用。
注意: GoogleChrome浏览器内嵌框架仅适用于IE6到IE9,并且已于2014年2月25日停用。
HTML5 :
仅当使用时,页面才会使用W3验证程序进行验证<meta http-equiv="X-UA-Compatible" content="IE=Edge">
。对于其他值,它将引发错误:A meta element with an http-equiv attribute whose value is X-UA-Compatible must have a content attributewiththevalueIE=edge.
换句话说,如果您IE=edge,chrome=1
将无法验证。我完全忽略了此错误,因为现代浏览器只是忽略了这一行代码。
XHTML
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
只要正确关闭标签(即/>
vs>
),使用时的验证就不会有问题。
Twitter的引导
这个标签已经被强烈地引导团队至少自2014推荐,并Bootlint的棉短绒撰写的团队继续扔了拼焊板警告省略标记时。短绒棉纸区分警告和错误,因此忽略此标签的严重性可能被认为是次要的。
android.support.v4.content.IntentCompat的实例源码
public static Intent addShowScenarioShortcut(Context context,Choice choice) { Intent addShowScenarioShortcutIntent = new Intent(context,AddShowScenarioShortcutActivity.class); addShowScenarioShortcutIntent = IntentCompat.makeRestartActivityTask(addShowScenarioShortcutIntent.getComponent()); addShowScenarioShortcutIntent.setAction(Intent.ACTION_VIEW); addShowScenarioShortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); Serializer serializer = new Persister(); ByteArrayOutputStream choiceOutputStream = new ByteArrayOutputStream(); try { serializer.write(choice,choiceOutputStream); } catch (Exception e) { Log.d(TAG,e.toString()); } String choiceXml = choiceOutputStream.toString(); addShowScenarioShortcutIntent.putExtra(EXTRA_CHOICE_XML,choiceXml); return addShowScenarioShortcutIntent; }
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mListener = new SharedPreferences.OnSharedPreferencechangelistener() { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,String key) { //Preferences.sync(getPreferenceManager(),key); if (key.equals(getActivity().getString(R.string.pref_theme))) { getActivity().finish(); final Intent intent = getActivity().getIntent(); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | IntentCompat.FLAG_ACTIVITY_CLEAR_TASK); getActivity().startActivity(intent); } } }; }
@Override protected void onPostExecute(Status status){ super.onPostExecute(status); if (status == Status.OK){ if (loginRequest){ Intent result = new Intent(); setResult(Activity.RESULT_OK,result); LoginActivity.this.finish(); } else { Intent intent = new Intent(LoginActivity.this,ProfileActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | IntentCompat.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); } } else if (status == Status.COOKIE_EXPIRED){ Toast.makeText(LoginActivity.this,"Cookie expired,please login",Toast.LENGTH_LONG).show(); } else { Toast.makeText(LoginActivity.this,"Could not login",Toast.LENGTH_LONG).show(); } }
public Intent getParentActivityIntent(Activity paramActivity) { String str = NavUtils.getParentActivityName(paramActivity); if (str == null) { return null; } ComponentName localComponentName = new ComponentName(paramActivity,str); try { if (NavUtils.getParentActivityName(paramActivity,localComponentName) == null) { return IntentCompat.makeMainActivity(localComponentName); } Intent localIntent = new Intent().setComponent(localComponentName); return localIntent; } catch (PackageManager.NameNotFoundException localNameNotFoundException) { Log.e("NavUtils","getParentActivityIntent: bad parentActivityName '" + str + "' in manifest"); } return null; }
public PostUploadNotifier(Post post) { // add the uploader to the notification bar mnotificationmanager = (notificationmanager) SystemServiceFactory.get(mContext,Context.NOTIFICATION_SERVICE); mNotificationBuilder = new NotificationCompat.Builder(getApplicationContext()); mNotificationBuilder.setSmallIcon(android.R.drawable.stat_sys_upload); Intent notificationIntent = new Intent(mContext,post.isPage() ? PagesActivity.class : PostsActivity.class); notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK | IntentCompat.FLAG_ACTIVITY_CLEAR_TASK); notificationIntent.setAction(Intent.ACTION_MAIN); notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER); notificationIntent.setData((Uri.parse("custom://wordpressNotificationIntent" + post.getLocalTableBlogId()))); notificationIntent.putExtra(PostsActivity.EXTRA_VIEW_PAGES,post.isPage()); PendingIntent pendingIntent = PendingIntent.getActivity(mContext,notificationIntent,PendingIntent.FLAG_UPDATE_CURRENT); mNotificationBuilder.setContentIntent(pendingIntent); mNotificationId = (new Random()).nextInt() + post.getLocalTableBlogId(); startForeground(mNotificationId,mNotificationBuilder.build()); }
@Override public void onBackpressed() { if (!mHasNavigationDrawer) { super.onBackpressed(); return; } DrawerLayout drawer = mNavigationDrawer.mLayout; if (drawer.isDrawerVisible(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { if (NavigationDrawerEntry.FIND_BAGGER.equals(mSelectedDrawerItem)) { super.onBackpressed(); } else { Intent intent = BaggersListActivity.createLaunchIntent(this,mPrefs.getCity()); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | IntentCompat.FLAG_ACTIVITY_CLEAR_TASK); startActivityWithoutTransition(intent); finish(); } } }
/** * Start the task stack constructed by this builder. The Context used to obtain * this builder must be an Activity. * * <p>On devices that do not support API level 11 or higher the topmost activity * will be started as a new task. On devices that do support API level 11 or higher * the new task stack will be created in its entirety.</p> * * @param options Additional options for how the Activity should be started. * See {@link android.content.Context#startActivity(Intent,Bundle) */ public void startActivities(Bundle options) { if (mIntents.isEmpty()) { throw new IllegalStateException( "No intents added to TaskStackBuilder; cannot startActivities"); } Intent[] intents = mIntents.toArray(new Intent[mIntents.size()]); intents[0] = new Intent(intents[0]).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | IntentCompat.FLAG_ACTIVITY_CLEAR_TASK | IntentCompat.FLAG_ACTIVITY_TASK_ON_HOME); if (!ContextCompat.startActivities(mSourceContext,intents,options)) { Intent topIntent = new Intent(intents[intents.length - 1]); topIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mSourceContext.startActivity(topIntent); } }
@Override public Intent getParentActivityIntent(Activity activity) { String parentName = NavUtils.getParentActivityName(activity); if (parentName == null) return null; // If the parent itself has no parent,generate a main activity intent. final ComponentName target = new ComponentName(activity,parentName); try { final String grandparent = NavUtils.getParentActivityName(activity,target); final Intent parentIntent = grandparent == null ? IntentCompat.makeMainActivity(target) : new Intent().setComponent(target); return parentIntent; } catch (NameNotFoundException e) { Log.e(TAG,"getParentActivityIntent: bad parentActivityName '" + parentName + "' in manifest"); return null; } }
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mListener = new SharedPreferences.OnSharedPreferencechangelistener() { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,key); if (key.equals(getActivity().getString(R.string.pref_theme))) { getActivity().finish(); final Intent intent = getActivity().getIntent(); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | IntentCompat.FLAG_ACTIVITY_CLEAR_TASK); getActivity().startActivity(intent); } /*if(key.equals(getActivity().getString(R.string.pref_help))){ getActivity().finish(); startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("http://android.bowenchin.com"))); }*/ } }; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings); Toolbar toolbar = getActionBarToolbar(); toolbar.setTitle(R.string.title_settings); toolbar.setNavigationIcon(R.drawable.ic_up); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { navigateUpToFromChild(SettingsActivity.this,IntentCompat.makeMainActivity(new ComponentName(SettingsActivity.this,browseSessionsActivity.class))); } }); if (savedInstanceState == null) { getFragmentManager().beginTransaction() .add(R.id.container,new SettingsFragment()) .commit(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings); Toolbar toolbar = getActionBarToolbar(); toolbar.setTitle(R.string.title_settings); toolbar.setNavigationIcon(R.drawable.ic_up); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { navigateUpToFromChild(SettingsActivity.this,new SettingsFragment()) .commit(); } }
public static Intent getParentActivityIntent(Context context,ComponentName componentname) { String s = getParentActivityName(context,componentname); if (s == null) { return null; } ComponentName componentname1 = new ComponentName(componentname.getPackageName(),s); if (getParentActivityName(context,componentname1) == null) { return IntentCompat.makeMainActivity(componentname1); } else { return (new Intent()).setComponent(componentname1); } }
public static Intent getParentActivityIntent(Context context,Class class1) { String s = getParentActivityName(context,new ComponentName(context,class1)); if (s == null) { return null; } ComponentName componentname = new ComponentName(context,componentname) == null) { return IntentCompat.makeMainActivity(componentname); } else { return (new Intent()).setComponent(componentname); } }
public static void doRestart(@NonNull Context cxt) { try { PackageManager pm = cxt.getPackageManager(); if (pm != null) { Intent intent = pm.getLaunchIntentForPackage(cxt.getPackageName()); if (intent != null) { ComponentName componentName = intent.getComponent(); Intent mainIntent = IntentCompat.makeRestartActivityTask(componentName); mainIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); cxt.startActivity(mainIntent); Runtime.getRuntime().exit(0); } else { LogHelper.d(TAG,"Was not able to restart application,intent null"); } } else { LogHelper.d(TAG,PM null"); } } catch (Exception e) { LogHelper.e(TAG,e,"Was not able to restart application"); } }
/** * Start the task stack constructed by this builder. The Context used to obtain * this builder must be an Activity. * * <p>On devices that do not support API level 11 or higher the topmost activity * will be started as a new task. On devices that do support API level 11 or higher * the new task stack will be created in its entirety.</p> * * @param options Additional options for how the Activity should be started. * See {@link android.content.Context#startActivity(Intent,options)) { Intent topIntent = new Intent(intents[intents.length - 1]); topIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mSourceContext.startActivity(topIntent); } }
@Override public Intent getParentActivityIntent(Activity activity) { String parentName = NavUtils.getParentActivityName(activity); if (parentName == null) return null; // If the parent itself has no parent,"getParentActivityIntent: bad parentActivityName '" + parentName + "' in manifest"); return null; } }
public static Intent getParentActivityIntent(Context context,ComponentName componentname) throws android.content.pm.PackageManager.NameNotFoundException { String s = getParentActivityName(context,componentname); if (s == null) { return null; } componentname = new ComponentName(componentname.getPackageName(),componentname) == null) { return IntentCompat.makeMainActivity(componentname); } else { return (new Intent()).setComponent(componentname); } }
public static Intent getParentActivityIntent(Context context,Class class1) throws android.content.pm.PackageManager.NameNotFoundException { class1 = getParentActivityName(context,class1)); if (class1 == null) { return null; } class1 = new ComponentName(context,class1); if (getParentActivityName(context,class1) == null) { return IntentCompat.makeMainActivity(class1); } else { return (new Intent()).setComponent(class1); } }
/** * Start the task stack constructed by this builder. The Context used to obtain * this builder must be an Activity. * * <p>On devices that do not support API level 11 or higher the topmost activity * will be started as a new task. On devices that do support API level 11 or higher * the new task stack will be created in its entirety.</p> * * @param options Additional options for how the Activity should be started. * See {@link android.content.Context#startActivity(Intent,options)) { Intent topIntent = new Intent(intents[intents.length - 1]); topIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mSourceContext.startActivity(topIntent); } }
@Override public Intent getParentActivityIntent(Activity activity) { String parentName = NavUtils.getParentActivityName(activity); if (parentName == null) return null; // If the parent itself has no parent,"getParentActivityIntent: bad parentActivityName '" + parentName + "' in manifest"); return null; } }
/** * Start the task stack constructed by this builder. The Context used to obtain * this builder must be an Activity. * * <p>On devices that do not support API level 11 or higher the topmost activity * will be started as a new task. On devices that do support API level 11 or higher * the new task stack will be created in its entirety.</p> * * @param options Additional options for how the Activity should be started. * See {@link android.content.Context#startActivity(Intent,options)) { Intent topIntent = new Intent(intents[intents.length - 1]); topIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mSourceContext.startActivity(topIntent); } }
@Override public Intent getParentActivityIntent(Activity activity) { String parentName = NavUtils.getParentActivityName(activity); if (parentName == null) return null; // If the parent itself has no parent,"getParentActivityIntent: bad parentActivityName '" + parentName + "' in manifest"); return null; } }
/** * Start the task stack constructed by this builder. The Context used to obtain * this builder must be an Activity. * * <p>On devices that do not support API level 11 or higher the topmost activity * will be started as a new task. On devices that do support API level 11 or higher * the new task stack will be created in its entirety.</p> * * @param options Additional options for how the Activity should be started. * See {@link android.content.Context#startActivity(Intent,options)) { Intent topIntent = new Intent(intents[intents.length - 1]); topIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mSourceContext.startActivity(topIntent); } }
@Override public Intent getParentActivityIntent(Activity activity) { String parentName = NavUtils.getParentActivityName(activity); if (parentName == null) return null; // If the parent itself has no parent,"getParentActivityIntent: bad parentActivityName '" + parentName + "' in manifest"); return null; } }
@Override public void onReceive(final Context context,Intent intent) { // Gets the intent,check if it matches our secret code if (Intent.ACTION_NEW_OUTGOING_CALL.equals(intent.getAction()) && intent.getExtras() != null) { Intent launcher = new Intent(context,MainActivity_.class); //These flags are added to make the new mainActivity in the home stack. //i.e. back button returns to home not dialer. launcher.addFlags(IntentCompat.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK | IntentCompat.FLAG_ACTIVITY_TASK_ON_HOME); String phoneNumber = intent.getExtras().getString(android.content.Intent.EXTRA_PHONE_NUMBER); if (Pref.OpenPIN().exists()) if (("*#" + Pref.OpenPIN().get()).equals(phoneNumber)) // Launch the main app!! launchActivity(context,launcher); } }
void confirm_stealth(String password) { final View dialogView = View.inflate(context,R.layout.dialog_confirm_stealth,null); ((TextView) dialogView .findViewById(R.id.stealth_keycode)) .append(password); new AlertDialog.Builder(context) .setInverseBackgroundForced(true) .setView(dialogView) .setMessage(R.string.Settings__try_once_before_hide) .setPositiveButton(getString(R.string.OK),new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog,int which) { Prefs.stealthMode().put(-1); Intent dial = new Intent(); dial.setAction("android.intent.action.DIAL"); dial.setData(Uri.parse("tel:")); dial.setFlags(IntentCompat.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(dial); context.finish(); } }) .show(); }
/** * Start the task stack constructed by this builder. The Context used to obtain * this builder must be an Activity. * * <p>On devices that do not support API level 11 or higher the topmost activity * will be started as a new task. On devices that do support API level 11 or higher * the new task stack will be created in its entirety.</p> * * @param options Additional options for how the Activity should be started. * See {@link android.content.Context#startActivity(Intent,options)) { Intent topIntent = new Intent(intents[intents.length - 1]); topIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mSourceContext.startActivity(topIntent); } }
@Override public Intent getParentActivityIntent(Activity activity) { String parentName = NavUtils.getParentActivityName(activity); if (parentName == null) return null; // If the parent itself has no parent,"getParentActivityIntent: bad parentActivityName '" + parentName + "' in manifest"); return null; } }
/** * Start the task stack constructed by this builder. The Context used to obtain * this builder must be an Activity. * * <p>On devices that do not support API level 11 or higher the topmost activity * will be started as a new task. On devices that do support API level 11 or higher * the new task stack will be created in its entirety.</p> * * @param options Additional options for how the Activity should be started. * See {@link android.content.Context#startActivity(Intent,options)) { Intent topIntent = new Intent(intents[intents.length - 1]); topIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mSourceContext.startActivity(topIntent); } }
@Override public Intent getParentActivityIntent(Activity activity) { String parentName = NavUtils.getParentActivityName(activity); if (parentName == null) return null; // If the parent itself has no parent,"getParentActivityIntent: bad parentActivityName '" + parentName + "' in manifest"); return null; } }
/** * Start the task stack constructed by this builder. The Context used to obtain * this builder must be an Activity. * * <p>On devices that do not support API level 11 or higher the topmost activity * will be started as a new task. On devices that do support API level 11 or higher * the new task stack will be created in its entirety.</p> * * @param options Additional options for how the Activity should be started. * See {@link android.content.Context#startActivity(Intent,options)) { Intent topIntent = new Intent(intents[intents.length - 1]); topIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mSourceContext.startActivity(topIntent); } }
@Override public Intent getParentActivityIntent(Activity activity) { String parentName = NavUtils.getParentActivityName(activity); if (parentName == null) return null; // If the parent itself has no parent,"getParentActivityIntent: bad parentActivityName '" + parentName + "' in manifest"); return null; } }
/** * Start the task stack constructed by this builder. The Context used to obtain * this builder must be an Activity. * * <p>On devices that do not support API level 11 or higher the topmost activity * will be started as a new task. On devices that do support API level 11 or higher * the new task stack will be created in its entirety.</p> * * @param options Additional options for how the Activity should be started. * See {@link android.content.Context#startActivity(Intent,options)) { Intent topIntent = new Intent(intents[intents.length - 1]); topIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mSourceContext.startActivity(topIntent); } }
@Override public Intent getParentActivityIntent(Activity activity) { String parentName = NavUtils.getParentActivityName(activity); if (parentName == null) return null; // If the parent itself has no parent,"getParentActivityIntent: bad parentActivityName '" + parentName + "' in manifest"); return null; } }
private void confirm_stealth(String password) { final View dialogView = View.inflate(context,int which) { SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(context).edit(); editor.putBoolean(Config.SHOW_StealTH_MODE_TUTORIAL,true); editor.apply(); Intent dial = new Intent(); dial.setAction("android.intent.action.DIAL"); dial.setData(Uri.parse("tel:")); dial.setFlags(IntentCompat.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(dial); getActivity().finish(); } }) .show(); }
@Override public void onReceive(final Context context,MainActivity.class); //These flags are added to make the new mainActivity in the home stack. //i.e. back button returns to home not dialer. launcher.addFlags(IntentCompat.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK | IntentCompat.FLAG_ACTIVITY_TASK_ON_HOME); String phoneNumber = intent.getExtras().getString(android.content.Intent.EXTRA_PHONE_NUMBER); String openPin = PreferenceManager.getDefaultSharedPreferences(context) .getString(Config.StealTH_MODE_PASSWORD,""); if (!openPin.equals("")) { if (("*#" + openPin).equals(phoneNumber)) { // Launch the main app!! launchActivity(context,launcher); } } } }
/** * Start the task stack constructed by this builder. The Context used to obtain * this builder must be an Activity. * * <p>On devices that do not support API level 11 or higher the topmost activity * will be started as a new task. On devices that do support API level 11 or higher * the new task stack will be created in its entirety.</p> * * @param options Additional options for how the Activity should be started. * See {@link android.content.Context#startActivity(Intent,options)) { Intent topIntent = new Intent(intents[intents.length - 1]); topIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mSourceContext.startActivity(topIntent); } }
@Override public Intent getParentActivityIntent(Activity activity) { String parentName = NavUtils.getParentActivityName(activity); if (parentName == null) return null; // If the parent itself has no parent,"getParentActivityIntent: bad parentActivityName '" + parentName + "' in manifest"); return null; } }
com.intellij.openapi.components.ComponentConfig的实例源码
protected final void init(@Nullable ProgressIndicator indicator,@Nullable Runnable componentsRegistered) { List<ComponentConfig> componentConfigs = getComponentConfigs(); for (ComponentConfig config : componentConfigs) { registerComponents(config); } myComponentConfigCount = componentConfigs.size(); if (componentsRegistered != null) { componentsRegistered.run(); } if (indicator != null) { indicator.setIndeterminate(false); } createComponents(indicator); myComponentsCreated = true; }
@NotNull private List<ComponentConfig> getComponentConfigs() { ArrayList<ComponentConfig> componentConfigs = new ArrayList<ComponentConfig>(); boolean isDefaultProject = this instanceof Project && ((Project)this).isDefault(); boolean headless = ApplicationManager.getApplication().isHeadlessEnvironment(); for (IdeaPluginDescriptor plugin : PluginManagerCore.getPlugins()) { if (PluginManagerCore.shouldSkipPlugin(plugin)) { continue; } ComponentConfig[] configs = getMyComponentConfigsFromDescriptor(plugin); componentConfigs.ensureCapacity(componentConfigs.size() + configs.length); for (ComponentConfig config : configs) { if ((!isDefaultProject || config.isLoadForDefaultProject()) && isComponentSuitable(config.options) && config.prepareClasses(headless)) { config.pluginDescriptor = plugin; componentConfigs.add(config); } } } return componentConfigs; }
private void registerComponents(@NotNull ComponentConfig config) { ClassLoader loader = config.getClassLoader(); try { final Class<?> interfaceClass = Class.forName(config.getInterfaceClass(),true,loader); final Class<?> implementationClass = Comparing.equal(config.getInterfaceClass(),config.getImplementationClass()) ? interfaceClass : StringUtil.isEmpty(config.getImplementationClass()) ? null : Class.forName(config.getImplementationClass(),loader); Mutablepicocontainer picocontainer = getpicocontainer(); if (config.options != null && Boolean.parseBoolean(config.options.get("overrides"))) { ComponentAdapter oldAdapter = picocontainer.getComponentAdapterOfType(interfaceClass); if (oldAdapter == null) { throw new RuntimeException(config + " does not override anything"); } picocontainer.unregisterComponent(oldAdapter.getComponentKey()); } // implementationClass == null means we want to unregister this component if (implementationClass != null) { picocontainer.registerComponent(new ComponentConfigComponentAdapter(interfaceClass,implementationClass,config.getPluginId(),config.options != null && Boolean.parseBoolean(config.options.get("workspace")))); } } catch (Throwable t) { handleInitComponentError(t,null,config.getPluginId()); } }
public static void handleComponentError(Throwable t,String componentClassName,ComponentConfig config) { if (t instanceof StartupAbortedException) { throw (StartupAbortedException)t; } PluginId pluginId = config != null ? config.getPluginId() : getPluginByClassName(componentClassName); if (pluginId != null && !CORE_PLUGIN_ID.equals(pluginId.getIdString())) { getLogger().warn(t); disablePlugin(pluginId.getIdString()); String message = "Plugin '" + pluginId.getIdString() + "' Failed to initialize and will be disabled\n" + "(reason: " + t.getMessage() + ")\n\n" + ApplicationNamesInfo.getInstance().getFullProductName() + " will be restarted."; Main.showMessage("Plugin Error",message,false); throw new StartupAbortedException(t).exitCode(Main.PLUGIN_ERROR).logError(false); } else { throw new StartupAbortedException("Fatal error initializing '" + componentClassName + "'",t); } }
private static ComponentConfig[] mergeComponents(ComponentConfig[] first,ComponentConfig[] second) { if (first == null) { return second; } if (second == null) { return first; } return ArrayUtil.mergeArrays(first,second); }
@Override protected void handleInitComponentError(Throwable t,ComponentConfig config) { if (!myHandlingInitComponentError) { myHandlingInitComponentError = true; try { PluginManager.handleComponentError(t,componentClassName,config); } finally { myHandlingInitComponentError = false; } } }
public void loadComponentsConfiguration(final ComponentConfig[] components,final PluginDescriptor descriptor,final boolean defaultProject) { if (components == null) return; loadConfiguration(components,defaultProject,descriptor); }
private static ComponentConfig[] mergeComponents(ComponentConfig[] first,second); }
@Override protected void handleInitComponentError(@Nonnull Throwable ex,@Nullable String componentClassName,@Nullable ComponentConfig config) { if (!myHandlingInitComponentError) { myHandlingInitComponentError = true; try { PluginManager.handleComponentError(ex,config); } finally { myHandlingInitComponentError = false; } } }
public static void handleComponentError(@Nonnull Throwable t,@Nullable ComponentConfig config) { if (t instanceof StartupAbortedException) { throw (StartupAbortedException)t; } PluginId pluginId = null; if (config != null) { pluginId = config.getPluginId(); } if (pluginId == null || CORE_PLUGIN.equals(pluginId)) { pluginId = componentClassName == null ? null : getPluginByClassName(componentClassName); } if (pluginId == null || CORE_PLUGIN.equals(pluginId)) { if (t instanceof PicopluginExtensionInitializationException) { pluginId = ((PicopluginExtensionInitializationException)t).getPluginId(); } } if (pluginId != null && !isSystemPlugin(pluginId)) { getLogger().warn(t); if(!ApplicationProperties.isInSandBox()) { disablePlugin(pluginId.getIdString()); } StringWriter message = new StringWriter(); message.append("Plugin '").append(pluginId.getIdString()).append("' Failed to initialize and will be disabled. "); message.append(" Please restart ").append(ApplicationNamesInfo.getInstance().getFullProductName()).append('.'); message.append("\n\n"); t.printstacktrace(new PrintWriter(message)); Main.showMessage("Plugin Error",message.toString(),t); } }
public void loadComponentsConfiguration(final ComponentConfig[] components,descriptor); }
private static ComponentConfig[] mergeComponents(ComponentConfig[] first,second); }
@NotNull ComponentConfig[] getAppComponents();
@NotNull ComponentConfig[] getProjectComponents();
@NotNull ComponentConfig[] getModuleComponents();
@NotNull @Override public ComponentConfig[] getMyComponentConfigsFromDescriptor(@NotNull IdeaPluginDescriptor plugin) { return plugin.getAppComponents(); }
@NotNull public ComponentConfig[] getComponentConfigurations() { return new ComponentConfig[0]; }
@Nullable public Object getComponent(final ComponentConfig componentConfig) { return null; }
public ComponentConfig getConfig(Class componentImplementation) { throw new UnsupportedOperationException("Method getConfig not implemented in " + getClass()); }
@NotNull public ComponentConfig[] getAppComponents() { throw new IllegalStateException(); }
@NotNull public ComponentConfig[] getProjectComponents() { throw new IllegalStateException(); }
@NotNull public ComponentConfig[] getModuleComponents() { throw new IllegalStateException(); }
@NotNull public ComponentConfig[] getMyComponentConfigsFromDescriptor(@NotNull IdeaPluginDescriptor plugin) { return plugin.getAppComponents(); }
@Override @NotNull public ComponentConfig[] getAppComponents() { return myAppComponents; }
@Override @NotNull public ComponentConfig[] getProjectComponents() { return myProjectComponents; }
@Override @NotNull public ComponentConfig[] getModuleComponents() { return myModuleComponents; }
@NotNull ComponentConfig[] getAppComponents();
@NotNull ComponentConfig[] getProjectComponents();
@NotNull ComponentConfig[] getModuleComponents();
@NotNull public ComponentConfig[] getComponentConfigurations() { return new ComponentConfig[0]; }
@Nullable public Object getComponent(final ComponentConfig componentConfig) { return null; }
public ComponentConfig getConfig(Class componentImplementation) { throw new UnsupportedOperationException("Method getConfig not implemented in " + getClass()); }
@NotNull public ComponentConfig[] getAppComponents() { throw new IllegalStateException(); }
@NotNull public ComponentConfig[] getProjectComponents() { throw new IllegalStateException(); }
@NotNull public ComponentConfig[] getModuleComponents() { throw new IllegalStateException(); }
private void loadConfiguration(final ComponentConfig[] configs,final boolean defaultProject,final PluginDescriptor descriptor) { for (ComponentConfig config : configs) { loadSingleConfig(defaultProject,config,descriptor); } }
private void loadSingleConfig(final boolean defaultProject,final ComponentConfig config,final PluginDescriptor descriptor) { if (defaultProject && !config.isLoadForDefaultProject()) return; if (!myComponentManager.isComponentSuitable(config.options)) return; myComponentManager.registerComponent(config,descriptor); }
@Override @NotNull public ComponentConfig[] getAppComponents() { return myAppComponents; }
@Override @NotNull public ComponentConfig[] getProjectComponents() { return myProjectComponents; }
@Override @NotNull public ComponentConfig[] getModuleComponents() { return myModuleComponents; }
com.intellij.openapi.components.ProjectComponent的实例源码
@After public void tearDown() throws Exception { UIUtil.invokeAndWaitIfNeeded(new Runnable() { @Override public void run() { try { myVcsManager.unregisterVcs(myVcs); myVcsManager = null; myVcs = null; ((ProjectComponent)mychangelistManager).projectClosed(); ((ProjectComponent)myVcsDirtyScopeManager).projectClosed(); tearDownProject(); if (myTempDirFixture != null) { myTempDirFixture.tearDown(); myTempDirFixture = null; } FileUtil.delete(myClientRoot); } catch (Exception e) { throw new RuntimeException(e); } } }); }
public void projectOpened() { final ProjectComponent[] components = getComponents(ProjectComponent.class); for (ProjectComponent component : components) { try { component.projectOpened(); } catch (Throwable e) { LOG.error(component.toString(),e); } } }
@Override public void updateJavaParameters(runconfigurationBase configuration,JavaParameters params,RunnerSettings runnerSettings) { if (!isApplicableFor(configuration)) { return; } ApplicationConfiguration appConfiguration = (ApplicationConfiguration) configuration; SnapShooterConfigurationSettings settings = appConfiguration.getUserData(SnapShooterConfigurationSettings.SNAP_SHOOTER_KEY); if (settings == null) { settings = new SnapShooterConfigurationSettings(); appConfiguration.putUserData(SnapShooterConfigurationSettings.SNAP_SHOOTER_KEY,settings); } if (appConfiguration.ENABLE_SWING_INSPECTOR) { settings.setLastPort(NetUtils.tryToFindAvailableSocketPort()); } if (appConfiguration.ENABLE_SWING_INSPECTOR && settings.getLastPort() != -1) { params.getProgramParametersList().prepend(appConfiguration.MAIN_CLASS_NAME); params.getProgramParametersList().prepend(Integer.toString(settings.getLastPort())); // add +1 because idea_rt.jar will be added as the last entry to the classpath params.getProgramParametersList().prepend(Integer.toString(params.getClasspath().getPathList().size() + 1)); Set<String> paths = new TreeSet<String>(); paths.add(PathUtil.getJarPathForClass(SnapShooter.class)); // ui-designer-impl paths.add(PathUtil.getJarPathForClass(BaseComponent.class)); // appcore-api paths.add(PathUtil.getJarPathForClass(ProjectComponent.class)); // openapi paths.add(PathUtil.getJarPathForClass(LwComponent.class)); // UIDesignerCore paths.add(PathUtil.getJarPathForClass(GridConstraints.class)); // forms_rt paths.add(PathUtil.getJarPathForClass(PaletteGroup.class)); // openapi paths.add(PathUtil.getJarPathForClass(LafManagerListener.class)); // ui-impl paths.add(PathUtil.getJarPathForClass(DataProvider.class)); // action-system-openapi paths.add(PathUtil.getJarPathForClass(XmlStringUtil.class)); // idea paths.add(PathUtil.getJarPathForClass(Navigatable.class)); // pom paths.add(PathUtil.getJarPathForClass(AreaInstance.class)); // extensions paths.add(PathUtil.getJarPathForClass(Formlayout.class)); // jgoodies paths.addAll(PathManager.getUtilClasspath()); for(String path: paths) { params.getClasspath().addFirst(path); } params.setMainClass("com.intellij.uiDesigner.snapShooter.SnapShooter"); } }
protected void startChangeProvider() { ((StartupManagerImpl) StartupManager.getInstance(myProject)).runPostStartupActivities(); mychangelistManager = changelistManager.getInstance(myProject); ((ProjectComponent) mychangelistManager).projectOpened(); myDirtyScopeManager = VcsDirtyScopeManager.getInstance(myProject); ((ProjectComponent) myDirtyScopeManager).projectOpened(); // mapping myVcsManager = ProjectLevelVcsManager.getInstance(myProject); myVcsManager.setDirectoryMappings(Collections.singletonList(new VcsDirectoryMapping(myBaseVf.getPath(),FossilVcs.NAME))); }
protected void startChangeProvider() { ((StartupManagerImpl) StartupManager.getInstance(myProject)).runPostStartupActivities(); mychangelistManager = changelistManager.getInstance(myProject); ((ProjectComponent) mychangelistManager).projectOpened(); myDirtyScopeManager = VcsDirtyScopeManager.getInstance(myProject); ((ProjectComponent) myDirtyScopeManager).projectOpened(); // mapping myVcsManager = ProjectLevelVcsManager.getInstance(myProject); myVcsManager.setDirectoryMappings(Collections.singletonList(new VcsDirectoryMapping(myBaseVf.getPath(),FossilVcs.NAME))); }
protected void tearDownProject() throws Exception { if (myProject != null) { ((ProjectComponent) VcsDirtyScopeManager.getInstance(myProject)).projectClosed(); ((ProjectComponent) changelistManager.getInstance(myProject)).projectClosed(); ((changelistManagerImpl)changelistManager.getInstance(myProject)).stopEveryThingIfInTestMode(); ((ProjectComponent)ProjectLevelVcsManager.getInstance(myProject)).projectClosed(); myProject = null; } if (myProjectFixture != null) { myProjectFixture.tearDown(); myProjectFixture = null; } }
private void projectOpened() { final ProjectComponent[] components = getComponents(ProjectComponent.class); for (ProjectComponent component : components) { try { component.projectOpened(); } catch (Throwable e) { LOG.error(component.toString(),e); } } }
private void projectClosed() { List<ProjectComponent> components = new ArrayList<ProjectComponent>(Arrays.asList(getComponents(ProjectComponent.class))); Collections.reverse(components); for (ProjectComponent component : components) { try { component.projectClosed(); } catch (Throwable e) { LOG.error(e); } } }
public void projectOpened() { final ProjectComponent[] components = getComponents(ProjectComponent.class); for (ProjectComponent component : components) { try { component.projectOpened(); } catch (Throwable e) { LOG.error(component.toString(),e); } } }
protected void tearDownProject() throws Exception { if (myProject != null) { ((ProjectComponent) VcsDirtyScopeManager.getInstance(myProject)).projectClosed(); ((ProjectComponent) changelistManager.getInstance(myProject)).projectClosed(); ((changelistManagerImpl)changelistManager.getInstance(myProject)).stopEveryThingIfInTestMode(); ((ProjectComponent)ProjectLevelVcsManager.getInstance(myProject)).projectClosed(); myProject = null; } if (myProjectFixture != null) { myProjectFixture.tearDown(); myProjectFixture = null; } }
private void projectOpened() { final ProjectComponent[] components = getComponents(ProjectComponent.class); for (ProjectComponent component : components) { try { component.projectOpened(); } catch (Throwable e) { LOG.error(component.toString(),e); } } }
private void projectClosed() { List<ProjectComponent> components = new ArrayList<ProjectComponent>(Arrays.asList(getComponents(ProjectComponent.class))); Collections.reverse(components); for (ProjectComponent component : components) { try { component.projectClosed(); } catch (Throwable e) { LOG.error(e); } } }
public void projectOpened() { final ProjectComponent[] components = getComponents(ProjectComponent.class); for (ProjectComponent component : components) { try { component.projectOpened(); } catch (Throwable e) { LOG.error(component.toString(),e); } } }
@Override protected void tearDown() throws Exception { removeLibs(); ((ProjectComponent)ModuleManager.getInstance(myProject)).projectClosed(); super.tearDown(); }
@Override public void updateJavaParameters(runconfigurationBase configuration,settings); } if (appConfiguration.ENABLE_SWING_INSPECTOR) { try { settings.setLastPort(NetUtils.findAvailableSocketPort()); } catch(IOException ex) { settings.setLastPort(-1); } } if (appConfiguration.ENABLE_SWING_INSPECTOR && settings.getLastPort() != -1) { params.getProgramParametersList().prepend(appConfiguration.MAIN_CLASS_NAME); params.getProgramParametersList().prepend(Integer.toString(settings.getLastPort())); // add +1 because idea_rt.jar will be added as the last entry to the classpath params.getProgramParametersList().prepend(Integer.toString(params.getClasspath().getPathList().size() + 1)); Set<String> paths = new TreeSet<String>(); paths.add(PathUtil.getJarPathForClass(SnapShooter.class)); // ui-designer-impl paths.add(PathUtil.getJarPathForClass(BaseComponent.class)); // appcore-api paths.add(PathUtil.getJarPathForClass(ProjectComponent.class)); // openapi paths.add(PathUtil.getJarPathForClass(LwComponent.class)); // UIDesignerCore paths.add(PathUtil.getJarPathForClass(GridConstraints.class)); // forms_rt paths.add(PathUtil.getJarPathForClass(LafManagerListener.class)); // ui-impl paths.add(PathUtil.getJarPathForClass(DataProvider.class)); // action-system-openapi paths.add(PathUtil.getJarPathForClass(XmlStringUtil.class)); // idea paths.add(PathUtil.getJarPathForClass(Navigatable.class)); // pom paths.add(PathUtil.getJarPathForClass(AreaInstance.class)); // extensions paths.add(PathUtil.getJarPathForClass(Formlayout.class)); // jgoodies paths.addAll(PathManager.getUtilClasspath()); for(String path: paths) { params.getClasspath().addFirst(path); } params.setMainClass("com.intellij.uiDesigner.snapShooter.SnapShooter"); } }
@Before @Order(0) public void setUp() throws Throwable { PlatformTestCase.initPlatformlangPrefix(); IdeaTestApplication.getInstance(null); String tempFileName = getClass().getName() + "-" + new Random().nextInt(); myProjectFixture = IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(tempFileName).getFixture(); edt(new ThrowableRunnable<Exception>() { @Override public void run() throws Exception { myProjectFixture.setUp(); } }); myProject = myProjectFixture.getProject(); ((ProjectComponent)changelistManager.getInstance(myProject)).projectOpened(); ((ProjectComponent)VcsDirtyScopeManager.getInstance(myProject)).projectOpened(); myProjectRoot = myProject.getBasePath(); myProjectDir = myProject.getBaseDir(); myTestRoot = myProjectRoot; myPlatformFacade = ServiceManager.getService(myProject,GitPlatformFacade.class); myGit = ServiceManager.getService(myProject,Git.class); mySettings = myPlatformFacade.getSettings(myProject); mySettings.getAppSettings().setPathToGit(GitExecutor.GIT_EXECUTABLE); // dynamic overriding is used instead of making it in plugin.xml,// because MockVcsHelper is not ready to be a full featured implementation for all tests. myVcsHelper = overrideService(myProject,AbstractVcsHelper.class,MockVcsHelper.class); mychangelistManager = (changelistManagerImpl)myPlatformFacade.getchangelistManager(myProject); myNotificator = (TestNotificator)ServiceManager.getService(myProject,Notificator.class); myVcs = GitVcs.getInstance(myProject); virtualCommits = new GitTestVirtualCommitsHolder(); myAsyncTasks = new ArrayList<Future>(); cd(myProjectRoot); myRepository = GitTestUtil.createRepository(myProject,myProjectRoot); ProjectLevelVcsManagerImpl vcsManager = (ProjectLevelVcsManagerImpl)ProjectLevelVcsManager.getInstance(myProject); AbstractVcs vcs = vcsManager.findVcsByName("Git"); Assert.assertEquals(1,vcsManager.getRootsUnderVcs(vcs).length); assumeSupportedGitVersion(); }
@Override public void updateJavaParameters(runconfigurationBase configuration,OwnJavaParameters params,settings); } if (appConfiguration.ENABLE_SWING_INSPECTOR) { try { settings.setLastPort(NetUtils.findAvailableSocketPort()); } catch(IOException ex) { settings.setLastPort(-1); } } if (appConfiguration.ENABLE_SWING_INSPECTOR && settings.getLastPort() != -1) { params.getProgramParametersList().prepend(appConfiguration.MAIN_CLASS_NAME); params.getProgramParametersList().prepend(Integer.toString(settings.getLastPort())); // add +1 because idea_rt.jar will be added as the last entry to the classpath params.getProgramParametersList().prepend(Integer.toString(params.getClasspath().getPathList().size() + 1)); Set<String> paths = new TreeSet<String>(); paths.add(PathUtil.getJarPathForClass(SnapShooter.class)); // ui-designer-impl paths.add(PathUtil.getJarPathForClass(BaseComponent.class)); // appcore-api paths.add(PathUtil.getJarPathForClass(ProjectComponent.class)); // openapi paths.add(PathUtil.getJarPathForClass(LwComponent.class)); // UIDesignerCore paths.add(PathUtil.getJarPathForClass(GridConstraints.class)); // forms_rt paths.add(PathUtil.getJarPathForClass(LafManagerListener.class)); // ui-impl paths.add(PathUtil.getJarPathForClass(DataProvider.class)); // action-system-openapi paths.add(PathUtil.getJarPathForClass(XmlStringUtil.class)); // idea paths.add(PathUtil.getJarPathForClass(Navigatable.class)); // pom paths.add(PathUtil.getJarPathForClass(AreaInstance.class)); // extensions paths.add(PathUtil.getJarPathForClass(Formlayout.class)); // jgoodies paths.addAll(PathManager.getUtilClasspath()); for(String path: paths) { params.getClasspath().addFirst(path); } params.setMainClass("com.intellij.uiDesigner.snapShooter.SnapShooter"); } }
@Override protected void tearDown() throws Exception { removeLibs(); ((ProjectComponent)ModuleManager.getInstance(myProject)).projectClosed(); super.tearDown(); }
关于super.paintComponent和g有什么作用?的介绍现已完结,谢谢您的耐心阅读,如果想了解更多关于有什么作用?、android.support.v4.content.IntentCompat的实例源码、com.intellij.openapi.components.ComponentConfig的实例源码、com.intellij.openapi.components.ProjectComponent的实例源码的相关知识,请在本站寻找。
本文标签: