import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Shell;
import org.tizen.dynamicanalyzer.appearance.DesignConstants;
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.path.PathManager;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
private static boolean opened = false;
private DACustomButton okButton = null;
- private static String ideBuildVersionInfo = CommonConstants.EMPTY;
- private static String daBuildTimeInfo = CommonConstants.EMPTY;
- private static String daVersionInfo = AnalyzerConstants.DA_VERSION;
+ private static String sdkBuildVersionInfo = CommonConstants.EMPTY;
+ private static String daBuildIDInfo = CommonConstants.EMPTY;
private final Image iconImage = ImageResources.ABOUT_TIZEN_SDK;
- final static String daAboutFilePath = PathManager.getWorkbenchPluginPath() + File.separator
- + "about.mappings";
+ final static String daAboutFilePath = PathManager.getWorkbenchPluginPath()
+ + File.separator + "about.mappings";
+
+ final static String sdkVersionFilePath = PathManager.TIZEN_SDK_INSTALL_PATH
+ + File.separator + "sdk.version";
- final static String sdkVersionFilePath = PathManager.TIZEN_SDK_INSTALL_PATH + File.separator
- + "sdk.version";
-
public AboutDialog(Shell parent) {
super(parent);
}
titleText.setText(AnalyzerLabels.ABOUT_DIALOG_TITLE);
Label version = new Label(base, SWT.TRANSPARENT);
- version.setText(AnalyzerLabels.ABOUT_DIALOG_VERSION_TAB + ideBuildVersionInfo);
+ version.setText(AnalyzerLabels.ABOUT_DIALOG_VERSION_TAB
+ + sdkBuildVersionInfo);
version.setBackground(ColorResources.DIALOG_BG_UPPER);
version.setAlignment(SWT.LEFT);
version.setForeground(ColorResources.DEFAULT_FONT_COLOR);
version.setFont(FontResources.ABOUT_TEXT);
- Label daVersion = new Label(base, SWT.TRANSPARENT);
- daVersion.setText(AnalyzerLabels.ABOUT_DIALOG_DA_VERSION_TAB + daVersionInfo);
- daVersion.setBackground(ColorResources.DIALOG_BG_UPPER);
- daVersion.setAlignment(SWT.LEFT);
- daVersion.setForeground(ColorResources.DEFAULT_FONT_COLOR);
- daVersion.setFont(FontResources.ABOUT_TEXT);
-
- Label buildTime = new Label(base, SWT.TRANSPARENT);
- buildTime.setText(AnalyzerLabels.ABOUT_DIALOG_BUILD_TIME_TAB + daBuildTimeInfo);
- buildTime.setBackground(ColorResources.DIALOG_BG_UPPER);
- buildTime.setAlignment(SWT.LEFT);
- buildTime.setForeground(ColorResources.DEFAULT_FONT_COLOR);
- buildTime.setFont(FontResources.ABOUT_TEXT);
-
+ Label buildID = new Label(base, SWT.TRANSPARENT);
+ buildID.setText(AnalyzerLabels.ABOUT_DIALOG_BUILD_ID_TAB
+ + daBuildIDInfo);
+ buildID.setBackground(ColorResources.DIALOG_BG_UPPER);
+ buildID.setAlignment(SWT.LEFT);
+ buildID.setForeground(ColorResources.DEFAULT_FONT_COLOR);
+ buildID.setFont(FontResources.ABOUT_TEXT);
+
FormData labelData = new FormData();
labelData.left = new FormAttachment(0, 0);
labelData.top = new FormAttachment(0, 0);
titleText.setLayoutData(labelData);
textPos += (17 + 15);
- if(!ideBuildVersionInfo.equals(CommonConstants.EMPTY)){
+ if (!sdkBuildVersionInfo.equals(CommonConstants.EMPTY)) {
labelData = new FormData();
labelData.left = new FormAttachment(0, 155);
labelData.right = new FormAttachment(100, 0);
labelData.right = new FormAttachment(100, 0);
labelData.top = new FormAttachment(0, textPos += 17);
labelData.height = 17;
- daVersion.setLayoutData(labelData);
-
- labelData = new FormData();
- labelData.left = new FormAttachment(0, 155);
- labelData.right = new FormAttachment(100, 0);
- labelData.top = new FormAttachment(0, textPos += 17);
- labelData.height = 17;
- buildTime.setLayoutData(labelData);
+ buildID.setLayoutData(labelData);
+
+ Link visit = new Link(base, SWT.NONE);
+ baseData = new FormData();
+ baseData.left = new FormAttachment(0, 155);
+ baseData.right = new FormAttachment(100, 0);
+ baseData.top = new FormAttachment(0, textPos += 51);
+ visit.setLayoutData(baseData);
+ visit.setText(AnalyzerLabels.ABOUT_DIALOG_VISIT + " <a>"
+ + AnalyzerLabels.ABOUT_DIALOG_SITE_URL + "</a>");
+ visit.setForeground(ColorResources.DEFAULT_FONT_COLOR);
+ visit.setBackground(ColorResources.DIALOG_BG_UPPER);
+ visit.setFont(FontResources.ABOUT_TEXT);
+ visit.addSelectionListener(new SelectionListener() {
+ @Override
+ public void widgetDefaultSelected(SelectionEvent arg0) {
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent arg0) {
+ try {
+ String url = AnalyzerLabels.ABOUT_DIALOG_SITE_URL;
+ if (CommonUtil.isWin()) {
+ org.eclipse.swt.program.Program.launch(url);
+ } else if (CommonUtil.isLinux()) {
+ Runtime.getRuntime().exec("xdg-open " + url); //$NON-NLS-1$
+ } else if (CommonUtil.isMac()) {
+ Runtime.getRuntime().exec("/usr/bin/open " + url); //$NON-NLS-1$
+ }
+ } catch (Throwable e) {
+ Logger.error("Failed to open developer site");
+ return;
+ }
+ }
+ });
Composite buttonComp = new Composite(shell, SWT.NONE);
buttonComp.setLayout(new FormLayout());
e.gc.setForeground(ColorResources.DIALOG_SUNKEN_1);
e.gc.drawLine(rect.x, rect.y, rect.x + rect.width, rect.y);
e.gc.setForeground(ColorResources.DIALOG_SUNKEN_2);
- e.gc.drawLine(rect.x, rect.y + 1, rect.x + rect.width, rect.y + 1);
+ e.gc.drawLine(rect.x, rect.y + 1, rect.x + rect.width,
+ rect.y + 1);
}
});
}
public static void updateBuildInfo() {
- if (ideBuildVersionInfo.equals(CommonConstants.EMPTY)
- || daBuildTimeInfo.equals(CommonConstants.EMPTY)) {
+ if (sdkBuildVersionInfo.equals(CommonConstants.EMPTY)
+ || daBuildIDInfo.equals(CommonConstants.EMPTY)) {
updateDABuildInfo();
- ideBuildVersionInfo = getSdkVersion();
+ sdkBuildVersionInfo = getSdkVersion();
writeBuildInfoToAboutFile();
}
}
buffWriter = new BufferedWriter(fileWriter);
printWriter = new PrintWriter(buffWriter);
- printWriter.println("0" + CommonConstants.EQUAL + ideBuildVersionInfo);//$NON-NLS-1$
- printWriter.println("1" + CommonConstants.EQUAL + daBuildTimeInfo);//$NON-NLS-1$
+ printWriter
+ .println("0" + CommonConstants.EQUAL + sdkBuildVersionInfo);//$NON-NLS-1$
+ printWriter.println("1" + CommonConstants.EQUAL + daBuildIDInfo);//$NON-NLS-1$
printWriter.checkError();
} catch (IOException e) {
Logger.exception(e);
private static String getSdkVersion() {
File file = new File(sdkVersionFilePath);
if (!file.exists()) {
- Logger.error(
- "about dlg, not exists file : " + sdkVersionFilePath);
+ Logger.error("about dlg, not exists file : " + sdkVersionFilePath);
return CommonConstants.EMPTY;
}
BufferedReader in = null;
while (null != (content = in.readLine())) {
buildVersion = parseBuildVersion(content);
if (buildVersion != null) {
- ideBuildVersionInfo = buildVersion;
+ sdkBuildVersionInfo = buildVersion;
}
buildTime = parseBuildTime(content);
if (buildTime != null) {
- daBuildTimeInfo = buildTime;
+ daBuildIDInfo = buildTime;
}
}
} catch (FileNotFoundException e) {
CommonUtil.tryClose(in);
}
}
+
}