📄 flowrepositorypropertypage.java
字号:
/*
* Copyright (c) 2003-2004, Alexander Greif
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the Flow4J-Eclipse project nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.orthanc.flow4j.designer.ui.properties;
import net.orthanc.flow4j.designer.core.Flow4JPlugin;
import net.orthanc.flow4j.designer.core.Flow4JProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
/**
* @author greifa
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class FlowRepositoryPropertyPage {
private static final int TEXT_WIDTH_FLOW_REPOSITORY_CLASS = 350;
private Flow4JProjectPropertyPage page;
private Button createFlowReposFileCheck;
private Text flowReposClassPathText;
public FlowRepositoryPropertyPage(Flow4JProjectPropertyPage page) {
this.page = page;
}
/**
* returns a control which consists of the ui elements of this page
*/
protected Control createContents(Composite parent) {
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(new GridLayout());
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
createCreateFlowReposFileGroup(composite);
Group group = new Group(composite, SWT.NONE);
group.setLayout(new GridLayout());
createFlowReposPathGroup(group);
// createRootDirGroup(group);
return composite;
}
/**
* TODO
* @param parent
*/
public void createCreateFlowReposFileGroup(Composite parent) {
Composite group = new Composite(parent,SWT.NONE);
group.setLayout(new GridLayout(3, false));
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// project location entry field
createFlowReposFileCheck = new Button(group, SWT.CHECK | SWT.LEFT);
createFlowReposFileCheck.setText(Flow4JPlugin.getResourceString("PropertiesPage_Project_FlowRepository_CreateFlowReposClass.label")); //$NON-NLS-1$
createFlowReposFileCheck.setEnabled(true);
createFlowReposFileCheck.setSelection(this.isCreateFlowRepositoryClass());
}
public void createFlowReposPathGroup(Composite parent) {
Composite group = new Composite(parent,SWT.NONE);
group.setLayout(new GridLayout(3, false));
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// class path label
Label label = new Label(group,SWT.NONE);
label.setText(Flow4JPlugin.getResourceString("PropertiesPage_Project_FlowRepository_FlowReposClassPath.label")); //$NON-NLS-1$
label.setEnabled(true);
// class path entry field
flowReposClassPathText = new Text(group, SWT.BORDER);
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.widthHint = TEXT_WIDTH_FLOW_REPOSITORY_CLASS;
flowReposClassPathText.setLayoutData(data);
flowReposClassPathText.setText(this.getFlowReposClassPath());
flowReposClassPathText.setEnabled(true);
}
private String getFlowReposClassPath() {
String result = null;
try {
Flow4JProject project = page.getFlow4JProject();
if (project != null)
result = project.getFlowReposClassPath();
} catch (CoreException e) {
Flow4JPlugin.log(e);
}
if (result == null)
result = "";
return result;
}
public boolean isCreateFlowRepositoryClass() {
boolean result = false;
try {
Flow4JProject project = page.getFlow4JProject();
if (project != null)
result = project.isCreateFlowRepositoryClass();
} catch (CoreException e) {
Flow4JPlugin.log(e);
}
return result;
}
/**
* performes the ok action for this property page
*/
public boolean performOk() {
try {
Flow4JProject project = page.getFlow4JProject();
project.updateFlowReposClassPath(flowReposClassPathText.getText());
project.updateCreateFlowRepositoryClass(createFlowReposFileCheck.getSelection());
} catch (Exception e) {
Flow4JPlugin.log(e);
}
return true;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -