protected long worked;
- protected int estimated;
+ //protected int estimated;
protected int rate;
{
this.totalWork = totalWork;
this.rate = 1;
- this.estimated = 0;
+ //this.estimated = 0;
while (totalWork > Integer.MAX_VALUE)
{
final String toStr;
final String sizeStr;
- String[] subTasks = name.split("\t");
- if (name == null || subTasks.length != 2)
+ if (name == null)
{
- fromStr = subTasks[0];
- toStr = "";
- sizeStr = "";
+ fromStr = toStr = sizeStr = "";
}
else
{
- fromStr = labelFrom + subTasks[0];
- toStr = labelTo + subTasks[1];
- sizeStr = labelSize + String.format("( %s / %s )", getSizeAndUnit(getWorked()), getSizeAndUnit(getTotal()));
+ String[] subTasks = name.split("\t");
+ if (subTasks.length != 2)
+ {
+ fromStr = subTasks[0];
+ toStr = "";
+ sizeStr = "";
+ }
+ else
+ {
+ fromStr = labelFrom + subTasks[0];
+ toStr = labelTo + subTasks[1];
+ sizeStr = labelSize + String.format("( %s / %s )", getSizeAndUnit(getWorked()), getSizeAndUnit(getTotal()));
+ }
}
SWTUtil.asyncExec(new Runnable()
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
+import org.tizen.common.util.IOUtil;
public class TizenRemoteFileImageLoader {
if (img == null) {
String tmp = PATH + filename;
InputStream imageStream = mClass.getResourceAsStream(tmp);
-
- if (imageStream != null) {
- img = new Image(display, imageStream);
- mLoadedImages.put(filename, img);
- return img;
+ try {
+ if (imageStream != null) {
+ img = new Image(display, imageStream);
+ mLoadedImages.put(filename, img);
+ return img;
+ }
+ } finally {
+ IOUtil.tryClose(imageStream);
}
}
return img;
GomMessages.SMARTLAUNCH_CYCLE_COLUMNS_4};
private String[] sampleColumns = {"Profile", "ProjectProject", "LaunchConfigurationLaunchConfiguration", "emulator-xxxxx"};
- private final String TIZEN_SMART_LAUNCH_UP_ID="org.tizen.common.gom.smartlaunch.ui.tizensmartlauncher.up";
- private final String TIZEN_SMART_LAUNCH_DOWN_ID="org.tizen.common.gom.smartlaunch.ui.tizensmartlauncher.down";
+ private final static String TIZEN_SMART_LAUNCH_UP_ID="org.tizen.common.gom.smartlaunch.ui.tizensmartlauncher.up";
+ private final static String TIZEN_SMART_LAUNCH_DOWN_ID="org.tizen.common.gom.smartlaunch.ui.tizensmartlauncher.down";
@Override
protected void addItems(Table table, WorkbenchPage page) {
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.*;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.activities.WorkbenchActivityHelper;
import org.tizen.common.ITizenNativeProject;
public class GomDialog extends TitleAreaDialog{
- private final int WIDTH = 500;
- private final int HEIGHT = 500;
+ private final static int WIDTH = 500;
+ private final static int HEIGHT = 500;
private Label lbBuild;
private Button[] btnMode;
{
String config = configList.get(i);
comboBuildConfiguration.add(configList.get(i));
- if(defaultConfig.equals(config))
+ if(defaultConfig != null && defaultConfig.equals(config))
{
setSelectionBuildConfiguration(i);
}
@Override
public void processNewLines(String[] lines) {
DlogInfo[] infos = DlogUtil.getDlogInfos(dlogFormat, lines);
-
- for (DlogInfo info : infos) {
- dlogUtilLogs.add(info);
+ if (infos != null) {
+ for (DlogInfo info : infos) {
+ dlogUtilLogs.add(info);
+ }
}
}
if ( !handler.is( this.path, Attribute.EXISTS ) ) {
final Policy policy = context.getPolicy( Policy.NONEXIST_IN_PROJECT );
- final MessagePolicy messagePolicy = policy.adapt( MessagePolicy.class );
-
- if ( messagePolicy != null ) {
- messagePolicy.print( context.getPrompter(), "{0} doesn't exist", this.path );
+ if ( policy != null ) {
+ final MessagePolicy messagePolicy = policy.adapt( MessagePolicy.class );
+
+ if ( messagePolicy != null ) {
+ messagePolicy.print( context.getPrompter(), "{0} doesn't exist", this.path );
+ }
}
-
return ;
}
protected List<Button> profileDependsButtons;
-
protected SigningProfileContainer container;
// load profile
this.container = SigningProfileUtil.getProfileContainerFromFile();
- // create root composite
Composite composite = createComposite(
parent, SWT.NONE, createGridLayout( 1 ), new GridData( GridData.FILL_BOTH ) );
- // create child composites
createProfilesControl( composite );
createAuthorControl( composite );
createDistributorControl( composite );
public void createControl(Composite parent) {
super.createControl( parent );
- // don't show a default button
Button defaultButton = getDefaultsButton();
if (defaultButton != null) {
defaultButton.setVisible( false );
}
- // set help
PlatformUI.getWorkbench().getHelpSystem().setHelp(
parent, TizenHelpContextIds.HELP_COMMON_CERTIFICATE_GENERTOR_CONTEXT );
}
Composite profileListComposite = createProfileListViewerControl( group );
Composite profileButtonComposite = createProfilesButtonControl( group );
- // add control listener
group.addControlListener( new ControlListenerImpl(
group, profileListComposite, profileButtonComposite ) );
}
final Composite profileListComposite = createComposite(
parent, SWT.NONE, createGridLayout( 1, 0, 3 ), new GridData( GridData.FILL_BOTH ) );
- // create ListViewer
this.listViewer = new TableViewer( profileListComposite );
this.listViewer.getTable().setLayoutData( new GridData( GridData.FILL_BOTH ) );
this.listViewer.setContentProvider( new ListViewerContentProvider( container ) );
SigningProfile activeProfile = this.container.getProfileByName( activeProfileName );
this.container.setActiveProfile( activeProfile );
- // TODO: ????
this.listViewer.setInput( "profile" );
if ( activeProfile != null ) {
public void widgetSelected(SelectionEvent e) {
// input a profile name from the dialog
InputValidator validator = new InputValidator( container );
- InputDialog dialog = new InputDialog(
- Display.getDefault().getActiveShell(),
+ InputDialog dialog = new InputDialog( Display.getDefault().getActiveShell(),
UIMessages.getString( "org.tizen.common.sign.profilename" ),
UIMessages.getString( "org.tizen.common.sign.entername" ),
EMPTY_STRING,
// input a profile name from the dialog with an old profile name
InputValidator validator = new InputValidator( container, profileName );
- InputDialog dialog = new InputDialog(
- Display.getDefault().getActiveShell(),
+ InputDialog dialog = new InputDialog( Display.getDefault().getActiveShell(),
UIMessages.getString("org.tizen.common.sign.profilename"),
UIMessages.getString("org.tizen.common.sign.entername"),
profileName, validator );
@Override
public void widgetSelected(SelectionEvent e) {
SigningProfile profile = getSelectedProfile( listViewer.getSelection() );
+ if ( profile == null )
+ return;
SigningProfileItem item = profile.getAuthorProfileItem();
ProfileItemDialog dialog = new ProfileItemDialog( Display.getDefault().getActiveShell(), item );
@Override
public String getColumnText(Object element, int columnIndex) {
if ( columnIndex == 0 ) {
- // item numbering
-
int i = 0;
Object e;
while ( ( e = distributorTableViewer.getElementAt( i++ ) ) != null ) {
Shell activeShell = Display.getDefault().getActiveShell();
SigningProfileItem selectedItem = getSelectedProfileItem( distributorTableViewer.getSelection() );
if ( selectedItem == null ) {
- MessageDialog.openError(
- activeShell,
+ MessageDialog.openError( activeShell,
"Certificate editor error",
"Not selected a distributor item for modification" );
return;
}
SigningProfile profile = getSelectedProfile( listViewer.getSelection() );
- SigningProfileItem item = profile.getProfileItem( profile.getOrdinal( selectedItem ) );
-
- ProfileItemDialog itemDialog = new ProfileItemDialog( activeShell, item );
- int result = itemDialog.open();
- if ( result == ProfileItemDialog.OK ) {
- item.setKeyLocation( itemDialog.getKeyPath() );
- item.setPassword( itemDialog.getPassword() );
- item.setCAPath( itemDialog.getCaPath() );
- item.setRootCAPath( itemDialog.getRootPath() );
-
- enableTableViewer( true, profile );
-
- validatePreferencePage();
+ if ( profile != null ) {
+ SigningProfileItem item = profile.getProfileItem( profile.getOrdinal( selectedItem ) );
+ ProfileItemDialog itemDialog = new ProfileItemDialog( activeShell, item );
+ int result = itemDialog.open();
+ if ( result == ProfileItemDialog.OK ) {
+ item.setKeyLocation( itemDialog.getKeyPath() );
+ item.setPassword( itemDialog.getPassword() );
+ item.setCAPath( itemDialog.getCaPath() );
+ item.setRootCAPath( itemDialog.getRootPath() );
+
+ enableTableViewer( true, profile );
+
+ validatePreferencePage();
+ }
}
}
messageLayout.marginWidth = 0;
messageLayout.marginHeight = 0;
messageComposite.setLayout(messageLayout);
- messageComposite.setLayoutData(new GridData(
- GridData.HORIZONTAL_ALIGN_FILL));
+ messageComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
messageComposite.setFont(font);
final Label noteLabel = new Label(messageComposite, SWT.BOLD);
noteLabel.setText(title);
- noteLabel.setFont(JFaceResources.getFontRegistry().getBold(
- JFaceResources.DIALOG_FONT));
- noteLabel
- .setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
+ noteLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
+ noteLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
Link messageLabel = new Link(messageComposite, SWT.WRAP);
messageLabel.setText(message);
IRunnableWithProgress runnable = new IRunnableWithProgress() {
@Override
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor = ObjectUtil.nvl( monitor, new NullProgressMonitor() );
monitor.beginTask( "generate a certificate", IProgressMonitor.UNKNOWN );
PlatformUI.getWorkbench().getProgressService().busyCursorWhile( runnable );
} catch (InvocationTargetException e) {
logger.error( e.getMessage(), e.getCause() );
- ErrorDialog.openError(
- activeShell,
+ ErrorDialog.openError( activeShell,
"Certificate generation error",
"Failed to generate a certificate.",
new Status( IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e.getCause() ) );
if ( bAutoFill ) {
SigningProfile profile = getSelectedProfile( listViewer.getSelection() );
- SigningProfileItem item = profile.getAuthorProfileItem();
-
- item.setKeyLocation( absolutePath );
- item.setPassword( dialog.getValue( CertDataKey.Password ).toCharArray() );
-
+ if ( profile != null ) {
+ SigningProfileItem item = profile.getAuthorProfileItem();
+
+ item.setKeyLocation( absolutePath );
+ item.setPassword( dialog.getValue( CertDataKey.Password ).toCharArray() );
+ }
enableTableViewer( true, profile );
validatePreferencePage();
Composite composite = new Composite( parent, SWT.NONE );
composite.setLayout( layout );
composite.setLayoutData( layoutData );
-
return composite;
}
final TableColumn column = new TableColumn( parent, style, index );
column.setText( text );
column.pack();
-
return column;
}
return (SigningProfile) firstElement;
}
}
-
return null;
}
return (SigningProfileItem) firstElement;
}
}
-
return null;
}
* TextCellEditor for password processing
*/
public class PasswordTextCellEditor extends TextCellEditor {
-
public PasswordTextCellEditor(Composite composite) {
super(composite);
}
public int getStyle() {
return super.getStyle() | SWT.PASSWORD;
}
-
}
}
return null;
}
}
-
public Collection<Command> getCommands() {\r
return commandMap.values();\r
}\r
+\r
+ public String getKey() {\r
+ return key;\r
+ }\r
}\r
\r
import org.eclipse.core.resources.IProject;\r
import org.eclipse.core.resources.ResourcesPlugin;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
import org.tizen.common.ui.commandbar.assistant.AssistantBubble.*;\r
import org.tizen.common.ui.commandbar.recommendations.*;\r
import org.tizen.common.ui.commandbar.textAssist.TextAssistContentProvider;\r
import org.tizen.common.util.ProjectUtil;\r
\r
public class CommandProvider extends TextAssistContentProvider implements OrderProcessor {\r
- protected Logger logger = LoggerFactory.getLogger(getClass());\r
-\r
Pattern PROJECT_COMMAND_PATTERN = Pattern.compile("(@[\\w]+)(\\s.*)*");\r
Pattern SDB_COMMAND_PATTERN = Pattern.compile("(" + Commands.SDB_COMMAND + ")(\\s.*)*");\r
\r
@Override\r
public void onProjectCommand(String projectName, String arg) {\r
boolean hasArg = arg != null;\r
- boolean projectExists = ProjectUtil.getProject(projectName).exists();\r
+ IProject project = ProjectUtil.getProject(projectName);\r
+ boolean projectExists = (project == null) ? false : project.exists();\r
if (!hasArg)\r
returnedList.addAll(getProjectList(projectName));\r
for (final String[] message : Commands.getInstance().getHelp(Commands.PROJECT_COMMAND, "projectExists", projectExists)) {\r
import org.eclipse.jface.layout.GridLayoutFactory;\r
import org.eclipse.jface.window.Window;\r
import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.browser.Browser;\r
import org.eclipse.swt.events.SelectionAdapter;\r
import org.eclipse.swt.events.SelectionEvent;\r
import org.eclipse.swt.graphics.Point;\r
}\r
\r
protected Layout getLayout() {\r
- return null;\r
+ return GridLayoutFactory.fillDefaults().create();\r
}\r
\r
protected void configureShell(Shell newShell) {\r
- newShell.setLayout(GridLayoutFactory.fillDefaults().create());\r
+ super.configureShell(newShell);\r
shell = newShell;\r
shell.setText(text);\r
}\r
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
import org.eclipse.ui.internal.dialogs.PropertyDialog;
import org.eclipse.ui.wizards.IWizardDescriptor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.tizen.common.core.command.ExecutionContext;
import org.tizen.common.core.command.Executor;
import org.tizen.common.ui.commandbar.IProjectCreator;
import org.tizen.common.util.SWTUtil;
public class ProjectCommand extends ConsoleCommand {
- protected Logger logger = LoggerFactory.getLogger(getClass());
-
ConsoleManager consoleManager = new ConsoleManager(CONSOLE_NAME, true);
- String lineSeparator = System.getProperty("line.separator");
-
void writeln(final String s) {
/*
new Thread(new Runnable() {
pda.run();
*/
PropertyDialog dialog = PropertyDialog.createDialogOn(SWTUtil.getShell(), initialPageId, new StructuredSelection(new Object[] { project }));
- dialog.open();
+ if (dialog != null)
+ dialog.open();
}
private void openWizardDialog(final String name) throws Exception {
}
private void createProject(final String name, final String[] args) throws Exception {
- if (ProjectUtil.getProject(name).exists()) {
+ IProject project = ProjectUtil.getProject(name);
+ if (project != null && project.exists()) {
writeln(String.format("A project '%s' already exists.", name));
return;
}
public class ShowStatCommand extends AbstractCommand<Object> {
DateFormat dfw = new SimpleDateFormat("yyyy-MM-dd");
- final int MAX_ENTRIES = 5;
+ private final static int MAX_ENTRIES = 5;
Ranker ranker = new Ranker();
public void run(final Executor executor, final ExecutionContext context) throws Exception {
@Override\r
public void linkActivated() {\r
IRegion region = console.getRegion(this);\r
- try {\r
- String hyperlink = console.getDocument().get(region.getOffset(), region.getLength());\r
- OpenBrowserUtil.open(new URL(hyperlink), SWTUtil.getDisplay());\r
- } catch (Exception e) {\r
- logger.error("Failed to open the browser", e);\r
+ if (region != null) {\r
+ try {\r
+ String hyperlink = console.getDocument().get(region.getOffset(), region.getLength());\r
+ OpenBrowserUtil.open(new URL(hyperlink), SWTUtil.getDisplay());\r
+ } catch (Exception e) {\r
+ logger.error("Failed to open the browser", e);\r
+ }\r
}\r
}\r
}, event.getOffset(), event.getLength());\r
import org.jsoup.nodes.Document;\r
\r
public class TizenHandler implements Handler {\r
- private final String HOST = "https://developer.tizen.org";\r
+ private final static String HOST = "https://developer.tizen.org";\r
\r
public boolean isQuestion(String link) {\r
return true;\r
if (isForum(link)) {\r
String post = doc.select(".field-item").get(0).text();\r
String count = doc.select(".topic-post-count").get(0).text();\r
- answer = String.format("%s (%s)\n" + // title & replies\r
- " >%s\n" + // link\r
+ answer = String.format("%s (%s)%n" + // title & replies\r
+ " >%s%n" + // link\r
" >%s...", // Post (Max: 200 chars)\r
title, count, link, left(post, 200));\r
} else {\r
}\r
\r
public String formatOutput(List<String> answers) {\r
- return String.format("\n" +\r
- "Answers\n" +\r
- "-------\n" +\r
+ return String.format("%n" +\r
+ "Answers%n" +\r
+ "-------%n" +\r
"%s", StringUtil.join(answers, "\n"));\r
}\r
}\r
import java.io.Writer;\r
import java.util.ArrayList;\r
import java.util.Collection;\r
-import java.util.HashSet;\r
-import java.util.Set;\r
\r
import javax.xml.parsers.DocumentBuilder;\r
import javax.xml.parsers.DocumentBuilderFactory;\r
throw new SAXException("illegal_boolean_attribute"); //$NON-NLS-1$\r
}\r
\r
- private String getStringValue(NamedNodeMap attributes, String name) throws SAXException {\r
- String val = getStringValue(attributes, name, null);\r
- if (val == null)\r
- throw new SAXException("missing_attribute"); //$NON-NLS-1$\r
- return val;\r
- }\r
-\r
private String getStringValue(NamedNodeMap attributes, String name, String defaultValue) {\r
Node node = attributes.getNamedItem(name);\r
return node == null ? defaultValue : node.getNodeValue();\r
private TextAssistContentProvider contentProvider;\r
private int numberOfLines = 20;\r
\r
- final int TEXT_MARGIN = 3;\r
+ final static int TEXT_MARGIN = 3;\r
private Font HELP_COMMAND_FONT;\r
private Color HELP_COMMAND_DESC_COLOR;\r
private Color HELP_SEPARATOR_COLOR;\r
*/\r
@Override\r
public void setFont(final Font font) {\r
+ super.setFont(font);\r
checkWidget();\r
this.text.setFont(font);\r
this.table.setFont(font);\r
private int BROWSER_WIDTH = 418;\r
private int ICON_WIDTH = 40;\r
private int ICON_DEFAULT_SIZE = 32;\r
- final int TEXT_MARGIN = 30;\r
+ final static int TEXT_MARGIN = 30;\r
\r
protected TizenCommonPWComposite(Category root, TizenCommonWizardPage page, String label, String propertyKey, int numberOfColumns, boolean singleWidget) {\r
super(label, propertyKey, numberOfColumns, singleWidget);\r
if (platformInfo == null)
throw new IllegalArgumentException("platformInfo can not be null");
ITizenProject tizenPrj = ProjectUtil.getTizenProject(project);
- TizenProjectDescription desc = new TizenProjectDescription(project);
- desc.setPlatform(platformInfo);
- tizenPrj.setDescription(desc);
+ if (tizenPrj != null) {
+ TizenProjectDescription desc = new TizenProjectDescription(project);
+ desc.setPlatform(platformInfo);
+ tizenPrj.setDescription(desc);
+ }
}
}
public class TizenCommonWizardPage extends WizardNewProjectCreationPage {
protected final Logger logger = LoggerFactory.getLogger(getClass());
- private final String ROOT_NAME = "TEMPLATE-ROOT"; //$NON-NLS-1$
+ private final static String ROOT_NAME = "TEMPLATE-ROOT"; //$NON-NLS-1$
private static Image imgBackground;
private static Image imgTree, imgList;
import org.eclipse.core.resources.IProject;
import org.tizen.common.core.application.InstallPathConfig;
+import org.tizen.common.core.application.ProfileInfo;
import org.tizen.common.core.application.TizenProjectDescription;
import org.tizen.common.core.application.tproject.TprojectHandler;
else {
if ( generate ) {
desc = new TizenProjectDescription(getProject());
- desc.setPlatform(InstallPathConfig.getLatestProfileInfo());
+ ProfileInfo latestProfileInfo = InstallPathConfig.getLatestProfileInfo();
+ if (latestProfileInfo != null)
+ desc.setPlatform(latestProfileInfo);
if ( setDescription(desc) ) {
return desc;
}
*/
package org.tizen.common;
-import org.apache.log4j.spi.RepositorySelector;
+//import org.apache.log4j.spi.RepositorySelector;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
*/
protected Executor executor = null;
- protected RepositorySelector selector = null;
+ //protected RepositorySelector selector = null;
protected CrashReportService crService = null;
ProfileInfo profileInfo = InstallPathConfig.getProfileInfo(profile);
if ( profileInfo == null ) {
return new ProfileInfo(profile, version, null);
+ } else {
+ String path = profileInfo.getPlatformPath(version);
+ return new ProfileInfo(profile, version, path);
}
- String path = profileInfo.getPlatformPath(version);
-
- return new ProfileInfo(profile, version, path);
}
-
+
/**
* Returns the profile name associated with project.
*/
public String getProfileName() {
return InstallPathConfig.getProfile(platform);
}
-
+
/**
* Returns the profile version associated with project.
*/
public String getVersion() {
return InstallPathConfig.getVersion(platform);
}
-
+
public String toString() {
return "TizenProjectDescription [project: " + project + "platform: " + platform +"]";
}
final ZipEntry entry = createEntry( relative );
zipOut.putNextEntry( entry );
- IOUtil.redirect( handler.read( filePath ), zipOut );
+ InputStream fileIn = handler.read( filePath );
+ try
+ {
+ IOUtil.redirect( fileIn, zipOut );
+ }
+ finally
+ {
+ tryClose( fileIn );
+ }
zipOut.closeEntry();
logger.debug( "Zip {}", relative );
}
}
if ( OPTION_ENABLE.equals(projectSpecificOption)) {
try {
- rdsOption = project.getPersistentProperty(RDS_PROPERTIES_RDS_OPTION_NAME);
+ if ( project != null ) {
+ rdsOption = project.getPersistentProperty(RDS_PROPERTIES_RDS_OPTION_NAME);
+ }
} catch (CoreException e) {
logger.error("Failed to read RDS option.", e);
}
package org.tizen.common.ui.dialog;
+import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
protected Text errorMessageText;
protected String errorMessage;
- // inputted fields
+ // input fields
protected Collection<UserField> fields;
// ID based controls for searching
protected Map<String, Control> controlMap = new HashMap<String, Control>();
- /////////////////////////////////////////////////////////////////
- // Constructor
-
/**
* Default constructor for dynamic generation
* @param parent parent shell
public DynamicDialog(Collection<UserField> fields) {
this( SWTUtil.getActiveShell(), fields );
}
-
-
- /////////////////////////////////////////////////////////////////
- // Dialog logic
-
+
public String getTitle() {
return title;
}
return button;
}
-
- /////////////////////////////////////////////////////////////////
- // control creation utility
-
private Composite createComposite(Composite parent, Layout layout, Object layoutData) {
Composite composite = new Composite( parent, getCompositeStyle() ) {
@Override
if ( controlMap.containsValue( children ) ) {
String controlId = getKeyByValue( controlMap, children );
UserField userField = getModel( fields, controlId );
-
- if ( !userField.canModify() ) {
+ if ( userField == null || !userField.canModify() ) {
continue;
}
}
if ( defaultText instanceof char[] ) {
text.setText( new String( (char[]) defaultText ) );
} else if ( defaultText instanceof Character[] ) {
- text.setText( ((Character[]) defaultText).toString() );
+ text.setText( Arrays.toString((Character[]) defaultText) );
} else {
text.setText( StringUtil.EMPTY_STRING );
}
logger.info( "Exception occurred:", e );
return false;
}finally{
- logger.debug( "Output Stream :{}", gb1.getResult() );
- logger.debug( "Error Stream :{}", gb2.getResult() );
}
return true;
}