Java, Eclipse Plugin Development and best software development practices
Monday, October 19, 2015
Monday, October 12, 2015
How to find the product code for the installed MSI file in windows
Run below command from power shell to see.
PS C:\Users\Admin> get-wmiobject -class Win32_Product
IdentifyingNumber : {32A3A4F4-B792-11D6-A78A-00B0D0170400}
Name : Java SE Development Kit 7 Update 40
Vendor : Oracle
Version : 1.7.0.400
Caption : Java SE Development Kit 7 Update 40
IdentifyingNumber : {32A3A4F4-B792-11D6-A78A-00B0D0170760}
Name : Java SE Development Kit 7 Update 76
Vendor : Oracle
Version : 1.7.0.760
Caption : Java SE Development Kit 7 Update 76
IdentifyingNumber : {32A3A4F4-B792-11D6-A78A-00B0D0170800}
Name : Java SE Development Kit 7 Update 80
Vendor : Oracle
Version : 1.7.0.800
Caption : Java SE Development Kit 7 Update 80
IdentifyingNumber : {64A3A4F4-B792-11D6-A78A-00B0D0170400}
Name : Java SE Development Kit 7 Update 40 (64-bit)
Vendor : Oracle
Version : 1.7.0.400
Caption : Java SE Development Kit 7 Update 40 (64-bit)
IdentifyingNumber : {64A3A4F4-B792-11D6-A78A-00B0D0170800}
Name : Java SE Development Kit 7 Update 80 (64-bit)
Vendor : Oracle
Version : 1.7.0.800
Caption : Java SE Development Kit 7 Update 80 (64-bit)
IdentifyingNumber number represents the product code.
PS C:\Users\Admin> get-wmiobject -class Win32_Product
IdentifyingNumber : {32A3A4F4-B792-11D6-A78A-00B0D0170400}
Name : Java SE Development Kit 7 Update 40
Vendor : Oracle
Version : 1.7.0.400
Caption : Java SE Development Kit 7 Update 40
IdentifyingNumber : {32A3A4F4-B792-11D6-A78A-00B0D0170760}
Name : Java SE Development Kit 7 Update 76
Vendor : Oracle
Version : 1.7.0.760
Caption : Java SE Development Kit 7 Update 76
IdentifyingNumber : {32A3A4F4-B792-11D6-A78A-00B0D0170800}
Name : Java SE Development Kit 7 Update 80
Vendor : Oracle
Version : 1.7.0.800
Caption : Java SE Development Kit 7 Update 80
IdentifyingNumber : {64A3A4F4-B792-11D6-A78A-00B0D0170400}
Name : Java SE Development Kit 7 Update 40 (64-bit)
Vendor : Oracle
Version : 1.7.0.400
Caption : Java SE Development Kit 7 Update 40 (64-bit)
IdentifyingNumber : {64A3A4F4-B792-11D6-A78A-00B0D0170800}
Name : Java SE Development Kit 7 Update 80 (64-bit)
Vendor : Oracle
Version : 1.7.0.800
Caption : Java SE Development Kit 7 Update 80 (64-bit)
IdentifyingNumber number represents the product code.
Sunday, September 13, 2015
How can I pass arguments to an extension point constructor/ createExecutableExtension with parameters in eclipse
Please also refer to my previous post.
http://exploreeclipse.blogspot.in/2015/09/reading-extension-point-from-eclipse.html
http://exploreeclipse.blogspot.in/2015/09/reading-extension-point-from-eclipse.html
public void readExtensionPoint(String myjsonString) {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IConfigurationElement[] elements = registry.getConfigurationElementsFor("com.kk.myplugin", "services");
for (IConfigurationElement iConfigurationElement : elements)
{
iConfigurationElement.getAttribute("service_id");
iConfigurationElement.getAttribute("name");
try
{
try
{
String attribute = iConfigurationElement.getAttribute("class");
String contributorName = iConfigurationElement.getDeclaringExtension().getContributor().getName();
Class<?> javaClass = Platform.getBundle(contributorName).loadClass(attribute);
Constructor<?> ctor = javaClass.getDeclaredConstructor(String.class);
IService service = (IService) ctor.newInstance(myjsonString);
return service;
}
catch (Exception e)
{
}
}
catch (CoreException e)
{
e.printStackTrace();
}
}
}
Reading an extension point from eclipse plugin
public void readExtensionPoint() {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IConfigurationElement[] elements = registry.getConfigurationElementsFor("com.kk.core", "platformServices");
for (IConfigurationElement iConfigurationElement : elements)
{
iConfigurationElement.getAttribute("id");
try
{
//This is your class
Object createExecutableExtension = iConfigurationElement.createExecutableExtension("class");
}
catch (CoreException e)
{
e.printStackTrace();
}
}
}
Here is my extension point schema definition:
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="com.kk.core" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="com.kk.core" id="platformServices" name="platformServices"/>
</appinfo>
<documentation>
[Enter description of this extension point.]
</documentation>
</annotation>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<sequence minOccurs="1" maxOccurs="unbounded">
<element ref="service"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="service">
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="class" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute kind="java" basedOn="com.kk.core.services.Service:com.kk.core.services.IService"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appinfo>
<meta.section type="since"/>
</appinfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="examples"/>
</appinfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="apiinfo"/>
</appinfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="implementation"/>
</appinfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
</schema>
Extension:
<extension
id="com.kk.core.platform.services"
name="KK Platform Services"
point="com.core.platformServices">
<service
class="com.kk.core.services.CheckService"
id="xx34567vvk">
</service>
</extension>
Sunday, September 6, 2015
Storing in eclipse secure storage with encryption
ISecurePreferences root = SecurePreferencesFactory.getDefault();
ISecurePreferences node = root.node("/com/kk/store"); //path
//store
try
{
node.put("myusername", "mysecretpassword", true);
}
catch (StorageException e)
{
e.printStackTrace();
}
Where does Eclipse secure storage file is saved ?
How to get the Eclipse Installation location ?
Eclipse provided a direct API call for this.
Platform.getInstallLocation().getURL();
To get a string path:
Platform.getInstallLocation().getURL().getPath();
Subscribe to:
Posts (Atom)