package com.jbase.jbuilder5vcs;
// jBuilder import
import com.borland.primetime.teamdev.vcs.VCS;
import com.borland.jbuilder.node.JBProject;
import com.borland.primetime.properties.PropertyPage;
import com.borland.primetime.help.HelpTopic;
/**
* Title: jBuilder/Perforce <br>
* Description: The class take by jBuilder for construct the Config Panel <br>
* <DL><DT><b>Company:</b></DT><DD>jBase.</DD></DL>
* @author <a href="mailto:nicolasj@jbase.com">Nicolas Jorand</a>
* @version 1.0
* @since JDK 1.3
*/
public class jPropertyPage extends PropertyPage
{
ConfigPanel pnlConfig = new ConfigPanel();
JBProject project;
public jPropertyPage( JBProject project ) {
this.project = project;
try {
initClass();
}
catch(Exception e) {
e.printStackTrace();
}
}
/**
* Write properties on the project when the Config panel <p<
* will be closed
*/
public void writeProperties() {
project.setAutoProperty(VCS.CATEGORY,PerforceVCS.PROP_CLIENT,pnlConfig.getClient());
project.setAutoProperty(VCS.CATEGORY,PerforceVCS.PROP_USER,pnlConfig.getUser());
project.setAutoProperty(VCS.CATEGORY,PerforceVCS.PROP_PASSWORD,pnlConfig.getPassword());
project.setAutoProperty(VCS.CATEGORY,PerforceVCS.PROP_PORT,pnlConfig.getPort());
project.setAutoProperty(VCS.CATEGORY,PerforceVCS.PROP_HOST,pnlConfig.getHost());
project.setAutoProperty(VCS.CATEGORY,PerforceVCS.PROP_PORT_DEFAULT,(new Boolean(pnlConfig.getDefaultPort())).toString());
// set project initialized
project.setAutoProperty(VCS.CATEGORY,PerforceVCS.PROP_ISNEW,"NO");
}
/**
* Read properties from the project for setting the<p>
* config panel.
*/
public void readProperties() {
// Get the default information if it's a new project
String sIsNew = project.getAutoProperty(VCS.CATEGORY,PerforceVCS.PROP_ISNEW);
String sClient = "";
String sUser = "";
String sPassword = "";
String sPort = "";
String sHost = "";
String sDefaultPort = "";
boolean bDefaultPort = true;
if (sIsNew != null){
// CLIENT Property
sClient = project.getAutoProperty(VCS.CATEGORY,PerforceVCS.PROP_CLIENT);
String sClientDefault = project.getAutoProperty(VCS.CATEGORY,PerforceVCS.PROP_CLIENT_DEFAULT);
if ( sClient != null ) {
pnlConfig.setClient(sClient);
}
// USER Property
sUser = project.getAutoProperty(VCS.CATEGORY,PerforceVCS.PROP_USER);
String sUserDefault = project.getAutoProperty(VCS.CATEGORY,PerforceVCS.PROP_USER_DEFAULT);
if ( sUser != null) {
pnlConfig.setUser(sUser);
}
// PASSWORD Property
sPassword = project.getAutoProperty(VCS.CATEGORY,PerforceVCS.PROP_PASSWORD);
if ( sPassword != null ) {
pnlConfig.setPassword(sPassword);
}
// HOST Property
sHost = project.getAutoProperty(VCS.CATEGORY,PerforceVCS.PROP_HOST );
if ( sHost != null ) {
pnlConfig.setHost(sHost);
}
// PORT Property
sPort = project.getAutoProperty(VCS.CATEGORY,PerforceVCS.PROP_PORT);
if ( sPort != null ) {
pnlConfig.setPort(sPort);
}
// PORT DEFAULT Property
sDefaultPort = project.getAutoProperty(VCS.CATEGORY,PerforceVCS.PROP_PORT_DEFAULT);
if ( sDefaultPort != null && sDefaultPort.equalsIgnoreCase("false") ) {
pnlConfig.setDefaultPort(false);
}else{
pnlConfig.setDefaultPort(true);
}
}else{ // It's the first initialisation
// get Info From P4
P4Cmd cmd = new P4Cmd();
// CLIENT Property
sClient = cmd._mySpec.getClient();
if ( sClient != null ) {
pnlConfig.setClient(sClient);
}
// USER Property
sUser = cmd._mySpec.getOwner();
if ( sUser != null) {
pnlConfig.setUser(sUser);
}
// PASSWORD Property
// null string by default
sPassword = "";
if ( sPassword != null ) {
pnlConfig.setPassword(sPassword);
}
// set by default the Host and port
pnlConfig.setDefaultPort(true);
}
}
/**
* NOT USED
*/
public HelpTopic getHelpTopic() {
// NOT USED
return null;
}
private void initClass() throws Exception {
this.add(pnlConfig);
}
}
# |
Change |
User |
Description |
Committed |
|
#1
|
939 |
nicolas_jorand |
First input of perforce integration for jBuilder5 |
|
|