Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IDE-379 add actions for invoking SDK project import wizards from SDKs in
workspace or from individual folders that are actually liferay projects
- Loading branch information
Showing
10 changed files
with
332 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...e.eclipse.project.ui/src/com/liferay/ide/eclipse/project/ui/SDKProjectPropertyTester.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2000-2011 Liferay, Inc. All rights reserved. | ||
* | ||
* This library is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU Lesser General Public License as published by the Free | ||
* Software Foundation; either version 2.1 of the License, or (at your option) | ||
* any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | ||
* details. | ||
* | ||
*******************************************************************************/ | ||
|
||
package com.liferay.ide.eclipse.project.ui; | ||
|
||
import com.liferay.ide.eclipse.project.core.util.ProjectUtil; | ||
|
||
import org.eclipse.core.expressions.PropertyTester; | ||
import org.eclipse.core.resources.IProject; | ||
|
||
/** | ||
* @author Greg Amerson | ||
*/ | ||
public class SDKProjectPropertyTester extends PropertyTester { | ||
|
||
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { | ||
if (receiver instanceof IProject) { | ||
return ProjectUtil.isSDKProject( (IProject) receiver ); | ||
} | ||
|
||
return false; | ||
} | ||
|
||
} |
85 changes: 85 additions & 0 deletions
85
....project.ui/src/com/liferay/ide/eclipse/project/ui/action/ImportLiferayProjectAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2000-2011 Liferay, Inc. All rights reserved. | ||
* | ||
* This library is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU Lesser General Public License as published by the Free | ||
* Software Foundation; either version 2.1 of the License, or (at your option) | ||
* any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | ||
* details. | ||
* | ||
*******************************************************************************/ | ||
|
||
package com.liferay.ide.eclipse.project.ui.action; | ||
|
||
import com.liferay.ide.eclipse.project.ui.wizard.LiferayProjectImportWizard; | ||
|
||
import org.eclipse.core.resources.IFolder; | ||
import org.eclipse.jface.action.IAction; | ||
import org.eclipse.jface.viewers.ISelection; | ||
import org.eclipse.jface.viewers.IStructuredSelection; | ||
import org.eclipse.jface.wizard.WizardDialog; | ||
import org.eclipse.swt.custom.BusyIndicator; | ||
import org.eclipse.swt.widgets.Display; | ||
import org.eclipse.ui.IObjectActionDelegate; | ||
import org.eclipse.ui.IWorkbenchPart; | ||
|
||
/** | ||
* @author Greg Amerson | ||
*/ | ||
public class ImportLiferayProjectAction implements IObjectActionDelegate { | ||
|
||
private ISelection fSelection; | ||
|
||
public ImportLiferayProjectAction() { | ||
} | ||
|
||
public Display getDisplay() { | ||
Display display = Display.getCurrent(); | ||
|
||
if (display == null) | ||
display = Display.getDefault(); | ||
|
||
return display; | ||
} | ||
|
||
public void run(IAction action) { | ||
|
||
if (fSelection instanceof IStructuredSelection) { | ||
Object[] elems = ((IStructuredSelection) fSelection).toArray(); | ||
|
||
IFolder folder = null; | ||
|
||
Object elem = elems[0]; | ||
|
||
if ( elem instanceof IFolder ) { | ||
folder = (IFolder) elem; | ||
} | ||
|
||
LiferayProjectImportWizard wizard = new LiferayProjectImportWizard( folder ); | ||
|
||
final Display display = getDisplay(); | ||
|
||
final WizardDialog dialog = new WizardDialog(display.getActiveShell(), wizard); | ||
|
||
BusyIndicator.showWhile(display, new Runnable() { | ||
|
||
public void run() { | ||
dialog.open(); | ||
} | ||
}); | ||
} | ||
|
||
} | ||
|
||
public void selectionChanged(IAction action, ISelection selection) { | ||
fSelection = selection; | ||
} | ||
|
||
public void setActivePart(IAction action, IWorkbenchPart targetPart) { | ||
} | ||
|
||
} |
87 changes: 87 additions & 0 deletions
87
...pse.project.ui/src/com/liferay/ide/eclipse/project/ui/action/SDKProjectsImportAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2000-2011 Liferay, Inc. All rights reserved. | ||
* | ||
* This library is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU Lesser General Public License as published by the Free | ||
* Software Foundation; either version 2.1 of the License, or (at your option) | ||
* any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | ||
* details. | ||
* | ||
*******************************************************************************/ | ||
|
||
package com.liferay.ide.eclipse.project.ui.action; | ||
|
||
import com.liferay.ide.eclipse.project.ui.wizard.SDKProjectsImportWizard; | ||
import com.liferay.ide.eclipse.sdk.SDKManager; | ||
|
||
import org.eclipse.core.resources.IProject; | ||
import org.eclipse.jface.action.IAction; | ||
import org.eclipse.jface.viewers.ISelection; | ||
import org.eclipse.jface.viewers.IStructuredSelection; | ||
import org.eclipse.jface.wizard.WizardDialog; | ||
import org.eclipse.swt.custom.BusyIndicator; | ||
import org.eclipse.swt.widgets.Display; | ||
import org.eclipse.ui.IObjectActionDelegate; | ||
import org.eclipse.ui.IWorkbenchPart; | ||
|
||
/** | ||
* @author Greg Amerson | ||
*/ | ||
public class SDKProjectsImportAction implements IObjectActionDelegate { | ||
|
||
private ISelection fSelection; | ||
|
||
public SDKProjectsImportAction() { | ||
} | ||
|
||
public Display getDisplay() { | ||
Display display = Display.getCurrent(); | ||
|
||
if (display == null) | ||
display = Display.getDefault(); | ||
|
||
return display; | ||
} | ||
|
||
public void run(IAction action) { | ||
|
||
if (fSelection instanceof IStructuredSelection) { | ||
Object[] elems = ((IStructuredSelection) fSelection).toArray(); | ||
|
||
IProject project = null; | ||
|
||
Object elem = elems[0]; | ||
|
||
if (elem instanceof IProject) { | ||
project = (IProject) elem; | ||
} | ||
|
||
SDKProjectsImportWizard wizard = | ||
new SDKProjectsImportWizard( SDKManager.getInstance().getSDK( project.getLocation() ) ); | ||
|
||
final Display display = getDisplay(); | ||
|
||
final WizardDialog dialog = new WizardDialog(display.getActiveShell(), wizard); | ||
|
||
BusyIndicator.showWhile(display, new Runnable() { | ||
|
||
public void run() { | ||
dialog.open(); | ||
} | ||
}); | ||
} | ||
|
||
} | ||
|
||
public void selectionChanged(IAction action, ISelection selection) { | ||
fSelection = selection; | ||
} | ||
|
||
public void setActivePart(IAction action, IWorkbenchPart targetPart) { | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.