Permalink
Browse files

IDE-862

  • Loading branch information...
1 parent 3df75bf commit 627cfea07b6725640b29e43811bbad57276d559f @gamerson gamerson committed Mar 11, 2013
View
20 tools/plugins/com.liferay.ide.sdk.core/src/com/liferay/ide/sdk/core/SDKHelper.java
@@ -20,16 +20,20 @@
import com.liferay.ide.core.util.RuntimeClasspathModel;
import com.liferay.ide.core.util.StringPool;
+import java.io.File;
import java.util.Map;
import org.eclipse.ant.launching.IAntLaunchConstants;
import org.eclipse.core.externaltools.internal.IExternalToolConstants;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.jdt.launching.JavaRuntime;
@@ -204,6 +208,22 @@ protected void addUserEntries( RuntimeClasspathModel model ) throws CoreExceptio
model.addEntry( RuntimeClasspathModel.USER, JavaRuntime.newArchiveRuntimeClasspathEntry( antLib ) );
}
}
+
+ //IDE-862 need to add Eclipse's own jdt.core that contains the necessary classes.
+ try
+ {
+ File bundleFile = FileLocator.getBundleFile( JavaCore.getPlugin().getBundle() );
+
+ if( bundleFile.exists() )
+ {
+ model.addEntry(
+ RuntimeClasspathModel.USER,
+ JavaRuntime.newArchiveRuntimeClasspathEntry( new Path( bundleFile.getAbsolutePath() ) ) );
+ }
+ }
+ catch( Exception e )
+ {
+ }
}
public void setVMArgs( String[] vmargs )
View
3 tools/plugins/com.liferay.ide.service.ui/META-INF/MANIFEST.MF
@@ -30,7 +30,8 @@ Require-Bundle: org.eclipse.ui,
com.liferay.ide.project.core,
org.eclipse.jst.j2ee.ui,
org.eclipse.jst.servlet.ui,
- com.liferay.ide.project.ui
+ com.liferay.ide.project.ui,
+ org.eclipse.debug.ui
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Export-Package: com.liferay.ide.service.ui,
View
65 tools/plugins/com.liferay.ide.service.ui/src/com/liferay/ide/service/ui/ServiceUIUtil.java
@@ -17,6 +17,9 @@
import java.lang.reflect.Method;
import org.eclipse.core.resources.IFile;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.ISaveablePart;
import org.eclipse.ui.IWorkbenchPage;
@@ -33,54 +36,60 @@
{
public static boolean shouldCreateServiceBuilderJob( IFile file )
{
- IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
+ final String saveDirty =
+ DebugUIPlugin.getDefault().getPreferenceStore().getString(
+ IInternalDebugUIConstants.PREF_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH );
- for( IWorkbenchWindow window : windows )
+ if( !MessageDialogWithToggle.PROMPT.equals( saveDirty ) )
{
- IWorkbenchPage[] pages = window.getPages();
+ final IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
- for( IWorkbenchPage page : pages )
+ for( IWorkbenchWindow window : windows )
{
- IEditorReference[] editorReferences = page.getEditorReferences();
+ final IWorkbenchPage[] pages = window.getPages();
- for( IEditorReference editorReference : editorReferences )
+ for( IWorkbenchPage page : pages )
{
- if( file.getName().equals( editorReference.getName() ) )
- {
- IWorkbenchPart part = editorReference.getPart( true );
+ final IEditorReference[] editorReferences = page.getEditorReferences();
- // SaveableHelper.savePart is not visible on Indigo so must use reflection
- try
+ for( IEditorReference editorReference : editorReferences )
+ {
+ if( file.getName().equals( editorReference.getName() ) )
{
- Method savePartMethod = SaveableHelper.class.getDeclaredMethod( "savePart",
- ISaveablePart.class,
- IWorkbenchPart.class,
- IWorkbenchWindow.class,
- Boolean.TYPE );
+ final IWorkbenchPart part = editorReference.getPart( true );
- savePartMethod.setAccessible( true );
+ // SaveableHelper.savePart is not visible on Indigo so must use reflection
+ try
+ {
+ Method savePartMethod = SaveableHelper.class.getDeclaredMethod( "savePart",
+ ISaveablePart.class,
+ IWorkbenchPart.class,
+ IWorkbenchWindow.class,
+ Boolean.TYPE );
- boolean save = (Boolean) savePartMethod.invoke( null, part, part, window, true );
+ savePartMethod.setAccessible( true );
- if( save )
- {
- return true;
+ boolean save = (Boolean) savePartMethod.invoke( null, part, part, window, true );
+
+ if( save )
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
- else
+ catch( Exception e )
{
- return false;
}
}
- catch( Exception e )
- {
- return true;
- }
}
}
}
}
- return false;
+ return true;
}
}

0 comments on commit 627cfea

Please sign in to comment.