-
Notifications
You must be signed in to change notification settings - Fork 311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prj1 Getting calendars and created plugin #1375
Open
shatuln
wants to merge
3
commits into
prj1_master
Choose a base branch
from
prj1_getcalendars
base: prj1_master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
apply plugin: 'java' | ||
apply plugin: 'idea' | ||
|
||
dependencies { | ||
compile fileTree(dir: 'lib', include: ['*.jar']) | ||
compile project(':..:ganttproject') | ||
mavenDeps group: 'com.google.api-client', name: 'google-api-client', version: '1.22.0' | ||
mavenDeps group: 'com.google.oauth-client', name: 'google-oauth-client-jetty', version: '1.22.0' | ||
mavenDeps group: 'com.google.apis', name: 'google-api-services-calendar', version: 'v3-rev237-1.22.0' | ||
} | ||
|
||
updateMavenDeps.doFirst { | ||
into project.ext.libDir | ||
} | ||
|
||
sourceSets { | ||
main { | ||
java { | ||
srcDir 'src' | ||
} | ||
resources { | ||
} | ||
} | ||
} | ||
|
||
task copyPlugin(type: Copy) { | ||
into(new File(rootProject.pluginsDir, project.name)) | ||
from(jar.outputs.getFiles().getFiles().flatten()) | ||
from(fileTree(".")) { | ||
include "plugin.xml" | ||
include "lib/**.jar" | ||
} | ||
doLast { | ||
println "Copying $project.name to $rootProject.pluginsDir" | ||
} | ||
} |
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,52 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<plugin | ||
id="biz.ganttproject.impex.google" | ||
name="Google prj" | ||
version="2.8.4" | ||
provider-name=""> | ||
|
||
<runtime> | ||
<library name="lib/core/google-http-client-1.22.0.jar"> | ||
<export name="*"/> | ||
</library> | ||
<library name="lib/core/google-http-client-jackson2-1.22.0.jar"> | ||
<export name="*"/> | ||
</library> | ||
<library name="lib/core/google-oauth-client-1.22.0.jar"> | ||
<export name="*"/> | ||
</library> | ||
<library name="lib/core/google-oauth-client-java6-1.22.0.jar"> | ||
<export name="*"/> | ||
</library> | ||
<library name="lib/core/google-oauth-client-jetty-1.22.0.jar"> | ||
<export name="*"/> | ||
</library> | ||
<library name="lib/core/google-api-client-1.22.0.jar"> | ||
<export name="*"/> | ||
</library> | ||
<library name="lib/core/jackson-core-2.8.1.jar"> | ||
<export name="*"/> | ||
</library> | ||
<library name="lib/core/jetty-6.1.26.jar"> | ||
<export name="*"/> | ||
</library> | ||
<library name="lib/core/jetty-util-6.1.26.jar"> | ||
<export name="*"/> | ||
</library> | ||
<library name="lib/core/servlet-api-2.5-20081211.jar"> | ||
<export name="*"/> | ||
</library> | ||
<library name="lib/core/google-api-services-calendar-v3-rev237-1.22.0.jar"> | ||
<export name="*"/> | ||
</library> | ||
</runtime> | ||
<requires> | ||
<import plugin="biz.ganttproject.core"/> | ||
<import plugin="org.eclipse.core.runtime"/> | ||
<import plugin="net.sourceforge.ganttproject"/> | ||
</requires> | ||
|
||
<extension point="net.sourceforge.ganttproject.exporter"> | ||
<exporter class="biz.ganttproject.impex.google.ExporterToGoogle"/> | ||
</extension> | ||
</plugin> |
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 |
---|---|---|
|
@@ -17,53 +17,82 @@ | |
package biz.ganttproject.impex.google; | ||
|
||
import biz.ganttproject.core.option.GPOptionGroup; | ||
import com.google.api.services.calendar.model.CalendarListEntry; | ||
import net.sourceforge.ganttproject.GPLogger; | ||
import net.sourceforge.ganttproject.action.GPAction; | ||
import net.sourceforge.ganttproject.gui.options.OptionPageProviderBase; | ||
import net.sourceforge.ganttproject.export.ExporterBase; | ||
|
||
import javax.swing.*; | ||
import javax.swing.border.EmptyBorder; | ||
import java.awt.*; | ||
import java.awt.event.ActionEvent; | ||
import java.io.File; | ||
import java.util.List; | ||
import java.util.logging.Level; | ||
|
||
/** | ||
* Builds option page for google authorization | ||
* Exporter to google calendar | ||
* | ||
* @author Leonid Shatunov ([email protected]) | ||
*/ | ||
public class GoogleExportOptionPageProvider extends OptionPageProviderBase { | ||
public class ExporterToGoogle extends ExporterBase { | ||
|
||
private GoogleAuth myAuth = new GoogleAuth(); | ||
private List<CalendarListEntry> myCalendars; | ||
|
||
public GoogleExportOptionPageProvider() { | ||
super("impex.google"); | ||
@Override | ||
public String getFileTypeDescription() { | ||
return language.getText("impex.google.description"); | ||
} | ||
|
||
@Override | ||
public GPOptionGroup getOptions() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<GPOptionGroup> getSecondaryOptions() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public GPOptionGroup[] getOptionGroups() { | ||
return new GPOptionGroup[0]; | ||
public String getFileNamePattern() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean hasCustomComponent() { | ||
return true; | ||
public String proposeFileExtension() { | ||
return null; | ||
} | ||
|
||
public Component buildPageComponent() { | ||
@Override | ||
public String[] getFileExtensions() { | ||
return new String[0]; | ||
} | ||
|
||
@Override | ||
public Component getCustomOptionsUI() { | ||
JPanel result = new JPanel(new BorderLayout()); | ||
result.setBorder(new EmptyBorder(5, 5, 5, 5)); | ||
JButton testConnectionButton = new JButton(new GPAction("googleConnect") { | ||
@Override | ||
public void actionPerformed(ActionEvent e) { | ||
try { | ||
myAuth.someSampleWork(myAuth.getCalendarService(myAuth.authorize())); | ||
myCalendars = myAuth.getAvaliableCalendarList(myAuth.getCalendarService(myAuth.authorize())); | ||
for (CalendarListEntry i : myCalendars) { | ||
System.out.println(i.getSummary()); | ||
} | ||
} catch (Exception e1) { | ||
GPLogger.getLogger(GoogleExportOptionPageProvider.class).log(Level.WARNING, "Something went wrong", e1); | ||
GPLogger.getLogger(ExporterToGoogle.class).log(Level.WARNING, "Something went wrong", e1); | ||
} | ||
} | ||
}); | ||
result.add(testConnectionButton, BorderLayout.SOUTH); | ||
return result; | ||
} | ||
|
||
@Override | ||
protected ExporterJob[] createJobs(File outputFile, List<File> resultFiles) { | ||
return new ExporterJob[0]; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
include ':..:ganttproject','..:biz.ganttproject.core','..:biz.ganttproject.impex.ical','..:biz.ganttproject.impex.msproject2','..:org.ganttproject.impex.htmlpdf','..:org.ganttproject.chart.pert','..:ganttproject-tester' | ||
include ':..:ganttproject','..:biz.ganttproject.core','..:biz.ganttproject.impex.ical','..:biz.ganttproject.impex.msproject2','..:org.ganttproject.impex.htmlpdf','..:org.ganttproject.chart.pert','..:ganttproject-tester','..:biz.ganttproject.impex.google' |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you try to run this code? You have no
core
directory in this plugin. You have nobiz.ganttproject.impex.google.jar
in the runtime section either.