Skip to content

Commit

Permalink
Merge branch 'development' into release
Browse files Browse the repository at this point in the history
Conflicts:
	desktop/plugins/com.appcelerator.titanium.desktop/src/com/appcelerator/titanium/desktop/ui/wizard/NewDesktopProjectWizard.java
  • Loading branch information
Michael Xia committed Dec 27, 2013
2 parents 3c43ea1 + 40982f2 commit ad6dfd1
Show file tree
Hide file tree
Showing 18 changed files with 117 additions and 109 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2011-2012 Appcelerator, Inc.
* Copyright 2011-2013 Appcelerator, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,6 @@
*/
package com.appcelerator.titanium.desktop;

import com.appcelerator.titanium.core.SDKEntity;
import com.aptana.core.diagnostic.IDiagnosticLog;

public class DesktopDiagnosticLog implements IDiagnosticLog
Expand All @@ -25,13 +24,17 @@ public String getLog()
{
StringBuilder buf = new StringBuilder();

for (SDKEntity sdkEntity : TitaniumDesktopSDKLocator.getInstance().getAvailable())
for (Object sdkEntity : TitaniumDesktopSDKLocator.getInstance().getAvailable())
{
buf.append(Messages.DesktopDiagnosticLog_sdk_version_label).append(sdkEntity.getVersion());
buf.append("\n"); //$NON-NLS-1$
if (sdkEntity instanceof DesktopSDKEntity)
{
DesktopSDKEntity entity = (DesktopSDKEntity) sdkEntity;
buf.append(Messages.DesktopDiagnosticLog_sdk_version_label).append(entity.getVersion());
buf.append("\n"); //$NON-NLS-1$

buf.append(Messages.DesktopDiagnosticLog_sdk_location_label).append(sdkEntity.getPath().toOSString());
buf.append("\n\n"); //$NON-NLS-1$
buf.append(Messages.DesktopDiagnosticLog_sdk_location_label).append(entity.getPath().toOSString());
buf.append("\n\n"); //$NON-NLS-1$
}
}

return buf.toString();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2012 Appcelerator, Inc.
* Copyright 2012-2013 Appcelerator, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,13 +22,12 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;

import com.appcelerator.titanium.core.ITiAppModel;
import com.appcelerator.titanium.core.SDKEntity;
import com.appcelerator.titanium.core.SDKLocator;
import com.appcelerator.titanium.core.TiAppReconciler;
import com.appcelerator.titanium.core.TitaniumProject;
import com.appcelerator.titanium.core.mobile.SDKEntity;
import com.appcelerator.titanium.core.mobile.SDKLocator;
import com.appcelerator.titanium.core.platform.IPlatformTypeConfigurator;
import com.appcelerator.titanium.core.tiapp.TiAppModelUtil;
import com.appcelerator.titanium.core.tiapp.ITiAppModel;
import com.appcelerator.titanium.core.tiapp.TiAppReconciler;
import com.appcelerator.titanium.core.tiapp.TiManifestModel;
import com.appcelerator.titanium.core.tiapp.TiManifestModel.MODULE;
import com.aptana.core.util.StringUtil;
Expand Down Expand Up @@ -70,7 +69,7 @@ public void postProjectImport(IProject project, TitaniumProject tiProject, IProg
// We might have to update the manifest here after the reconcile, as it may change due to SDK compatibilities.
// We do it here, and not in the TiAppReconciler, for dependency reasons (Desktop-specific code that cannot be
// accessed from the core plugin).
String sdkVersion = TiAppModelUtil.getSDKVersion(reconciledModel);
String sdkVersion = reconciledModel.getSDKVersion();
if (!StringUtil.isEmpty(sdkVersion))
{
DesktopSDKEntity sdkEntity = (DesktopSDKEntity) getSDKLocator().findVersion(sdkVersion);
Expand All @@ -81,12 +80,12 @@ public void postProjectImport(IProject project, TitaniumProject tiProject, IProg
}
}

public void onTiAppSDKSave(String sdkVersion, TiManifestModel manifestModel, Set<MODULE> mdoules)
public void onTiAppSDKSave(String sdkVersion, TiManifestModel manifestModel, Set modules)
{
if (manifestModel != null)
{
DesktopSDKEntity sdkEntity = (DesktopSDKEntity) getSDK(sdkVersion);
TitaniumDesktopManifestUtil.updateSDKVersion(manifestModel, sdkVersion, sdkEntity, mdoules);
TitaniumDesktopManifestUtil.updateSDKVersion(manifestModel, sdkVersion, sdkEntity, modules);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2011-2012 Appcelerator, Inc.
* Copyright 2011-2013 Appcelerator, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,7 +21,7 @@

import org.eclipse.core.runtime.IPath;

import com.appcelerator.titanium.core.SDKEntity;
import com.appcelerator.titanium.core.mobile.SDKEntity;
import com.appcelerator.titanium.core.tiapp.TiManifestModel.MODULE;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2011-2012 Appcelerator, Inc.
* Copyright 2011-2013 Appcelerator, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,8 +32,8 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.preferences.IScopeContext;

import com.appcelerator.titanium.core.SDKLocator;
import com.appcelerator.titanium.core.TitaniumCorePlugin;
import com.appcelerator.titanium.core.mobile.SDKLocator;
import com.appcelerator.titanium.core.preferences.ITitaniumCorePreferencesConstants;
import com.appcelerator.titanium.core.tiapp.TiManifestModel.MODULE;
import com.aptana.core.util.CollectionsUtil;
Expand All @@ -43,7 +43,7 @@
/**
* @author Max Stepanov
*/
public final class TitaniumDesktopSDKLocator extends SDKLocator
public final class TitaniumDesktopSDKLocator extends SDKLocator<DesktopSDKEntity>
{

private Map<String, List<String>> versionsToModules;
Expand Down Expand Up @@ -77,62 +77,52 @@ public static TitaniumDesktopSDKLocator getInstance()
.getInstance(TitaniumDesktopSDKLocator.class);
}

/**
* Initialize the SDK locator with a given SDK root path.
*
* @param sdkRoot
*/
protected void initialize(IPath sdkRoot)
protected IStatus initialize()
{
initializationStatus = Status.OK_STATUS;
versionsToModules = null;
if (sdkRoot.isEmpty())
if (sdkPath.isEmpty())
{
initializationStatus = new Status(IStatus.WARNING, DesktopPlugin.PLUGIN_ID,
SDKLocator.CONFIGURATION_WARNING, Messages.TitaniumDesktopSDKLocator_sdkRootNotSpecified, null);
return;
return new Status(IStatus.WARNING, DesktopPlugin.PLUGIN_ID, SDKLocator.CONFIGURATION_WARNING,
Messages.TitaniumDesktopSDKLocator_sdkRootNotSpecified, null);
}
if (!sdkRoot.toFile().isDirectory())
if (!sdkPath.toFile().isDirectory())
{
initializationStatus = new Status(IStatus.WARNING, DesktopPlugin.PLUGIN_ID, SDKLocator.CONFIGURATION_ERROR,
return new Status(IStatus.WARNING, DesktopPlugin.PLUGIN_ID, SDKLocator.CONFIGURATION_ERROR,
MessageFormat.format(Messages.TitaniumDesktopSDKLocator_sdkRootPathNotDirectory,
sdkRoot.toOSString()), null);
return;
sdkPath.toOSString()), null);
}
IPath desktopSdkRoot;
IPath modulesRoot;
IPath runtimeRoot;
if (Platform.OS_MACOSX.equals(Platform.getOS()))
{
desktopSdkRoot = sdkRoot.append("sdk/osx"); //$NON-NLS-1$
modulesRoot = sdkRoot.append("modules/osx"); //$NON-NLS-1$
runtimeRoot = sdkRoot.append("runtime/osx"); //$NON-NLS-1$
desktopSdkRoot = sdkPath.append("sdk/osx"); //$NON-NLS-1$
modulesRoot = sdkPath.append("modules/osx"); //$NON-NLS-1$
runtimeRoot = sdkPath.append("runtime/osx"); //$NON-NLS-1$
}
else if (Platform.OS_WIN32.equals(Platform.getOS()))
{
desktopSdkRoot = sdkRoot.append("sdk\\win32"); //$NON-NLS-1$
modulesRoot = sdkRoot.append("modules\\win32"); //$NON-NLS-1$
runtimeRoot = sdkRoot.append("runtime\\win32"); //$NON-NLS-1$
desktopSdkRoot = sdkPath.append("sdk\\win32"); //$NON-NLS-1$
modulesRoot = sdkPath.append("modules\\win32"); //$NON-NLS-1$
runtimeRoot = sdkPath.append("runtime\\win32"); //$NON-NLS-1$
}
else if (Platform.OS_LINUX.equals(Platform.getOS()))
{
desktopSdkRoot = sdkRoot.append("sdk/linux"); //$NON-NLS-1$
modulesRoot = sdkRoot.append("modules/linux"); //$NON-NLS-1$
runtimeRoot = sdkRoot.append("runtime/linux"); //$NON-NLS-1$
desktopSdkRoot = sdkPath.append("sdk/linux"); //$NON-NLS-1$
modulesRoot = sdkPath.append("modules/linux"); //$NON-NLS-1$
runtimeRoot = sdkPath.append("runtime/linux"); //$NON-NLS-1$
}
else
{
initializationStatus = new Status(IStatus.ERROR, DesktopPlugin.PLUGIN_ID, SDKLocator.COMPATIBILITY_ERROR,
return new Status(IStatus.ERROR, DesktopPlugin.PLUGIN_ID, SDKLocator.COMPATIBILITY_ERROR,
MessageFormat.format(Messages.TitaniumDesktopSDKLocator_unsupportedPlatform, Platform.getOS()),
null);
return;
}
if (!desktopSdkRoot.toFile().isDirectory())
{
initializationStatus = new Status(IStatus.WARNING, DesktopPlugin.PLUGIN_ID, SDKLocator.CONFIGURATION_ERROR,
return new Status(IStatus.WARNING, DesktopPlugin.PLUGIN_ID, SDKLocator.CONFIGURATION_ERROR,
MessageFormat.format(Messages.TitaniumDesktopSDKLocator_mobileSDKRootNotDirectory,
desktopSdkRoot.toOSString()), null);
return;
}

// For each of the module directories under the root 'modules' directory, look inside to grab the versions and
Expand Down Expand Up @@ -192,6 +182,7 @@ public boolean accept(File dir, String name)
watchLocation(modulesRoot, false);
watchLocation(runtimeRoot, false);
}
return Status.OK_STATUS;
}

private void updateVersionToModule(Map<String, List<String>> versionsToModules, String version, String moduleName)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2011-2012 Appcelerator, Inc.
* Copyright 2011-2013 Appcelerator, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,8 +25,9 @@
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;

import com.appcelerator.titanium.core.SDKEntity;
import com.appcelerator.titanium.core.TitaniumCorePlugin;
import com.appcelerator.titanium.core.TitaniumProject;
import com.appcelerator.titanium.core.mobile.SDKEntity;
import com.appcelerator.titanium.desktop.preferences.IDesktopPreferenceConstants;
import com.aptana.core.logging.IdeLog;
import com.aptana.core.util.EclipseUtil;
Expand Down Expand Up @@ -81,7 +82,7 @@ public static SDKEntity getProjectSDK(IProject project) throws CoreException
{
// We start by checking if we can grab the SDK version from the tiapp.xml.
// If we can't, we fall back to the preferences (backward compatability)
String sdk = (project != null) ? (new TitaniumProject(project)).getSDKVersion() : null;
String sdk = (project != null) ? getTitaniumProject(project).getSDKVersion() : null;
if (StringUtil.isEmpty(sdk))
{
IScopeContext[] lookupContexts;
Expand Down Expand Up @@ -143,4 +144,9 @@ public static boolean setProjectSDK(IProject project, SDKEntity version)
}
return false;
}

private static TitaniumProject getTitaniumProject(IProject project)
{
return TitaniumCorePlugin.getDefault().getTitaniumProjectFactory().create(project);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2011-2012 Appcelerator, Inc.
* Copyright 2011-2013 Appcelerator, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,8 +25,8 @@
import org.eclipse.help.IUAElement;
import org.osgi.framework.Version;

import com.appcelerator.titanium.core.SDKEntity;
import com.appcelerator.titanium.desktop.DesktopPlugin;
import com.appcelerator.titanium.desktop.DesktopSDKEntity;
import com.appcelerator.titanium.desktop.TitaniumDesktopSDKLocator;
import com.aptana.core.logging.IdeLog;
import com.aptana.core.util.StringUtil;
Expand Down Expand Up @@ -64,8 +64,8 @@ public String getLabel()
public ITopic[] getTopics()
{
List<ITopic> al = new ArrayList<ITopic>();
List<SDKEntity> sdks = TitaniumDesktopSDKLocator.getInstance().getAvailable();
for (SDKEntity sdkEntity : sdks)
List<DesktopSDKEntity> sdks = TitaniumDesktopSDKLocator.getInstance().getAvailable();
for (DesktopSDKEntity sdkEntity : sdks)
{
try
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2011-2012 Appcelerator, Inc.
* Copyright 2011-2013 Appcelerator, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,16 +19,16 @@
import org.eclipse.help.IToc;
import org.eclipse.help.ITocContribution;

import com.appcelerator.titanium.core.SDKLocator;
import com.appcelerator.titanium.core.SDKManager.SDKChangeListener;
import com.appcelerator.titanium.core.documentation.SDKListenerProxy;
import com.appcelerator.titanium.core.mobile.SDKLocator;
import com.appcelerator.titanium.core.mobile.SDKManager;
import com.appcelerator.titanium.desktop.DesktopPlugin;
import com.appcelerator.titanium.desktop.TitaniumDesktopSDKLocator;

/**
* Creates a TOC entry for the currently installed Titanium Desktop SDKs
*/
public class DesktopSDKTocProvider extends AbstractTocProvider implements SDKChangeListener
public class DesktopSDKTocProvider extends AbstractTocProvider implements SDKManager.SDKChangeListener
{
public static SDKListenerProxy proxy;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.model.IProcess;

import com.appcelerator.titanium.core.SDKEntity;
import com.appcelerator.titanium.core.TitaniumCorePlugin;
import com.appcelerator.titanium.core.TitaniumProject;
import com.appcelerator.titanium.core.TitaniumSDKTools;
import com.appcelerator.titanium.core.launching.TitaniumLaunchConfigurationUtil;
import com.appcelerator.titanium.core.launching.TitaniumSingleProjectLaunchConfigurationDelegate;
import com.appcelerator.titanium.core.mobile.SDKEntity;
import com.appcelerator.titanium.desktop.DesktopPlugin;
import com.appcelerator.titanium.desktop.DesktopUsageUtil;
import com.appcelerator.titanium.desktop.TitaniumDesktopSDKTools;
Expand Down Expand Up @@ -72,7 +72,7 @@ public void launch(ILaunchConfiguration configuration, String mode, ILaunch laun
throw new CoreException(new Status(IStatus.ERROR, TitaniumCorePlugin.PLUGIN_ID,
TitaniumLaunchConfigurationUtil.SUBSCRIPTION_ERROR_CODE, StringUtil.EMPTY, null));
}
DesktopUsageUtil.sendLaunchEvent(sdkEntity.getVersion(), new TitaniumProject(project));
DesktopUsageUtil.sendLaunchEvent(sdkEntity.getVersion(), getTitaniumProject(project));
try
{
Process osProcess = TitaniumSDKTools.run(TitaniumDesktopSDKTools.getDesktopToolPath(project).toOSString(),
Expand All @@ -92,4 +92,9 @@ public void launch(ILaunchConfiguration configuration, String mode, ILaunch laun
Messages.DesktopLaunchConfigurationDelegate_LaunchProcessFailed_Error, e));
}
}

protected TitaniumProject getTitaniumProject(IProject project)
{
return TitaniumCorePlugin.getDefault().getTitaniumProjectFactory().create(project);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;

import com.appcelerator.titanium.core.TitaniumProjectBuilder;
import com.appcelerator.titanium.desktop.DesktopPlugin;
Expand Down Expand Up @@ -83,7 +84,6 @@ public void projectCreated(IProject project)
* @param project
* @throws CoreException
*/
@SuppressWarnings("deprecation")
protected void markBuildFolderDerived(final IProject project) throws CoreException
{
IFolder buildFolder = project.getFolder("build"); //$NON-NLS-1$
Expand All @@ -92,8 +92,7 @@ protected void markBuildFolderDerived(final IProject project) throws CoreExcepti
// Mark build folder as derived if it isn't already.
if (!buildFolder.isDerived())
{
// TODO When 3.6 is our base, use the new method!
buildFolder.setDerived(true);
buildFolder.setDerived(true, new NullProgressMonitor());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.plugin.AbstractUIPlugin;

import com.appcelerator.titanium.core.TitaniumCorePlugin;
import com.appcelerator.titanium.core.TitaniumProject;
import com.appcelerator.titanium.desktop.DesktopPlugin;

Expand All @@ -60,7 +61,7 @@ class DesktopPackagingPage extends WizardPage
public DesktopPackagingPage(IProject project)
{
super("Desktop Packaging", Messages.DesktopPackagingPage_Title, null); //$NON-NLS-1$
this.tiProject = new TitaniumProject(project);
this.tiProject = getTitaniumProject(project);
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(DesktopPlugin.PLUGIN_ID,
"icons/full/obj16/package.png")); //$NON-NLS-1$
}
Expand Down Expand Up @@ -381,4 +382,9 @@ private void restoreWidgetValues()
dontReleaseButton.setSelection(!release);
}
}

private TitaniumProject getTitaniumProject(IProject project)
{
return TitaniumCorePlugin.getDefault().getTitaniumProjectFactory().create(project);
}
}
Loading

0 comments on commit ad6dfd1

Please sign in to comment.