Skip to content

Commit

Permalink
Merge pull request #18 from camac/synclistener
Browse files Browse the repository at this point in the history
Synclistener final version
  • Loading branch information
camac authored Jul 21, 2017
2 parents 323db6c + 7d212fe commit 96e8792
Show file tree
Hide file tree
Showing 32 changed files with 777 additions and 53 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,10 @@ YourKit supports open source projects with its full-featured Java Profiler.
YourKit, LLC is the creator of <a href="https://www.yourkit.com/java/profiler/index.jsp">YourKit Java Profiler</a>
and <a href="https://www.yourkit.com/.net/profiler/index.jsp">YourKit .NET Profiler</a>,
innovative and intelligent tools for profiling Java and .NET applications.

# FAM FAM FAM Silk Icon Set

In the Toolbar buttons I am using some icons from the excellent Silk Icons set by Mark James
http://www.famfamfam.com/lab/icons/silk/


2 changes: 1 addition & 1 deletion org.openntf.swiper.feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<feature
id="org.openntf.swiper.feature"
label="OpenNTF Swiper Feature"
version="1.0.2.qualifier"
version="2.0.0.qualifier"
provider-name="OpenNTF">

<description url="http://www.openntf.org/main.nsf/project.xsp?r=project/Swiper">
Expand Down
10 changes: 8 additions & 2 deletions org.openntf.swiper/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: OpenNTF Swiper Plugin
Bundle-SymbolicName: org.openntf.swiper;singleton:=true
Bundle-Version: 1.0.2.qualifier
Bundle-Version: 2.0.0.qualifier
Bundle-Activator: org.openntf.swiper.SwiperActivator
Bundle-Vendor: OpenNTF
Require-Bundle: org.eclipse.ui,
Expand All @@ -23,5 +23,11 @@ Require-Bundle: org.eclipse.ui,
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Export-Package: org.openntf.swiper,
org.openntf.swiper.builder
org.openntf.swiper.action,
org.openntf.swiper.builder,
org.openntf.swiper.builder.post,
org.openntf.swiper.builder.pre,
org.openntf.swiper.handlers,
org.openntf.swiper.pref,
org.openntf.swiper.util
Import-Package: com.ibm.commons.util
5 changes: 3 additions & 2 deletions org.openntf.swiper/build.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###############################################################################
# Copyright 2015 Cameron Gregor
# Copyright 2017 Cameron Gregor (http://camerongregor.com)
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
Expand All @@ -10,4 +10,5 @@ source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
.
.,\
icons/
Binary file added org.openntf.swiper/icons/arrow_refresh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added org.openntf.swiper/icons/arrow_refresh_small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added org.openntf.swiper/icons/arrow_switch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added org.openntf.swiper/icons/folder_go.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added org.openntf.swiper/icons/sport_8ball.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
70 changes: 69 additions & 1 deletion org.openntf.swiper/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<!--
Copyright 2015 Cameron Gregor
Copyright 2017 Cameron Gregor (http://camerongregor.com)
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Expand Down Expand Up @@ -240,6 +240,74 @@
</enabledWhen>
</page>
</extension>
<extension
point="com.ibm.designer.domino.team.synclistener">
<syncListener
class="org.openntf.swiper.builder.SwiperSyncListener">
</syncListener>
</extension>
<extension
point="org.eclipse.ui.actionSets">
<actionSet
id="org.openntf.swiper.actionSet"
label="Swiper"
visible="true">
<menu
id="org.openntf.swiper.menu"
label="Swiper">
<separator
name="org.openntf.swiper.separator">
</separator>
</menu>
<action
class="org.openntf.swiper.action.LaunchODPFolderAction"
enablesFor="1"
icon="icons/folder_go.png"
id="org.openntf.swiper.launchodpfolderaction"
label="Open ODP Folder in System Explorer"
menubarPath="org.openntf.swiper.menu/org.openntf.swiper.separator"
style="push"
toolbarPath="swiper"
tooltip="Open ODP Folder in System Explorer">
</action>

<action
class="org.openntf.swiper.action.RefreshODPThenSyncAction"
enablesFor="1"
icon="icons/sport_8ball.png"
id="org.openntf.swiper.refreshodpthensyncaction"
label="Refresh On-Disk Project and then Sync"
menubarPath="org.openntf.swiper.menu/org.openntf.swiper.separator"
style="push"
toolbarPath="swiper"
tooltip="Refresh On-Disk Project and then Sync">
</action>

<action
class="org.openntf.swiper.action.RefreshODPAction"
enablesFor="1"
icon="icons/arrow_refresh_small.png"
id="org.openntf.swiper.refreshodpaction"
label="Refresh On-Disk Project"
menubarPath="org.openntf.swiper.menu/org.openntf.swiper.separator"
style="push"
toolbarPath="swiper"
tooltip="Refresh On-Disk Project">
</action>
<action
class="org.openntf.swiper.action.SyncAction"
enablesFor="1"
icon="icons/arrow_switch.png"
id="org.openntf.swiper.action1"
label="Sync with On Disk Project"
menubarPath="org.openntf.swiper.menu/org.openntf.swiper.separator"
style="push"
toolbarPath="swiper"
tooltip="Sync with On Disk Project">
</action>

</actionSet>
</extension>


</plugin>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2015 Cameron Gregor
* Copyright 2017 Cameron Gregor (http://camerongregor.com)
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2015 Cameron Gregor
* Copyright 2017 Cameron Gregor (http://camerongregor.com)
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
Expand Down Expand Up @@ -88,7 +88,7 @@ public void setSyncProjects(IDominoDesignerProject designerProject, IProject dis

}

private Transformer getTransformer() throws TransformerConfigurationException, FileNotFoundException {
public Transformer getTransformer() throws TransformerConfigurationException, FileNotFoundException {

if (this.cachedXslt == null) {

Expand Down Expand Up @@ -130,10 +130,10 @@ private Transformer getTransformer() throws TransformerConfigurationException, F

}

private void filter(IFile diskFile, Transformer transformer, IProgressMonitor monitor)
public InputStream getFilteredInputStream(IFile diskFile, Transformer transformer, IProgressMonitor monitor)
throws TransformerException, CoreException, IOException {

InputStream is = diskFile.getContents();
InputStream is = diskFile.getContents(true);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Source source = new StreamSource(is);

Expand All @@ -156,8 +156,18 @@ private void filter(IFile diskFile, Transformer transformer, IProgressMonitor mo

transformer.transform(source, result);

ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
diskFile.setContents(bais, 0, monitor);
is.close();

return new ByteArrayInputStream(baos.toByteArray());

}

private void filter(IFile diskFile, Transformer transformer, IProgressMonitor monitor)
throws TransformerException, CoreException, IOException {

InputStream is = getFilteredInputStream(diskFile, transformer, monitor);

diskFile.setContents(is, 0, monitor);

/*
* When you export the DXL normally, there is an Newline at the end of
Expand All @@ -174,15 +184,13 @@ private void filter(IFile diskFile, Transformer transformer, IProgressMonitor mo
String linesep = System.getProperty("line.separator");

linesep = linesep + linesep;
bais = new ByteArrayInputStream(linesep.getBytes("UTF-8"));
ByteArrayInputStream bais = new ByteArrayInputStream(linesep.getBytes("UTF-8"));
diskFile.appendContents(bais, 0, monitor);

}

is.close();

SyncUtil.setModifiedBySync(diskFile);

}

public void filterDiskFile(IResource designerResource, IFile diskFile, IProgressMonitor monitor) {
Expand All @@ -198,7 +206,7 @@ public void filterDiskFile(IResource designerResource, IFile diskFile, IProgress

if (diskFile != null) {
filter(diskFile, transformer, monitor);
SwiperUtil.logInfo("Filtered " + diskFile.getName());
SwiperUtil.logTrace("Filtered " + diskFile.getName());
}

} catch (TransformerConfigurationException e) {
Expand Down Expand Up @@ -229,7 +237,7 @@ public void filterDiskFile(IResource designerResource, IFile diskFile, IProgress
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {

SwiperUtil.logInfo("**** Performing Explicit Filtering");
SwiperUtil.logTrace("**** Performing Explicit Filtering");

processSelection(event);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*******************************************************************************
* Copyright 2017 Cameron Gregor (http://camerongregor.com)
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License
*******************************************************************************/
package org.openntf.swiper.action;

import java.awt.Desktop;
import java.io.File;
import java.io.IOException;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;

import com.ibm.designer.domino.ide.resources.DominoResourcesPlugin;
import com.ibm.designer.domino.ide.resources.NsfException;
import com.ibm.designer.domino.ide.resources.project.IDominoDesignerProject;
import com.ibm.designer.domino.team.action.SyncAction;
import com.ibm.designer.domino.team.util.SyncUtil;

public class LaunchODPFolderAction extends SyncAction {

public LaunchODPFolderAction() {
super();
// TODO Auto-generated constructor stub
}

public LaunchODPFolderAction(int arg0) {
super(arg0);
// TODO Auto-generated constructor stub
}

@Override
public void doExecute(IProgressMonitor monitor) {

IProject p = this.getSourceProject();

if (p != null) {
try {

IDominoDesignerProject ddp = DominoResourcesPlugin.getDominoDesignerProject(p);
IProject odp = SyncUtil.getAssociatedDiskProject(ddp, false);

File odpFolder = odp.getLocation().toFile();
Desktop.getDesktop().open(odpFolder);

} catch (CoreException e) {
e.printStackTrace();
} catch (NsfException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}

}

@Override
protected String getTaskName() {
return "Open ODP Folder";
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*******************************************************************************
* Copyright 2017 Cameron Gregor (http://camerongregor.com)
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License
*******************************************************************************/
package org.openntf.swiper.action;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;

import com.ibm.designer.domino.ide.resources.DominoResourcesPlugin;
import com.ibm.designer.domino.ide.resources.NsfException;
import com.ibm.designer.domino.ide.resources.project.IDominoDesignerProject;
import com.ibm.designer.domino.team.util.SyncUtil;

public class RefreshODPAction extends SyncAction {

public RefreshODPAction() {
super();
}

public RefreshODPAction(int arg0) {
super(arg0);
}

@Override
public void doExecute(IProgressMonitor monitor) {

IProject p = this.getSourceProject();

if (p != null) {
try {

IDominoDesignerProject ddp = DominoResourcesPlugin.getDominoDesignerProject(p);
IProject odp = SyncUtil.getAssociatedDiskProject(ddp, false);

odp.refreshLocal(IResource.DEPTH_INFINITE, monitor);

} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NsfException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

}

@Override
protected String getTaskName() {
return "Refreshing On-Disk Project";
}

}
Loading

0 comments on commit 96e8792

Please sign in to comment.